diff options
| author | Roy Marples <roy@marples.name> | 2020-05-29 22:01:10 +0300 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-05-29 22:01:10 +0300 |
| commit | 837af32bf91961453501019ffb725a2fc536fd9e (patch) | |
| tree | fc3ab03c6919c8694611114abd9b31e4d2fb9b72 /src/if.c | |
| parent | 11101f7ba350c8ec1cf0c7e8d333f0a0d366b591 (diff) | |
| download | dhcpcd-837af32bf91961453501019ffb725a2fc536fd9e.tar.xz | |
Solaris: driver names have numbers
So we can't use the BSD/Linux methodology
Diffstat (limited to 'src/if.c')
| -rw-r--r-- | src/if.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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; |
