mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-12-08 08:21:27 +00:00
staticd: Fix nht to include SAFI_MULTICAST
The nexthop tracking was correctly registering the nexthops in
the SAFI_UNICAST table, but we need to apply them to the
SAFI_MULTICAST mroute information( if any ) as well.
donna.cumulusnetworks.com# conf t
donna.cumulusnetworks.com(config)# ip mroute 230.0.4.0/24 192.168.210.50
donna.cumulusnetworks.com(config)# end
donna.cumulusnetworks.com# show ip rpf
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route
C>* 10.0.2.0/24 is directly connected, enp0s3, 00:08:28
C>* 192.168.209.0/24 is directly connected, enp0s8, 00:08:28
C>* 192.168.210.0/24 is directly connected, enp0s9, 00:08:28
S>* 230.0.4.0/24 [1/0] via 192.168.210.50, enp0s9, 00:07:56
S>* 230.0.5.0/24 [1/0] via 192.168.210.50, enp0s9, 00:07:17
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
ea66cec488
commit
c45fb58dd3
@ -29,59 +29,68 @@
|
||||
#include "static_zebra.h"
|
||||
#include "static_nht.h"
|
||||
|
||||
void static_nht_update(struct prefix *p, uint32_t nh_num, afi_t afi,
|
||||
static void static_nht_update_safi(struct prefix *p, uint32_t nh_num,
|
||||
afi_t afi, safi_t safi, struct vrf *vrf,
|
||||
vrf_id_t nh_vrf_id)
|
||||
{
|
||||
struct route_table *stable;
|
||||
struct static_route *si;
|
||||
struct static_vrf *svrf;
|
||||
struct route_node *rn;
|
||||
struct vrf *vrf;
|
||||
bool orig;
|
||||
bool reinstall;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||
svrf = vrf->info;
|
||||
if (!svrf)
|
||||
continue;
|
||||
return;
|
||||
|
||||
stable = static_vrf_static_table(afi, SAFI_UNICAST, svrf);
|
||||
stable = static_vrf_static_table(afi, safi, svrf);
|
||||
if (!stable)
|
||||
continue;
|
||||
return;
|
||||
|
||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
||||
reinstall = false;
|
||||
for (si = rn->info; si; si = si->next) {
|
||||
if (si->nh_vrf_id != nh_vrf_id)
|
||||
continue;
|
||||
return;
|
||||
|
||||
if (si->type != STATIC_IPV4_GATEWAY
|
||||
&& si->type != STATIC_IPV4_GATEWAY_IFNAME
|
||||
&& si->type != STATIC_IPV6_GATEWAY
|
||||
&& si->type != STATIC_IPV6_GATEWAY_IFNAME)
|
||||
continue;
|
||||
return;
|
||||
|
||||
orig = si->nh_valid;
|
||||
if (p->family == AF_INET
|
||||
&& p->u.prefix4.s_addr
|
||||
== si->addr.ipv4.s_addr)
|
||||
&& p->u.prefix4.s_addr == si->addr.ipv4.s_addr)
|
||||
si->nh_valid = !!nh_num;
|
||||
|
||||
if (p->family == AF_INET6
|
||||
&& memcmp(&p->u.prefix6, &si->addr.ipv6, 16)
|
||||
== 0)
|
||||
&& memcmp(&p->u.prefix6, &si->addr.ipv6, 16) == 0)
|
||||
si->nh_valid = !!nh_num;
|
||||
|
||||
if (orig != si->nh_valid)
|
||||
reinstall = true;
|
||||
|
||||
if (reinstall) {
|
||||
static_zebra_route_add(
|
||||
rn, si, vrf->vrf_id,
|
||||
SAFI_UNICAST, true);
|
||||
static_zebra_route_add(rn, si, vrf->vrf_id,
|
||||
safi, true);
|
||||
reinstall = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void static_nht_update(struct prefix *p, uint32_t nh_num, afi_t afi,
|
||||
vrf_id_t nh_vrf_id)
|
||||
{
|
||||
|
||||
struct vrf *vrf;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||
static_nht_update_safi(p, nh_num, afi, SAFI_UNICAST,
|
||||
vrf, nh_vrf_id);
|
||||
static_nht_update_safi(p, nh_num, afi, SAFI_MULTICAST,
|
||||
vrf, nh_vrf_id);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user