From: Roy Marples Date: Sat, 15 Feb 2020 01:50:31 +0000 (+0000) Subject: if: Decode vlid from the interface name X-Git-Tag: v8.1.7~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=029c5cbbfcb082fb6f0755fa2fae9a0afdada48c;p=thirdparty%2Fdhcpcd.git if: Decode vlid from the interface name This just clarifies the former fix --- 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 *);