Hi Tijl, Good questions and see my comments below. > > I'm looking into the Wine case, but don't have any experience with the > implementation of routing tables, so I need to have a few things > spelled out. > > Wine currently uses: > > int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; > > I take it this returns all the entries which have the RTF_LLINFO flag > set? And to make this compile on CURRENT I have to change this into: > > #ifdef RTF_LLINFO > int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; > #else > int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, 0}; > #endif > > Is AF_INET really the correct address family? What about AF_LINK and > AF_ARP? Is using NET_RT_FLAGS with flags mask 0 exactly the same as > using NET_RT_DUMP? > AF_INET is the correct address family, which indicates the L2 information (a.k.a RTF_LLINFO previously) should be retrieved from the IPv4 ARP table. If the AF family were instead AF_INET6, then the L2 information would be coming from the ND6 cache. NET_RT_DUMP walks the entire routing tree. Specifying specific flags and using the NET_RT_FLAGS opcode retrieves routing entries that have those bits set. NET_RT_FLAGS with mask 0 is an indication to the kernel the L2 table should be retrieved. I am glad you asked these questions because after re-examining my code, I realized I could make slight optimization and also need to perform additional check against erroneous input. > > Also, at some other place, Wine wants to retrieve gateway entries and > it uses: > > int mib[6] = {CTL_NET, PF_ROUTE, 0, PF_INET, NET_RT_DUMP, 0}; > ^ this should be AF_INET I think > > After that it runs over all entries counting only those which have > RTF_GATEWAY set and RTF_MULTICAST unset. Is the output of this > different now in CURRENT? > No, the output of this command is still the same. NET_RT_DUMP obtains the entire L3 table and filtering for RTF_GATEWAY non-multicast routes have the same semantics. Those flags never apply to L2 entries. -- QingReceived on Tue Dec 23 2008 - 01:27:08 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:39 UTC