summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-12-05 15:31:44 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-12-05 15:31:44 +0000
commite5e885d0c4b4228349a2f8ed2749664131ff2554 (patch)
tree0fee5636d87901648b0d4e7c29b1dc4195719629 /sys
parent3d100bed7e17dd2604e5f1599df3b353a9eabe00 (diff)
Remove recursive splsoftnet()s in ioctl(2) path.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/igmp.c9
-rw-r--r--sys/netinet/in.c20
2 files changed, 9 insertions, 20 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 1180f01bf30..11446ce4188 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.55 2016/11/28 11:12:45 mpi Exp $ */
+/* $OpenBSD: igmp.c,v 1.56 2016/12/05 15:31:43 mpi Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -498,10 +498,9 @@ void
igmp_joingroup(struct in_multi *inm)
{
struct ifnet* ifp;
- int i, s;
+ int i;
ifp = if_get(inm->inm_ifidx);
- s = splsoftnet();
inm->inm_state = IGMP_IDLE_MEMBER;
@@ -519,7 +518,6 @@ igmp_joingroup(struct in_multi *inm)
inm->inm_timer = 0;
out:
- splx(s);
if_put(ifp);
}
@@ -527,10 +525,8 @@ void
igmp_leavegroup(struct in_multi *inm)
{
struct ifnet* ifp;
- int s;
ifp = if_get(inm->inm_ifidx);
- s = splsoftnet();
switch (inm->inm_state) {
case IGMP_DELAYING_MEMBER:
@@ -546,7 +542,6 @@ igmp_leavegroup(struct in_multi *inm)
case IGMP_SLEEPING_MEMBER:
break;
}
- splx(s);
if_put(ifp);
}
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index b70abc895bf..6e75f57df27 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.129 2016/09/04 10:32:01 mpi Exp $ */
+/* $OpenBSD: in.c,v 1.130 2016/12/05 15:31:43 mpi Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -212,6 +212,8 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
int newifaddr;
int s;
+ splsoftassert(IPL_SOFTNET);
+
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
if (ifa->ifa_addr->sa_family == AF_INET) {
ia = ifatoia(ifa);
@@ -329,12 +331,10 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
break;
case SIOCSIFADDR:
- s = splsoftnet();
in_ifscrub(ifp, ia);
error = in_ifinit(ifp, ia, satosin(&ifr->ifr_addr), newifaddr);
if (!error)
dohooks(ifp->if_addrhooks, 0);
- splx(s);
return (error);
case SIOCSIFNETMASK:
@@ -347,7 +347,6 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
error = 0;
- s = splsoftnet();
if (ia->ia_addr.sin_family == AF_INET) {
if (ifra->ifra_addr.sin_len == 0)
ifra->ifra_addr = ia->ia_addr;
@@ -380,7 +379,6 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
}
if (!error)
dohooks(ifp->if_addrhooks, 0);
- splx(s);
return (error);
}
case SIOCDIFADDR:
@@ -390,10 +388,8 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
* should happen to a packet that was routed after
* the scrub but before the other steps?
*/
- s = splsoftnet();
in_purgeaddr(&ia->ia_ifa);
dohooks(ifp->if_addrhooks, 0);
- splx(s);
break;
default:
@@ -798,7 +794,8 @@ in_addmulti(struct in_addr *ap, struct ifnet *ifp)
{
struct in_multi *inm;
struct ifreq ifr;
- int s;
+
+ splsoftassert(IPL_SOFTNET);
/*
* See if address already in list.
@@ -839,10 +836,8 @@ in_addmulti(struct in_addr *ap, struct ifnet *ifp)
return (NULL);
}
- s = splsoftnet();
TAILQ_INSERT_HEAD(&ifp->if_maddrlist, &inm->inm_ifma,
ifma_list);
- splx(s);
/*
* Let IGMP know that we have joined a new IP multicast group.
@@ -861,7 +856,8 @@ in_delmulti(struct in_multi *inm)
{
struct ifreq ifr;
struct ifnet *ifp;
- int s;
+
+ splsoftassert(IPL_SOFTNET);
if (--inm->inm_refcnt == 0) {
/*
@@ -883,10 +879,8 @@ in_delmulti(struct in_multi *inm)
satosin(&ifr.ifr_addr)->sin_addr = inm->inm_addr;
(*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr);
- s = splsoftnet();
TAILQ_REMOVE(&ifp->if_maddrlist, &inm->inm_ifma,
ifma_list);
- splx(s);
}
if_put(ifp);