diff options
| author | Roy Marples <roy@marples.name> | 2020-02-15 01:29:13 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-02-15 01:29:13 +0000 |
| commit | cfe9aebe35ca86ca02d91e576ba8d5befca89074 (patch) | |
| tree | fe591560916aa04e773d1b6e7e3e05b2bc8496b3 /src/if.c | |
| parent | 0ec5b7b8f9d3840a5c3d991386a53203ce8b8c3d (diff) | |
| download | dhcpcd-cfe9aebe35ca86ca02d91e576ba8d5befca89074.tar.xz | |
if: . is part of the interface name, not an alias
Diffstat (limited to 'src/if.c')
| -rw-r--r-- | src/if.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -700,9 +700,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) { @@ -714,6 +714,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 == ':') { @@ -723,7 +724,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; |
