examples/netlink_route/netlink_route_main.c: Use options to disable individual NETLINK_ROUTE commands.
This commit is contained in:
parent
449290c8da
commit
5c7c34f559
@ -75,6 +75,7 @@
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_NETLINK_DISABLE_GETLINK
|
||||||
static void dump_devices(sa_family_t family)
|
static void dump_devices(sa_family_t family)
|
||||||
{
|
{
|
||||||
struct netlib_device_s devlist[MAX_DEVICES];
|
struct netlib_device_s devlist[MAX_DEVICES];
|
||||||
@ -109,8 +110,11 @@ static void dump_devices(sa_family_t family)
|
|||||||
printf("Name: \"%s\"\n", dev->ifname);
|
printf("Name: \"%s\"\n", dev->ifname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
# define dump_devices(f)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#if defined(CONFIG_NET_IPv6) && !defined(CONFIG_NETLINK_DISABLE_GETNEIGH)
|
||||||
static void dump_neighbor(void)
|
static void dump_neighbor(void)
|
||||||
{
|
{
|
||||||
FAR struct neighbor_entry_s *nbtab;
|
FAR struct neighbor_entry_s *nbtab;
|
||||||
@ -186,9 +190,11 @@ static void dump_neighbor(void)
|
|||||||
|
|
||||||
free(nbtab);
|
free(nbtab);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
# define dump_neighbor()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ARP
|
#if defined(CONFIG_NET_ARP) && !defined(CONFIG_NETLINK_DISABLE_GETNEIGH)
|
||||||
static void dump_arp(void)
|
static void dump_arp(void)
|
||||||
{
|
{
|
||||||
FAR struct arp_entry_s *arptab;
|
FAR struct arp_entry_s *arptab;
|
||||||
@ -252,9 +258,11 @@ static void dump_arp(void)
|
|||||||
|
|
||||||
free(arptab);
|
free(arptab);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
# define dump_arp()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_NET_ROUTE
|
#if defined(CONFIG_NET_ROUTE) && !defined(CONFIG_NETLINK_DISABLE_GETROUTE)
|
||||||
static void dump_route(sa_family_t family)
|
static void dump_route(sa_family_t family)
|
||||||
{
|
{
|
||||||
FAR struct rtentry *rttab;
|
FAR struct rtentry *rttab;
|
||||||
@ -309,6 +317,8 @@ static void dump_route(sa_family_t family)
|
|||||||
|
|
||||||
free(rttab);
|
free(rttab);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
# define dump_route(f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -322,23 +332,10 @@ static void dump_route(sa_family_t family)
|
|||||||
int main(int argc, FAR char *argv[])
|
int main(int argc, FAR char *argv[])
|
||||||
{
|
{
|
||||||
dump_devices(AF_PACKET);
|
dump_devices(AF_PACKET);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
|
||||||
dump_neighbor();
|
dump_neighbor();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ARP
|
|
||||||
dump_arp();
|
dump_arp();
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CONFIG_NET_ROUTE
|
|
||||||
#ifdef CONFIG_NET_IPv4
|
|
||||||
dump_route(AF_INET);
|
dump_route(AF_INET);
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
|
||||||
dump_route(AF_INET6);
|
dump_route(AF_INET6);
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user