Module Name: src Committed By: ozaki-r Date: Thu Nov 10 04:13:53 UTC 2016
Modified Files: src/sys/netinet6: in6_src.c ip6_output.c ip6_var.h Log Message: Tidy up in6_select* This change tidies up in6_select* functions, especially selectroute. selectroute is annoying because: - It returns both/either of a rtentry and/or an ifp - Yes, it may return only an ifp! - It is valid but selectroute shouldn't handle the case - Such conditional behavior makes it difficult to apply locking/psref thingy - It may return a rtentry even if error - It may use opt->ip6po_nextroute rtcache implicitly - The caller can know if it is used by rtcache_validate(&opt->ip6po_nextroute) but it's racy in MP-safe world - Even if it uses opt->ip6po_nextroute, it may return a rtentry that isn't derived from the rtcache The change includes: - Rename selectroute to in6_selectroute - Let a remaining caller of selectroute, in6_selectif, use in6_selectroute instead - Let in6_selectroute return only an rtentry - If error, it doesn't return an rtentry - A caller gets an ifp from a returned rtentry - Allow in6_selectroute to modify a passed rtcache and a caller can know if opt->ip6po_nextroute is used via the rtcache - Let callers (ip6_output and in6_selectif) handle the case that only an ifp is required Inspired by OpenBSD Proposed on tech-kern and tech-net LGTM by roy@ To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/netinet6/in6_src.c cvs rdiff -u -r1.177 -r1.178 src/sys/netinet6/ip6_output.c cvs rdiff -u -r1.69 -r1.70 src/sys/netinet6/ip6_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.