Hi All, As many of you know, FreeBSD uses IPv6 stack derived from the KAME project. The KAME project was started so long ago, when many RFCs and standards weren't written yet. Also the struct sockaddr_in6 did not have the sin6_scope_id field and link-local addresses had to be disambiguated in an implementation-dependent manner. The KAME-specific workaround to this problem was use of an embedded form. I.e. in the kernel we keep scope zone id in the second 16-bit field of IPv6 address structure. Also we have a bunch of helper functions in the kernel to maintain embedded form of addresses: in6_setscope(), in6_clearscope(), sa6_recoverscope(), sa6_embedscope(). Conversion to embedded form and back can be done several times per packet [1]. This is basically useless operations. And it is worth mentioning that some operations with embedded form use locking, and also changing an address on packet flow has bad effect for caching.
My proposal is remove this code from our kernel. From my investigation this needs the following changes: 1. Do not keep link-local addresses in the routing tables. We already have list and hash table with all IPv6 addresses, so we can use sin6_scope_id to disambiguate an address and determine outgoing interface. 2. Add scope zone id field to the struct in_endpoints and hc_metrics. This also leads to changes in the PCB code. 3. Rework ip6_input * Don't use auxiliary data * Use ifaddr hash to check against own addresses * Remove route and lle lookups from input path 4. Rework ip6_output * Introduce new IPV6_USEROIF flag and use ifpp argument to specify outgoing interface * Rework route lookup part of ip6_output() to properly handle the fact, that now we don't keep routes for link-local addresses. It is the biggest changes, also there are many of small changes that should be done. I would like to see your opinions about first point. [1] http://tinyurl.com/figure2-12 -- WBR, Andrey V. Elsukov _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"