diff options
author | Avneesh Sachdev <avneesh@opensourcerouting.org> | 2012-11-13 22:48:56 +0000 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2012-11-30 21:41:17 +0100 |
commit | 78deec450cfa5ddcad290c13b36dd1d187da213e (patch) | |
tree | bf6e811b78c726db3fe00b168b35a67e9aa586c1 /zebra/zebra_rib.c | |
parent | 0915bb0ce2ca6b5fee2cd214be4499eeeaf1c9af (diff) | |
download | quagga-78deec450cfa5ddcad290c13b36dd1d187da213e.tar.bz2 quagga-78deec450cfa5ddcad290c13b36dd1d187da213e.tar.xz |
zebra: extern/extract some functions from rt_netlink.c
* zebra/{rib.h,zebra_rib.c}
Add nexthop_type_to_str(), which returns a human-readable string
corresponding to a nexthop type.
* zebra/rt_netlink.[hc]
- Add new header file that exposes some existing and new
netlink-related functions from rt_netlink.c to the rest of
zebra.
addattr32
addattr_l
rta_addattr_l
nl_msg_type_to_str (new)
nl_rtproto_to_str (new)
- Use nexthop_type_to_str() instead of the static array
'nexthop_types_desc'.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r-- | zebra/zebra_rib.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5c75b909..29977123 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -170,6 +170,31 @@ vrf_static_table (afi_t afi, safi_t safi, u_int32_t id) return vrf->stable[afi][safi]; } +/* + * nexthop_type_to_str + */ +const char * +nexthop_type_to_str (enum nexthop_types_t nh_type) +{ + static const char *desc[] = { + "none", + "Directly connected", + "Interface route", + "IPv4 nexthop", + "IPv4 nexthop with ifindex", + "IPv4 nexthop with ifname", + "IPv6 nexthop", + "IPv6 nexthop with ifindex", + "IPv6 nexthop with ifname", + "Null0 nexthop", + }; + + if (nh_type >= ZEBRA_NUM_OF (desc)) + return "<Invalid nh type>"; + + return desc[nh_type]; +} + /* Add nexthop to the end of the list. */ static void nexthop_add (struct rib *rib, struct nexthop *nexthop) |