Source-Changes-HG archive

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

[src/trunk]: src/sys/net Leave promiscuous mode when detaching a parent (ifco...



details:   https://anonhg.NetBSD.org/src/rev/0d22fb08d2bd
branches:  trunk
changeset: 332309:0d22fb08d2bd
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Sep 15 05:54:02 2014 +0000

description:
Leave promiscuous mode when detaching a parent (ifconfig -vlanif)

We have to call ifpromisc(ifp, 0) for both a VLAN interface
and its parent when they are in promiscuous mode.

PR 49196

diffstat:

 sys/net/if_vlan.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 4c9ad8be7728 -r 0d22fb08d2bd sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Mon Sep 15 00:35:37 2014 +0000
+++ b/sys/net/if_vlan.c Mon Sep 15 05:54:02 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.72 2014/09/12 04:10:24 ozaki-r Exp $     */
+/*     $NetBSD: if_vlan.c,v 1.73 2014/09/15 05:54:02 ozaki-r Exp $     */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.72 2014/09/12 04:10:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.73 2014/09/15 05:54:02 ozaki-r Exp $");
 
 #include "opt_inet.h"
 
@@ -400,6 +400,8 @@
        ifv->ifv_if.if_mtu = 0;
        ifv->ifv_flags = 0;
 
+       if ((ifp->if_flags & IFF_PROMISC) != 0)
+               ifpromisc(ifp, 0);
        if_down(ifp);
        ifp->if_flags &= ~(IFF_UP|IFF_RUNNING);
        ifp->if_capabilities = 0;
@@ -484,6 +486,9 @@
                if ((error = copyin(ifr->ifr_data, &vlr, sizeof(vlr))) != 0)
                        break;
                if (vlr.vlr_parent[0] == '\0') {
+                       if (ifv->ifv_p != NULL &&
+                           (ifp->if_flags & IFF_PROMISC) != 0)
+                               error = ifpromisc(ifv->ifv_p, 0);
                        vlan_unconfig(ifp);
                        break;
                }



Home | Main Index | Thread Index | Old Index