From 1859f56380e817ca682c30c0817c346938bff0fe Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 19 Nov 2019 09:49:36 -0600 Subject: [PATCH] apps/netutils/netinit, apps/netutils/netlib/, and apps/include/netutils/netlib.h: Extend a few definitions to permit building netutils and netinit with only Netlink sockets enabled. --- include/netutils/netlib.h | 4 ++++ netutils/netinit/netinit.c | 9 +++------ netutils/netlib/netlib_getifstatus.c | 2 ++ netutils/netlib/netlib_setifstatus.c | 6 ++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/netutils/netlib.h b/include/netutils/netlib.h index e4010b6e6..360107fb4 100644 --- a/include/netutils/netlib.h +++ b/include/netutils/netlib.h @@ -104,6 +104,8 @@ # define NETLIB_SOCK_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define NETLIB_SOCK_FAMILY AF_INET +#elif defined(CONFIG_NET_NETLINK) +# define NETLIB_SOCK_FAMILY AF_NETLINK #else # define NETLIB_SOCK_FAMILY AF_UNSPEC #endif @@ -152,6 +154,8 @@ # define NETLIB_SOCK_TYPE SOCK_DGRAM #elif NETLIB_SOCK_FAMILY == AF_BLUETOOTH # define NETLIB_SOCK_TYPE SOCK_RAW +#elif NETLIB_SOCK_FAMILY == AF_NETLINK +# define NETLIB_SOCK_TYPE SOCK_DGRAM #endif /**************************************************************************** diff --git a/netutils/netinit/netinit.c b/netutils/netinit/netinit.c index 414701490..0b8284a1b 100644 --- a/netutils/netinit/netinit.c +++ b/netutils/netinit/netinit.c @@ -164,6 +164,7 @@ * not be the one that you want). */ +#undef NETINIT_HAVE_NETDEV #if defined(CONFIG_DRIVERS_IEEE80211) /* Usually also has CONFIG_NET_ETHERNET */ # define NET_DEVNAME "wlan0" # define NETINIT_HAVE_NETDEV @@ -188,14 +189,10 @@ #elif defined(CONFIG_NET_LOCAL) # define NET_DEVNAME "lo" # define NETINIT_HAVE_NETDEV -#elif defined(CONFIG_NET_USRSOCK) -# undef NETINIT_HAVE_NETDEV -#elif !defined(CONFIG_NET_LOOPBACK) -# error ERROR: No link layer protocol defined #endif -/* If we have no network device (only only the local loopback device), then we - * cannot support the network monitor. +/* If we have no network device (perhaps only USRSOCK, local loopback, or + * Netlink sockets), then we cannot support the network monitor. */ #ifndef NETINIT_HAVE_NETDEV diff --git a/netutils/netlib/netlib_getifstatus.c b/netutils/netlib/netlib_getifstatus.c index 7dcfa3e71..94a503f44 100644 --- a/netutils/netlib/netlib_getifstatus.c +++ b/netutils/netlib/netlib_getifstatus.c @@ -76,6 +76,8 @@ # define AF_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define AF_FAMILY AF_INET +#elif defined(CONFIG_NET_NETLINK) +# define AF_FAMILY AF_NETLINK #endif /**************************************************************************** diff --git a/netutils/netlib/netlib_setifstatus.c b/netutils/netlib/netlib_setifstatus.c index 437adbe2c..11bebfa84 100644 --- a/netutils/netlib/netlib_setifstatus.c +++ b/netutils/netlib/netlib_setifstatus.c @@ -70,11 +70,13 @@ #elif defined(CONFIG_NET_PKT) # define AF_FAMILY AF_PACKET #elif defined(CONFIG_NET_IEEE802154) -# define AF_FAMILY AF_IEEE802154 +# define AF_FAMILY AF_IEEE802154 #elif defined(CONFIG_NET_BLUETOOTH) -# define AF_FAMILY AF_BLUETOOTH +# define AF_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define AF_FAMILY AF_INET +#elif defined(CONFIG_NET_NETLINK) +# define AF_FAMILY AF_NETLINK #endif /****************************************************************************