net: shell: Do not print IPv4 information in some cases

If the network interface does not support IPv4 like IEEE 802.15.4
or Bluetooth, then do not print IPv4 information for those interfaces.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-09-29 10:56:31 +03:00
parent 52563e3b09
commit 604cdb6b6d

View file

@ -260,6 +260,21 @@ static void iface_cb(struct net_if *iface, void *user_data)
#endif /* CONFIG_NET_IPV6 */
#if defined(CONFIG_NET_IPV4)
/* No need to print IPv4 information for interface that does not
* support that protocol.
*/
if (
#if defined(CONFIG_NET_L2_IEEE802154)
(iface->l2 == &NET_L2_GET_NAME(IEEE802154)) ||
#endif
#if defined(CONFIG_NET_L2_BT)
(iface->l2 == &NET_L2_GET_NAME(BLUETOOTH)) ||
#endif
0) {
printk("IPv4 not supported for this interface.\n");
return;
}
count = 0;
printk("IPv4 unicast addresses (max %d):\n", NET_IF_MAX_IPV4_ADDR);