summaryrefslogtreecommitdiffstats
path: root/src/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-02-15 01:50:31 +0000
committerRoy Marples <roy@marples.name>2020-02-15 01:51:57 +0000
commitfac4a27e2f0c46b16db4fbf0e15f4c867cc533f4 (patch)
tree68e364185053fb3373cf1c0e405b27bafdeb6581 /src/if.c
parentf39a6f9e63d124a664a27fa56e9e2bf45667c3a6 (diff)
downloaddhcpcd-fac4a27e2f0c46b16db4fbf0e15f4c867cc533f4.tar.xz
if: Decode vlid from the interface name
This just clarifies the former fix
Diffstat (limited to 'src/if.c')
-rw-r--r--src/if.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/if.c b/src/if.c
index 8f2011ac..51e05571 100644
--- a/src/if.c
+++ b/src/if.c
@@ -683,8 +683,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)
{
@@ -729,11 +735,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;
}