Mechanically remove the last stray remains of spl* calls from net*/*.

They have been Noop's for a long time now.
This commit is contained in:
Andre Oppermann 2012-10-18 13:57:24 +00:00
parent bc17db9558
commit c9b652e3e8
24 changed files with 29 additions and 236 deletions

View File

@ -691,12 +691,9 @@ static void
if_attachdomain(void *dummy) if_attachdomain(void *dummy)
{ {
struct ifnet *ifp; struct ifnet *ifp;
int s;
s = splnet();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) TAILQ_FOREACH(ifp, &V_ifnet, if_link)
if_attachdomain1(ifp); if_attachdomain1(ifp);
splx(s);
} }
SYSINIT(domainifattach, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_SECOND, SYSINIT(domainifattach, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_SECOND,
if_attachdomain, NULL); if_attachdomain, NULL);
@ -705,21 +702,15 @@ static void
if_attachdomain1(struct ifnet *ifp) if_attachdomain1(struct ifnet *ifp)
{ {
struct domain *dp; struct domain *dp;
int s;
s = splnet();
/* /*
* Since dp->dom_ifattach calls malloc() with M_WAITOK, we * Since dp->dom_ifattach calls malloc() with M_WAITOK, we
* cannot lock ifp->if_afdata initialization, entirely. * cannot lock ifp->if_afdata initialization, entirely.
*/ */
if (IF_AFDATA_TRYLOCK(ifp) == 0) { if (IF_AFDATA_TRYLOCK(ifp) == 0)
splx(s);
return; return;
}
if (ifp->if_afdata_initialized >= domain_init_status) { if (ifp->if_afdata_initialized >= domain_init_status) {
IF_AFDATA_UNLOCK(ifp); IF_AFDATA_UNLOCK(ifp);
splx(s);
printf("if_attachdomain called more than once on %s\n", printf("if_attachdomain called more than once on %s\n",
ifp->if_xname); ifp->if_xname);
return; return;
@ -734,8 +725,6 @@ if_attachdomain1(struct ifnet *ifp)
ifp->if_afdata[dp->dom_family] = ifp->if_afdata[dp->dom_family] =
(*dp->dom_ifattach)(ifp); (*dp->dom_ifattach)(ifp);
} }
splx(s);
} }
/* /*
@ -1825,7 +1814,6 @@ link_rtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
/* /*
* Mark an interface down and notify protocols of * Mark an interface down and notify protocols of
* the transition. * the transition.
* NOTE: must be called at splnet or eqivalent.
*/ */
static void static void
if_unroute(struct ifnet *ifp, int flag, int fam) if_unroute(struct ifnet *ifp, int flag, int fam)
@ -1849,7 +1837,6 @@ if_unroute(struct ifnet *ifp, int flag, int fam)
/* /*
* Mark an interface up and notify protocols of * Mark an interface up and notify protocols of
* the transition. * the transition.
* NOTE: must be called at splnet or eqivalent.
*/ */
static void static void
if_route(struct ifnet *ifp, int flag, int fam) if_route(struct ifnet *ifp, int flag, int fam)
@ -1935,7 +1922,6 @@ do_link_state_change(void *arg, int pending)
/* /*
* Mark an interface down and notify protocols of * Mark an interface down and notify protocols of
* the transition. * the transition.
* NOTE: must be called at splnet or eqivalent.
*/ */
void void
if_down(struct ifnet *ifp) if_down(struct ifnet *ifp)
@ -1947,7 +1933,6 @@ if_down(struct ifnet *ifp)
/* /*
* Mark an interface up and notify protocols of * Mark an interface up and notify protocols of
* the transition. * the transition.
* NOTE: must be called at splnet or eqivalent.
*/ */
void void
if_up(struct ifnet *ifp) if_up(struct ifnet *ifp)
@ -2150,14 +2135,10 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
/* Smart drivers twiddle their own routes */ /* Smart drivers twiddle their own routes */
} else if (ifp->if_flags & IFF_UP && } else if (ifp->if_flags & IFF_UP &&
(new_flags & IFF_UP) == 0) { (new_flags & IFF_UP) == 0) {
int s = splimp();
if_down(ifp); if_down(ifp);
splx(s);
} else if (new_flags & IFF_UP && } else if (new_flags & IFF_UP &&
(ifp->if_flags & IFF_UP) == 0) { (ifp->if_flags & IFF_UP) == 0) {
int s = splimp();
if_up(ifp); if_up(ifp);
splx(s);
} }
/* See if permanently promiscuous mode bit is about to flip */ /* See if permanently promiscuous mode bit is about to flip */
if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) { if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) {
@ -2605,11 +2586,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td)
if ((oif_flags ^ ifp->if_flags) & IFF_UP) { if ((oif_flags ^ ifp->if_flags) & IFF_UP) {
#ifdef INET6 #ifdef INET6
if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_UP)
int s = splimp();
in6_if_up(ifp); in6_if_up(ifp);
splx(s);
}
#endif #endif
} }
if_rele(ifp); if_rele(ifp);

View File

@ -151,14 +151,10 @@ static int
ef_detach(struct efnet *sc) ef_detach(struct efnet *sc)
{ {
struct ifnet *ifp = sc->ef_ifp; struct ifnet *ifp = sc->ef_ifp;
int s;
s = splimp();
ether_ifdetach(ifp); ether_ifdetach(ifp);
if_free(ifp); if_free(ifp);
splx(s);
return 0; return 0;
} }
@ -172,11 +168,10 @@ ef_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{ {
struct efnet *sc = ifp->if_softc; struct efnet *sc = ifp->if_softc;
struct ifaddr *ifa = (struct ifaddr*)data; struct ifaddr *ifa = (struct ifaddr*)data;
int s, error; int error;
EFDEBUG("IOCTL %ld for %s\n", cmd, ifp->if_xname); EFDEBUG("IOCTL %ld for %s\n", cmd, ifp->if_xname);
error = 0; error = 0;
s = splimp();
switch (cmd) { switch (cmd) {
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
error = 0; error = 0;
@ -193,7 +188,6 @@ ef_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = ether_ioctl(ifp, cmd, data); error = ether_ioctl(ifp, cmd, data);
break; break;
} }
splx(s);
return error; return error;
} }

View File

@ -518,7 +518,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct if_laddrreq *lifr = (struct if_laddrreq *)data; struct if_laddrreq *lifr = (struct if_laddrreq *)data;
struct in_aliasreq *aifr = (struct in_aliasreq *)data; struct in_aliasreq *aifr = (struct in_aliasreq *)data;
struct gre_softc *sc = ifp->if_softc; struct gre_softc *sc = ifp->if_softc;
int s;
struct sockaddr_in si; struct sockaddr_in si;
struct sockaddr *sa = NULL; struct sockaddr *sa = NULL;
int error, adj; int error, adj;
@ -528,7 +527,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = 0; error = 0;
adj = 0; adj = 0;
s = splnet();
switch (cmd) { switch (cmd) {
case SIOCSIFADDR: case SIOCSIFADDR:
ifp->if_flags |= IFF_UP; ifp->if_flags |= IFF_UP;
@ -848,7 +846,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -791,13 +791,12 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
struct sppp *sp = IFP2SP(ifp); struct sppp *sp = IFP2SP(ifp);
struct ppp_header *h; struct ppp_header *h;
struct ifqueue *ifq = NULL; struct ifqueue *ifq = NULL;
int s, error, rv = 0; int error, rv = 0;
#ifdef INET #ifdef INET
int ipproto = PPP_IP; int ipproto = PPP_IP;
#endif #endif
int debug = ifp->if_flags & IFF_DEBUG; int debug = ifp->if_flags & IFF_DEBUG;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
if (!(ifp->if_flags & IFF_UP) || if (!(ifp->if_flags & IFF_UP) ||
@ -808,7 +807,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
#endif #endif
m_freem (m); m_freem (m);
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx (s);
return (ENETDOWN); return (ENETDOWN);
} }
@ -832,9 +830,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
* to start LCP for it. * to start LCP for it.
*/ */
ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags |= IFF_DRV_RUNNING;
splx(s);
lcp.Open(sp); lcp.Open(sp);
s = splimp();
} }
#ifdef INET #ifdef INET
@ -858,7 +854,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
{ {
m_freem(m); m_freem(m);
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
if(ip->ip_p == IPPROTO_TCP) if(ip->ip_p == IPPROTO_TCP)
return(EADDRNOTAVAIL); return(EADDRNOTAVAIL);
else else
@ -903,7 +898,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
default: default:
m_freem(m); m_freem(m);
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
return (EINVAL); return (EINVAL);
} }
} }
@ -933,7 +927,6 @@ nobufs: if (debug)
SPP_ARGS(ifp)); SPP_ARGS(ifp));
++ifp->if_oerrors; ++ifp->if_oerrors;
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx (s);
return (ENOBUFS); return (ENOBUFS);
} }
/* /*
@ -1000,7 +993,6 @@ nobufs: if (debug)
m_freem (m); m_freem (m);
++ifp->if_oerrors; ++ifp->if_oerrors;
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx (s);
return (EAFNOSUPPORT); return (EAFNOSUPPORT);
} }
@ -1016,11 +1008,9 @@ out:
if (error) { if (error) {
++ifp->if_oerrors; ++ifp->if_oerrors;
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx (s);
return (rv? rv: ENOBUFS); return (rv? rv: ENOBUFS);
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx (s);
/* /*
* Unlike in sppp_input(), we can always bump the timestamp * Unlike in sppp_input(), we can always bump the timestamp
* here since sppp_output() is only called on behalf of * here since sppp_output() is only called on behalf of
@ -1137,14 +1127,12 @@ int
sppp_isempty(struct ifnet *ifp) sppp_isempty(struct ifnet *ifp)
{ {
struct sppp *sp = IFP2SP(ifp); struct sppp *sp = IFP2SP(ifp);
int empty, s; int empty;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
empty = !sp->pp_fastq.ifq_head && !sp->pp_cpq.ifq_head && empty = !sp->pp_fastq.ifq_head && !sp->pp_cpq.ifq_head &&
!SP2IFP(sp)->if_snd.ifq_head; !SP2IFP(sp)->if_snd.ifq_head;
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
return (empty); return (empty);
} }
@ -1156,9 +1144,7 @@ sppp_dequeue(struct ifnet *ifp)
{ {
struct sppp *sp = IFP2SP(ifp); struct sppp *sp = IFP2SP(ifp);
struct mbuf *m; struct mbuf *m;
int s;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
/* /*
* Process only the control protocol queue until we have at * Process only the control protocol queue until we have at
@ -1175,7 +1161,6 @@ sppp_dequeue(struct ifnet *ifp)
IF_DEQUEUE (&SP2IFP(sp)->if_snd, m); IF_DEQUEUE (&SP2IFP(sp)->if_snd, m);
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
return m; return m;
} }
@ -1187,9 +1172,7 @@ sppp_pick(struct ifnet *ifp)
{ {
struct sppp *sp = IFP2SP(ifp); struct sppp *sp = IFP2SP(ifp);
struct mbuf *m; struct mbuf *m;
int s;
s = splimp ();
SPPP_LOCK(sp); SPPP_LOCK(sp);
m = sp->pp_cpq.ifq_head; m = sp->pp_cpq.ifq_head;
@ -1200,7 +1183,6 @@ sppp_pick(struct ifnet *ifp)
if ((m = sp->pp_fastq.ifq_head) == NULL) if ((m = sp->pp_fastq.ifq_head) == NULL)
m = SP2IFP(sp)->if_snd.ifq_head; m = SP2IFP(sp)->if_snd.ifq_head;
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx (s);
return (m); return (m);
} }
@ -1212,9 +1194,8 @@ sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
{ {
struct ifreq *ifr = (struct ifreq*) data; struct ifreq *ifr = (struct ifreq*) data;
struct sppp *sp = IFP2SP(ifp); struct sppp *sp = IFP2SP(ifp);
int s, rv, going_up, going_down, newmode; int rv, going_up, going_down, newmode;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
rv = 0; rv = 0;
switch (cmd) { switch (cmd) {
@ -1320,7 +1301,6 @@ sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
rv = ENOTTY; rv = ENOTTY;
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
return rv; return rv;
} }
@ -2070,9 +2050,7 @@ static void
sppp_to_event(const struct cp *cp, struct sppp *sp) sppp_to_event(const struct cp *cp, struct sppp *sp)
{ {
STDDCL; STDDCL;
int s;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
if (debug) if (debug)
log(LOG_DEBUG, SPP_FMT "%s TO(%s) rst_counter = %d\n", log(LOG_DEBUG, SPP_FMT "%s TO(%s) rst_counter = %d\n",
@ -2122,7 +2100,6 @@ sppp_to_event(const struct cp *cp, struct sppp *sp)
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
} }
/* /*
@ -4025,7 +4002,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m)
{ {
STDDCL; STDDCL;
struct lcp_header *h; struct lcp_header *h;
int len, x; int len;
u_char *value, *name, digest[AUTHKEYLEN], dsize; u_char *value, *name, digest[AUTHKEYLEN], dsize;
int value_len, name_len; int value_len, name_len;
MD5_CTX ctx; MD5_CTX ctx;
@ -4102,7 +4079,6 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m)
} }
log(-1, "\n"); log(-1, "\n");
} }
x = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
sp->pp_flags &= ~PP_NEEDAUTH; sp->pp_flags &= ~PP_NEEDAUTH;
if (sp->myauth.proto == PPP_CHAP && if (sp->myauth.proto == PPP_CHAP &&
@ -4114,11 +4090,9 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m)
* to network phase. * to network phase.
*/ */
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
break; break;
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
sppp_phase_network(sp); sppp_phase_network(sp);
break; break;
@ -4280,9 +4254,7 @@ sppp_chap_TO(void *cookie)
{ {
struct sppp *sp = (struct sppp *)cookie; struct sppp *sp = (struct sppp *)cookie;
STDDCL; STDDCL;
int s;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
if (debug) if (debug)
log(LOG_DEBUG, SPP_FMT "chap TO(%s) rst_counter = %d\n", log(LOG_DEBUG, SPP_FMT "chap TO(%s) rst_counter = %d\n",
@ -4313,14 +4285,13 @@ sppp_chap_TO(void *cookie)
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
} }
static void static void
sppp_chap_tlu(struct sppp *sp) sppp_chap_tlu(struct sppp *sp)
{ {
STDDCL; STDDCL;
int i, x; int i;
i = 0; i = 0;
sp->rst_counter[IDX_CHAP] = sp->lcp.max_configure; sp->rst_counter[IDX_CHAP] = sp->lcp.max_configure;
@ -4351,7 +4322,6 @@ sppp_chap_tlu(struct sppp *sp)
log(-1, "re-challenging supressed\n"); log(-1, "re-challenging supressed\n");
} }
x = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
/* indicate to LCP that we need to be closed down */ /* indicate to LCP that we need to be closed down */
sp->lcp.protos |= (1 << IDX_CHAP); sp->lcp.protos |= (1 << IDX_CHAP);
@ -4363,11 +4333,9 @@ sppp_chap_tlu(struct sppp *sp)
* phase. * phase.
*/ */
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
return; return;
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
/* /*
* If we are already in phase network, we are done here. This * If we are already in phase network, we are done here. This
@ -4436,7 +4404,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m)
{ {
STDDCL; STDDCL;
struct lcp_header *h; struct lcp_header *h;
int len, x; int len;
u_char *name, *passwd, mlen; u_char *name, *passwd, mlen;
int name_len, passwd_len; int name_len, passwd_len;
@ -4523,7 +4491,6 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m)
} }
log(-1, "\n"); log(-1, "\n");
} }
x = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
sp->pp_flags &= ~PP_NEEDAUTH; sp->pp_flags &= ~PP_NEEDAUTH;
if (sp->myauth.proto == PPP_PAP && if (sp->myauth.proto == PPP_PAP &&
@ -4535,11 +4502,9 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m)
* to network phase. * to network phase.
*/ */
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
break; break;
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
sppp_phase_network(sp); sppp_phase_network(sp);
break; break;
@ -4620,9 +4585,7 @@ sppp_pap_TO(void *cookie)
{ {
struct sppp *sp = (struct sppp *)cookie; struct sppp *sp = (struct sppp *)cookie;
STDDCL; STDDCL;
int s;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
if (debug) if (debug)
log(LOG_DEBUG, SPP_FMT "pap TO(%s) rst_counter = %d\n", log(LOG_DEBUG, SPP_FMT "pap TO(%s) rst_counter = %d\n",
@ -4648,7 +4611,6 @@ sppp_pap_TO(void *cookie)
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
} }
/* /*
@ -4675,7 +4637,6 @@ static void
sppp_pap_tlu(struct sppp *sp) sppp_pap_tlu(struct sppp *sp)
{ {
STDDCL; STDDCL;
int x;
sp->rst_counter[IDX_PAP] = sp->lcp.max_configure; sp->rst_counter[IDX_PAP] = sp->lcp.max_configure;
@ -4683,7 +4644,6 @@ sppp_pap_tlu(struct sppp *sp)
log(LOG_DEBUG, SPP_FMT "%s tlu\n", log(LOG_DEBUG, SPP_FMT "%s tlu\n",
SPP_ARGS(ifp), pap.name); SPP_ARGS(ifp), pap.name);
x = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
/* indicate to LCP that we need to be closed down */ /* indicate to LCP that we need to be closed down */
sp->lcp.protos |= (1 << IDX_PAP); sp->lcp.protos |= (1 << IDX_PAP);
@ -4695,11 +4655,9 @@ sppp_pap_tlu(struct sppp *sp)
* phase. * phase.
*/ */
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
return; return;
} }
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(x);
sppp_phase_network(sp); sppp_phase_network(sp);
} }
@ -4837,9 +4795,7 @@ sppp_keepalive(void *dummy)
{ {
struct sppp *sp = (struct sppp*)dummy; struct sppp *sp = (struct sppp*)dummy;
struct ifnet *ifp = SP2IFP(sp); struct ifnet *ifp = SP2IFP(sp);
int s;
s = splimp();
SPPP_LOCK(sp); SPPP_LOCK(sp);
/* Keepalive mode disabled or channel down? */ /* Keepalive mode disabled or channel down? */
if (! (sp->pp_flags & PP_KEEPALIVE) || if (! (sp->pp_flags & PP_KEEPALIVE) ||
@ -4882,7 +4838,6 @@ sppp_keepalive(void *dummy)
} }
out: out:
SPPP_UNLOCK(sp); SPPP_UNLOCK(sp);
splx(s);
callout_reset(&sp->keepalive_callout, hz * 10, sppp_keepalive, callout_reset(&sp->keepalive_callout, hz * 10, sppp_keepalive,
(void *)sp); (void *)sp);
} }
@ -4932,7 +4887,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
#ifdef INET #ifdef INET
/* /*
* Set my IP address. Must be called at splimp. * Set my IP address.
*/ */
static void static void
sppp_set_ip_addr(struct sppp *sp, u_long src) sppp_set_ip_addr(struct sppp *sp, u_long src)
@ -5049,7 +5004,7 @@ sppp_gen_ip6_addr(struct sppp *sp, struct in6_addr *addr)
} }
/* /*
* Set my IPv6 address. Must be called at splimp. * Set my IPv6 address.
*/ */
static void static void
sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src) sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src)

View File

@ -274,7 +274,7 @@ void if_maddr_runlock(struct ifnet *ifp); /* if_multiaddrs */
* Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
* are queues of messages stored on ifqueue structures * are queues of messages stored on ifqueue structures
* (defined above). Entries are added to and deleted from these structures * (defined above). Entries are added to and deleted from these structures
* by these macros, which should be called with ipl raised to splimp(). * by these macros.
*/ */
#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx) #define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx)
#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) #define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx)

View File

@ -302,7 +302,7 @@ static int
rts_attach(struct socket *so, int proto, struct thread *td) rts_attach(struct socket *so, int proto, struct thread *td)
{ {
struct rawcb *rp; struct rawcb *rp;
int s, error; int error;
KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL")); KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL"));
@ -311,20 +311,11 @@ rts_attach(struct socket *so, int proto, struct thread *td)
if (rp == NULL) if (rp == NULL)
return ENOBUFS; return ENOBUFS;
/*
* The splnet() is necessary to block protocols from sending
* error notifications (like RTM_REDIRECT or RTM_LOSING) while
* this PCB is extant but incompletely initialized.
* Probably we should try to do more of this work beforehand and
* eliminate the spl.
*/
s = splnet();
so->so_pcb = (caddr_t)rp; so->so_pcb = (caddr_t)rp;
so->so_fibnum = td->td_proc->p_fibnum; so->so_fibnum = td->td_proc->p_fibnum;
error = raw_attach(so, proto); error = raw_attach(so, proto);
rp = sotorawcb(so); rp = sotorawcb(so);
if (error) { if (error) {
splx(s);
so->so_pcb = NULL; so->so_pcb = NULL;
free(rp, M_PCB); free(rp, M_PCB);
return error; return error;
@ -345,7 +336,6 @@ rts_attach(struct socket *so, int proto, struct thread *td)
RTSOCK_UNLOCK(); RTSOCK_UNLOCK();
soisconnected(so); soisconnected(so);
so->so_options |= SO_USELOOPBACK; so->so_options |= SO_USELOOPBACK;
splx(s);
return 0; return 0;
} }

View File

@ -1178,10 +1178,8 @@ ng_ccatm_log(const char *fmt, ...)
static int static int
ng_ccatm_mod_event(module_t mod, int event, void *data) ng_ccatm_mod_event(module_t mod, int event, void *data)
{ {
int s;
int error = 0; int error = 0;
s = splnet();
switch (event) { switch (event) {
case MOD_LOAD: case MOD_LOAD:
@ -1194,6 +1192,5 @@ ng_ccatm_mod_event(module_t mod, int event, void *data)
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -587,10 +587,8 @@ sscfu_verbose(struct sscfu *sscfu, void *arg, const char *fmt, ...)
static int static int
ng_sscfu_mod_event(module_t mod, int event, void *data) ng_sscfu_mod_event(module_t mod, int event, void *data)
{ {
int s;
int error = 0; int error = 0;
s = splnet();
switch (event) { switch (event) {
case MOD_LOAD: case MOD_LOAD:
@ -603,6 +601,5 @@ ng_sscfu_mod_event(module_t mod, int event, void *data)
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -861,10 +861,8 @@ sscop_send_manage(struct sscop *sscop, void *p, enum sscop_maasig sig,
static int static int
ng_sscop_mod_event(module_t mod, int event, void *data) ng_sscop_mod_event(module_t mod, int event, void *data)
{ {
int s;
int error = 0; int error = 0;
s = splnet();
switch (event) { switch (event) {
case MOD_LOAD: case MOD_LOAD:
@ -877,6 +875,5 @@ ng_sscop_mod_event(module_t mod, int event, void *data)
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -907,10 +907,8 @@ ng_uni_free(enum unimem type, void *ptr, const char *file, u_int lno)
static int static int
ng_uni_mod_event(module_t mod, int event, void *data) ng_uni_mod_event(module_t mod, int event, void *data)
{ {
int s;
int error = 0; int error = 0;
s = splnet();
switch(event) { switch(event) {
case MOD_LOAD: case MOD_LOAD:
@ -925,6 +923,5 @@ ng_uni_mod_event(module_t mod, int event, void *data)
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -132,12 +132,11 @@ ng_eiface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
{ {
const priv_p priv = (priv_p)ifp->if_softc; const priv_p priv = (priv_p)ifp->if_softc;
struct ifreq *const ifr = (struct ifreq *)data; struct ifreq *const ifr = (struct ifreq *)data;
int s, error = 0; int error = 0;
#ifdef DEBUG #ifdef DEBUG
ng_eiface_print_ioctl(ifp, command, data); ng_eiface_print_ioctl(ifp, command, data);
#endif #endif
s = splimp();
switch (command) { switch (command) {
/* These two are mostly handled at a higher layer */ /* These two are mostly handled at a higher layer */
@ -193,7 +192,6 @@ ng_eiface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
error = EINVAL; error = EINVAL;
break; break;
} }
splx(s);
return (error); return (error);
} }
@ -202,14 +200,9 @@ ng_eiface_init(void *xsc)
{ {
priv_p sc = xsc; priv_p sc = xsc;
struct ifnet *ifp = sc->ifp; struct ifnet *ifp = sc->ifp;
int s;
s = splimp();
ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags |= IFF_DRV_RUNNING;
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
splx(s);
} }
/* /*

View File

@ -220,8 +220,6 @@ NETGRAPH_INIT(ether, &ng_ether_typestruct);
/* /*
* Handle a packet that has come in on an interface. We get to * Handle a packet that has come in on an interface. We get to
* look at it here before any upper layer protocols do. * look at it here before any upper layer protocols do.
*
* NOTE: this function will get called at splimp()
*/ */
static void static void
ng_ether_input(struct ifnet *ifp, struct mbuf **mp) ng_ether_input(struct ifnet *ifp, struct mbuf **mp)
@ -239,8 +237,6 @@ ng_ether_input(struct ifnet *ifp, struct mbuf **mp)
/* /*
* Handle a packet that has come in on an interface, and which * Handle a packet that has come in on an interface, and which
* does not match any of our known protocols (an ``orphan''). * does not match any of our known protocols (an ``orphan'').
*
* NOTE: this function will get called at splimp()
*/ */
static void static void
ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m) ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m)
@ -759,9 +755,7 @@ static int
ng_ether_mod_event(module_t mod, int event, void *data) ng_ether_mod_event(module_t mod, int event, void *data)
{ {
int error = 0; int error = 0;
int s;
s = splnet();
switch (event) { switch (event) {
case MOD_LOAD: case MOD_LOAD:
@ -802,7 +796,6 @@ ng_ether_mod_event(module_t mod, int event, void *data)
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -753,7 +753,7 @@ static int
ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
{ {
struct ifreq *const ifr = (struct ifreq *) data; struct ifreq *const ifr = (struct ifreq *) data;
int s, error = 0; int error = 0;
struct ng_fec_private *priv; struct ng_fec_private *priv;
struct ng_fec_bundle *b; struct ng_fec_bundle *b;
@ -763,7 +763,6 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#ifdef DEBUG #ifdef DEBUG
ng_fec_print_ioctl(ifp, command, data); ng_fec_print_ioctl(ifp, command, data);
#endif #endif
s = splimp();
switch (command) { switch (command) {
/* These two are mostly handled at a higher layer */ /* These two are mostly handled at a higher layer */
@ -843,7 +842,6 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
error = EINVAL; error = EINVAL;
break; break;
} }
(void) splx(s);
return (error); return (error);
} }

View File

@ -163,8 +163,6 @@ NETGRAPH_INIT(gif, &ng_gif_typestruct);
/* /*
* Handle a packet that has come in on an interface. We get to * Handle a packet that has come in on an interface. We get to
* look at it here before any upper layer protocols do. * look at it here before any upper layer protocols do.
*
* NOTE: this function will get called at splimp()
*/ */
static void static void
ng_gif_input(struct ifnet *ifp, struct mbuf **mp, int af) ng_gif_input(struct ifnet *ifp, struct mbuf **mp, int af)
@ -181,8 +179,6 @@ ng_gif_input(struct ifnet *ifp, struct mbuf **mp, int af)
/* /*
* Handle a packet that has come in on an interface, and which * Handle a packet that has come in on an interface, and which
* does not match any of our known protocols (an ``orphan''). * does not match any of our known protocols (an ``orphan'').
*
* NOTE: this function will get called at splimp()
*/ */
static void static void
ng_gif_input_orphan(struct ifnet *ifp, struct mbuf *m, int af) ng_gif_input_orphan(struct ifnet *ifp, struct mbuf *m, int af)
@ -203,8 +199,6 @@ ng_gif_input_orphan(struct ifnet *ifp, struct mbuf *m, int af)
/* /*
* Handle a packet that has come in on a gif interface. * Handle a packet that has come in on a gif interface.
* Attach the address family to the mbuf for later use. * Attach the address family to the mbuf for later use.
*
* NOTE: this function will get called at splimp()
*/ */
static void static void
ng_gif_input2(node_p node, struct mbuf **mp, int af) ng_gif_input2(node_p node, struct mbuf **mp, int af)
@ -543,9 +537,7 @@ ng_gif_mod_event(module_t mod, int event, void *data)
VNET_ITERATOR_DECL(vnet_iter); VNET_ITERATOR_DECL(vnet_iter);
struct ifnet *ifp; struct ifnet *ifp;
int error = 0; int error = 0;
int s;
s = splnet();
switch (event) { switch (event) {
case MOD_LOAD: case MOD_LOAD:
@ -597,7 +589,6 @@ ng_gif_mod_event(module_t mod, int event, void *data)
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
} }
splx(s);
return (error); return (error);
} }

View File

@ -1045,9 +1045,7 @@ ng_ksocket_incoming2(node_p node, hook_p hook, void *arg1, int arg2)
struct mbuf *m; struct mbuf *m;
struct ng_mesg *response; struct ng_mesg *response;
struct uio auio; struct uio auio;
int s, flags, error; int flags, error;
s = splnet();
/* so = priv->so; *//* XXX could have derived this like so */ /* so = priv->so; *//* XXX could have derived this like so */
KASSERT(so == priv->so, ("%s: wrong socket", __func__)); KASSERT(so == priv->so, ("%s: wrong socket", __func__));
@ -1094,10 +1092,8 @@ ng_ksocket_incoming2(node_p node, hook_p hook, void *arg1, int arg2)
* the hook gets created and is connected, this upcall function * the hook gets created and is connected, this upcall function
* will be called again. * will be called again.
*/ */
if (priv->hook == NULL) { if (priv->hook == NULL)
splx(s);
return; return;
}
/* Read and forward available mbuf's */ /* Read and forward available mbuf's */
auio.uio_td = NULL; auio.uio_td = NULL;
@ -1165,7 +1161,6 @@ sendit: /* Forward data with optional peer sockaddr as packet tag */
} }
priv->flags |= KSF_EOFSEEN; priv->flags |= KSF_EOFSEEN;
} }
splx(s);
} }
/* /*

View File

@ -608,7 +608,6 @@ static int
ng_source_store_output_ifp(sc_p sc, char *ifname) ng_source_store_output_ifp(sc_p sc, char *ifname)
{ {
struct ifnet *ifp; struct ifnet *ifp;
int s;
ifp = ifunit(ifname); ifp = ifunit(ifname);
@ -624,13 +623,11 @@ ng_source_store_output_ifp(sc_p sc, char *ifname)
* interface with small packets. * interface with small packets.
* XXX we should restore the original value at stop or disconnect * XXX we should restore the original value at stop or disconnect
*/ */
s = splimp(); /* XXX is this required? */
if (ifp->if_snd.ifq_maxlen < NG_SOURCE_DRIVER_IFQ_MAXLEN) { if (ifp->if_snd.ifq_maxlen < NG_SOURCE_DRIVER_IFQ_MAXLEN) {
printf("ng_source: changing ifq_maxlen from %d to %d\n", printf("ng_source: changing ifq_maxlen from %d to %d\n",
ifp->if_snd.ifq_maxlen, NG_SOURCE_DRIVER_IFQ_MAXLEN); ifp->if_snd.ifq_maxlen, NG_SOURCE_DRIVER_IFQ_MAXLEN);
ifp->if_snd.ifq_maxlen = NG_SOURCE_DRIVER_IFQ_MAXLEN; ifp->if_snd.ifq_maxlen = NG_SOURCE_DRIVER_IFQ_MAXLEN;
} }
splx(s);
#endif #endif
return (0); return (0);
} }

View File

@ -117,10 +117,9 @@ ip_ipsec_fwd(struct mbuf *m)
struct m_tag *mtag; struct m_tag *mtag;
struct tdb_ident *tdbi; struct tdb_ident *tdbi;
struct secpolicy *sp; struct secpolicy *sp;
int s, error; int error;
mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL);
s = splnet();
if (mtag != NULL) { if (mtag != NULL) {
tdbi = (struct tdb_ident *)(mtag + 1); tdbi = (struct tdb_ident *)(mtag + 1);
sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND);
@ -129,7 +128,6 @@ ip_ipsec_fwd(struct mbuf *m)
IP_FORWARDING, &error); IP_FORWARDING, &error);
} }
if (sp == NULL) { /* NB: can happen if error */ if (sp == NULL) { /* NB: can happen if error */
splx(s);
/*XXX error stat???*/ /*XXX error stat???*/
DPRINTF(("ip_input: no SP for forwarding\n")); /*XXX*/ DPRINTF(("ip_input: no SP for forwarding\n")); /*XXX*/
return 1; return 1;
@ -140,7 +138,6 @@ ip_ipsec_fwd(struct mbuf *m)
*/ */
error = ipsec_in_reject(sp, m); error = ipsec_in_reject(sp, m);
KEY_FREESP(&sp); KEY_FREESP(&sp);
splx(s);
if (error) { if (error) {
IPSTAT_INC(ips_cantforward); IPSTAT_INC(ips_cantforward);
return 1; return 1;
@ -164,7 +161,7 @@ ip_ipsec_input(struct mbuf *m)
struct m_tag *mtag; struct m_tag *mtag;
struct tdb_ident *tdbi; struct tdb_ident *tdbi;
struct secpolicy *sp; struct secpolicy *sp;
int s, error; int error;
/* /*
* enforce IPsec policy checking if we are seeing last header. * enforce IPsec policy checking if we are seeing last header.
* note that we do not visit this with protocols with pcb layer * note that we do not visit this with protocols with pcb layer
@ -178,7 +175,6 @@ ip_ipsec_input(struct mbuf *m)
* packet is returned to the ip input queue for delivery. * packet is returned to the ip input queue for delivery.
*/ */
mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL);
s = splnet();
if (mtag != NULL) { if (mtag != NULL) {
tdbi = (struct tdb_ident *)(mtag + 1); tdbi = (struct tdb_ident *)(mtag + 1);
sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND);
@ -198,7 +194,6 @@ ip_ipsec_input(struct mbuf *m)
DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/
return 1; return 1;
} }
splx(s);
if (error) if (error)
return 1; return 1;
} }
@ -267,7 +262,6 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
struct ip *ip = mtod(*m, struct ip *); struct ip *ip = mtod(*m, struct ip *);
struct tdb_ident *tdbi; struct tdb_ident *tdbi;
struct m_tag *mtag; struct m_tag *mtag;
int s;
/* /*
* Check the security policy (SP) for the packet and, if * Check the security policy (SP) for the packet and, if
* required, do IPsec-related processing. There are two * required, do IPsec-related processing. There are two
@ -278,7 +272,6 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
* the lookup and related policy checking. * the lookup and related policy checking.
*/ */
mtag = m_tag_find(*m, PACKET_TAG_IPSEC_PENDING_TDB, NULL); mtag = m_tag_find(*m, PACKET_TAG_IPSEC_PENDING_TDB, NULL);
s = splnet();
if (mtag != NULL) { if (mtag != NULL) {
tdbi = (struct tdb_ident *)(mtag + 1); tdbi = (struct tdb_ident *)(mtag + 1);
sp = ipsec_getpolicy(tdbi, IPSEC_DIR_OUTBOUND); sp = ipsec_getpolicy(tdbi, IPSEC_DIR_OUTBOUND);
@ -327,7 +320,6 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
* done: below. * done: below.
*/ */
KEY_FREESP(&sp), sp = NULL; KEY_FREESP(&sp), sp = NULL;
splx(s);
goto done; goto done;
} }
} }
@ -372,10 +364,8 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
*/ */
if (*error == ENOENT) if (*error == ENOENT)
*error = 0; *error = 0;
splx(s);
goto reinjected; goto reinjected;
} else { /* sp == NULL */ } else { /* sp == NULL */
splx(s);
if (*error != 0) { if (*error != 0) {
/* /*

View File

@ -995,7 +995,6 @@ cleanup:
* Update parameters of an IPv6 interface address. * Update parameters of an IPv6 interface address.
* If necessary, a new entry is created and linked into address chains. * If necessary, a new entry is created and linked into address chains.
* This function is separated from in6_control(). * This function is separated from in6_control().
* XXX: should this be performed under splnet()?
*/ */
int int
in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
@ -1522,7 +1521,6 @@ in6_purgeaddr(struct ifaddr *ifa)
static void static void
in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp)
{ {
int s = splnet();
IF_ADDR_WLOCK(ifp); IF_ADDR_WLOCK(ifp);
TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link);
@ -1560,7 +1558,6 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp)
pfxlist_onlink_check(); pfxlist_onlink_check();
} }
ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */
splx(s);
} }
void void
@ -1856,7 +1853,6 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia,
struct sockaddr_in6 *sin6, int newhost) struct sockaddr_in6 *sin6, int newhost)
{ {
int error = 0, plen, ifacount = 0; int error = 0, plen, ifacount = 0;
int s = splimp();
struct ifaddr *ifa; struct ifaddr *ifa;
/* /*
@ -1876,12 +1872,9 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia,
if (ifacount <= 1 && ifp->if_ioctl) { if (ifacount <= 1 && ifp->if_ioctl) {
error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia); error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
if (error) { if (error)
splx(s);
return (error); return (error);
}
} }
splx(s);
ia->ia_ifa.ifa_metric = ifp->if_metric; ia->ia_ifa.ifa_metric = ifp->if_metric;

View File

@ -128,9 +128,8 @@ ip6_ipsec_fwd(struct mbuf *m)
struct m_tag *mtag; struct m_tag *mtag;
struct tdb_ident *tdbi; struct tdb_ident *tdbi;
struct secpolicy *sp; struct secpolicy *sp;
int s, error; int error;
mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL);
s = splnet();
if (mtag != NULL) { if (mtag != NULL) {
tdbi = (struct tdb_ident *)(mtag + 1); tdbi = (struct tdb_ident *)(mtag + 1);
sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND);
@ -139,7 +138,6 @@ ip6_ipsec_fwd(struct mbuf *m)
IP_FORWARDING, &error); IP_FORWARDING, &error);
} }
if (sp == NULL) { /* NB: can happen if error */ if (sp == NULL) { /* NB: can happen if error */
splx(s);
/*XXX error stat???*/ /*XXX error stat???*/
DPRINTF(("%s: no SP for forwarding\n", __func__)); /*XXX*/ DPRINTF(("%s: no SP for forwarding\n", __func__)); /*XXX*/
return 1; return 1;
@ -150,7 +148,6 @@ ip6_ipsec_fwd(struct mbuf *m)
*/ */
error = ipsec_in_reject(sp, m); error = ipsec_in_reject(sp, m);
KEY_FREESP(&sp); KEY_FREESP(&sp);
splx(s);
if (error) { if (error) {
V_ip6stat.ip6s_cantforward++; V_ip6stat.ip6s_cantforward++;
return 1; return 1;
@ -173,7 +170,7 @@ ip6_ipsec_input(struct mbuf *m, int nxt)
struct m_tag *mtag; struct m_tag *mtag;
struct tdb_ident *tdbi; struct tdb_ident *tdbi;
struct secpolicy *sp; struct secpolicy *sp;
int s, error; int error;
/* /*
* enforce IPsec policy checking if we are seeing last header. * enforce IPsec policy checking if we are seeing last header.
* note that we do not visit this with protocols with pcb layer * note that we do not visit this with protocols with pcb layer
@ -189,7 +186,6 @@ ip6_ipsec_input(struct mbuf *m, int nxt)
* packet is returned to the ip input queue for delivery. * packet is returned to the ip input queue for delivery.
*/ */
mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL);
s = splnet();
if (mtag != NULL) { if (mtag != NULL) {
tdbi = (struct tdb_ident *)(mtag + 1); tdbi = (struct tdb_ident *)(mtag + 1);
sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND);
@ -209,7 +205,6 @@ ip6_ipsec_input(struct mbuf *m, int nxt)
DPRINTF(("%s: no SP, packet discarded\n", __func__));/*XXX*/ DPRINTF(("%s: no SP, packet discarded\n", __func__));/*XXX*/
return 1; return 1;
} }
splx(s);
if (error) if (error)
return 1; return 1;
} }
@ -283,7 +278,6 @@ ip6_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error,
* done: below. * done: below.
*/ */
KEY_FREESP(sp), *sp = NULL; KEY_FREESP(sp), *sp = NULL;
/* XXX splx(s); */
goto done; goto done;
} }
} }

View File

@ -575,7 +575,6 @@ void
nd6_timer(void *arg) nd6_timer(void *arg)
{ {
CURVNET_SET((struct vnet *) arg); CURVNET_SET((struct vnet *) arg);
int s;
struct nd_defrouter *dr, *ndr; struct nd_defrouter *dr, *ndr;
struct nd_prefix *pr, *npr; struct nd_prefix *pr, *npr;
struct in6_ifaddr *ia6, *nia6; struct in6_ifaddr *ia6, *nia6;
@ -584,7 +583,6 @@ nd6_timer(void *arg)
nd6_timer, curvnet); nd6_timer, curvnet);
/* expire default router list */ /* expire default router list */
s = splnet();
TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) {
if (dr->expire && dr->expire < time_second) if (dr->expire && dr->expire < time_second)
defrtrlist_del(dr); defrtrlist_del(dr);
@ -679,7 +677,6 @@ nd6_timer(void *arg)
prelist_remove(pr); prelist_remove(pr);
} }
} }
splx(s);
CURVNET_RESTORE(); CURVNET_RESTORE();
} }
@ -1216,7 +1213,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
struct nd_defrouter *dr; struct nd_defrouter *dr;
struct nd_prefix *pr; struct nd_prefix *pr;
int i = 0, error = 0; int i = 0, error = 0;
int s;
switch (cmd) { switch (cmd) {
case SIOCGDRLST_IN6: case SIOCGDRLST_IN6:
@ -1224,7 +1220,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
* obsolete API, use sysctl under net.inet6.icmp6 * obsolete API, use sysctl under net.inet6.icmp6
*/ */
bzero(drl, sizeof(*drl)); bzero(drl, sizeof(*drl));
s = splnet();
TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) {
if (i >= DRLSTSIZ) if (i >= DRLSTSIZ)
break; break;
@ -1237,7 +1232,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
drl->defrouter[i].if_index = dr->ifp->if_index; drl->defrouter[i].if_index = dr->ifp->if_index;
i++; i++;
} }
splx(s);
break; break;
case SIOCGPRLST_IN6: case SIOCGPRLST_IN6:
/* /*
@ -1253,7 +1247,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
* how about separating ioctls into two? * how about separating ioctls into two?
*/ */
bzero(oprl, sizeof(*oprl)); bzero(oprl, sizeof(*oprl));
s = splnet();
LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) {
struct nd_pfxrouter *pfr; struct nd_pfxrouter *pfr;
int j; int j;
@ -1299,7 +1292,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
i++; i++;
} }
splx(s);
break; break;
case OSIOCGIFINFO_IN6: case OSIOCGIFINFO_IN6:
@ -1448,7 +1440,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
/* flush all the prefix advertised by routers */ /* flush all the prefix advertised by routers */
struct nd_prefix *pr, *next; struct nd_prefix *pr, *next;
s = splnet();
LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, next) { LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, next) {
struct in6_ifaddr *ia, *ia_next; struct in6_ifaddr *ia, *ia_next;
@ -1467,7 +1458,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
} }
prelist_remove(pr); prelist_remove(pr);
} }
splx(s);
break; break;
} }
case SIOCSRTRFLUSH_IN6: case SIOCSRTRFLUSH_IN6:
@ -1475,13 +1465,11 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
/* flush all the default routers */ /* flush all the default routers */
struct nd_defrouter *dr, *next; struct nd_defrouter *dr, *next;
s = splnet();
defrouter_reset(); defrouter_reset();
TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, next) { TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, next) {
defrtrlist_del(dr); defrtrlist_del(dr);
} }
defrouter_select(); defrouter_select();
splx(s);
break; break;
} }
case SIOCGNBRINFO_IN6: case SIOCGNBRINFO_IN6:

View File

@ -1331,13 +1331,10 @@ static void
nd6_dad_timer(struct dadq *dp) nd6_dad_timer(struct dadq *dp)
{ {
CURVNET_SET(dp->dad_vnet); CURVNET_SET(dp->dad_vnet);
int s;
struct ifaddr *ifa = dp->dad_ifa; struct ifaddr *ifa = dp->dad_ifa;
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
char ip6buf[INET6_ADDRSTRLEN]; char ip6buf[INET6_ADDRSTRLEN];
s = splnet(); /* XXX */
/* Sanity check */ /* Sanity check */
if (ia == NULL) { if (ia == NULL) {
log(LOG_ERR, "nd6_dad_timer: called with null parameter\n"); log(LOG_ERR, "nd6_dad_timer: called with null parameter\n");
@ -1424,7 +1421,6 @@ nd6_dad_timer(struct dadq *dp)
} }
done: done:
splx(s);
CURVNET_RESTORE(); CURVNET_RESTORE();
} }

View File

@ -473,7 +473,6 @@ defrouter_addreq(struct nd_defrouter *new)
{ {
struct sockaddr_in6 def, mask, gate; struct sockaddr_in6 def, mask, gate;
struct rtentry *newrt = NULL; struct rtentry *newrt = NULL;
int s;
int error; int error;
bzero(&def, sizeof(def)); bzero(&def, sizeof(def));
@ -485,7 +484,6 @@ defrouter_addreq(struct nd_defrouter *new)
def.sin6_family = gate.sin6_family = AF_INET6; def.sin6_family = gate.sin6_family = AF_INET6;
gate.sin6_addr = new->rtaddr; gate.sin6_addr = new->rtaddr;
s = splnet();
error = in6_rtrequest(RTM_ADD, (struct sockaddr *)&def, error = in6_rtrequest(RTM_ADD, (struct sockaddr *)&def,
(struct sockaddr *)&gate, (struct sockaddr *)&mask, (struct sockaddr *)&gate, (struct sockaddr *)&mask,
RTF_GATEWAY, &newrt, RT_DEFAULT_FIB); RTF_GATEWAY, &newrt, RT_DEFAULT_FIB);
@ -495,7 +493,6 @@ defrouter_addreq(struct nd_defrouter *new)
} }
if (error == 0) if (error == 0)
new->installed = 1; new->installed = 1;
splx(s);
return; return;
} }
@ -624,7 +621,6 @@ defrtrlist_del(struct nd_defrouter *dr)
void void
defrouter_select(void) defrouter_select(void)
{ {
int s = splnet();
struct nd_defrouter *dr, *selected_dr = NULL, *installed_dr = NULL; struct nd_defrouter *dr, *selected_dr = NULL, *installed_dr = NULL;
struct llentry *ln = NULL; struct llentry *ln = NULL;
@ -632,10 +628,8 @@ defrouter_select(void)
* Let's handle easy case (3) first: * Let's handle easy case (3) first:
* If default router list is empty, there's nothing to be done. * If default router list is empty, there's nothing to be done.
*/ */
if (TAILQ_EMPTY(&V_nd_defrouter)) { if (TAILQ_EMPTY(&V_nd_defrouter))
splx(s);
return; return;
}
/* /*
* Search for a (probably) reachable router from the list. * Search for a (probably) reachable router from the list.
@ -699,7 +693,6 @@ defrouter_select(void)
defrouter_addreq(selected_dr); defrouter_addreq(selected_dr);
} }
splx(s);
return; return;
} }
@ -734,7 +727,6 @@ static struct nd_defrouter *
defrtrlist_update(struct nd_defrouter *new) defrtrlist_update(struct nd_defrouter *new)
{ {
struct nd_defrouter *dr, *n; struct nd_defrouter *dr, *n;
int s = splnet();
if ((dr = defrouter_lookup(&new->rtaddr, new->ifp)) != NULL) { if ((dr = defrouter_lookup(&new->rtaddr, new->ifp)) != NULL) {
/* entry exists */ /* entry exists */
@ -754,10 +746,8 @@ defrtrlist_update(struct nd_defrouter *new)
* to sort the entries. Also make sure the selected * to sort the entries. Also make sure the selected
* router is still installed in the kernel. * router is still installed in the kernel.
*/ */
if (dr->installed && rtpref(new) == oldpref) { if (dr->installed && rtpref(new) == oldpref)
splx(s);
return (dr); return (dr);
}
/* /*
* preferred router may be changed, so relocate * preferred router may be changed, so relocate
@ -772,21 +762,16 @@ defrtrlist_update(struct nd_defrouter *new)
n = dr; n = dr;
goto insert; goto insert;
} }
splx(s);
return (dr); return (dr);
} }
/* entry does not exist */ /* entry does not exist */
if (new->rtlifetime == 0) { if (new->rtlifetime == 0)
splx(s);
return (NULL); return (NULL);
}
n = (struct nd_defrouter *)malloc(sizeof(*n), M_IP6NDP, M_NOWAIT); n = (struct nd_defrouter *)malloc(sizeof(*n), M_IP6NDP, M_NOWAIT);
if (n == NULL) { if (n == NULL)
splx(s);
return (NULL); return (NULL);
}
bzero(n, sizeof(*n)); bzero(n, sizeof(*n));
*n = *new; *n = *new;
@ -810,8 +795,6 @@ insert:
defrouter_select(); defrouter_select();
splx(s);
return (n); return (n);
} }
@ -874,7 +857,7 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr,
{ {
struct nd_prefix *new = NULL; struct nd_prefix *new = NULL;
int error = 0; int error = 0;
int i, s; int i;
char ip6buf[INET6_ADDRSTRLEN]; char ip6buf[INET6_ADDRSTRLEN];
new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT);
@ -903,10 +886,8 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr,
new->ndpr_prefix.sin6_addr.s6_addr32[i] &= new->ndpr_prefix.sin6_addr.s6_addr32[i] &=
new->ndpr_mask.s6_addr32[i]; new->ndpr_mask.s6_addr32[i];
s = splnet();
/* link ndpr_entry to nd_prefix list */ /* link ndpr_entry to nd_prefix list */
LIST_INSERT_HEAD(&V_nd_prefix, new, ndpr_entry); LIST_INSERT_HEAD(&V_nd_prefix, new, ndpr_entry);
splx(s);
/* ND_OPT_PI_FLAG_ONLINK processing */ /* ND_OPT_PI_FLAG_ONLINK processing */
if (new->ndpr_raf_onlink) { if (new->ndpr_raf_onlink) {
@ -931,7 +912,7 @@ void
prelist_remove(struct nd_prefix *pr) prelist_remove(struct nd_prefix *pr)
{ {
struct nd_pfxrouter *pfr, *next; struct nd_pfxrouter *pfr, *next;
int e, s; int e;
char ip6buf[INET6_ADDRSTRLEN]; char ip6buf[INET6_ADDRSTRLEN];
/* make sure to invalidate the prefix until it is really freed. */ /* make sure to invalidate the prefix until it is really freed. */
@ -956,8 +937,6 @@ prelist_remove(struct nd_prefix *pr)
if (pr->ndpr_refcnt > 0) if (pr->ndpr_refcnt > 0)
return; /* notice here? */ return; /* notice here? */
s = splnet();
/* unlink ndpr_entry from nd_prefix list */ /* unlink ndpr_entry from nd_prefix list */
LIST_REMOVE(pr, ndpr_entry); LIST_REMOVE(pr, ndpr_entry);
@ -965,8 +944,6 @@ prelist_remove(struct nd_prefix *pr)
LIST_FOREACH_SAFE(pfr, &pr->ndpr_advrtrs, pfr_entry, next) { LIST_FOREACH_SAFE(pfr, &pr->ndpr_advrtrs, pfr_entry, next) {
free(pfr, M_IP6NDP); free(pfr, M_IP6NDP);
} }
splx(s);
free(pr, M_IP6NDP); free(pr, M_IP6NDP);
pfxlist_onlink_check(); pfxlist_onlink_check();
@ -984,7 +961,6 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr,
struct ifaddr *ifa; struct ifaddr *ifa;
struct ifnet *ifp = new->ndpr_ifp; struct ifnet *ifp = new->ndpr_ifp;
struct nd_prefix *pr; struct nd_prefix *pr;
int s = splnet();
int error = 0; int error = 0;
int newprefix = 0; int newprefix = 0;
int auth; int auth;
@ -1309,7 +1285,6 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr,
} }
end: end:
splx(s);
return error; return error;
} }
@ -2112,13 +2087,10 @@ rt6_flush(struct in6_addr *gateway, struct ifnet *ifp)
{ {
struct radix_node_head *rnh; struct radix_node_head *rnh;
u_int fibnum; u_int fibnum;
int s = splnet();
/* We'll care only link-local addresses */ /* We'll care only link-local addresses */
if (!IN6_IS_ADDR_LINKLOCAL(gateway)) { if (!IN6_IS_ADDR_LINKLOCAL(gateway))
splx(s);
return; return;
}
/* XXX Do we really need to walk any but the default FIB? */ /* XXX Do we really need to walk any but the default FIB? */
for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
@ -2130,7 +2102,6 @@ rt6_flush(struct in6_addr *gateway, struct ifnet *ifp)
rnh->rnh_walktree(rnh, rt6_deleteroute, (void *)gateway); rnh->rnh_walktree(rnh, rt6_deleteroute, (void *)gateway);
RADIX_NODE_HEAD_UNLOCK(rnh); RADIX_NODE_HEAD_UNLOCK(rnh);
} }
splx(s);
} }
static int static int

View File

@ -644,8 +644,6 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
faddr = &sin6->sin6_addr; faddr = &sin6->sin6_addr;
/* /*
* IPv4 version of udp_output calls in_pcbconnect in this case,
* which needs splnet and affects performance.
* Since we saw no essential reason for calling in_pcbconnect, * Since we saw no essential reason for calling in_pcbconnect,
* we get rid of such kind of logic, and call in6_selectsrc * we get rid of such kind of logic, and call in6_selectsrc
* and in6_pcbsetport in order to fill in the local address * and in6_pcbsetport in order to fill in the local address

View File

@ -6912,16 +6912,12 @@ key_freereg(struct socket *so)
static int static int
key_expire(struct secasvar *sav) key_expire(struct secasvar *sav)
{ {
int s;
int satype; int satype;
struct mbuf *result = NULL, *m; struct mbuf *result = NULL, *m;
int len; int len;
int error = -1; int error = -1;
struct sadb_lifetime *lt; struct sadb_lifetime *lt;
/* XXX: Why do we lock ? */
s = splnet(); /*called from softclock()*/
IPSEC_ASSERT (sav != NULL, ("null sav")); IPSEC_ASSERT (sav != NULL, ("null sav"));
IPSEC_ASSERT (sav->sah != NULL, ("null sa header")); IPSEC_ASSERT (sav->sah != NULL, ("null sa header"));
@ -7023,13 +7019,11 @@ key_expire(struct secasvar *sav)
mtod(result, struct sadb_msg *)->sadb_msg_len = mtod(result, struct sadb_msg *)->sadb_msg_len =
PFKEY_UNIT64(result->m_pkthdr.len); PFKEY_UNIT64(result->m_pkthdr.len);
splx(s);
return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED); return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED);
fail: fail:
if (result) if (result)
m_freem(result); m_freem(result);
splx(s);
return error; return error;
} }