Date: Mon, 22 Dec 2008 18:27:21 -0800 From: "Li, Qing" <qing.li@bluecoat.com> To: "Tijl Coosemans" <tijl@ulyssis.org>, "Qing Li" <qingli@freebsd.org> Cc: freebsd-net@freebsd.org, freebsd-current@freebsd.org Subject: RE: HEADSUP: arp-v2 has been committed Message-ID: <B583FBF374231F4A89607B4D08578A4302A8B8BE@bcs-mail03.internal.cacheflow.com> In-Reply-To: <200812221621.40722.tijl@ulyssis.org> References: <20081221125120.GO23166@droso.net> <rqtxfXiOI/zU%2BmZivn3AictW17c@TVy1gMAmSsiP9GTg//ziIjLy%2Bsk> <B583FBF374231F4A89607B4D08578A431442EB@bcs-mail03.internal.cacheflow.com> <200812221621.40722.tijl@ulyssis.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Tijl,
Good questions and see my comments below.
>=20
> 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.
>=20
> Wine currently uses:
>=20
>  int mib[] =3D {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS,
RTF_LLINFO};
>=20
> 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:
>=20
> #ifdef RTF_LLINFO
>  int mib[] =3D {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS,
RTF_LLINFO};
> #else
>  int mib[] =3D {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, 0};
> #endif
>=20
> 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?
>=20
AF_INET is the correct address family, which indicates the L2=20
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.=20
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=20
should be retrieved.=20
I am glad you asked these questions because after re-examining my code,=20
I realized I could make slight optimization and also need to perform=20
additional check against erroneous input.=20
>=20
> Also, at some other place, Wine wants to retrieve gateway entries and
> it uses:
>=20
>  int mib[6] =3D {CTL_NET, PF_ROUTE, 0, PF_INET, NET_RT_DUMP, 0};
>                                      ^ this should be AF_INET I think
>=20
> 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.
-- Qing
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B583FBF374231F4A89607B4D08578A4302A8B8BE>
