From 0f1a34e91568e1f7db2bad922d5a494fee5eddfb Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Tue, 23 Feb 2016 07:09:17 -0500 Subject: [master] Fixed interface device naming for DLPI under Solaris 11 Merges in rt37954. --- common/dlpi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/dlpi.c b/common/dlpi.c index c34adc39..ff4094ba 100644 --- a/common/dlpi.c +++ b/common/dlpi.c @@ -3,7 +3,7 @@ Data Link Provider Interface (DLPI) network interface code. */ /* - * Copyright (c) 2009-2011,2014 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009-2011,2014,2016 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * @@ -130,7 +130,13 @@ static int strioctl (int fd, int cmd, int timeout, int len, char *dp); #define DLPI_MAXDLBUF 8192 /* Buffer size */ #define DLPI_MAXDLADDR 1024 /* Max address size */ -#define DLPI_DEVDIR "/dev/" /* Device directory */ + +/* Device directory */ +#if defined(USE_DEV_NET) +#define DLPI_DEVDIR "/dev/net/" /* Solaris 11 + */ +#else +#define DLPI_DEVDIR "/dev/" /* Pre Solaris 11 */ +#endif static int dlpiopen(const char *ifname); static int dlpiunit (char *ifname); @@ -794,9 +800,13 @@ dlpiopen(const char *ifname) { ep = cp = ifname; while (*ep) ep++; + +/* Before Solaris 11 we strip off the digit to open the base dev name */ +#if !defined(USE_DEV_NET) /* And back up to the first digit (unit number) */ while ((*(ep - 1) >= '0' && *(ep - 1) <= '9') || *(ep - 1) == ':') ep--; +#endif /* Copy everything up to the unit number */ while (cp < ep) { -- cgit v1.2.1