diff options
author | Mark O'Brien <mobrien@firebolt.vyatta.com> | 2008-07-09 13:44:13 -0700 |
---|---|---|
committer | Mark O'Brien <mobrien@firebolt.vyatta.com> | 2008-07-09 13:44:13 -0700 |
commit | f63a0b4acc3de4823ba8ac244beb0df74f8213b4 (patch) | |
tree | d7d1aea8b4e405791262f64e83c9106bc4aff609 /zebra/zebra_rib.c | |
parent | ab5c50927981ae4be0e6bc59f7d0b8ea7f662886 (diff) | |
parent | 7ddd7a8c51f05287919e9c4e39756f9a52dac99c (diff) | |
download | quagga-f63a0b4acc3de4823ba8ac244beb0df74f8213b4.tar.bz2 quagga-f63a0b4acc3de4823ba8ac244beb0df74f8213b4.tar.xz |
Merge branch 'hollywood' of git:/git/vyatta-quagga into hollywood
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r-- | zebra/zebra_rib.c | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 59b53fa1..5acb644d 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -51,7 +51,7 @@ extern struct zebra_t zebrad; int rib_process_hold_time = 10; /* Each route type's string and default distance value. */ -struct +static const struct { int key; int distance; @@ -70,7 +70,7 @@ struct }; /* Vector for routing table. */ -vector vrf_vector; +static vector vrf_vector; /* Allocate new VRF. */ static struct vrf * @@ -401,17 +401,24 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set, { /* Directly point connected route. */ newhop = match->nexthop; - if (newhop && nexthop->type == NEXTHOP_TYPE_IPV4) - nexthop->ifindex = newhop->ifindex; - else if (newhop && newhop->type == NEXTHOP_TYPE_IFINDEX) + if (newhop) { - ifp = if_lookup_by_index (newhop->ifindex); - return (ifp && if_is_operative (ifp)); - } - else if (newhop && newhop->type == NEXTHOP_TYPE_IFNAME) - { - ifp = if_lookup_by_name(newhop->ifname); - return (ifp && if_is_operative (ifp)); + if (nexthop->type == NEXTHOP_TYPE_IPV4) + nexthop->ifindex = newhop->ifindex; + + if (newhop->type == NEXTHOP_TYPE_IFINDEX || + newhop->type == NEXTHOP_TYPE_IPV4_IFINDEX) + { + ifp = if_lookup_by_index (newhop->ifindex); + return (ifp && if_is_operative (ifp)); + } + + if (newhop->type == NEXTHOP_TYPE_IFNAME || + newhop->type == NEXTHOP_TYPE_IPV4_IFNAME) + { + ifp = if_lookup_by_name(newhop->ifname); + return (ifp && if_is_operative (ifp)); + } } return 1; } @@ -521,19 +528,25 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set, /* Directly point connected route. */ newhop = match->nexthop; - if (newhop && nexthop->type == NEXTHOP_TYPE_IPV6) - nexthop->ifindex = newhop->ifindex; - else if (newhop && newhop->type == NEXTHOP_TYPE_IFINDEX) + if (newhop) { - ifp = if_lookup_by_index (newhop->ifindex); - return (ifp && if_is_operative (ifp)); + if (nexthop->type == NEXTHOP_TYPE_IPV4) + nexthop->ifindex = newhop->ifindex; + + if (newhop->type == NEXTHOP_TYPE_IFINDEX || + newhop->type == NEXTHOP_TYPE_IPV4_IFINDEX) + { + ifp = if_lookup_by_index (newhop->ifindex); + return (ifp && if_is_operative (ifp)); + } + + if (newhop->type == NEXTHOP_TYPE_IFNAME || + newhop->type == NEXTHOP_TYPE_IPV4_IFNAME) + { + ifp = if_lookup_by_name(newhop->ifname); + return (ifp && if_is_operative (ifp)); + } } - else if (newhop && newhop->type == NEXTHOP_TYPE_IFNAME) - { - ifp = if_lookup_by_name(newhop->ifname); - return (ifp && if_is_operative (ifp)); - } - return 1; } else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) |