From ceb9411e2a867544a745cd3eddc68f2232ed143d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 5 Jul 2008 18:56:33 -0700 Subject: Make some rib data structures private The route_info table can be static const, and the vrf_table can be static. --- zebra/zebra_rib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'zebra/zebra_rib.c') diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 59b53fa1..8580517a 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 * -- cgit v1.2.3 From 1dda22224848890695689def6af6ce8fa6d66397 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 5 Jul 2008 19:32:29 -0700 Subject: Correctly identify/manage all connected static routes Need to handle all the different flavors of connected routes in linkstate management Bugfix: 2904, 3416 --- zebra/zebra_rib.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'zebra/zebra_rib.c') diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 8580517a..3d3a2c8f 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -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; } -- cgit v1.2.3 From 28de8497e34585088d74d739d8f6d9ca27eb311d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 7 Jul 2008 14:06:57 -0700 Subject: active static route changes for ipv6 This is the IPV6 analog to earlier changes to IPV4 static route management. --- zebra/zebra_rib.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'zebra/zebra_rib.c') diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 3d3a2c8f..5acb644d 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -528,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) - { - ifp = if_lookup_by_index (newhop->ifindex); - return (ifp && if_is_operative (ifp)); - } - else if (newhop && newhop->type == NEXTHOP_TYPE_IFNAME) + if (newhop) { - 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; } else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL)) -- cgit v1.2.3