ifconfig must not accept reserved IDs, it'll fail:

        /sys/net/if_vlan.c:
        646         case SIOCSVNETID:
        647                 if (ifr->ifr_vnetid < EVL_VLID_MIN ||
        648                     ifr->ifr_vnetid > EVL_VLID_MAX) {
        649                         error = EINVAL;
        650                         break;
        651                 }

Prompted by denis' pcap diff.

OK?

Index: ifconfig.8
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.319
diff -u -p -r1.319 ifconfig.8
--- ifconfig.8  8 Sep 2018 15:21:03 -0000       1.319
+++ ifconfig.8  10 Nov 2018 13:04:08 -0000
@@ -1843,7 +1843,7 @@ headers in packets handled by
 or
 .Xr svlan 4
 interfaces respectively.
-Valid tag values are from 1 to 4095 inclusive.
+Valid tag values are from 1 to 4094 inclusive.
 .It Cm -vnetid
 Clear the tag value.
 Packets on a VLAN interface without a tag set will use a value of
Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.380
diff -u -p -r1.380 ifconfig.c
--- ifconfig.c  15 Oct 2018 11:25:55 -0000      1.380
+++ ifconfig.c  10 Nov 2018 13:02:58 -0000
@@ -4033,7 +4033,7 @@ setvlantag(const char *val, int d)
        struct vlanreq vreq;
        const char *errmsg = NULL;
 
-       __tag = tag = strtonum(val, 0, 4095, &errmsg);
+       __tag = tag = strtonum(val, EVL_VLID_MIN, EVL_VLID_MAX, &errmsg);
        if (errmsg)
                errx(1, "vlan tag %s: %s", val, errmsg);
        __have_tag = 1;

Reply via email to