diff options
-rw-r--r-- | apps/netutils/netlib/Makefile | 4 | ||||
-rw-r--r-- | apps/netutils/netlib/netlib_getifstatus.c | 15 | ||||
-rw-r--r-- | apps/netutils/netlib/netlib_getmacaddr.c | 15 | ||||
-rw-r--r-- | apps/netutils/netlib/netlib_setifstatus.c | 17 | ||||
-rw-r--r-- | apps/netutils/netlib/netlib_setmacaddr.c | 21 |
5 files changed, 62 insertions, 10 deletions
diff --git a/apps/netutils/netlib/Makefile b/apps/netutils/netlib/Makefile index aff9c5bcd..a9b234f56 100644 --- a/apps/netutils/netlib/Makefile +++ b/apps/netutils/netlib/Makefile @@ -58,8 +58,10 @@ endif # These require TCP support ifeq ($(CONFIG_NET_TCP),y) +ifeq ($(CONFIG_NET_IPv4),y) # Not yet available for IPv6 CSRCS += netlib_server.c netlib_listenon.c endif +endif # No MAC address support for SLIP (Ethernet only) @@ -70,8 +72,10 @@ endif # IGMP support ifeq ($(CONFIG_NET_IGMP),y) +ifeq ($(CONFIG_NET_IPv4),y) # Not yet available for IPv6 CSRCS += netlib_ipmsfilter.c endif +endif AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) diff --git a/apps/netutils/netlib/netlib_getifstatus.c b/apps/netutils/netlib/netlib_getifstatus.c index 0d718209d..7bf6fa112 100644 --- a/apps/netutils/netlib/netlib_getifstatus.c +++ b/apps/netutils/netlib/netlib_getifstatus.c @@ -54,6 +54,19 @@ #include <apps/netutils/netlib.h> /**************************************************************************** + * 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 ****************************************************************************/ @@ -79,7 +92,7 @@ int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags) { /* 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; 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 @@ -53,6 +53,19 @@ #include <apps/netutils/netlib.h> /**************************************************************************** + * 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; diff --git a/apps/netutils/netlib/netlib_setifstatus.c b/apps/netutils/netlib/netlib_setifstatus.c index f754c17be..1a4ee8cd6 100644 --- a/apps/netutils/netlib/netlib_setifstatus.c +++ b/apps/netutils/netlib/netlib_setifstatus.c @@ -53,6 +53,19 @@ #include <apps/netutils/netlib.h> /**************************************************************************** + * 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 ****************************************************************************/ @@ -77,7 +90,7 @@ int netlib_ifup(const char *ifname) { /* 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; @@ -120,7 +133,7 @@ int netlib_ifdown(const char *ifname) { /* 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; diff --git a/apps/netutils/netlib/netlib_setmacaddr.c b/apps/netutils/netlib/netlib_setmacaddr.c index 733690a18..0c5221789 100644 --- a/apps/netutils/netlib/netlib_setmacaddr.c +++ b/apps/netutils/netlib/netlib_setmacaddr.c @@ -55,11 +55,20 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ - -#ifdef CONFIG_NET_IPv6 -# define AF_INETX AF_INET6 -#else -# define AF_INETX AF_INET +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* The address family that we used to create the socket and in the IOCTL + * data really does not matter. It should, however, be valid in the current + * configuration. + */ + +#if defined(CONFIG_NET_IPv4) +# define PF_INETX PF_INET +# define AF_INETX AF_INET +#elif defined(CONFIG_NET_IPv6) +# define PF_INETX PF_INET6 +# define AF_INETX AF_INET6 #endif /**************************************************************************** @@ -89,7 +98,7 @@ int netlib_setmacaddr(const char *ifname, const 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; |