summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 7340eeaa6..85e0fdf3a 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -890,6 +890,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) {
@@ -903,15 +904,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