diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-10-02 12:27:27 -0400 |
---|---|---|
committer | Paul Jakma <paul@quagga.net> | 2015-10-27 10:53:22 +0000 |
commit | a6a11765d4206a00b0875988ce352be7cdfa3617 (patch) | |
tree | 961fe1aba2fec0f81155bd1fcf7a89542111f678 | |
parent | 4edf1c6aea8fd93e8fdeb2a651bf34bb24329611 (diff) | |
download | quagga-a6a11765d4206a00b0875988ce352be7cdfa3617.tar.bz2 quagga-a6a11765d4206a00b0875988ce352be7cdfa3617.tar.xz |
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>
-rw-r--r-- | pimd/pim_iface.c | 47 | ||||
-rw-r--r-- | pimd/pim_zebra.c | 26 |
2 files changed, 18 insertions, 55 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index de56d04f..930dad00 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -249,35 +249,6 @@ static void pim_addr_change(struct interface *ifp) 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 @@ static int detect_primary_address_change(struct interface *ifp, } 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 @@ static void detect_secondary_address_change(struct interface *ifp, 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 3ca9eddd..3c739d28 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -150,8 +150,6 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient, 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 @@ static int pim_zebra_if_state_down(int command, struct zclient *zclient, 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 @@ static int pim_zebra_if_address_add(int command, struct zclient *zclient, 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 @@ static int pim_zebra_if_address_add(int command, struct zclient *zclient, 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 @@ static int pim_zebra_if_address_del(int command, struct zclient *client, 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 |