diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-10-21 21:34:08 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-10-22 17:19:27 -0700 |
| commit | c0551cbbaf8984a55ee688416ec2801c9429bc2c (patch) | |
| tree | e0f125b28ce440fd7f3446d65f6b1a5c61b21b1c /zebra/rib.h | |
| parent | ff40e335bbbed5e4fb36536d0c7cecf3edbb330e (diff) | |
zebra: Collapse struct static_ipv[4|6] into struct static_route
The 'struct static_ipv4' and 'struct static_ipv6' structures
are essentially the same. Collapse them into one data structure
'struct static_route'.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/rib.h')
| -rw-r--r-- | zebra/rib.h | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/zebra/rib.h b/zebra/rib.h index fa37f7d8c3..ec29acf2b2 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -165,11 +165,11 @@ typedef struct rib_dest_t_ RIB_DEST_FOREACH_ROUTE_SAFE (rib_dest_from_rnode (rn), rib, next) /* Static route information. */ -struct static_ipv4 +struct static_route { /* For linked list. */ - struct static_ipv4 *prev; - struct static_ipv4 *next; + struct static_route *prev; + struct static_route *next; /* Administrative distance. */ u_char distance; @@ -179,47 +179,22 @@ struct static_ipv4 /* Flag for this static route's type. */ u_char type; -#define STATIC_IPV4_GATEWAY 1 -#define STATIC_IPV4_IFNAME 2 -#define STATIC_IPV4_BLACKHOLE 3 +#define STATIC_IPV4_GATEWAY 1 +#define STATIC_IPV4_IFNAME 2 +#define STATIC_IPV4_BLACKHOLE 3 +#define STATIC_IPV6_GATEWAY 4 +#define STATIC_IPV6_GATEWAY_IFNAME 5 +#define STATIC_IPV6_IFNAME 6 - /* Nexthop value. */ - union - { - struct in_addr ipv4; - char *ifname; - } gate; - - /* bit flags */ - u_char flags; -/* - see ZEBRA_FLAG_REJECT - ZEBRA_FLAG_BLACKHOLE - */ -}; - -#ifdef HAVE_IPV6 -/* Static route information. */ -struct static_ipv6 -{ - /* For linked list. */ - struct static_ipv6 *prev; - struct static_ipv6 *next; - - /* Administrative distance. */ - u_char distance; - - /* Tag */ - u_short tag; - - /* Flag for this static route's type. */ - u_char type; -#define STATIC_IPV6_GATEWAY 1 -#define STATIC_IPV6_GATEWAY_IFNAME 2 -#define STATIC_IPV6_IFNAME 3 - - /* Nexthop value. */ - struct in6_addr ipv6; + /* + * Nexthop value. + * + * Under IPv4 addr and ifname are + * used independentyly. + * STATIC_IPV4_GATEWAY uses addr + * STATIC_IPV4_IFNAME uses ifname + */ + union g_addr addr; char *ifname; /* bit flags */ @@ -229,7 +204,6 @@ struct static_ipv6 ZEBRA_FLAG_BLACKHOLE */ }; -#endif /* HAVE_IPV6 */ /* The following for loop allows to iterate over the nexthop * structure of routes. |
