]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
if: Decode vlid from the interface name
authorRoy Marples <roy@marples.name>
Sat, 15 Feb 2020 01:50:31 +0000 (01:50 +0000)
committerRoy Marples <roy@marples.name>
Sat, 15 Feb 2020 01:50:31 +0000 (01:50 +0000)
This just clarifies the former fix

src/if.c
src/if.h

index 8ac8b048661d8e4eb83755566e05910e13486be4..b2d390874827cf86ad33480c45fba8de7cd18ab6 100644 (file)
--- a/src/if.c
+++ b/src/if.c
@@ -613,8 +613,14 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
        return ifs;
 }
 
-/* Decode bge0:1 as dev = bge, ppa = 0 and lun = 1
- * Special case XEN where : could be i (NetBSD) or . (Linux) */
+/*
+ * eth0.100:2 OR eth0i100:2 (seems to be NetBSD xvif(4) only)
+ *
+ * drvname == eth
+ * devname == eth0.100 OR eth0i100
+ * ppa = 0
+ * lun = 2
+ */
 int
 if_nametospec(const char *ifname, struct if_spec *spec)
 {
@@ -659,11 +665,12 @@ if_nametospec(const char *ifname, struct if_spec *spec)
         * . is used for VLAN style names
         * i is used on NetBSD for xvif interfaces
         */
-       if (pp != NULL && (*pp == '.' || *pp == 'i') && spec->lun == -1) {
-               spec->lun = (int)strtoi(pp + 1, NULL, 10, 0, INT_MAX, &e);
+       if (pp != NULL && (*pp == '.' || *pp == 'i')) {
+               spec->vlid = (int)strtoi(pp + 1, NULL, 10, 0, INT_MAX, &e);
                if (e)
-                       spec->lun = -1;
-       }
+                       spec->vlid = -1;
+       } else
+               spec->vlid = -1;
 
        return 0;
 }
index cd24726b71d70f8e2f1015dbf5e70c2554ca11e9..1fe9a516fd25fb8f658acb680f08807f6dd3882d 100644 (file)
--- a/src/if.h
+++ b/src/if.h
@@ -150,6 +150,7 @@ struct if_spec {
        char devname[IF_NAMESIZE];
        char drvname[IF_NAMESIZE];
        int ppa;
+       int vlid;
        int lun;
 };
 int if_nametospec(const char *, struct if_spec *);