From 0694c0413702a7ff4f6bcd2c862abd89f3e7b24c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 19 Jan 2015 11:41:46 -0600 Subject: apps/netutils/netlib: All IOCTLs must use a valid address family -- even if the address family does not matter such as when getting the MAC address or the network flags --- apps/netutils/netlib/netlib_getmacaddr.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'apps/netutils/netlib/netlib_getmacaddr.c') diff --git a/apps/netutils/netlib/netlib_getmacaddr.c b/apps/netutils/netlib/netlib_getmacaddr.c index 1a404dd39..da1bfbf7f 100644 --- a/apps/netutils/netlib/netlib_getmacaddr.c +++ b/apps/netutils/netlib/netlib_getmacaddr.c @@ -52,6 +52,19 @@ #include +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* The address family that we used to create the socket really does not + * matter. It should, however, be valid in the current configuration. + */ + +#if defined(CONFIG_NET_IPv4) +# define PF_INETX PF_INET +#elif defined(CONFIG_NET_IPv6) +# define PF_INETX PF_INET6 +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -78,7 +91,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr) { /* Get a socket (only so that we get access to the INET subsystem) */ - int sockfd = socket(PF_INET, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct ifreq req; -- cgit v1.2.3