On Mon, Nov 28, 2016 at 03:08:20PM +0100, Martin Pieuchot wrote:
> umb(4) also calls in_ioctl() directly but always under splnet(), so for
> the moment this is good enough.
> 
> ok?

OK bluhm@

> 
> Index: netinet/igmp.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/igmp.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 igmp.c
> --- netinet/igmp.c    28 Nov 2016 11:12:45 -0000      1.55
> +++ netinet/igmp.c    28 Nov 2016 14:03:30 -0000
> @@ -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);
>  }
>  
> Index: netinet/in.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/in.c,v
> retrieving revision 1.129
> diff -u -p -r1.129 in.c
> --- netinet/in.c      4 Sep 2016 10:32:01 -0000       1.129
> +++ netinet/in.c      28 Nov 2016 14:03:33 -0000
> @@ -212,6 +212,8 @@ in_ioctl(u_long cmd, caddr_t data, struc
>       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, struc
>               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, struc
>  
>               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, struc
>               }
>               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, struc
>                * 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 i
>  {
>       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 i
>                       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);
>  

Reply via email to