[Midnightbsd-cvs] src [8434] trunk/sys/netinet6: zoneid has unsigned type.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Sep 18 17:18:53 EDT 2016
Revision: 8434
http://svnweb.midnightbsd.org/src/?rev=8434
Author: laffer1
Date: 2016-09-18 17:18:53 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
zoneid has unsigned type. SCOPE6_LOCK protects v_sid_default. if_afdata lock was convert from mux to rw
Modified Paths:
--------------
trunk/sys/netinet6/icmp6.c
trunk/sys/netinet6/in6_src.c
trunk/sys/netinet6/ip6_input.c
trunk/sys/netinet6/nd6.c
trunk/sys/netinet6/nd6_rtr.c
trunk/sys/netinet6/scope6.c
Modified: trunk/sys/netinet6/icmp6.c
===================================================================
--- trunk/sys/netinet6/icmp6.c 2016-09-18 21:15:57 UTC (rev 8433)
+++ trunk/sys/netinet6/icmp6.c 2016-09-18 21:18:53 UTC (rev 8434)
@@ -2681,9 +2681,9 @@
struct nd_opt_hdr *nd_opt;
char *lladdr;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(router_ll6, 0, ifp);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL)
goto nolladdropt;
Modified: trunk/sys/netinet6/in6_src.c
===================================================================
--- trunk/sys/netinet6/in6_src.c 2016-09-18 21:15:57 UTC (rev 8433)
+++ trunk/sys/netinet6/in6_src.c 2016-09-18 21:18:53 UTC (rev 8434)
@@ -608,9 +608,9 @@
rt = ron->ro_rt;
ifp = rt->rt_ifp;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (la != NULL)
LLE_RUNLOCK(la);
else {
Modified: trunk/sys/netinet6/ip6_input.c
===================================================================
--- trunk/sys/netinet6/ip6_input.c 2016-09-18 21:15:57 UTC (rev 8433)
+++ trunk/sys/netinet6/ip6_input.c 2016-09-18 21:18:53 UTC (rev 8434)
@@ -685,10 +685,10 @@
dst6.sin6_len = sizeof(struct sockaddr_in6);
dst6.sin6_addr = ip6->ip6_dst;
ifp = m->m_pkthdr.rcvif;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
lle = lla_lookup(LLTABLE6(ifp), 0,
(struct sockaddr *)&dst6);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if ((lle != NULL) && (lle->la_flags & LLE_IFADDR)) {
struct ifaddr *ifa;
struct in6_ifaddr *ia6;
Modified: trunk/sys/netinet6/nd6.c
===================================================================
--- trunk/sys/netinet6/nd6.c 2016-09-18 21:15:57 UTC (rev 8433)
+++ trunk/sys/netinet6/nd6.c 2016-09-18 21:18:53 UTC (rev 8434)
@@ -978,12 +978,12 @@
* Even if the address matches none of our addresses, it might be
* in the neighbor cache.
*/
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) {
LLE_RUNLOCK(lle);
rc = 1;
}
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (rc);
}
@@ -1502,9 +1502,9 @@
if ((error = in6_setscope(&nb_addr, ifp, NULL)) != 0)
return (error);
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(&nb_addr, 0, ifp);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL) {
error = EINVAL;
@@ -2223,9 +2223,9 @@
/*
* the entry should have been created in nd6_store_lladdr
*/
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
ln = lla_lookup(LLTABLE6(ifp), 0, dst);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if ((ln == NULL) || !(ln->la_flags & LLE_VALID)) {
if (ln != NULL)
LLE_RUNLOCK(ln);
Modified: trunk/sys/netinet6/nd6_rtr.c
===================================================================
--- trunk/sys/netinet6/nd6_rtr.c 2016-09-18 21:15:57 UTC (rev 8433)
+++ trunk/sys/netinet6/nd6_rtr.c 2016-09-18 21:18:53 UTC (rev 8434)
@@ -651,13 +651,13 @@
* the ordering rule of the list described in defrtrlist_update().
*/
TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) {
- IF_AFDATA_LOCK(dr->ifp);
+ IF_AFDATA_RLOCK(dr->ifp);
if (selected_dr == NULL &&
(ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) &&
ND6_IS_LLINFO_PROBREACH(ln)) {
selected_dr = dr;
}
- IF_AFDATA_UNLOCK(dr->ifp);
+ IF_AFDATA_RUNLOCK(dr->ifp);
if (ln != NULL) {
LLE_RUNLOCK(ln);
ln = NULL;
@@ -685,13 +685,13 @@
else
selected_dr = TAILQ_NEXT(installed_dr, dr_entry);
} else if (installed_dr) {
- IF_AFDATA_LOCK(installed_dr->ifp);
+ IF_AFDATA_RLOCK(installed_dr->ifp);
if ((ln = nd6_lookup(&installed_dr->rtaddr, 0, installed_dr->ifp)) &&
ND6_IS_LLINFO_PROBREACH(ln) &&
rtpref(selected_dr) <= rtpref(installed_dr)) {
selected_dr = installed_dr;
}
- IF_AFDATA_UNLOCK(installed_dr->ifp);
+ IF_AFDATA_RUNLOCK(installed_dr->ifp);
if (ln != NULL)
LLE_RUNLOCK(ln);
}
@@ -1334,9 +1334,9 @@
int canreach;
LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) {
- IF_AFDATA_LOCK(pfxrtr->router->ifp);
+ IF_AFDATA_RLOCK(pfxrtr->router->ifp);
ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp);
- IF_AFDATA_UNLOCK(pfxrtr->router->ifp);
+ IF_AFDATA_RUNLOCK(pfxrtr->router->ifp);
if (ln == NULL)
continue;
canreach = ND6_IS_LLINFO_PROBREACH(ln);
Modified: trunk/sys/netinet6/scope6.c
===================================================================
--- trunk/sys/netinet6/scope6.c 2016-09-18 21:15:57 UTC (rev 8433)
+++ trunk/sys/netinet6/scope6.c 2016-09-18 21:18:53 UTC (rev 8434)
@@ -121,11 +121,11 @@
int error = 0;
struct scope6_id *sid = NULL;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_WLOCK(ifp);
sid = SID(ifp);
if (!sid) { /* paranoid? */
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_WUNLOCK(ifp);
return (EINVAL);
}
@@ -139,7 +139,6 @@
* interface addresses, routing table entries, PCB entries...
*/
- SCOPE6_LOCK();
for (i = 0; i < 16; i++) {
if (idlist->s6id_list[i] &&
idlist->s6id_list[i] != sid->s6id_list[i]) {
@@ -149,8 +148,7 @@
*/
if (i == IPV6_ADDR_SCOPE_INTFACELOCAL &&
idlist->s6id_list[i] != ifp->if_index) {
- IF_AFDATA_UNLOCK(ifp);
- SCOPE6_UNLOCK();
+ IF_AFDATA_WUNLOCK(ifp);
return (EINVAL);
}
@@ -162,8 +160,7 @@
* IDs, but we check the consistency for
* safety in later use.
*/
- IF_AFDATA_UNLOCK(ifp);
- SCOPE6_UNLOCK();
+ IF_AFDATA_WUNLOCK(ifp);
return (EINVAL);
}
@@ -175,8 +172,7 @@
sid->s6id_list[i] = idlist->s6id_list[i];
}
}
- SCOPE6_UNLOCK();
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_WUNLOCK(ifp);
return (error);
}
@@ -184,20 +180,19 @@
int
scope6_get(struct ifnet *ifp, struct scope6_id *idlist)
{
+ struct scope6_id *sid;
+
/* We only need to lock the interface's afdata for SID() to work. */
- IF_AFDATA_LOCK(ifp);
- struct scope6_id *sid = SID(ifp);
-
+ IF_AFDATA_RLOCK(ifp);
+ sid = SID(ifp);
if (sid == NULL) { /* paranoid? */
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (EINVAL);
}
- SCOPE6_LOCK();
*idlist = *sid;
- SCOPE6_UNLOCK();
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (0);
}
@@ -382,7 +377,7 @@
zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]);
if (zoneid) {
/* sanity check */
- if (zoneid < 0 || V_if_index < zoneid)
+ if (V_if_index < zoneid)
return (ENXIO);
if (!ifnet_byindex(zoneid))
return (ENXIO);
@@ -416,7 +411,7 @@
u_int32_t zoneid = 0;
struct scope6_id *sid;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
sid = SID(ifp);
@@ -433,19 +428,17 @@
*/
if (IN6_IS_ADDR_LOOPBACK(in6)) {
if (!(ifp->if_flags & IFF_LOOPBACK)) {
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (EINVAL);
} else {
if (ret_id != NULL)
*ret_id = 0; /* there's no ambiguity */
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (0);
}
}
scope = in6_addrscope(in6);
-
- SCOPE6_LOCK();
switch (scope) {
case IPV6_ADDR_SCOPE_INTFACELOCAL: /* should be interface index */
zoneid = sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL];
@@ -467,8 +460,7 @@
zoneid = 0; /* XXX: treat as global. */
break;
}
- SCOPE6_UNLOCK();
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (ret_id != NULL)
*ret_id = zoneid;
More information about the Midnightbsd-cvs
mailing list