Source-Changes-HG archive

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

[src/trunk]: src/sys/net Start out with a link name that says "802.1Q VLAN", ...



details:   https://anonhg.NetBSD.org/src/rev/5287ac9909d4
branches:  trunk
changeset: 503027:5287ac9909d4
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jan 29 01:51:05 2001 +0000

description:
Start out with a link name that says "802.1Q VLAN", and inherit the
parent interface's as usual once we attach to the parent.  When we
detach from the parent, reset our link name to the "802.1Q VLAN" name.

diffstat:

 sys/net/if_vlan.c |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 6f06f8c79c96 -r 5287ac9909d4 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Mon Jan 29 01:49:43 2001 +0000
+++ b/sys/net/if_vlan.c Mon Jan 29 01:51:05 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.29 2001/01/28 10:41:44 itojun Exp $      */
+/*     $NetBSD: if_vlan.c,v 1.30 2001/01/29 01:51:05 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -194,6 +194,23 @@
        if_clone_attach(&vlan_cloner);
 }
 
+static void
+vlan_reset_linkname(struct ifnet *ifp)
+{
+
+       /*
+        * We start out with a "802.1Q VLAN" type and zero-length
+        * addresses.  When we attach to a parent interface, we
+        * inherit its type, address length, address, and data link
+        * type.
+        */
+
+       ifp->if_type = IFT_L2VLAN;
+       ifp->if_addrlen = 0;
+       ifp->if_dlt = DLT_NULL;
+       if_alloc_sadl(ifp);
+}
+
 static int
 vlan_clone_create(struct if_clone *ifc, int unit)
 {
@@ -217,7 +234,7 @@
        ifp->if_ioctl = vlan_ioctl;
 
        if_attach(ifp);
-       if_alloc_sadl(ifp);
+       vlan_reset_linkname(ifp);
 
        return (0);
 }
@@ -359,6 +376,7 @@
                }
 
                ether_ifdetach(ifp);
+               vlan_reset_linkname(ifp);
                break;
            }
 
@@ -454,8 +472,6 @@
                break;
 
        case SIOCGIFADDR:
-               if (ifp->if_sadl == NULL)
-                       return (EADDRNOTAVAIL);
                sa = (struct sockaddr *)&ifr->ifr_data;
                memcpy(sa->sa_data, LLADDR(ifp->if_sadl), ifp->if_addrlen);
                break;



Home | Main Index | Thread Index | Old Index