Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net if: announce flag changes other than up or down



details:   https://anonhg.NetBSD.org/src/rev/a3a393f883b8
branches:  trunk
changeset: 453626:a3a393f883b8
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Aug 20 10:59:00 2019 +0000

description:
if: announce flag changes other than up or down

For example toggling promiscuous mode or disabling ARP.

XXX Pullup -9

diffstat:

 sys/net/if.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 752f452b88f1 -r a3a393f883b8 sys/net/if.c
--- a/sys/net/if.c      Tue Aug 20 09:55:49 2019 +0000
+++ b/sys/net/if.c      Tue Aug 20 10:59:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.458 2019/08/15 04:20:59 ozaki-r Exp $ */
+/*     $NetBSD: if.c,v 1.459 2019/08/20 10:59:00 roy Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.458 2019/08/15 04:20:59 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.459 2019/08/20 10:59:00 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2914,6 +2914,7 @@
        struct ifreq *ifr;
        struct ifcapreq *ifcr;
        struct ifdatareq *ifdr;
+       unsigned short flags;
 
        switch (cmd) {
        case SIOCSIFCAP:
@@ -2985,8 +2986,13 @@
                        splx(s);
                }
                KERNEL_UNLOCK_IF_IFP_MPSAFE(ifp);
-               ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
-                       (ifr->ifr_flags &~ IFF_CANTCHANGE);
+               flags = (ifp->if_flags & IFF_CANTCHANGE) |
+                   (ifr->ifr_flags &~ IFF_CANTCHANGE);
+               if (ifp->if_flags != flags) {
+                       ifp->if_flags = flags;
+                       /* Notify that the flags have changed. */
+                       rt_ifmsg(ifp);
+               }
                break;
        case SIOCGIFFLAGS:
                ifr = data;



Home | Main Index | Thread Index | Old Index