summaryrefslogtreecommitdiff
path: root/apps/netutils/netlib/netlib_setifstatus.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/netutils/netlib/netlib_setifstatus.c')
-rw-r--r--apps/netutils/netlib/netlib_setifstatus.c17
1 files changed, 15 insertions, 2 deletions
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;