summaryrefslogtreecommitdiffstats
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:50:31 +0000
commit029c5cbbfcb082fb6f0755fa2fae9a0afdada48c (patch)
tree70307cbb8b766b7f18c63a423f65a980b6840fed
parent4679d8447e05929f05451c8a516fbb6ddb273a0f (diff)
downloaddhcpcd-029c5cbbfcb082fb6f0755fa2fae9a0afdada48c.tar.xz
if: Decode vlid from the interface name
This just clarifies the former fix
-rw-r--r--src/if.c19
-rw-r--r--src/if.h1
2 files changed, 14 insertions, 6 deletions
diff --git a/src/if.c b/src/if.c
index 8ac8b048..b2d39087 100644
--- 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;
}
diff --git a/src/if.h b/src/if.h
index cd24726b..1fe9a516 100644
--- 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 *);