summaryrefslogtreecommitdiffstats
path: root/sys/netipx/ipx_outputfl.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-06-21 21:04:12 +0000
committerrwatson <rwatson@FreeBSD.org>2009-06-21 21:04:12 +0000
commit9e88f817eec82327026cdbd1ec18229191f6482d (patch)
treeab15f66e2608189ce25106a3bf1b8202ed4a4dac /sys/netipx/ipx_outputfl.c
parentd092e8e13d0d2c4c93ccc14801eb033e16b09bb1 (diff)
downloadFreeBSD-src-9e88f817eec82327026cdbd1ec18229191f6482d.zip
FreeBSD-src-9e88f817eec82327026cdbd1ec18229191f6482d.tar.gz
Introduce basic locking of global IPX address list 'ipx_ifaddr' using
a new rwlock, ipx_ifaddr_rw, wrapped with macros. This locking is necessary but not sufficient, in isolation, to satisfy the stability requirements of a fully parallel IPX input path during interface reconfiguration. MFC after: 3 weeks
Diffstat (limited to 'sys/netipx/ipx_outputfl.c')
-rw-r--r--sys/netipx/ipx_outputfl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/netipx/ipx_outputfl.c b/sys/netipx/ipx_outputfl.c
index f6be964..325a5f9 100644
--- a/sys/netipx/ipx_outputfl.c
+++ b/sys/netipx/ipx_outputfl.c
@@ -101,14 +101,18 @@ ipx_outputfl(struct mbuf *m0, struct route *ro, int flags)
* short circuit routing lookup.
*/
if (flags & IPX_ROUTETOIF) {
- struct ipx_ifaddr *ia = ipx_iaonnetof(&ipx->ipx_dna);
+ struct ipx_ifaddr *ia;
+ IPX_IFADDR_RLOCK();
+ ia = ipx_iaonnetof(&ipx->ipx_dna);
if (ia == NULL) {
+ IPX_IFADDR_RUNLOCK();
ipxstat.ipxs_noroute++;
error = ENETUNREACH;
goto bad;
}
ifp = ia->ia_ifp;
+ IPX_IFADDR_RUNLOCK();
goto gotif;
}
rtalloc_ign(ro, 0);
@@ -200,6 +204,7 @@ ipx_output_type20(struct mbuf *m)
/*
* Now see if we have already seen this.
*/
+ IPX_IFADDR_RLOCK();
for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next)
if(ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) {
if(tia == NULL)
@@ -207,15 +212,20 @@ ipx_output_type20(struct mbuf *m)
for (i=0;i<ipx->ipx_tc;i++,nbnet++)
if(ipx_neteqnn(ia->ia_addr.sipx_addr.x_net,
- *nbnet))
+ *nbnet)) {
+ IPX_IFADDR_RUNLOCK();
goto bad;
+ }
}
+
/*
* Don't route the packet if the interface where it come from
* does not have an IPX address.
*/
- if(tia == NULL)
+ if (tia == NULL) {
+ IPX_IFADDR_RUNLOCK();
goto bad;
+ }
/*
* Add our receiving interface to the list.
@@ -266,6 +276,7 @@ ipx_output_type20(struct mbuf *m)
}
skip_this: ;
}
+ IPX_IFADDR_RUNLOCK();
bad:
m_freem(m);
OpenPOWER on IntegriCloud