From ae2a1d07b31c5c711e594982b61a27ed33c67486 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 19 Sep 2017 15:00:46 -0600 Subject: [PATCH] Networking: drivers/net/loopback.c: Eliminate a warning. net/netdev/netdev_ifconfig.c: Was not returning all of the address info. --- drivers/net/loopback.c | 6 ++---- net/netdev/netdev_ifconf.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index fcebc69966..8b48a45056 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -133,12 +133,10 @@ static int lo_ifup(FAR struct net_driver_s *dev); static int lo_ifdown(FAR struct net_driver_s *dev); static void lo_txavail_work(FAR void *arg); static int lo_txavail(FAR struct net_driver_s *dev); -#if defined(CONFIG_NET_IGMP) || defined(CONFIG_NET_ICMPv6) -static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #ifdef CONFIG_NET_IGMP +static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); static int lo_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#endif /**************************************************************************** * Private Functions @@ -455,7 +453,7 @@ static int lo_txavail(FAR struct net_driver_s *dev) * ****************************************************************************/ -#if defined(CONFIG_NET_IGMP) || defined(CONFIG_NET_ICMPv6) +#ifdef CONFIG_NET_IGMP static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac) { /* There is no multicast support in the loopback driver */ diff --git a/net/netdev/netdev_ifconf.c b/net/netdev/netdev_ifconf.c index 44efdea4a1..6b2a821914 100644 --- a/net/netdev/netdev_ifconf.c +++ b/net/netdev/netdev_ifconf.c @@ -134,8 +134,11 @@ static int ifconf_ipv4_callback(FAR struct net_driver_s *dev, FAR void *arg) * transferred is returned in ifc_len. */ - strncpy(req->ifr_name, dev->d_ifname, IFNAMSIZ); - net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr); + strncpy(req->ifr_name, dev->d_ifname, IFNAMSIZ); + + inaddr->sin_family = AF_INET; + inaddr->sin_port = 0; + net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr); } /* Increment the size of the buffer in any event */ @@ -206,6 +209,9 @@ static int ifconf_ipv6_callback(FAR struct net_driver_s *dev, FAR void *arg) */ strncpy(req->lifr_name, dev->d_ifname, IFNAMSIZ); + + inaddr->sin6_family = AF_INET6; + inaddr->sin6_port = 0; net_ipv6addr_copy(inaddr->sin6_addr.s6_addr16, dev->d_ipv6addr); }