summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_clist.c2
-rw-r--r--bgpd/bgp_clist.h4
-rw-r--r--ospfd/ospf_vty.c7
-rw-r--r--ospfd/ospfd.c7
-rw-r--r--tests/topotests/zebra_multiple_connected/r1/ip_route_kernel_blackhole.json24
-rw-r--r--tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py21
-rw-r--r--zebra/zebra_rib.c2
7 files changed, 59 insertions, 8 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index ad154e638b..61ba527498 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -182,7 +182,7 @@ community_list_insert(struct community_list_handler *ch, const char *name,
}
/* In case of name is all digit character */
- if (i == strlen(name)) {
+ if (i == strlen(name) && number <= COMMUNITY_LIST_NUMBER_MAX) {
new->sort = COMMUNITY_LIST_NUMBER;
/* Set access_list to number list. */
diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h
index 29bd880c93..7f35a6d53e 100644
--- a/bgpd/bgp_clist.h
+++ b/bgpd/bgp_clist.h
@@ -20,6 +20,10 @@
/* Number and string based community-list name. */
#define COMMUNITY_LIST_STRING 0
#define COMMUNITY_LIST_NUMBER 1
+/* The numbered community-list (including large/ext communities)
+ * have a range between 1-500.
+ */
+#define COMMUNITY_LIST_NUMBER_MAX 500
#define COMMUNITY_SEQ_NUMBER_AUTO -1
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index b7261da261..4e1c083872 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -339,6 +339,12 @@ DEFPY (no_ospf_router_id,
return CMD_SUCCESS;
}
+ALIAS_HIDDEN (no_ospf_router_id,
+ no_router_id_cmd,
+ "no router-id [A.B.C.D]",
+ NO_STR
+ "router-id for the OSPF process\n"
+ "OSPF router-id in IP address format\n")
static void ospf_passive_interface_default_update(struct ospf *ospf,
uint8_t newval)
@@ -13624,6 +13630,7 @@ void ospf_vty_init(void)
install_element(OSPF_NODE, &ospf_router_id_cmd);
install_element(OSPF_NODE, &ospf_router_id_old_cmd);
install_element(OSPF_NODE, &no_ospf_router_id_cmd);
+ install_element(OSPF_NODE, &no_router_id_cmd);
/* "passive-interface" commands. */
install_element(OSPF_NODE, &ospf_passive_interface_default_cmd);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 7638e979a2..d72afec1e4 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -147,15 +147,10 @@ void ospf_process_refresh_data(struct ospf *ospf, bool reset)
/* Select the router ID based on these priorities:
1. Statically assigned router ID is always the first choice.
- 2. If there is no statically assigned router ID, then try to stick
- with the most recent value, since changing router ID's is very
- disruptive.
- 3. Last choice: just go with whatever the zebra daemon recommends.
+ 2. Just go with whatever the zebra daemon recommends.
*/
if (ospf->router_id_static.s_addr != INADDR_ANY)
router_id = ospf->router_id_static;
- else if (ospf->router_id.s_addr != INADDR_ANY)
- router_id = ospf->router_id;
else
router_id = ospf->router_id_zebra;
diff --git a/tests/topotests/zebra_multiple_connected/r1/ip_route_kernel_blackhole.json b/tests/topotests/zebra_multiple_connected/r1/ip_route_kernel_blackhole.json
new file mode 100644
index 0000000000..c8ea930370
--- /dev/null
+++ b/tests/topotests/zebra_multiple_connected/r1/ip_route_kernel_blackhole.json
@@ -0,0 +1,24 @@
+{
+ "0.0.0.0/0":[
+ {
+ "prefix":"0.0.0.0/0",
+ "prefixLen":0,
+ "protocol":"kernel",
+ "vrfName":"default",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "nexthops":[
+ {
+ "fib":true,
+ "unreachable":true,
+ "blackhole":true,
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py b/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py
index 7dbeb6f1cc..eda8c88706 100644
--- a/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py
+++ b/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py
@@ -202,6 +202,27 @@ def test_zebra_kernel_route_add():
assert result, "Connected Route should have been added\n{}".format(_)
+def test_zebra_kernel_route_blackhole_add():
+ "Test that a blackhole route is not affected by interface's link change"
+
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["r1"]
+ router.run("ip route add blackhole default")
+ router.run("ip link set dev r1-eth1 down")
+
+ kernel = "{}/{}/ip_route_kernel_blackhole.json".format(CWD, router.name)
+ expected = json.loads(open(kernel).read())
+
+ test_func = partial(
+ topotest.router_json_cmp, router, "show ip route 0.0.0.0/0 json", expected
+ )
+ result, _ = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assert result, "Blackhole Route should have not been removed\n{}".format(_)
+
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 4c70013701..752f8282df 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -4490,7 +4490,7 @@ rib_update_handle_kernel_route_down_possibility(struct route_node *rn,
struct interface *ifp = if_lookup_by_index(nexthop->ifindex,
nexthop->vrf_id);
- if (ifp && if_is_up(ifp)) {
+ if ((ifp && if_is_up(ifp)) || nexthop->type == NEXTHOP_TYPE_BLACKHOLE) {
alive = true;
break;
}