pimd: Cleanup interface startup
This patch cleans up some interface startup, removes duplicate
debug messages and protects against some always being displayed.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index de56d04..930dad0 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -249,35 +249,6 @@
pim_hello_restart_now(ifp); /* send hello and restart timer */
}
-static void on_primary_address_change(struct interface *ifp,
- const char *caller,
- struct in_addr old_addr,
- struct in_addr new_addr)
-{
- struct pim_interface *pim_ifp;
-
- if (PIM_DEBUG_ZEBRA) {
- char old_str[100];
- char new_str[100];
- pim_inet4_dump("<old?>", old_addr, old_str, sizeof(old_str));
- pim_inet4_dump("<new?>", new_addr, new_str, sizeof(new_str));
- zlog_debug("%s: %s: primary address changed from %s to %s on interface %s",
- __PRETTY_FUNCTION__, caller,
- old_str, new_str, ifp->name);
- }
-
- pim_ifp = ifp->info;
- if (!pim_ifp) {
- return;
- }
-
- if (!PIM_IF_TEST_PIM(pim_ifp->options)) {
- return;
- }
-
- pim_addr_change(ifp);
-}
-
static int detect_primary_address_change(struct interface *ifp,
int force_prim_as_any,
const char *caller)
@@ -309,10 +280,13 @@
}
if (changed) {
- struct in_addr old_addr = pim_ifp->primary_address;
pim_ifp->primary_address = new_prim_addr;
- on_primary_address_change(ifp, caller, old_addr, new_prim_addr);
+ if (!PIM_IF_TEST_PIM(pim_ifp->options)) {
+ return changed;
+ }
+
+ pim_addr_change(ifp);
}
return changed;
@@ -329,14 +303,9 @@
return;
changed = 1; /* true */
- zlog_info("FIXME T31 C15 %s: on interface %s: acting on any addr change",
- __PRETTY_FUNCTION__, ifp->name);
-
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug("%s: on interface %s: %s",
- __PRETTY_FUNCTION__,
- ifp->name, changed ? "changed" : "unchanged");
- }
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("FIXME T31 C15 %s: on interface %s: acting on any addr change",
+ __PRETTY_FUNCTION__, ifp->name);
if (!changed) {
return;
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 3ca9edd..3c739d2 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -150,8 +150,6 @@
if (!ifp)
return 0;
- zlog_info("INTERFACE UP: %s ifindex=%d", ifp->name, ifp->ifindex);
-
if (PIM_DEBUG_ZEBRA) {
zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__,
@@ -182,8 +180,6 @@
if (!ifp)
return 0;
- zlog_info("INTERFACE DOWN: %s ifindex=%d", ifp->name, ifp->ifindex);
-
if (PIM_DEBUG_ZEBRA) {
zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__,
@@ -242,8 +238,6 @@
struct connected *c;
struct prefix *p;
- zassert(command == ZEBRA_INTERFACE_ADDRESS_ADD);
-
/*
zebra api notifies address adds/dels events by using the same call
interface_add_read below, see comments in lib/zclient.c
@@ -278,17 +272,19 @@
struct in_addr primary_addr = pim_find_primary_addr(c->ifp);
if (primary_addr.s_addr != p->u.prefix4.s_addr) {
- /* but we had a primary address already */
+ if (PIM_DEBUG_ZEBRA) {
+ /* but we had a primary address already */
- char buf[BUFSIZ];
- char old[100];
+ char buf[BUFSIZ];
+ char old[100];
- prefix2str(p, buf, BUFSIZ);
- pim_inet4_dump("<old?>", primary_addr, old, sizeof(old));
+ prefix2str(p, buf, BUFSIZ);
+ pim_inet4_dump("<old?>", primary_addr, old, sizeof(old));
- zlog_warn("%s: %s primary addr old=%s: forcing secondary flag on new=%s",
- __PRETTY_FUNCTION__,
- c->ifp->name, old, buf);
+ zlog_warn("%s: %s primary addr old=%s: forcing secondary flag on new=%s",
+ __PRETTY_FUNCTION__,
+ c->ifp->name, old, buf);
+ }
SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY);
}
}
@@ -304,8 +300,6 @@
struct connected *c;
struct prefix *p;
- zassert(command == ZEBRA_INTERFACE_ADDRESS_DELETE);
-
/*
zebra api notifies address adds/dels events by using the same call
interface_add_read below, see comments in lib/zclient.c