summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranlan_cs <vic.lan@pica8.com>2023-05-26 07:17:22 +0200
committeranlan_cs <vic.lan@pica8.com>2023-05-26 07:24:55 +0200
commitce95ba5ab750c7505f01165d5811262065533f01 (patch)
tree1dee7aa133283afeb2167cc074581dc73cd38c56
parentMerge pull request #13598 from opensourcerouting/fix/typo_vtysh (diff)
downloadfrr-ce95ba5ab750c7505f01165d5811262065533f01.tar.xz
frr-ce95ba5ab750c7505f01165d5811262065533f01.zip
pimd: Fix missing promotion for primary address
Assume that `pim_ifp` has two ip (v4) addresses, one is primary, the other is secondary. After remove primary ip, the secondary ip doesn't be promoted, so `pim_ifp->primary_address` will wrongly be set to "0.0.0.0", it leads to `pim_sock_delete(ifp)` on this interface. Add the promotion for primary address. Fixed #13590 Signed-off-by: anlan_cs <vic.lan@pica8.com>
-rw-r--r--pimd/pim_iface.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index b1beb4563..7da7a98fb 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -893,6 +893,7 @@ pim_addr pim_find_primary_addr(struct interface *ifp)
#else
int v4_addrs = 0;
int v6_addrs = 0;
+ struct connected *promote_ifc = NULL;
for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
switch (ifc->address->family) {
@@ -906,15 +907,24 @@ pim_addr pim_find_primary_addr(struct interface *ifp)
continue;
}
- if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY))
+ if (ifc->address->family != PIM_AF)
continue;
- if (ifc->address->family != PIM_AF)
+ if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)) {
+ promote_ifc = ifc;
continue;
+ }
return pim_addr_from_prefix(ifc->address);
}
+
+ /* Promote the new primary address. */
+ if (v4_addrs && promote_ifc) {
+ UNSET_FLAG(promote_ifc->flags, ZEBRA_IFA_SECONDARY);
+ return pim_addr_from_prefix(promote_ifc->address);
+ }
+
/*
* If we have no v4_addrs and v6 is configured
* We probably are using unnumbered