В письме от 5 ноября 2013 15:19:20 пользователь Bryan Duff написал: > Any reason why the max route table is limited to 256 and not the Linux > limit of 32767? >
This is a BIRD kernel protocol implementation limitation. This limitation comes from old kernel versions where table id represented in rtnetlink protocol message structure as "unsigned char" (8 bits long, 256 values max). Modern Linux kernels has support for 4294967295 table ids, implemented as rtnetlink attribute RTA_TABLE with 32 bit length. In BIRD each kernel routing table (KRT) represented as static array of pointers to kernel protocol structure description. Length of this static array is limited with define NL_NUM_TABLES, which is set to 256. According to supplied patch, increasing value of NL_NUM_TABLES from 256 to 32767 (0x7fff), size of static array on 64-bit platform increases to ~256Kb (32767 * sizeof(void *) == 262136 bytes). But this is not a main problem with patch. As I described earlier on modern Linux kernels support for RTA_TABLE rtnetlink attribute was added. For compatibility with previous kernels rtm_table field in struct rtmsg is used only for values less than 256. BIRD does not use attribute RTA_TABLE (but uses rtm_table field) to work with tables greather than 255 and thus could not work with table id greather than 255. Also adding support for parsing such attribute to the BIRD and modifying this constant makes possible array out of bounds access with values greather than 32766 in nl_parse_route() at sysdep/linux/netlink.c as there is no bounds check. To implement full support for RTA_TABLE nl_table_map[] probably should be reimplemented as hash or something similar. > Also any thoughts of adding dbus support or something similar for direct > command injection (instead of rewriting the config and HUP'ing)? > This is probably good idea, but I think for most deplyoments support for one global configuration, which sources (via include directive in configuration) other configuration files, that could be modified/generated dynamically and using birdc CLI interface with "configure" command is more than enought. Handling of HUP signal is less mature than using CLI interface to perform BIRD reconfiguration. > Thanks. > > -Bryan -- SP5474-RIPE Sergey Popovich