the vlan ioctls have been superseded by the generic ifparent and
vnetid ioctls, and will eventually go away.

this removes the vlan ioctl handling from ifconfig. however, to
continue to support existing vlan interface configuration files
(/etc/hostname.vlan*), the command line options have been aliased
to the equiv handlers for the generic ioctls.

ok?

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.320
diff -u -p -r1.320 ifconfig.c
--- ifconfig.c  18 Apr 2016 06:20:23 -0000      1.320
+++ ifconfig.c  17 May 2016 00:48:43 -0000
@@ -90,8 +90,6 @@
 
 #include <netdb.h>
 
-#include <net/if_vlan_var.h>
-
 #include <netmpls/mpls.h>
 
 #include <ctype.h>
@@ -210,12 +208,8 @@ void       setmpwencap(const char *, int);
 void   setmpwlabel(const char *, const char *);
 void   setmpwneighbor(const char *, int);
 void   setmpwcontrolword(const char *, int);
-void   setvlantag(const char *, int);
-void   setvlandev(const char *, int);
-void   unsetvlandev(const char *, int);
 void   mpe_status(void);
 void   mpw_status(void);
-void   vlan_status(void);
 void   setinstance(const char *, int);
 int    main(int, char *[]);
 int    prefix(void *val, int);
@@ -351,9 +345,9 @@ const struct        cmd {
        { "scan",       NEXTARG0,       0,              setifscan },
        { "broadcast",  NEXTARG,        0,              setifbroadaddr },
        { "prefixlen",  NEXTARG,        0,              setifprefixlen},
-       { "vlan",       NEXTARG,        0,              setvlantag },
-       { "vlandev",    NEXTARG,        0,              setvlandev },
-       { "-vlandev",   1,              0,              unsetvlandev },
+       { "vlan",       NEXTARG,        0,              setvnetid },
+       { "vlandev",    NEXTARG,        0,              setifparent },
+       { "-vlandev",   1,              0,              delifparent },
        { "group",      NEXTARG,        0,              setifgroup },
        { "-group",     NEXTARG,        0,              unsetifgroup },
        { "autoconf",   1,              0,              setautoconf },
@@ -2947,7 +2941,6 @@ status(int link, struct sockaddr_dl *sdl
            if_indextoname(ifrdesc.ifr_index, ifname) != NULL)
                printf("\tpatch: %s\n", ifname);
 #endif
-       vlan_status();
        getvnetid();
        getifparent();
 #ifndef SMALL
@@ -3652,100 +3645,6 @@ getifparent(void)
                parent = ifp.ifp_parent;
 
        printf("\tparent: %s\n", parent);
-}
-
-static int __tag = 0;
-static int __have_tag = 0;
-
-void
-vlan_status(void)
-{
-       struct vlanreq vreq;
-
-       bzero((char *)&vreq, sizeof(struct vlanreq));
-       ifr.ifr_data = (caddr_t)&vreq;
-
-       if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
-               return;
-
-       if (vreq.vlr_tag || (vreq.vlr_parent[0] != '\0'))
-               printf("\tvlan: %d parent interface: %s\n",
-                   vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
-                   "<none>" : vreq.vlr_parent);
-}
-
-/* ARGSUSED */
-void
-setvlantag(const char *val, int d)
-{
-       u_int16_t tag;
-       struct vlanreq vreq;
-       const char *errmsg = NULL;
-
-       __tag = tag = strtonum(val, 0, 4095, &errmsg);
-       if (errmsg)
-               errx(1, "vlan tag %s: %s", val, errmsg);
-       __have_tag = 1;
-
-       bzero((char *)&vreq, sizeof(struct vlanreq));
-       ifr.ifr_data = (caddr_t)&vreq;
-
-       if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
-               err(1, "SIOCGETVLAN");
-
-       vreq.vlr_tag = tag;
-
-       if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
-               err(1, "SIOCSETVLAN");
-}
-
-/* ARGSUSED */
-void
-setvlandev(const char *val, int d)
-{
-       struct vlanreq   vreq;
-       int              tag;
-       size_t           skip;
-       const char      *estr;
-
-       bzero((char *)&vreq, sizeof(struct vlanreq));
-       ifr.ifr_data = (caddr_t)&vreq;
-
-       if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
-               err(1, "SIOCGETVLAN");
-
-       (void) strlcpy(vreq.vlr_parent, val, sizeof(vreq.vlr_parent));
-
-       if (!__have_tag && vreq.vlr_tag == 0) {
-               skip = strcspn(ifr.ifr_name, "0123456789");
-               tag = strtonum(ifr.ifr_name + skip, 0, 4095, &estr);
-               if (estr != NULL)
-                       errx(1, "invalid vlan tag and device specification");
-               vreq.vlr_tag = tag;
-       } else if (__have_tag)
-               vreq.vlr_tag = __tag;
-
-       if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
-               err(1, "SIOCSETVLAN");
-}
-
-/* ARGSUSED */
-void
-unsetvlandev(const char *val, int d)
-{
-       struct vlanreq vreq;
-
-       bzero((char *)&vreq, sizeof(struct vlanreq));
-       ifr.ifr_data = (caddr_t)&vreq;
-
-       if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
-               err(1, "SIOCGETVLAN");
-
-       bzero((char *)&vreq.vlr_parent, sizeof(vreq.vlr_parent));
-       vreq.vlr_tag = 0;
-
-       if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
-               err(1, "SIOCSETVLAN");
 }
 
 void

Reply via email to