From 414158882318898c970297d84d20935f4e4a7bb0 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Thu, 7 Jun 2018 12:58:42 +0200 Subject: [PATCH] fabricd: add support for completely unnumbered operation With this commit, fabricd can run without any IPv4 addresses configured except on loopback. There are two changes to achieve this: a) If a circuit has no IPv4 address configured, fabricd will resort to advertise the routers loopback IP in the OpenFabric hellos. b) All the routes from OpenFabric are sent with ZEBRA_FLAG_ONLINK set, so that zebra will install them into the fib without checking whether the nexthop is reachable Signed-off-by: Christian Franke --- isisd/fabricd.c | 24 ++++++++++++++++++++++++ isisd/fabricd.h | 1 + isisd/isis_pdu.c | 10 +++++++--- isisd/isis_zebra.c | 2 ++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/isisd/fabricd.c b/isisd/fabricd.c index b52f2b554e..7951efe5a1 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -691,3 +691,27 @@ void fabricd_trigger_csnp(struct isis_area *area) &circuit->t_send_csnp[ISIS_LEVEL2 - 1]); } } + +struct list *fabricd_ip_addrs(struct isis_circuit *circuit) +{ + if (circuit->ip_addrs && listcount(circuit->ip_addrs)) + return circuit->ip_addrs; + + if (!fabricd || !circuit->area || !circuit->area->circuit_list) + return NULL; + + struct listnode *node; + struct isis_circuit *c; + + for (ALL_LIST_ELEMENTS_RO(circuit->area->circuit_list, node, c)) { + if (c->circ_type != CIRCUIT_T_LOOPBACK) + continue; + + if (!c->ip_addrs || !listcount(c->ip_addrs)) + return NULL; + + return c->ip_addrs; + } + + return NULL; +} diff --git a/isisd/fabricd.h b/isisd/fabricd.h index f54c7bf89e..76c182f2d2 100644 --- a/isisd/fabricd.h +++ b/isisd/fabricd.h @@ -44,5 +44,6 @@ uint8_t fabricd_tier(struct isis_area *area); int fabricd_write_settings(struct isis_area *area, struct vty *vty); void fabricd_lsp_flood(struct isis_lsp *lsp); void fabricd_trigger_csnp(struct isis_area *area); +struct list *fabricd_ip_addrs(struct isis_circuit *circuit); #endif diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index fc9ff5143f..88575f5319 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -679,7 +679,7 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit, goto out; } - iih.v4_usable = (circuit->ip_addrs && listcount(circuit->ip_addrs) + iih.v4_usable = (fabricd_ip_addrs(circuit) && iih.tlvs->ipv4_address.count); iih.v6_usable = (circuit->ipv6_link && listcount(circuit->ipv6_link) @@ -1689,8 +1689,12 @@ int send_hello(struct isis_circuit *circuit, int level) false, false); } - if (circuit->ip_router && circuit->ip_addrs) - isis_tlvs_add_ipv4_addresses(tlvs, circuit->ip_addrs); + if (circuit->ip_router) { + struct list *circuit_ip_addrs = fabricd_ip_addrs(circuit); + + if (circuit_ip_addrs) + isis_tlvs_add_ipv4_addresses(tlvs, circuit_ip_addrs); + } if (circuit->ipv6_router && circuit->ipv6_link) isis_tlvs_add_ipv6_addresses(tlvs, circuit->ipv6_link); diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 220f131b63..33d8a0f771 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -261,6 +261,8 @@ static void isis_zebra_route_add_route(struct prefix *prefix, return; memset(&api, 0, sizeof(api)); + if (fabricd) + api.flags |= ZEBRA_FLAG_ONLINK; api.vrf_id = VRF_DEFAULT; api.type = PROTO_TYPE; api.safi = SAFI_UNICAST; -- 2.39.5