changeset 5277:e60767dab375 draft

Solaris: driver names have numbers So we can't use the BSD/Linux methodology
author Roy Marples <roy@marples.name>
date Fri, 29 May 2020 22:01:10 +0300
parents 3bc21bfa52f8
children ffa72e19fcb8
files src/if.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/if.c	Fri May 29 21:13:11 2020 +0300
+++ b/src/if.c	Fri May 29 22:01:10 2020 +0300
@@ -693,15 +693,27 @@
 	}
 
 	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 (e)
 			spec->vlid = -1;
 	} else
+#endif
 		spec->vlid = -1;
 
 	return 0;