Diff below removes if_up() calls from pseudo-driver ioctl(2) path.
Setting IFF_UP is enough for ifioctl() to generate a RTM_INFO for us.

I tested lo0 because that's what claudio@ need for an upcoming diff.

I appreciate more tests & oks.

Index: net/if_gif.c
===================================================================
RCS file: /cvs/src/sys/net/if_gif.c,v
retrieving revision 1.108
diff -u -p -r1.108 if_gif.c
--- net/if_gif.c        12 Jan 2018 02:25:27 -0000      1.108
+++ net/if_gif.c        9 Feb 2018 07:51:42 -0000
@@ -372,8 +372,7 @@ gif_ioctl(struct ifnet *ifp, u_long cmd,
                bcopy((caddr_t)dst, (caddr_t)sa, dst->sa_len);
                sc->gif_pdst = sa;
 
-               ifp->if_flags |= IFF_RUNNING;
-               if_up(ifp);             /* send up RTM_IFINFO */
+               ifp->if_flags |= (IFF_UP|IFF_RUNNING);
 
                error = 0;
                break;
Index: net/if_loop.c
===================================================================
RCS file: /cvs/src/sys/net/if_loop.c,v
retrieving revision 1.85
diff -u -p -r1.85 if_loop.c
--- net/if_loop.c       9 Jan 2018 15:24:24 -0000       1.85
+++ net/if_loop.c       9 Feb 2018 07:52:03 -0000
@@ -261,11 +261,7 @@ loioctl(struct ifnet *ifp, u_long cmd, c
                break;
 
        case SIOCSIFADDR:
-               ifp->if_flags |= IFF_RUNNING;
-               if_up(ifp);             /* send up RTM_IFINFO */
-               /*
-                * Everything else is done at a higher level.
-                */
+               ifp->if_flags |= (IFF_UP|IFF_RUNNING);
                break;
 
        case SIOCADDMULTI:
Index: net/if_mpe.c
===================================================================
RCS file: /cvs/src/sys/net/if_mpe.c,v
retrieving revision 1.64
diff -u -p -r1.64 if_mpe.c
--- net/if_mpe.c        9 Jan 2018 15:24:24 -0000       1.64
+++ net/if_mpe.c        9 Feb 2018 07:52:33 -0000
@@ -278,7 +278,7 @@ mpeioctl(struct ifnet *ifp, u_long cmd, 
        switch (cmd) {
        case SIOCSIFADDR:
                if (!ISSET(ifp->if_flags, IFF_UP))
-                       if_up(ifp);
+                       ifp->if_flags |= IFF_UP;
                break;
        case SIOCSIFFLAGS:
                if (ifp->if_flags & IFF_UP)
Index: net/if_spppsubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_spppsubr.c,v
retrieving revision 1.173
diff -u -p -r1.173 if_spppsubr.c
--- net/if_spppsubr.c   20 Oct 2017 09:35:09 -0000      1.173
+++ net/if_spppsubr.c   9 Feb 2018 07:54:00 -0000
@@ -827,8 +827,8 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
                break;
 
        case SIOCSIFADDR:
-               if_up(ifp);
-               /* FALLTHROUGH */
+               if (!ISSET(ifp->if_flags, IFF_UP))
+                       ifp->if_flags |= IFF_UP;
 
        case SIOCSIFFLAGS:
                going_up = (ifp->if_flags & IFF_UP) &&

Reply via email to