Skip to content

Commit

Permalink
Make net.inet6.ip6.deembed_scopeid behaviour default & remove sysctl.
Browse files Browse the repository at this point in the history
Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision:	https://reviews.freebsd.org/D25637
  • Loading branch information
AlexanderChernikov committed Aug 15, 2020
1 parent 04996cb commit bec053f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
10 changes: 5 additions & 5 deletions sys/net/rtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ route_output(struct mbuf *m, struct socket *so, ...)
error = lla_rt_output(rtm, &info);
#ifdef INET6
if (error == 0)
rti_need_deembed = (V_deembed_scopeid) ? 1 : 0;
rti_need_deembed = 1;
#endif
goto flush;
}
Expand All @@ -915,7 +915,7 @@ route_output(struct mbuf *m, struct socket *so, ...)
error = rib_action(fibnum, rtm->rtm_type, &info, &rc);
if (error == 0) {
#ifdef INET6
rti_need_deembed = (V_deembed_scopeid) ? 1 : 0;
rti_need_deembed = 1;
#endif
rtm->rtm_index = rc.rc_nh_new->nh_ifp->if_index;
nh = rc.rc_nh_new;
Expand All @@ -930,7 +930,7 @@ route_output(struct mbuf *m, struct socket *so, ...)
}
#ifdef INET6
/* rt_msg2() will not be used when RTM_DELETE fails. */
rti_need_deembed = (V_deembed_scopeid) ? 1 : 0;
rti_need_deembed = 1;
#endif
break;

Expand Down Expand Up @@ -1192,7 +1192,7 @@ rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo)
rtinfo->rti_addrs |= (1 << i);
dlen = SA_SIZE(sa);
#ifdef INET6
if (V_deembed_scopeid && sa->sa_family == AF_INET6) {
if (sa->sa_family == AF_INET6) {
sin6 = (struct sockaddr_in6 *)&ss;
bcopy(sa, sin6, sizeof(*sin6));
if (sa6_recoverscope(sin6) == 0)
Expand Down Expand Up @@ -1298,7 +1298,7 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *
dlen = SA_SIZE(sa);
if (cp != NULL && buflen >= dlen) {
#ifdef INET6
if (V_deembed_scopeid && sa->sa_family == AF_INET6) {
if (sa->sa_family == AF_INET6) {
sin6 = (struct sockaddr_in6 *)&ss;
bcopy(sa, sin6, sizeof(*sin6));
if (sa6_recoverscope(sin6) == 0)
Expand Down
3 changes: 1 addition & 2 deletions sys/netinet6/in6.c
Original file line number Diff line number Diff line change
Expand Up @@ -2374,8 +2374,7 @@ in6_lltable_dump_entry(struct lltable *llt, struct llentry *lle,
ndpc.rtm.rtm_type = RTM_GET;
ndpc.rtm.rtm_flags = RTF_UP;
ndpc.rtm.rtm_addrs = RTA_DST | RTA_GATEWAY;
if (V_deembed_scopeid)
sa6_recoverscope(&ndpc.sin6);
sa6_recoverscope(&ndpc.sin6);

/* publish */
if (lle->la_flags & LLE_PUB)
Expand Down
4 changes: 0 additions & 4 deletions sys/netinet6/scope6.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ 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_INT(_net_inet6_ip6, OID_AUTO, deembed_scopeid, CTLFLAG_VNET | 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
Expand Down
3 changes: 0 additions & 3 deletions sys/netinet6/scope6_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ struct scope6_id {
uint32_t s6id_list[IPV6_ADDR_SCOPES_COUNT];
};

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 *);
Expand Down

0 comments on commit bec053f

Please sign in to comment.