diff options
43 files changed, 258 insertions, 246 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index d37e0b608f..85d79bdc3b 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -693,7 +693,7 @@ interface_recalculate(struct interface *ifp) rc = resize_receive_buffer(mtu); if(rc < 0) - zlog_warn("couldn't resize receive buffer for interface %s (%d) (%d bytes).\n", + zlog_warn("couldn't resize receive buffer for interface %s (%d) (%d bytes).", ifp->name, ifp->ifindex, mtu); memset(&mreq, 0, sizeof(mreq)); diff --git a/babeld/message.c b/babeld/message.c index c9a10cb1c0..edb9806011 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -643,7 +643,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, return; rtt = MAX(0, local_waiting_us - remote_waiting_us); - debugf(BABEL_DEBUG_COMMON, "RTT to %s on %s sample result: %d us.\n", + debugf(BABEL_DEBUG_COMMON, "RTT to %s on %s sample result: %d us.", format_address(from), ifp->name, rtt); old_rttcost = neighbour_rttcost(neigh); diff --git a/bfdd/bfd.c b/bfdd/bfd.c index ca4bf94955..3e45bf0e04 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1672,15 +1672,54 @@ static bool bfd_id_hash_cmp(const void *n1, const void *n2) static unsigned int bfd_key_hash_do(const void *p) { const struct bfd_session *bs = p; + struct bfd_key key = bs->key; - return jhash(&bs->key, sizeof(bs->key), 0); + /* + * Local address and interface name are optional and + * can be filled any time after session creation. + * Hash key should not depend on these fields. + */ + memset(&key.local, 0, sizeof(key.local)); + memset(key.ifname, 0, sizeof(key.ifname)); + + return jhash(&key, sizeof(key), 0); } static bool bfd_key_hash_cmp(const void *n1, const void *n2) { const struct bfd_session *bs1 = n1, *bs2 = n2; - return memcmp(&bs1->key, &bs2->key, sizeof(bs1->key)) == 0; + if (bs1->key.family != bs2->key.family) + return false; + if (bs1->key.mhop != bs2->key.mhop) + return false; + if (memcmp(&bs1->key.peer, &bs2->key.peer, sizeof(bs1->key.peer))) + return false; + if (memcmp(bs1->key.vrfname, bs2->key.vrfname, + sizeof(bs1->key.vrfname))) + return false; + + /* + * Local address is optional and can be empty. + * If both addresses are not empty and different, + * then the keys are different. + */ + if (memcmp(&bs1->key.local, &zero_addr, sizeof(bs1->key.local)) + && memcmp(&bs2->key.local, &zero_addr, sizeof(bs2->key.local)) + && memcmp(&bs1->key.local, &bs2->key.local, sizeof(bs1->key.local))) + return false; + + /* + * Interface name is optional and can be empty. + * If both names are not empty and different, + * then the keys are different. + */ + if (bs1->key.ifname[0] && bs2->key.ifname[0] + && memcmp(bs1->key.ifname, bs2->key.ifname, + sizeof(bs1->key.ifname))) + return false; + + return true; } @@ -1698,117 +1737,13 @@ struct bfd_session *bfd_id_lookup(uint32_t id) return hash_lookup(bfd_id_hash, &bs); } -struct bfd_key_walk_partial_lookup { - struct bfd_session *given; - struct bfd_session *result; -}; - -/* ignore some parameters */ -static int bfd_key_lookup_ignore_partial_walker(struct hash_bucket *b, - void *data) -{ - struct bfd_key_walk_partial_lookup *ctx = - (struct bfd_key_walk_partial_lookup *)data; - struct bfd_session *given = ctx->given; - struct bfd_session *parsed = b->data; - - if (given->key.family != parsed->key.family) - return HASHWALK_CONTINUE; - if (given->key.mhop != parsed->key.mhop) - return HASHWALK_CONTINUE; - if (memcmp(&given->key.peer, &parsed->key.peer, - sizeof(struct in6_addr))) - return HASHWALK_CONTINUE; - if (memcmp(given->key.vrfname, parsed->key.vrfname, MAXNAMELEN)) - return HASHWALK_CONTINUE; - ctx->result = parsed; - /* ignore localaddr or interface */ - return HASHWALK_ABORT; -} - struct bfd_session *bfd_key_lookup(struct bfd_key key) { - struct bfd_session bs, *bsp; - struct bfd_key_walk_partial_lookup ctx; - char peer_buf[INET6_ADDRSTRLEN]; - - bs.key = key; - bsp = hash_lookup(bfd_key_hash, &bs); - if (bsp) - return bsp; - - inet_ntop(bs.key.family, &bs.key.peer, peer_buf, - sizeof(peer_buf)); - /* Handle cases where local-address is optional. */ - if (memcmp(&bs.key.local, &zero_addr, sizeof(bs.key.local))) { - memset(&bs.key.local, 0, sizeof(bs.key.local)); - bsp = hash_lookup(bfd_key_hash, &bs); - if (bsp) { - if (bglobal.debug_peer_event) { - char addr_buf[INET6_ADDRSTRLEN]; - inet_ntop(bs.key.family, &key.local, addr_buf, - sizeof(addr_buf)); - zlog_debug( - " peer %s found, but loc-addr %s ignored", - peer_buf, addr_buf); - } - return bsp; - } - } - - bs.key = key; - /* Handle cases where ifname is optional. */ - if (bs.key.ifname[0]) { - memset(bs.key.ifname, 0, sizeof(bs.key.ifname)); - bsp = hash_lookup(bfd_key_hash, &bs); - if (bsp) { - if (bglobal.debug_peer_event) - zlog_debug(" peer %s found, but ifp %s ignored", - peer_buf, key.ifname); - return bsp; - } - } + struct bfd_session bs; - /* Handle cases where local-address and ifname are optional. */ - if (bs.key.family == AF_INET) { - memset(&bs.key.local, 0, sizeof(bs.key.local)); - bsp = hash_lookup(bfd_key_hash, &bs); - if (bsp) { - if (bglobal.debug_peer_event) { - char addr_buf[INET6_ADDRSTRLEN]; - inet_ntop(bs.key.family, &bs.key.local, - addr_buf, sizeof(addr_buf)); - zlog_debug( - " peer %s found, but ifp %s and loc-addr %s ignored", - peer_buf, key.ifname, addr_buf); - } - return bsp; - } - } bs.key = key; - /* Handle case where a context more complex ctx is present. - * input has no iface nor local-address, but a context may - * exist. - * - * Only applies to IPv4, because IPv6 requires either - * local-address or interface. - */ - if (!bs.key.mhop && bs.key.family == AF_INET) { - ctx.result = NULL; - ctx.given = &bs; - hash_walk(bfd_key_hash, &bfd_key_lookup_ignore_partial_walker, - &ctx); - /* change key */ - if (ctx.result) { - bsp = ctx.result; - if (bglobal.debug_peer_event) - zlog_debug( - " peer %s found, but ifp and/or loc-addr params ignored", - peer_buf); - } - } - return bsp; + return hash_lookup(bfd_key_hash, &bs); } /* @@ -1832,16 +1767,11 @@ struct bfd_session *bfd_id_delete(uint32_t id) struct bfd_session *bfd_key_delete(struct bfd_key key) { - struct bfd_session bs, *bsp; + struct bfd_session bs; bs.key = key; - bsp = hash_lookup(bfd_key_hash, &bs); - if (bsp == NULL && key.ifname[0]) { - memset(bs.key.ifname, 0, sizeof(bs.key.ifname)); - bsp = hash_lookup(bfd_key_hash, &bs); - } - return hash_release(bfd_key_hash, bsp); + return hash_release(bfd_key_hash, &bs); } /* Iteration functions. */ diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 88747b14b1..c976632678 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -5370,11 +5370,11 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, switch (ret) { case BGP_ERR_AS_MISMATCH: flog_err(EC_BGP_EVPN_AS_MISMATCH, - "BGP is already running; AS is %u\n", as); + "BGP is already running; AS is %u", as); return -1; case BGP_ERR_INSTANCE_MISMATCH: flog_err(EC_BGP_EVPN_INSTANCE_MISMATCH, - "BGP instance name and AS number mismatch\n"); + "BGP instance name and AS number mismatch"); return -1; } diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c index 15b891f25a..b244c87258 100644 --- a/bgpd/bgp_flowspec_util.c +++ b/bgpd/bgp_flowspec_util.c @@ -637,7 +637,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, offset += ret; break; default: - flog_err(EC_LIB_DEVELOPMENT, "%s: unknown type %d\n", + flog_err(EC_LIB_DEVELOPMENT, "%s: unknown type %d", __func__, type); } } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 8d06a4b374..f8ef5e2aa2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -5020,7 +5020,7 @@ ALIAS_HIDDEN(neighbor_set_peer_group, neighbor_set_peer_group_hidden_cmd, DEFUN_YANG (no_neighbor_set_peer_group, no_neighbor_set_peer_group_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME", + "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group [PGNAME]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5041,7 +5041,7 @@ DEFUN_YANG (no_neighbor_set_peer_group, } ALIAS_HIDDEN(no_neighbor_set_peer_group, no_neighbor_set_peer_group_hidden_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME", + "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group [PGNAME]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Member of the peer-group\n" "Peer-group name\n") diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index bc29f05aeb..c90fcf8d72 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -1177,19 +1177,19 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp, if (!rfg->rt_export_list || !rfg->rfapi_import_table) { vnc_zlog_debug_verbose( - "%s: VRF \"%s\" is missing RT import/export configuration.\n", + "%s: VRF \"%s\" is missing RT import/export configuration.", __func__, rfg->name); return; } if (!rfg->rd.prefixlen) { vnc_zlog_debug_verbose( - "%s: VRF \"%s\" is missing RD configuration.\n", + "%s: VRF \"%s\" is missing RD configuration.", __func__, rfg->name); return; } if (rfg->label > MPLS_LABEL_MAX) { vnc_zlog_debug_verbose( - "%s: VRF \"%s\" is missing default label configuration.\n", + "%s: VRF \"%s\" is missing default label configuration.", __func__, rfg->name); return; } diff --git a/configure.ac b/configure.ac index 09ec23ab76..266f37a112 100755 --- a/configure.ac +++ b/configure.ac @@ -2366,6 +2366,29 @@ if test "$frr_cv_mallinfo" = "yes"; then AC_DEFINE([HAVE_MALLINFO], [1], [mallinfo]) fi +AC_CACHE_CHECK([whether mallinfo2 is available], [frr_cv_mallinfo2], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [ +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif +#ifdef HAVE_MALLOC_NP_H +#include <malloc_np.h> +#endif +#ifdef HAVE_MALLOC_MALLOC_H +#include <malloc/malloc.h> +#endif +]], [[ +struct mallinfo2 ac_x; ac_x = mallinfo2 (); +]])], [ + frr_cv_mallinfo2=yes + ], [ + frr_cv_mallinfo2=no + ]) +]) +if test "$frr_cv_mallinfo2" = "yes"; then + AC_DEFINE([HAVE_MALLINFO2], [1], [mallinfo2]) +fi + AC_MSG_CHECKING([whether malloc_usable_size is available]) AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [ #ifdef HAVE_MALLOC_H diff --git a/doc/developer/tracing.rst b/doc/developer/tracing.rst index d54f6c7aaa..c194ae1270 100644 --- a/doc/developer/tracing.rst +++ b/doc/developer/tracing.rst @@ -308,6 +308,31 @@ Limitations Tracers do not like ``fork()`` or ``dlopen()``. LTTng has some workarounds for this involving interceptor libraries using ``LD_PRELOAD``. +If you're running FRR in a typical daemonizing way (``-d`` to the daemons) +you'll need to run the daemons like so: + +.. code-block:: shell + + LD_PRELOAD=liblttng-ust-fork.so <daemon> + + +If you're using systemd this you can accomplish this for all daemons by +modifying ``frr.service`` like so: + +.. code-block:: diff + + --- a/frr.service + +++ b/frr.service + @@ -7,6 +7,7 @@ Before=network.target + OnFailure=heartbeat-failed@%n.service + + [Service] + +Environment="LD_PRELOAD=liblttng-ust-fork.so" + Nice=-5 + Type=forking + NotifyAccess=all + + USDT tracepoints are relatively high overhead and probably shouldn't be used for "flight recorder" functionality, i.e. enabling and passively recording all events for monitoring purposes. It's generally okay to use LTTng like this, diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 2d68aaa9ed..a02b48157f 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -167,7 +167,7 @@ static int process_p2p_hello(struct iih_info *iih) if (adj) { if (memcmp(iih->sys_id, adj->sysid, ISIS_SYS_ID_LEN)) { zlog_debug( - "hello source and adjacency do not match, set adj down\n"); + "hello source and adjacency do not match, set adj down"); isis_adj_state_change(&adj, ISIS_ADJ_DOWN, "adj do not exist"); return ISIS_OK; diff --git a/lib/command_parse.y b/lib/command_parse.y index ba5225b702..8135d02b4b 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -496,7 +496,7 @@ terminate_graph (CMD_YYLTYPE *locp, struct parser_ctx *ctx, zlog_err ("----------"); while (ctx->docstr && ctx->docstr[1] != '\0') zlog_err ("%s", strsep(&ctx->docstr, "\n")); - zlog_err ("----------\n"); + zlog_err ("----------"); } graph_add_edge (finalnode, end_token_node); diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 54b6cda9a5..5d66a9fc73 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -259,7 +259,7 @@ DEFPY_YANG( /* Access-list must exist before entries. */ if (yang_dnode_exists(running_config->dnode, xpath) == false) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; /* Use access-list data structure to fetch sequence. */ dnode = yang_dnode_get(running_config->dnode, xpath); @@ -268,7 +268,7 @@ DEFPY_YANG( mask_str ? mask_str : CISCO_HOST_WILDCARD_MASK, NULL, NULL); if (sseq == -1) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; snprintfrr(xpath_entry, sizeof(xpath_entry), "%s/entry[sequence='%" PRId64 "']", xpath, sseq); @@ -436,7 +436,7 @@ DEFPY_YANG( /* Access-list must exist before entries. */ if (yang_dnode_exists(running_config->dnode, xpath) == false) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; /* Use access-list data structure to fetch sequence. */ dnode = yang_dnode_get(running_config->dnode, xpath); @@ -469,7 +469,7 @@ DEFPY_YANG( "0.0.0.0", CISCO_ANY_WILDCARD_MASK); } if (sseq == -1) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; snprintfrr(xpath_entry, sizeof(xpath_entry), "%s/entry[sequence='%" PRId64 "']", xpath, sseq); @@ -588,7 +588,7 @@ DEFPY_YANG( /* Access-list must exist before entries. */ if (yang_dnode_exists(running_config->dnode, xpath) == false) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; /* Use access-list data structure to fetch sequence. */ dnode = yang_dnode_get(running_config->dnode, xpath); @@ -601,7 +601,7 @@ DEFPY_YANG( sseq = acl_zebra_get_seq(acl, action, (struct prefix *)prefix, exact); if (sseq == -1) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; snprintfrr(xpath_entry, sizeof(xpath_entry), "%s/entry[sequence='%" PRId64 "']", xpath, sseq); @@ -786,7 +786,7 @@ DEFPY_YANG( /* Access-list must exist before entries. */ if (yang_dnode_exists(running_config->dnode, xpath) == false) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; /* Use access-list data structure to fetch sequence. */ dnode = yang_dnode_get(running_config->dnode, xpath); @@ -799,7 +799,7 @@ DEFPY_YANG( sseq = acl_zebra_get_seq(acl, action, (struct prefix *)prefix, exact); if (sseq == -1) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; snprintfrr(xpath_entry, sizeof(xpath_entry), "%s/entry[sequence='%" PRId64 "']", xpath, sseq); @@ -979,7 +979,7 @@ DEFPY_YANG( /* Access-list must exist before entries. */ if (yang_dnode_exists(running_config->dnode, xpath) == false) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; /* Use access-list data structure to fetch sequence. */ dnode = yang_dnode_get(running_config->dnode, xpath); @@ -992,7 +992,7 @@ DEFPY_YANG( sseq = acl_zebra_get_seq(acl, action, (struct prefix *)prefix, false); if (sseq == -1) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; snprintfrr(xpath_entry, sizeof(xpath_entry), "%s/entry[sequence='%" PRId64 "']", xpath, sseq); @@ -1277,7 +1277,7 @@ static int plist_remove(struct vty *vty, const char *iptype, const char *name, /* Access-list must exist before entries. */ if (yang_dnode_exists(running_config->dnode, xpath) == false) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; /* Use access-list data structure to fetch sequence. */ assert(action != NULL); @@ -1290,7 +1290,7 @@ static int plist_remove(struct vty *vty, const char *iptype, const char *name, pl = nb_running_get_entry(dnode, NULL, true); pentry = prefix_list_entry_lookup(pl, p, plt, -1, le, ge); if (pentry == NULL) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; snprintfrr(xpath_entry, sizeof(xpath_entry), "%s/entry[sequence='%" PRId64 "']", xpath, pentry->seq); diff --git a/lib/lib_vty.c b/lib/lib_vty.c index cd8b5c9809..128261a39c 100644 --- a/lib/lib_vty.c +++ b/lib/lib_vty.c @@ -43,10 +43,14 @@ #include "vty.h" #include "command.h" -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO2) || defined(HAVE_MALLINFO) static int show_memory_mallinfo(struct vty *vty) { +#if defined(HAVE_MALLINFO2) + struct mallinfo2 minfo = mallinfo2(); +#elif defined(HAVE_MALLINFO) struct mallinfo minfo = mallinfo(); +#endif char buf[MTYPE_MEMSTR_LEN]; vty_out(vty, "System allocator statistics:\n"); diff --git a/lib/link_state.c b/lib/link_state.c index 8dc5ab8eee..6bd7ef703c 100644 --- a/lib/link_state.c +++ b/lib/link_state.c @@ -1234,7 +1234,7 @@ void ls_dump_ted(struct ls_ted *ted) /* Loop TED, start printing Node, then Attributes and finally Prefix */ frr_each(vertices, &ted->vertices, vertex) { ls_vertex2msg(&msg, vertex); - zlog_debug("\tTed node (%s %pI4 %s)", + zlog_debug(" Ted node (%s %pI4 %s)", vertex->node->name[0] ? vertex->node->name : "no name node", &vertex->node->router_id, @@ -1246,7 +1246,7 @@ void ls_dump_ted(struct ls_ted *ted) for (ALL_LIST_ELEMENTS_RO(vertex->incoming_edges, lst_node, vertex_edge)) { zlog_debug( - "\t\tinc edge key:%lldn attr key:%pI4 loc:(%pI4) rmt:(%pI4)", + " inc edge key:%lldn attr key:%pI4 loc:(%pI4) rmt:(%pI4)", vertex_edge->key, &vertex_edge->attributes->adv.id.ip.addr, &vertex_edge->attributes->standard.local, @@ -1255,7 +1255,7 @@ void ls_dump_ted(struct ls_ted *ted) for (ALL_LIST_ELEMENTS_RO(vertex->outgoing_edges, lst_node, vertex_edge)) { zlog_debug( - "\t\tout edge key:%lld attr key:%pI4 loc:(%pI4) rmt:(%pI4)", + " out edge key:%lld attr key:%pI4 loc:(%pI4) rmt:(%pI4)", vertex_edge->key, &vertex_edge->attributes->adv.id.ip.addr, &vertex_edge->attributes->standard.local, @@ -1264,7 +1264,7 @@ void ls_dump_ted(struct ls_ted *ted) } frr_each(edges, &ted->edges, edge) { ls_edge2msg(&msg, edge); - zlog_debug("\tTed edge key:%lld src:%s dst:%s", edge->key, + zlog_debug(" Ted edge key:%lld src:%s dst:%s", edge->key, edge->source ? edge->source->node->name : "no_source", edge->destination ? edge->destination->node->name @@ -1273,7 +1273,7 @@ void ls_dump_ted(struct ls_ted *ted) frr_each(subnets, &ted->subnets, subnet) { ls_subnet2msg(&msg, subnet); zlog_debug( - "\tTed subnet key:%pFX vertex:%pI4 pfx:%pFX", + " Ted subnet key:%pFX vertex:%pI4 pfx:%pFX", &subnet->key, &subnet->vertex->node->adv.id.ip.addr, &subnet->ls_pref->pref); diff --git a/lib/stream.c b/lib/stream.c index e4e37b7315..ef73c2fdc9 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -57,7 +57,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO") #define STREAM_WARN_OFFSETS(S) \ do { \ flog_warn(EC_LIB_STREAM, \ - "&(struct stream): %p, size: %lu, getp: %lu, endp: %lu\n", \ + "&(struct stream): %p, size: %lu, getp: %lu, endp: %lu", \ (void *)(S), (unsigned long)(S)->size, \ (unsigned long)(S)->getp, (unsigned long)(S)->endp); \ zlog_backtrace(LOG_WARNING); \ @@ -93,7 +93,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO") if (((S)->endp + (Z)) > (S)->size) { \ flog_warn( \ EC_LIB_STREAM, \ - "CHECK_SIZE: truncating requested size %lu\n", \ + "CHECK_SIZE: truncating requested size %lu", \ (unsigned long)(Z)); \ STREAM_WARN_OFFSETS(S); \ (Z) = (S)->size - (S)->endp; \ diff --git a/lib/thread.c b/lib/thread.c index c140c7600c..e0d734a951 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1365,7 +1365,7 @@ static int thread_process_io_helper(struct thread_master *m, if (!thread) { if ((actual_state & (POLLHUP|POLLIN)) != POLLHUP) flog_err(EC_LIB_NO_THREAD, - "Attempting to process an I/O event but for fd: %d(%d) no thread to handle this!\n", + "Attempting to process an I/O event but for fd: %d(%d) no thread to handle this!", m->handler.pfds[pos].fd, actual_state); return 0; } @@ -675,12 +675,12 @@ int vrf_handler_create(struct vty *vty, const char *vrfname, if (strlen(vrfname) > VRF_NAMSIZ) { if (vty) vty_out(vty, - "%% VRF name %s invalid: length exceeds %d bytes\n", + "%% VRF name %s invalid: length exceeds %d bytes", vrfname, VRF_NAMSIZ); else flog_warn( EC_LIB_VRF_LENGTH, - "%% VRF name %s invalid: length exceeds %d bytes\n", + "%% VRF name %s invalid: length exceeds %d bytes", vrfname, VRF_NAMSIZ); return CMD_WARNING_CONFIG_FAILED; } diff --git a/lib/zclient.c b/lib/zclient.c index bfdf4971bb..20c285cf7f 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1002,7 +1002,7 @@ static int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg) if (cmd != ZEBRA_NHG_DEL && cmd != ZEBRA_NHG_ADD) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: Specified zapi NHG command (%d) doesn't exist\n", + "%s: Specified zapi NHG command (%d) doesn't exist", __func__, cmd); return -1; } @@ -1010,7 +1010,7 @@ static int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg) if (api_nhg->nexthop_num >= MULTIPATH_NUM || api_nhg->backup_nexthop_num >= MULTIPATH_NUM) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: zapi NHG encode with invalid input\n", __func__); + "%s: zapi NHG encode with invalid input", __func__); return -1; } @@ -1065,7 +1065,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) if (api->type >= ZEBRA_ROUTE_MAX) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: Specified route type (%u) is not a legal value\n", + "%s: Specified route type (%u) is not a legal value", __func__, api->type); return -1; } @@ -1077,7 +1077,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) if (api->safi < SAFI_UNICAST || api->safi >= SAFI_MAX) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: Specified route SAFI (%u) is not a legal value\n", + "%s: Specified route SAFI (%u) is not a legal value", __func__, api->safi); return -1; } @@ -1292,7 +1292,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) STREAM_GETC(s, api->type); if (api->type >= ZEBRA_ROUTE_MAX) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: Specified route type: %d is not a legal value\n", + "%s: Specified route type: %d is not a legal value", __func__, api->type); return -1; } @@ -1303,7 +1303,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) STREAM_GETC(s, api->safi); if (api->safi < SAFI_UNICAST || api->safi >= SAFI_MAX) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: Specified route SAFI (%u) is not a legal value\n", + "%s: Specified route SAFI (%u) is not a legal value", __func__, api->safi); return -1; } @@ -3304,7 +3304,7 @@ static void zclient_capability_decode(ZAPI_CALLBACK_ARGS) if (vrf_backend < 0 || vrf_configure_backend(vrf_backend)) { flog_err(EC_LIB_ZAPI_ENCODE, - "%s: Garbage VRF backend type: %d\n", __func__, + "%s: Garbage VRF backend type: %d", __func__, vrf_backend); goto stream_failure; } diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index ce2b1fe2ff..334f468c18 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -98,6 +98,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, { struct zapi_route api; struct zapi_nexthop *api_nh; + union sockunion *nexthop_ref = (union sockunion *)nexthop; if (zclient->sock < 0) return; @@ -133,8 +134,14 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, switch (api.prefix.family) { case AF_INET: - if (nexthop) { - api_nh->gate.ipv4 = nexthop->sin.sin_addr; + if (api.prefix.prefixlen == IPV4_MAX_BITLEN && + nexthop_ref && + memcmp(&nexthop_ref->sin.sin_addr, &api.prefix.u.prefix4, + sizeof(struct in_addr)) == 0) { + nexthop_ref = NULL; + } + if (nexthop_ref) { + api_nh->gate.ipv4 = nexthop_ref->sin.sin_addr; api_nh->type = NEXTHOP_TYPE_IPV4; } if (ifp) { @@ -146,8 +153,14 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, } break; case AF_INET6: - if (nexthop) { - api_nh->gate.ipv6 = nexthop->sin6.sin6_addr; + if (api.prefix.prefixlen == IPV6_MAX_BITLEN && + nexthop_ref && + memcmp(&nexthop_ref->sin6.sin6_addr, &api.prefix.u.prefix6, + sizeof(struct in6_addr)) == 0) { + nexthop_ref = NULL; + } + if (nexthop_ref) { + api_nh->gate.ipv6 = nexthop_ref->sin6.sin6_addr; api_nh->type = NEXTHOP_TYPE_IPV6; } if (ifp) { @@ -170,8 +183,9 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, zlog_debug( "Zebra send: route %s %pFX nexthop %s metric %u count %d dev %s", add ? "add" : "del", &api.prefix, - nexthop ? inet_ntop(api.prefix.family, &api_nh->gate, - buf, sizeof(buf)) + nexthop_ref ? inet_ntop(api.prefix.family, + &api_nh->gate, + buf, sizeof(buf)) : "<onlink>", api.metric, api.nexthop_num, ifp ? ifp->name : "none"); } diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 6ad0c9ea03..fbb883185a 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -51,18 +51,26 @@ static int nhrp_shortcut_do_expire(struct thread *t) static void nhrp_shortcut_cache_notify(struct notifier_block *n, unsigned long cmd) { + char buf2[PREFIX_STRLEN]; + struct nhrp_shortcut *s = container_of(n, struct nhrp_shortcut, cache_notifier); + struct nhrp_cache *c = s->cache; + if (c) + sockunion2str(&c->remote_addr, buf2, sizeof(buf2)); + else + snprintf(buf2, sizeof(buf2), "(unspec)"); switch (cmd) { case NOTIFY_CACHE_UP: if (!s->route_installed) { debugf(NHRP_DEBUG_ROUTE, - "Shortcut: route install %pFX nh (unspec) dev %s", - s->p, s->cache->ifp->name); + "Shortcut: route install %pFX nh %s dev %s", + s->p, buf2, c && c->ifp ? + c->ifp->name : "<unk>"); - nhrp_route_announce(1, s->type, s->p, s->cache->ifp, - &s->cache->remote_addr, 0); + nhrp_route_announce(1, s->type, s->p, c ? c->ifp : NULL, + c ? &c->remote_addr : NULL, 0); s->route_installed = 1; } break; diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 6b24f27672..f94252991c 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -654,7 +654,7 @@ static int ospf6_spf_calculation_thread(struct thread *t) (long long)runtime.tv_usec); zlog_info( - "SPF processing: # Areas: %d, SPF runtime: %lld sec %lld usec, Reason: %s\n", + "SPF processing: # Areas: %d, SPF runtime: %lld sec %lld usec, Reason: %s", areas_processed, (long long)runtime.tv_sec, (long long)runtime.tv_usec, rbuf); diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 94fa1b5b44..0b4e5d7762 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -517,7 +517,7 @@ struct ospf_external_aggr_rt *ospf_external_aggr_match(struct ospf *ospf, struct ospf_external_aggr_rt *ag = node->info; zlog_debug( - "%s: Matching aggregator found.prefix:%pI4/%d Aggregator %pI4/%d\n", + "%s: Matching aggregator found.prefix:%pI4/%d Aggregator %pI4/%d", __func__, &p->prefix, p->prefixlen, &ag->p.prefix, ag->p.prefixlen); } @@ -956,7 +956,7 @@ static void ospf_handle_external_aggr_update(struct ospf *ospf) struct route_node *rn = NULL; if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) - zlog_debug("%s: Process modified aggregators.\n", __func__); + zlog_debug("%s: Process modified aggregators.", __func__); for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) { struct ospf_external_aggr_rt *aggr; @@ -1047,7 +1047,7 @@ static int ospf_asbr_external_aggr_process(struct thread *thread) operation = ospf->aggr_action; if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) - zlog_debug("%s: operation:%d\n", __func__, operation); + zlog_debug("%s: operation:%d", __func__, operation); switch (operation) { case OSPF_ROUTE_AGGR_ADD: diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 6ed0497562..5a48eebe49 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -2645,7 +2645,7 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi, } else { if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) { zlog_debug( - "ospf_lsa_install() got an lsa with seq 0x80000000 that was not self originated. Ignoring\n"); + "ospf_lsa_install() got an lsa with seq 0x80000000 that was not self originated. Ignoring"); ospf_lsa_header_dump(lsa->data); } return old; diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 3145d16161..4083ea9332 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1451,9 +1451,7 @@ static uint16_t show_vty_sr_range(struct vty *vty, struct tlv_header *tlvh) GET_LABEL(ntohl(range->lower.value))); } else { zlog_debug( - " Segment Routing %s Range TLV:\n" - " Range Size = %d\n" - " SID Label = %d\n\n", + " Segment Routing %s Range TLV: Range Size = %d SID Label = %d", ntohs(range->header.type) == RI_SR_TLV_SRGB_LABEL_RANGE ? "Global" : "Local", @@ -1476,8 +1474,7 @@ static uint16_t show_vty_sr_msd(struct vty *vty, struct tlv_header *tlvh) msd->value); } else { zlog_debug( - " Segment Routing MSD TLV:\n" - " Node Maximum Stack Depth = %d\n", + " Segment Routing MSD TLV: Node Maximum Stack Depth = %d", msd->value); } diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index efe07e1411..7b2d794214 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -598,11 +598,6 @@ int ospf_sr_init(void) if (OspfSR.neighbors == NULL) return rc; - /* Initialize Route Table for prefix */ - OspfSR.prefix = route_table_init(); - if (OspfSR.prefix == NULL) - return rc; - /* Register Segment Routing VTY command */ ospf_sr_register_vty(); @@ -626,9 +621,6 @@ void ospf_sr_term(void) if (OspfSR.neighbors) hash_free(OspfSR.neighbors); - /* Clear Prefix Table */ - if (OspfSR.prefix) - route_table_finish(OspfSR.prefix); } /* @@ -913,8 +905,13 @@ static int compute_prefix_nhlfe(struct sr_prefix *srp) * be received before corresponding Router Information LSA */ if (srnext == NULL || srnext->srgb.lower_bound == 0 - || srnext->srgb.range_size == 0) + || srnext->srgb.range_size == 0) { + osr_debug( + " |- SR-Node %pI4 not ready. Stop process", + &srnext->adv_router); + path->srni.label_out = MPLS_INVALID_LABEL; continue; + } osr_debug(" |- Found SRGB %u/%u for next hop SR-Node %pI4", srnext->srgb.range_size, srnext->srgb.lower_bound, @@ -1273,7 +1270,7 @@ static void update_in_nhlfe(struct hash_bucket *bucket, void *args) /* * When SRGB has changed, update NHLFE Output Label for all Extended Prefix - * with SID index which use the given SR-Node as nexthop though hash_iterate() + * with SID index which use the given SR-Node as nexthop through hash_iterate() */ static void update_out_nhlfe(struct hash_bucket *bucket, void *args) { @@ -1283,21 +1280,29 @@ static void update_out_nhlfe(struct hash_bucket *bucket, void *args) struct sr_prefix *srp; struct ospf_path *path; + /* Skip Self SR-Node */ + if (srn == OspfSR.self) + return; + + osr_debug("SR (%s): Update Out NHLFE for neighbor SR-Node %pI4", + __func__, &srn->adv_router); + for (ALL_LIST_ELEMENTS_RO(srn->ext_prefix, node, srp)) { - /* Process only SID Index with valid route */ + /* Skip Prefix that has not yet a valid route */ if (srp->route == NULL) continue; for (ALL_LIST_ELEMENTS_RO(srp->route->paths, pnode, path)) { - /* Process only SID Index for next hop without PHP */ - if ((path->srni.nexthop == srp->srn) - && (!CHECK_FLAG(srp->flags, - EXT_SUBTLV_PREFIX_SID_NPFLG))) + /* Skip path that has not next SR-Node as nexthop */ + if (path->srni.nexthop != srnext) continue; - path->srni.label_out = - index2label(srp->sid, srnext->srgb); - ospf_zebra_update_prefix_sid(srp); + + /* Compute new Output Label */ + path->srni.label_out = sr_prefix_out_label(srp, srnext); } + + /* Finally update MPLS table */ + ospf_zebra_update_prefix_sid(srp); } } @@ -1438,11 +1443,6 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) srn->srlb.lower_bound = GET_LABEL(ntohl(ri_srlb->lower.value)); } - osr_debug(" |- Update SR-Node[%pI4], SRGB[%u/%u], SRLB[%u/%u], Algo[%u], MSD[%u]", - &srn->adv_router, srn->srgb.lower_bound, srn->srgb.range_size, - srn->srlb.lower_bound, srn->srlb.range_size, srn->algo[0], - srn->msd); - /* Check if SRGB has changed */ if ((srn->srgb.range_size == srgb.range_size) && (srn->srgb.lower_bound == srgb.lower_bound)) @@ -1452,6 +1452,11 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) srn->srgb.range_size = srgb.range_size; srn->srgb.lower_bound = srgb.lower_bound; + osr_debug(" |- Update SR-Node[%pI4], SRGB[%u/%u], SRLB[%u/%u], Algo[%u], MSD[%u]", + &srn->adv_router, srn->srgb.lower_bound, srn->srgb.range_size, + srn->srlb.lower_bound, srn->srlb.range_size, srn->algo[0], + srn->msd); + /* ... and NHLFE if it is a neighbor SR node */ if (srn->neighbor == OspfSR.self) hash_iterate(OspfSR.neighbors, update_out_nhlfe, srn); diff --git a/ospfd/ospf_sr.h b/ospfd/ospf_sr.h index d8079c9905..ce13457484 100644 --- a/ospfd/ospf_sr.h +++ b/ospfd/ospf_sr.h @@ -233,9 +233,6 @@ struct ospf_sr_db { /* List of neighbour SR nodes */ struct hash *neighbors; - /* List of SR prefix */ - struct route_table *prefix; - /* Local SR info announced in Router Info LSA */ /* Algorithms supported by the node */ diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 130108d348..aaab274570 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -541,9 +541,6 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp) struct listnode *node; struct ospf_path *path; - osr_debug("SR (%s): Update Labels %u for Prefix %pFX", __func__, - srp->label_in, (struct prefix *)&srp->prefv4); - /* Prepare message. */ memset(&zl, 0, sizeof(zl)); zl.type = ZEBRA_LSP_OSPF_SR; @@ -557,6 +554,11 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp) znh->ifindex = srp->nhlfe.ifindex; znh->label_num = 1; znh->labels[0] = srp->nhlfe.label_out; + + osr_debug("SR (%s): Configure Prefix %pFX with labels %u/%u", + __func__, (struct prefix *)&srp->prefv4, + srp->label_in, srp->nhlfe.label_out); + break; case PREF_SID: @@ -572,6 +574,10 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp) if (srp->route == NULL) { return; } + + osr_debug("SR (%s): Configure Prefix %pFX with", + __func__, (struct prefix *)&srp->prefv4); + for (ALL_LIST_ELEMENTS_RO(srp->route->paths, node, path)) { if (path->srni.label_out == MPLS_INVALID_LABEL) continue; @@ -615,6 +621,9 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp) znh->label_num = 1; znh->labels[0] = path->srni.label_out; + osr_debug(" |- labels %u/%u", srp->label_in, + srp->nhlfe.label_out); + /* Set TI-LFA backup nexthop info if present */ if (path->srni.backup_label_stack) { SET_FLAG(zl.message, ZAPI_LABELS_HAS_BACKUPS); diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c index 01caff5b52..5b851988f6 100644 --- a/pbrd/pbr_map.c +++ b/pbrd/pbr_map.c @@ -304,7 +304,7 @@ static void pbrms_vrf_update(struct pbr_map_sequence *pbrms, if (pbrms->vrf_lookup && (strncmp(vrf_name, pbrms->vrf_name, sizeof(pbrms->vrf_name)) == 0)) { - DEBUGD(&pbr_dbg_map, "\tSeq %u uses vrf %s (%u), updating map", + DEBUGD(&pbr_dbg_map, " Seq %u uses vrf %s (%u), updating map", pbrms->seqno, vrf_name, pbr_vrf_id(pbr_vrf)); pbr_map_check(pbrms, false); @@ -666,7 +666,7 @@ void pbr_map_schedule_policy_from_nhg(const char *nh_group, bool installed) RB_FOREACH (pbrm, pbr_map_entry_head, &pbr_maps) { DEBUGD(&pbr_dbg_map, "%s: Looking at %s", __func__, pbrm->name); for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, node, pbrms)) { - DEBUGD(&pbr_dbg_map, "\tNH Grp name: %s", + DEBUGD(&pbr_dbg_map, " NH Grp name: %s", pbrms->nhgrp_name ? pbrms->nhgrp_name : pbrms->internal_nhg_name); @@ -707,7 +707,7 @@ void pbr_map_policy_install(const char *name) if (pbrm->valid && pbrms->nhs_installed && pbrm->incoming->count) { - DEBUGD(&pbr_dbg_map, "\tInstalling %s %u", pbrm->name, + DEBUGD(&pbr_dbg_map, " Installing %s %u", pbrm->name, pbrms->seqno); for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, inode, pmi)) if (pbr_map_interface_is_valid(pmi)) @@ -861,7 +861,7 @@ void pbr_map_check(struct pbr_map_sequence *pbrms, bool changed) DEBUGD(&pbr_dbg_map, "%s: Installing %s(%u) reason: %" PRIu64, __func__, pbrm->name, pbrms->seqno, pbrms->reason); DEBUGD(&pbr_dbg_map, - "\tSending PBR_MAP_POLICY_INSTALL event"); + " Sending PBR_MAP_POLICY_INSTALL event"); } else { install = false; DEBUGD(&pbr_dbg_map, "%s: Removing %s(%u) reason: %" PRIu64, diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 7a814bd724..ba9ad97ab8 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -213,7 +213,7 @@ void pbr_nhgroup_add_cb(const char *name) nhgc = nhgc_find(name); if (!nhgc) { - DEBUGD(&pbr_dbg_nht, "%s: Could not find nhgc with name: %s\n", + DEBUGD(&pbr_dbg_nht, "%s: Could not find nhgc with name: %s", __func__, name); return; } @@ -620,7 +620,7 @@ struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name) nhgc = nhgc_find(name); if (!nhgc) { - DEBUGD(&pbr_dbg_nht, "%s: Could not find nhgc with name: %s\n", + DEBUGD(&pbr_dbg_nht, "%s: Could not find nhgc with name: %s", __func__, name); return NULL; } @@ -686,7 +686,7 @@ bool pbr_nht_nexthop_group_valid(const char *name) pnhgc = hash_get(pbr_nhg_hash, &lookup, NULL); if (!pnhgc) return false; - DEBUGD(&pbr_dbg_nht, "%s: \t%d %d", __func__, pnhgc->valid, + DEBUGD(&pbr_dbg_nht, "%s: %d %d", __func__, pnhgc->valid, pnhgc->installed); if (pnhgc->valid && pnhgc->installed) return true; @@ -851,7 +851,7 @@ static void pbr_nht_individual_nexthop_update_lookup(struct hash_bucket *b, pbr_nht_individual_nexthop_update(pnhc, pnhi); - DEBUGD(&pbr_dbg_nht, "\tFound %pFX: old: %d new: %d", + DEBUGD(&pbr_dbg_nht, " Found %pFX: old: %d new: %d", &pnhi->nhr->prefix, old_valid, pnhc->valid); if (pnhc->valid) @@ -1102,7 +1102,7 @@ pbr_nht_individual_nexthop_interface_update_lookup(struct hash_bucket *b, pbr_nht_individual_nexthop_update(pnhc, pnhi); - DEBUGD(&pbr_dbg_nht, "\tFound %s: old: %d new: %d", pnhi->ifp->name, + DEBUGD(&pbr_dbg_nht, " Found %s: old: %d new: %d", pnhi->ifp->name, old_valid, pnhc->valid); if (pnhc->valid) diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 222a10e751..467bbc8f72 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -266,7 +266,7 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg, api->prefix.family = install_afi; - DEBUGD(&pbr_dbg_zebra, "\tEncoding %pFX", &api->prefix); + DEBUGD(&pbr_dbg_zebra, " Encoding %pFX", &api->prefix); i = 0; for (ALL_NEXTHOPS(nhg, nhop)) { @@ -409,12 +409,12 @@ static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %pFX", __func__, &nhr.prefix); - DEBUGD(&pbr_dbg_zebra, "%s: (\tNexthops(%u)", __func__, + DEBUGD(&pbr_dbg_zebra, "%s: (Nexthops(%u)", __func__, nhr.nexthop_num); for (i = 0; i < nhr.nexthop_num; i++) { DEBUGD(&pbr_dbg_zebra, - "%s: \tType: %d: vrf: %d, ifindex: %d gate: %pI4", + "%s: Type: %d: vrf: %d, ifindex: %d gate: %pI4", __func__, nhr.nexthops[i].type, nhr.nexthops[i].vrf_id, nhr.nexthops[i].ifindex, &nhr.nexthops[i].gate.ipv4); @@ -585,7 +585,7 @@ bool pbr_send_pbr_map(struct pbr_map_sequence *pbrms, */ stream_putl(s, 1); - DEBUGD(&pbr_dbg_zebra, "%s: \t%s %s seq %u %d %s %u", __func__, + DEBUGD(&pbr_dbg_zebra, "%s: %s %s seq %u %d %s %u", __func__, install ? "Installing" : "Deleting", pbrm->name, pbrms->seqno, install, pmi->ifp->name, pmi->delete); diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index 7620cd5792..ddd8dc6bf9 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -44,7 +44,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &optval, &optlen) < 0) { flog_err_sys(EC_LIB_SOCKET, - "getsockopt of SO_SNDBUF failed %s\n", + "getsockopt of SO_SNDBUF failed %s", safe_strerror(errno)); return; } @@ -53,7 +53,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) { flog_err_sys(EC_LIB_SOCKET, - "Couldn't increase send buffer: %s\n", + "Couldn't increase send buffer: %s", safe_strerror(errno)); } } diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 301a27001f..dbba6b66d8 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -242,7 +242,7 @@ struct rp_info *pim_rp_find_match_group(struct pim_instance *pim, if (!rn) { flog_err( EC_LIB_DEVELOPMENT, - "%s: BUG We should have found default group information\n", + "%s: BUG We should have found default group information", __func__); return best; } diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index 7728717e99..f4f489c3dd 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -854,7 +854,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, vrrp_pkt_adver_dump(dumpbuf, sizeof(dumpbuf), pkt); DEBUGD(&vrrp_dbg_proto, VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM - "Received VRRP Advertisement from %s:\n%s", + "Received VRRP Advertisement from %s: %s", r->vr->vrid, family2str(r->family), sipstr, dumpbuf); /* Check that VRID matches our configured VRID */ diff --git a/vrrpd/vrrp_arp.c b/vrrpd/vrrp_arp.c index 750050e8c3..749b59cc43 100644 --- a/vrrpd/vrrp_arp.c +++ b/vrrpd/vrrp_arp.c @@ -170,7 +170,7 @@ void vrrp_garp_send_all(struct vrrp_router *r) if (ifp->flags & IFF_NOARP) { zlog_warn( VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM - "Unable to send gratuitous ARP on %s; has IFF_NOARP\n", + "Unable to send gratuitous ARP on %s; has IFF_NOARP", r->vr->vrid, family2str(r->family), ifp->name); return; } diff --git a/zebra/interface.c b/zebra/interface.c index 4072eb1568..fc34a6fb9e 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1029,7 +1029,7 @@ void if_up(struct interface *ifp) /* Notify the protocol daemons. */ if (ifp->ptm_enable && (ifp->ptm_status == ZEBRA_PTM_STATUS_DOWN)) { flog_warn(EC_ZEBRA_PTM_NOT_READY, - "%s: interface %s hasn't passed ptm check\n", + "%s: interface %s hasn't passed ptm check", __func__, ifp->name); return; } @@ -2977,7 +2977,7 @@ int if_ip_address_install(struct interface *ifp, struct prefix *prefix, dplane_res = dplane_intf_addr_set(ifp, ifc); if (dplane_res == ZEBRA_DPLANE_REQUEST_FAILURE) { zlog_debug( - "dplane can't set interface IP address: %s.\n", + "dplane can't set interface IP address: %s.", dplane_res2str(dplane_res)); return NB_ERR; } @@ -3095,7 +3095,7 @@ int if_ip_address_uinstall(struct interface *ifp, struct prefix *prefix) /* Check current interface address. */ ifc = connected_check_ptp(ifp, prefix, NULL); if (!ifc) { - zlog_debug("interface %s Can't find address\n", + zlog_debug("interface %s Can't find address", ifp->name); return -1; } @@ -3106,7 +3106,7 @@ int if_ip_address_uinstall(struct interface *ifp, struct prefix *prefix) } if (!ifc) { - zlog_debug("interface %s Can't find address\n", ifp->name); + zlog_debug("interface %s Can't find address", ifp->name); return -1; } UNSET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED); @@ -3122,7 +3122,7 @@ int if_ip_address_uinstall(struct interface *ifp, struct prefix *prefix) /* This is real route. */ dplane_res = dplane_intf_addr_unset(ifp, ifc); if (dplane_res == ZEBRA_DPLANE_REQUEST_FAILURE) { - zlog_debug("Can't unset interface IP address: %s.\n", + zlog_debug("Can't unset interface IP address: %s.", dplane_res2str(dplane_res)); return -1; } @@ -3335,7 +3335,7 @@ int if_ipv6_address_install(struct interface *ifp, struct prefix *prefix, dplane_res = dplane_intf_addr_set(ifp, ifc); if (dplane_res == ZEBRA_DPLANE_REQUEST_FAILURE) { zlog_debug( - "dplane can't set interface IP address: %s.\n", + "dplane can't set interface IP address: %s.", dplane_res2str(dplane_res)); return NB_ERR; } diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 56fd35a736..6134df9c41 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -105,7 +105,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp) if (iplen < ICMP_MINLEN) { flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH, - "IRDP: RX ICMP packet too short from %pI4\n", + "IRDP: RX ICMP packet too short from %pI4", &src); return; } @@ -116,7 +116,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp) len of IP-header) 14+20 */ if (iplen > IRDP_RX_BUF - 34) { flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH, - "IRDP: RX ICMP packet too long from %pI4\n", + "IRDP: RX ICMP packet too long from %pI4", &src); return; } @@ -153,7 +153,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp) && !(irdp->flags & IF_BROADCAST))) { flog_warn( EC_ZEBRA_IRDP_BAD_RX_FLAGS, - "IRDP: RX illegal from %pI4 to %s while %s operates in %s; Please correct settings\n", + "IRDP: RX illegal from %pI4 to %s while %s operates in %s; Please correct settings", &src, ntohl(ip->ip_dst.s_addr) == INADDR_ALLRTRS_GROUP ? "multicast" diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 7d2f9e372d..c77a357e9f 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -383,7 +383,7 @@ static int netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id, * it to be sent up to us */ flog_err(EC_ZEBRA_UNKNOWN_NLMSG, - "Unknown netlink nlmsg_type %s(%d) vrf %u\n", + "Unknown netlink nlmsg_type %s(%d) vrf %u", nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type, ns_id); break; @@ -485,7 +485,7 @@ static void netlink_install_filter(int sock, __u32 pid, __u32 dplane_pid) if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog)) < 0) - flog_err_sys(EC_LIB_SOCKET, "Can't install socket filter: %s\n", + flog_err_sys(EC_LIB_SOCKET, "Can't install socket filter: %s", safe_strerror(errno)); } diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 370dbaa240..b0f124ed55 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -206,7 +206,7 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p, afi = family2afi(p->family); if (!afi) { flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF, - "%s: Unknown AFI/SAFI prefix received\n", __func__); + "%s: Unknown AFI/SAFI prefix received", __func__); return; } if (!zebra_check_addr(p)) { @@ -276,7 +276,7 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p, afi = family2afi(p->family); if (!afi) { flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF, - "%s: Unknown AFI/SAFI prefix received\n", + "%s: Unknown AFI/SAFI prefix received", __func__); return; } diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 3af3586d31..1cae0b1f9b 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -3343,7 +3343,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) netlink_handle_5549(ndm, zif, ifp, &ip, false); if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "\tNeighbor Entry Received is a 5549 entry, finished"); + " Neighbor Entry Received is a 5549 entry, finished"); return 0; } @@ -3372,7 +3372,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) else { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "\tNeighbor Entry received is not on a VLAN or a BRIDGE, ignoring"); + " Neighbor Entry received is not on a VLAN or a BRIDGE, ignoring"); return 0; } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 21bff96b7d..46171df848 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1146,7 +1146,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS) } else { flog_err( EC_ZEBRA_UNKNOWN_FAMILY, - "rnh_register: Received unknown family type %d\n", + "rnh_register: Received unknown family type %d", p.family); return; } @@ -1237,7 +1237,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS) } else { flog_err( EC_ZEBRA_UNKNOWN_FAMILY, - "rnh_register: Received unknown family type %d\n", + "rnh_register: Received unknown family type %d", p.family); return; } @@ -1287,7 +1287,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS) if (p.family != AF_INET && p.family != AF_INET6) { flog_err( EC_ZEBRA_UNKNOWN_FAMILY, - "fec_register: Received unknown family type %d\n", + "fec_register: Received unknown family type %d", p.family); return; } @@ -1353,7 +1353,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS) if (p.family != AF_INET && p.family != AF_INET6) { flog_err( EC_ZEBRA_UNKNOWN_FAMILY, - "fec_unregister: Received unknown family type %d\n", + "fec_unregister: Received unknown family type %d", p.family); return; } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 69d3a577cf..c5d977017e 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -745,7 +745,7 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq) if (rnh->seqno == seq) { if (IS_ZEBRA_DEBUG_NHT_DETAILED) zlog_debug( - "\tNode processed and moved already"); + " Node processed and moved already"); continue; } diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 3c4dbc5e9c..48e2bafe44 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -1124,7 +1124,7 @@ int zebra_send_rnh_update(struct rnh *rnh, struct zserv *client, break; default: flog_err(EC_ZEBRA_RNH_UNKNOWN_FAMILY, - "%s: Unknown family (%d) notification attempted\n", + "%s: Unknown family (%d) notification attempted", __func__, rn->p.family); goto failure; } diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 3a0874da4d..424c00d5eb 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -3333,7 +3333,7 @@ int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni) zevpn = zebra_evpn_lookup(vni); if (!zevpn) { - zlog_warn("VNI %u does not exist\n", vni); + zlog_warn("VNI %u does not exist", vni); return CMD_WARNING; } |
