From 377b89c55f75aba70c2c66bfc96fb4c4af7311ae Mon Sep 17 00:00:00 2001 From: hrs Date: Wed, 5 Dec 2012 19:45:24 +0000 Subject: - Move definition of V_deembed_scopeid to scope6_var.h. - Deembed scope id in L3 address in in6_lltable_dump(). - Simplify scope id recovery in rtsock routines. - Remove embedded scope id handling in ndp(8) and route(8) completely. --- sys/netinet6/in6.c | 2 ++ sys/netinet6/scope6.c | 9 +++++++++ sys/netinet6/scope6_var.h | 5 +++++ 3 files changed, 16 insertions(+) (limited to 'sys/netinet6') diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 63b64ee..8da46cf 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2669,6 +2669,8 @@ in6_lltable_dump(struct lltable *llt, struct sysctl_req *wr) ndpc.sin6.sin6_family = AF_INET6; ndpc.sin6.sin6_len = sizeof(ndpc.sin6); bcopy(L3_ADDR(lle), &ndpc.sin6, L3_ADDR_LEN(lle)); + if (V_deembed_scopeid) + sa6_recoverscope(&ndpc.sin6); /* publish */ if (lle->la_flags & LLE_PUB) diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index edfb1e6..060fe59 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -55,6 +56,11 @@ VNET_DEFINE(int, ip6_use_defzone) = 1; #else VNET_DEFINE(int, ip6_use_defzone) = 0; #endif +VNET_DEFINE(int, deembed_scopeid) = 1; +SYSCTL_DECL(_net_inet6_ip6); +SYSCTL_VNET_INT(_net_inet6_ip6, OID_AUTO, deembed_scopeid, CTLFLAG_RW, + &VNET_NAME(deembed_scopeid), 0, + "Extract embedded zone ID and set it to sin6_scope_id in sockaddr_in6."); /* * The scope6_lock protects the global sid default stored in @@ -379,8 +385,11 @@ sa6_recoverscope(struct sockaddr_in6 *sin6) /* sanity check */ if (V_if_index < zoneid) return (ENXIO); +#if 0 + /* XXX: Disabled due to possible deadlock. */ if (!ifnet_byindex(zoneid)) return (ENXIO); +#endif if (sin6->sin6_scope_id != 0 && zoneid != sin6->sin6_scope_id) { log(LOG_NOTICE, diff --git a/sys/netinet6/scope6_var.h b/sys/netinet6/scope6_var.h index ae337b8..87de8d7 100644 --- a/sys/netinet6/scope6_var.h +++ b/sys/netinet6/scope6_var.h @@ -34,6 +34,8 @@ #define _NETINET6_SCOPE6_VAR_H_ #ifdef _KERNEL +#include + struct scope6_id { /* * 16 is correspondent to 4bit multicast scope field. @@ -42,6 +44,9 @@ struct scope6_id { u_int32_t s6id_list[16]; }; +VNET_DECLARE(int, deembed_scopeid); +#define V_deembed_scopeid VNET(deembed_scopeid) + void scope6_init(void); struct scope6_id *scope6_ifattach(struct ifnet *); void scope6_ifdetach(struct scope6_id *); -- cgit v1.1