Page MenuHomeFreeBSD

D54726.id.diff
No OneTemporary

D54726.id.diff

diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2613,8 +2613,8 @@
COUNTER_ARRAY_ALLOC(ext->icmp6_ifstat,
sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_WAITOK);
nd6_ifattach(ifp);
+ scope6_ifattach(ifp);
- ext->scope6_id = scope6_ifattach(ifp);
ext->lltable = in6_lltattach(ifp);
ext->mld_ifinfo = mld_domifattach(ifp);
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -917,7 +917,6 @@
#endif
_in6_ifdetach(ifp, 1);
mld_domifdetach(ifp);
- scope6_ifdetach(ext->scope6_id);
nd6_ifdetach(ifp);
lltable_free(ext->lltable);
COUNTER_ARRAY_FREE(ext->in6_ifstat,
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -506,7 +506,15 @@
u_int nd_dad_failures;
uint8_t nd_curhoplimit;
- struct scope6_id *scope6_id;
+ struct scope6_id {
+ /*
+ * 16 is correspondent to 4bit multicast scope field. i.e. from
+ * node-local to global with some reserved/unassigned types.
+ */
+#define IPV6_ADDR_SCOPES_COUNT 16
+ uint32_t s6id_list[IPV6_ADDR_SCOPES_COUNT];
+ } scope6_id;
+
struct lltable *lltable;
struct mld_ifsoftc *mld_ifinfo;
};
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -73,10 +73,11 @@
VNET_DEFINE_STATIC(struct scope6_id, sid_default);
#define V_sid_default VNET(sid_default)
-#define SID(ifp) ((ifp)->if_inet6->scope6_id)
+#define SID(ifp) (&(ifp)->if_inet6->scope6_id)
static int scope6_get(struct ifnet *, struct scope6_id *);
static int scope6_set(struct ifnet *, struct scope6_id *);
+static int scope6_get_default(struct scope6_id *);
void
scope6_init(void)
@@ -90,26 +91,18 @@
SCOPE6_LOCK_INIT();
}
-struct scope6_id *
+void
scope6_ifattach(struct ifnet *ifp)
{
- struct scope6_id *sid;
+ struct scope6_id *sid = &ifp->if_inet6->scope6_id;
- sid = malloc(sizeof(*sid), M_IFADDR, M_WAITOK | M_ZERO);
/*
* XXX: IPV6_ADDR_SCOPE_xxx macros are not standard.
* Should we rather hardcode here?
*/
+ bzero(sid, sizeof(*sid));
sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = ifp->if_index;
sid->s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = ifp->if_index;
- return (sid);
-}
-
-void
-scope6_ifdetach(struct scope6_id *sid)
-{
-
- free(sid, M_IFADDR);
}
int
@@ -280,7 +273,7 @@
SCOPE6_UNLOCK();
}
-int
+static int
scope6_get_default(struct scope6_id *idlist)
{
diff --git a/sys/netinet6/scope6_var.h b/sys/netinet6/scope6_var.h
--- a/sys/netinet6/scope6_var.h
+++ b/sys/netinet6/scope6_var.h
@@ -37,21 +37,10 @@
#ifdef _KERNEL
#include <net/vnet.h>
-#define IPV6_ADDR_SCOPES_COUNT 16
-struct scope6_id {
- /*
- * 16 is correspondent to 4bit multicast scope field.
- * i.e. from node-local to global with some reserved/unassigned types.
- */
- uint32_t s6id_list[IPV6_ADDR_SCOPES_COUNT];
-};
-
void scope6_init(void);
-struct scope6_id *scope6_ifattach(struct ifnet *);
-void scope6_ifdetach(struct scope6_id *);
+void scope6_ifattach(struct ifnet *);
int scope6_ioctl(u_long cmd, caddr_t data, struct ifnet *);
void scope6_setdefault(struct ifnet *);
-int scope6_get_default(struct scope6_id *);
u_int32_t scope6_addr2default(struct in6_addr *);
int sa6_embedscope(struct sockaddr_in6 *, int);
int sa6_recoverscope(struct sockaddr_in6 *);

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 16, 1:21 PM (14 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27658994
Default Alt Text
D54726.id.diff (3 KB)

Event Timeline