From: Roy Marples Date: Fri, 29 May 2020 19:01:10 +0000 (+0300) Subject: Solaris: driver names have numbers X-Git-Tag: v9.1.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=837af32bf91961453501019ffb725a2fc536fd9e;p=thirdparty%2Fdhcpcd.git Solaris: driver names have numbers So we can't use the BSD/Linux methodology --- diff --git a/src/if.c b/src/if.c index dd9fdc05..69e9ccb4 100644 --- a/src/if.c +++ b/src/if.c @@ -693,15 +693,27 @@ if_nametospec(const char *ifname, struct if_spec *spec) } strlcpy(spec->devname, spec->drvname, sizeof(spec->devname)); +#ifdef __sun + /* Solaris has numbers in the driver name, such as e1000g */ + while (ep > spec->drvname && isdigit((int)*ep)) + ep--; + if (*ep++ == ':') { + errno = EINVAL; + return -1; + } +#else + /* BSD and Linux no not have numbers in the driver name */ for (ep = spec->drvname; *ep != '\0' && !isdigit((int)*ep); ep++) { if (*ep == ':') { errno = EINVAL; return -1; } } +#endif spec->ppa = (int)strtoi(ep, &pp, 10, 0, INT_MAX, &e); *ep = '\0'; +#ifndef __sun /* * . is used for VLAN style names * i is used on NetBSD for xvif interfaces @@ -711,6 +723,7 @@ if_nametospec(const char *ifname, struct if_spec *spec) if (e) spec->vlid = -1; } else +#endif spec->vlid = -1; return 0;