summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorhasso <hasso>2003-05-25 19:21:25 +0000
committerhasso <hasso>2003-05-25 19:21:25 +0000
commit81dfcaa2e27d53f4eb61c549e03065dcb1b8eec3 (patch)
tree2aed449138a4833fe343052cdfa505be74332cb4 /zebra/zebra_rib.c
parent15291357d130b804dcdcfd81bdb1b86a84567fd0 (diff)
Route (reject|blackhole) support from 6Wind patch.
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 1c381901..74edfbb8 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -305,22 +305,6 @@ nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
}
#endif /* HAVE_IPV6 */
-
-struct nexthop *
-nexthop_blackhole_add (struct rib *rib)
-{
- struct nexthop *nexthop;
-
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
- nexthop->type = NEXTHOP_TYPE_BLACKHOLE;
- SET_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE);
-
- nexthop_add (rib, nexthop);
-
- return nexthop;
-}
-
/* If force flag is not set, do not modify falgs at all for uninstall
the route from FIB. */
int
@@ -739,9 +723,6 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
}
break;
#endif /* HAVE_IPV6 */
- case NEXTHOP_TYPE_BLACKHOLE:
- SET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
- break;
default:
break;
}
@@ -1289,9 +1270,6 @@ static_install_ipv4 (struct prefix *p, struct static_ipv4 *si)
case STATIC_IPV4_IFNAME:
nexthop_ifname_add (rib, si->gate.ifname);
break;
- case STATIC_IPV4_BLACKHOLE:
- nexthop_blackhole_add (rib);
- break;
}
rib_process (rn, NULL);
}
@@ -1314,11 +1292,11 @@ static_install_ipv4 (struct prefix *p, struct static_ipv4 *si)
case STATIC_IPV4_IFNAME:
nexthop_ifname_add (rib, si->gate.ifname);
break;
- case STATIC_IPV4_BLACKHOLE:
- nexthop_blackhole_add (rib);
- break;
}
+ /* Save the flags of this static routes (reject, blackhole) */
+ rib->flags = si->flags;
+
/* Link this rib to the tree. */
rib_addnode (rn, rib);
@@ -1338,9 +1316,6 @@ static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_ipv4 *si)
&& si->type == STATIC_IPV4_IFNAME
&& strcmp (nexthop->ifname, si->gate.ifname) == 0)
return 1;
- if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE
- && si->type == STATIC_IPV4_BLACKHOLE)
- return 1;
return 0;;
}
@@ -1408,7 +1383,7 @@ static_uninstall_ipv4 (struct prefix *p, struct static_ipv4 *si)
/* Add static route into static route configuration. */
int
static_add_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname,
- u_char distance, u_int32_t vrf_id)
+ u_char flags, u_char distance, u_int32_t vrf_id)
{
u_char type = 0;
struct route_node *rn;
@@ -1429,10 +1404,8 @@ static_add_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname,
/* Make flags. */
if (gate)
type = STATIC_IPV4_GATEWAY;
- else if (ifname)
+ if (ifname)
type = STATIC_IPV4_IFNAME;
- else
- type = STATIC_IPV4_BLACKHOLE;
/* Do nothing if there is a same static route. */
for (si = rn->info; si; si = si->next)
@@ -1461,6 +1434,7 @@ static_add_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname,
si->type = type;
si->distance = distance;
+ si->flags = flags;
if (gate)
si->gate.ipv4 = *gate;
@@ -1525,8 +1499,6 @@ static_delete_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname,
type = STATIC_IPV4_GATEWAY;
else if (ifname)
type = STATIC_IPV4_IFNAME;
- else
- type = STATIC_IPV4_BLACKHOLE;
/* Find same static route is the tree */
for (si = rn->info; si; si = si->next)
@@ -1869,6 +1841,9 @@ static_install_ipv6 (struct prefix *p, struct static_ipv6 *si)
break;
}
+ /* Save the flags of this static routes (reject, blackhole) */
+ rib->flags = si->flags;
+
/* Link this rib to the tree. */
rib_addnode (rn, rib);
@@ -1958,7 +1933,7 @@ static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si)
/* Add static route into static route configuration. */
int
static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
- char *ifname, u_char distance, u_int32_t vrf_id)
+ char *ifname, u_char flags, u_char distance, u_int32_t vrf_id)
{
struct route_node *rn;
struct static_ipv6 *si;
@@ -1993,6 +1968,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
si->type = type;
si->distance = distance;
+ si->flags = flags;
switch (type)
{