summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-02-15 01:29:13 +0000
committerRoy Marples <roy@marples.name>2020-02-15 01:32:24 +0000
commit4679d8447e05929f05451c8a516fbb6ddb273a0f (patch)
treed04e875338fcb36509a4541e09a18629751e0b3c
parent690a9c3080708e958ec52341a26f33aa961dbf13 (diff)
downloaddhcpcd-4679d8447e05929f05451c8a516fbb6ddb273a0f.tar.xz
if: . is part of the interface name, not an alias
-rw-r--r--src/if.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/if.c b/src/if.c
index c58c9380..8ac8b048 100644
--- a/src/if.c
+++ b/src/if.c
@@ -630,9 +630,9 @@ if_nametospec(const char *ifname, struct if_spec *spec)
errno = EINVAL;
return -1;
}
+
+ /* :N is an alias */
ep = strchr(spec->drvname, ':');
- if (ep == NULL)
- ep = strchr(spec->drvname, '.');
if (ep) {
spec->lun = (int)strtoi(ep + 1, NULL, 10, 0, INT_MAX, &e);
if (e != 0) {
@@ -644,6 +644,7 @@ if_nametospec(const char *ifname, struct if_spec *spec)
spec->lun = -1;
ep = spec->drvname + strlen(spec->drvname) - 1;
}
+
strlcpy(spec->devname, spec->drvname, sizeof(spec->devname));
for (ep = spec->drvname; *ep != '\0' && !isdigit((int)*ep); ep++) {
if (*ep == ':') {
@@ -653,7 +654,12 @@ if_nametospec(const char *ifname, struct if_spec *spec)
}
spec->ppa = (int)strtoi(ep, &pp, 10, 0, INT_MAX, &e);
*ep = '\0';
- if (pp != NULL && *pp == 'i' && spec->lun == -1) {
+
+ /*
+ * . 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 (e)
spec->lun = -1;