diff options
38 files changed, 416 insertions, 145 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 44629b3d7c..fc97178450 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9314,7 +9314,8 @@ void route_vty_out_tag(struct vty *vty, const struct prefix *p, vty_out(vty, "notag/%d", label); vty_out(vty, "\n"); } - } + } else if (!json) + vty_out(vty, "\n"); } void route_vty_out_overlay(struct vty *vty, const struct prefix *p, diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index e8ca544c23..dc48629e1d 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1219,7 +1219,6 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, struct zapi_nexthop *api_nh; int nh_family; unsigned int valid_nh_count = 0; - int has_valid_label = 0; bool allow_recursion = false; int has_valid_sid = 0; uint8_t distance; @@ -1434,7 +1433,6 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, if (mpinfo->extra && bgp_is_valid_label(&mpinfo->extra->label[0]) && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) { - has_valid_label = 1; label = label_pton(&mpinfo->extra->label[0]); SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_LABEL); @@ -1560,7 +1558,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, label_buf[0] = '\0'; eth_buf[0] = '\0'; segs_buf[0] = '\0'; - if (has_valid_label + if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_LABEL) && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) snprintf(label_buf, sizeof(label_buf), "label %u", api_nh->labels[0]); diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst index c703be62fc..2ce5f5d1c8 100644 --- a/doc/developer/workflow.rst +++ b/doc/developer/workflow.rst @@ -637,6 +637,39 @@ well as CERT or MISRA C guidelines may provide useful input on safe C code. However, these rules are not applied as-is; some of them expressly collide with established practice. + +Container implementations +^^^^^^^^^^^^^^^^^^^^^^^^^ + +In particular to gain defensive coding benefits from better compiler type +checks, there is a set of replacement container data structures to be found +in :file:`lib/typesafe.h`. They're documented under :ref:`lists`. + +Unfortunately, the FRR codebase is quite large, and migrating existing code to +use these new structures is a tedious and far-reaching process (even if it +can be automated with coccinelle, the patches would touch whole swaths of code +and create tons of merge conflicts for ongoing work.) Therefore, little +existing code has been migrated. + +However, both **new code and refactors of existing code should use the new +containers**. If there are any reasons this can't be done, please work to +remove these reasons (e.g. by adding necessary features to the new containers) +rather than falling back to the old code. + +In order of likelyhood of removal, these are the old containers: + +- :file:`nhrpd/list.*`, ``hlist_*`` ⇒ ``DECLARE_LIST`` +- :file:`nhrpd/list.*`, ``list_*`` ⇒ ``DECLARE_DLIST`` +- :file:`lib/skiplist.*`, ``skiplist_*`` ⇒ ``DECLARE_SKIPLIST`` +- :file:`lib/*_queue.h` (BSD), ``SLIST_*`` ⇒ ``DECLARE_LIST`` +- :file:`lib/*_queue.h` (BSD), ``LIST_*`` ⇒ ``DECLARE_DLIST`` +- :file:`lib/*_queue.h` (BSD), ``STAILQ_*`` ⇒ ``DECLARE_LIST`` +- :file:`lib/*_queue.h` (BSD), ``TAILQ_*`` ⇒ ``DECLARE_DLIST`` +- :file:`lib/hash.*`, ``hash_*`` ⇒ ``DECLARE_HASH`` +- :file:`lib/linklist.*`, ``list_*`` ⇒ ``DECLARE_DLIST`` +- open-coded linked lists ⇒ ``DECLARE_LIST``/``DECLARE_DLIST`` + + Code Formatting --------------- diff --git a/doc/user/ospf6d.rst b/doc/user/ospf6d.rst index f0b0638eeb..b7a8c5d796 100644 --- a/doc/user/ospf6d.rst +++ b/doc/user/ospf6d.rst @@ -317,7 +317,7 @@ Graceful Restart To perform a graceful shutdown, the "graceful-restart prepare ipv6 ospf" EXEC-level command needs to be issued before restarting the ospf6d daemon. -.. clicmd:: graceful-restart helper-only [A.B.C.D] +.. clicmd:: graceful-restart helper enable [A.B.C.D] Configure Graceful Restart (RFC 5187) helper support. diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst index e8ca394727..0122e2ac75 100644 --- a/doc/user/ospfd.rst +++ b/doc/user/ospfd.rst @@ -722,7 +722,7 @@ Graceful Restart To perform a graceful shutdown, the "graceful-restart prepare ip ospf" EXEC-level command needs to be issued before restarting the ospfd daemon. -.. clicmd:: graceful-restart helper-only [A.B.C.D] +.. clicmd:: graceful-restart helper enable [A.B.C.D] Configure Graceful Restart (RFC 3623) helper support. diff --git a/lib/command.h b/lib/command.h index c76fc1e8eb..8a7c9a2048 100644 --- a/lib/command.h +++ b/lib/command.h @@ -229,6 +229,7 @@ struct cmd_node { #define CMD_WARNING_CONFIG_FAILED 13 #define CMD_NOT_MY_INSTANCE 14 #define CMD_NO_LEVEL_UP 15 +#define CMD_ERR_NO_DAEMON 16 /* Argc max counts. */ #define CMD_ARGC_MAX 256 diff --git a/lib/skiplist.c b/lib/skiplist.c index fc42857418..c5219f7381 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -65,17 +65,25 @@ DEFINE_MTYPE_STATIC(LIB, SKIP_LIST, "Skip List"); DEFINE_MTYPE_STATIC(LIB, SKIP_LIST_NODE, "Skip Node"); +DEFINE_MTYPE_STATIC(LIB, SKIP_LIST_STATS, "Skiplist Counters"); #define BitsInRandom 31 #define MaxNumberOfLevels 16 #define MaxLevel (MaxNumberOfLevels-1) -#define newNodeOfLevel(l) XCALLOC(MTYPE_SKIP_LIST_NODE, sizeof(struct skiplistnode)+(l)*sizeof(struct skiplistnode *)) +#define newNodeOfLevel(l) \ + XCALLOC(MTYPE_SKIP_LIST_NODE, \ + sizeof(struct skiplistnode) \ + + (l) * sizeof(struct skiplistnode *)) + +/* XXX must match type of (struct skiplist).level_stats */ +#define newStatsOfLevel(l) \ + XCALLOC(MTYPE_SKIP_LIST_STATS, ((l) + 1) * sizeof(int)) static int randomsLeft; static int randomBits; -#if 1 +#ifdef SKIPLIST_DEBUG #define CHECKLAST(sl) \ do { \ if ((sl)->header->forward[0] && !(sl)->last) \ @@ -138,7 +146,7 @@ struct skiplist *skiplist_new(int flags, new->level = 0; new->count = 0; new->header = newNodeOfLevel(MaxNumberOfLevels); - new->stats = newNodeOfLevel(MaxNumberOfLevels); + new->level_stats = newStatsOfLevel(MaxNumberOfLevels); new->flags = flags; if (cmp) @@ -166,7 +174,7 @@ void skiplist_free(struct skiplist *l) p = q; } while (p); - XFREE(MTYPE_SKIP_LIST_NODE, l->stats); + XFREE(MTYPE_SKIP_LIST_STATS, l->level_stats); XFREE(MTYPE_SKIP_LIST, l); } @@ -180,11 +188,13 @@ int skiplist_insert(register struct skiplist *l, register void *key, CHECKLAST(l); +#ifdef SKIPLIST_DEBUG /* DEBUG */ if (!key) { flog_err(EC_LIB_DEVELOPMENT, "%s: key is 0, value is %p", __func__, value); } +#endif p = l->header; k = l->level; @@ -214,10 +224,10 @@ int skiplist_insert(register struct skiplist *l, register void *key, q->flags = SKIPLIST_NODE_FLAG_INSERTED; /* debug */ #endif - ++(l->stats->forward[k]); + ++(l->level_stats[k]); #ifdef SKIPLIST_DEBUG - zlog_debug("%s: incremented stats @%p:%d, now %ld", __func__, l, k, - l->stats->forward[k] - (struct skiplistnode *)NULL); + zlog_debug("%s: incremented level_stats @%p:%d, now %d", __func__, l, k, + l->level_stats[k]); #endif do { @@ -298,12 +308,10 @@ int skiplist_delete(register struct skiplist *l, register void *key, k++) { p->forward[k] = q->forward[k]; } - --(l->stats->forward[k - 1]); + --(l->level_stats[k - 1]); #ifdef SKIPLIST_DEBUG - zlog_debug("%s: decremented stats @%p:%d, now %ld", - __func__, l, k - 1, - l->stats->forward[k - 1] - - (struct skiplistnode *)NULL); + zlog_debug("%s: decremented level_stats @%p:%d, now %d", + __func__, l, k - 1, l->level_stats[k - 1]); #endif if (l->del) (*l->del)(q->value); @@ -559,11 +567,10 @@ int skiplist_delete_first(register struct skiplist *l) l->last = NULL; } - --(l->stats->forward[nodelevel]); + --(l->level_stats[nodelevel]); #ifdef SKIPLIST_DEBUG - zlog_debug("%s: decremented stats @%p:%d, now %ld", __func__, l, - nodelevel, - l->stats->forward[nodelevel] - (struct skiplistnode *)NULL); + zlog_debug("%s: decremented level_stats @%p:%d, now %d", __func__, l, + nodelevel, l->level_stats[nodelevel]); #endif if (l->del) @@ -587,9 +594,7 @@ void skiplist_debug(struct vty *vty, struct skiplist *l) vty_out(vty, "Skiplist %p has max level %d\n", l, l->level); for (i = l->level; i >= 0; --i) - vty_out(vty, " @%d: %ld\n", i, - (long)((l->stats->forward[i]) - - (struct skiplistnode *)NULL)); + vty_out(vty, " @%d: %d\n", i, l->level_stats[i]); } static void *scramble(int i) diff --git a/lib/skiplist.h b/lib/skiplist.h index a106a455d6..00950e13bb 100644 --- a/lib/skiplist.h +++ b/lib/skiplist.h @@ -60,7 +60,7 @@ struct skiplist { int level; /* max lvl (1 + current # of levels in list) */ unsigned int count; struct skiplistnode *header; - struct skiplistnode *stats; + int *level_stats; struct skiplistnode *last; /* last real list item (NULL if empty list) */ @@ -123,6 +123,7 @@ extern int skiplist_empty(register struct skiplist *l); /* in */ extern unsigned int skiplist_count(register struct skiplist *l); /* in */ +struct vty; extern void skiplist_debug(struct vty *vty, struct skiplist *l); extern void skiplist_test(struct vty *vty); diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index 4522bd2619..ad8998b1ed 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -1019,10 +1019,11 @@ static void show_ospf6_gr_helper_details(struct vty *vty, struct ospf6 *ospf6, /* Graceful Restart HELPER config Commands */ DEFPY(ospf6_gr_helper_enable, ospf6_gr_helper_enable_cmd, - "graceful-restart helper-only [A.B.C.D$rtr_id]", + "graceful-restart helper enable [A.B.C.D$rtr_id]", "ospf6 graceful restart\n" + "ospf6 GR Helper\n" "Enable Helper support\n" - "Advertisement RouterId\n") + "Advertisement Router-ID\n") { VTY_DECLVAR_CONTEXT(ospf6, ospf6); @@ -1041,11 +1042,12 @@ DEFPY(ospf6_gr_helper_enable, DEFPY(ospf6_gr_helper_disable, ospf6_gr_helper_disable_cmd, - "no graceful-restart helper-only [A.B.C.D$rtr_id]", + "no graceful-restart helper enable [A.B.C.D$rtr_id]", NO_STR "ospf6 graceful restart\n" - "Disable Helper support\n" - "Advertisement RouterId\n") + "ospf6 GR Helper\n" + "Enable Helper support\n" + "Advertisement Router-ID\n") { VTY_DECLVAR_CONTEXT(ospf6, ospf6); @@ -1354,14 +1356,14 @@ static int ospf6_cfg_write_helper_enable_rtr_walkcb(struct hash_bucket *backet, struct advRtr *rtr = backet->data; struct vty *vty = (struct vty *)arg; - vty_out(vty, " graceful-restart helper-only %pI4\n", &rtr->advRtrAddr); + vty_out(vty, " graceful-restart helper enable %pI4\n", &rtr->advRtrAddr); return HASHWALK_CONTINUE; } int config_write_ospf6_gr_helper(struct vty *vty, struct ospf6 *ospf6) { if (ospf6->ospf6_helper_cfg.is_helper_supported) - vty_out(vty, " graceful-restart helper-only\n"); + vty_out(vty, " graceful-restart helper enable\n"); if (!ospf6->ospf6_helper_cfg.strict_lsa_check) vty_out(vty, " graceful-restart helper lsa-check-disable\n"); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 85a2713c0a..277af4b1c5 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1495,7 +1495,6 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, struct listnode *anode, *anext; struct listnode *nnode, *rnode, *rnext; struct ospf6_nexthop *nh, *rnh; - char buf[PREFIX2STR_BUFFER]; bool route_found = false; struct interface *ifp = NULL; struct ospf6_lsa *lsa; @@ -1679,8 +1678,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, if (ls_entry == NULL) { if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) zlog_debug( - "%s: ls_prfix %s ls_entry not found.", - __func__, buf); + "%s: ls_prfix %pFX ls_entry not found.", + __func__, + &o_path->ls_prefix); continue; } lsa = ospf6_lsdb_lookup(o_path->origin.type, diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 53f3c3468a..64de9bae41 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1878,11 +1878,13 @@ static void ospf6_make_header(uint8_t type, struct ospf6_interface *oi, oh->version = (uint8_t)OSPFV3_VERSION; oh->type = type; - + oh->length = 0; oh->router_id = oi->area->ospf6->router_id; oh->area_id = oi->area->area_id; + oh->checksum = 0; oh->instance_id = oi->instance_id; oh->reserved = 0; + stream_forward_endp(s, OSPF6_HEADER_SIZE); } diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index e4de6ccf91..0e7a2f8fa8 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -440,11 +440,22 @@ void ospf6_spf_table_finish(struct ospf6_route_table *result_table) } static const char *const ospf6_spf_reason_str[] = { - "R+", "R-", "N+", "N-", "L+", "L-", "R*", "N*", "C", "A", "GR"}; - -void ospf6_spf_reason_string(unsigned int reason, char *buf, int size) + "R+", /* OSPF6_SPF_FLAGS_ROUTER_LSA_ADDED */ + "R-", /* OSPF6_SPF_FLAGS_ROUTER_LSA_REMOVED */ + "N+", /* OSPF6_SPF_FLAGS_NETWORK_LSA_ADDED */ + "N-", /* OSPF6_SPF_FLAGS_NETWORK_LSA_REMOVED */ + "L+", /* OSPF6_SPF_FLAGS_NETWORK_LINK_LSA_ADDED */ + "L-", /* OSPF6_SPF_FLAGS_NETWORK_LINK_LSA_REMOVED */ + "R*", /* OSPF6_SPF_FLAGS_ROUTER_LSA_ORIGINATED */ + "N*", /* OSPF6_SPF_FLAGS_NETWORK_LSA_ORIGINATED */ + "C", /* OSPF6_SPF_FLAGS_CONFIG_CHANGE */ + "A", /* OSPF6_SPF_FLAGS_ASBR_STATUS_CHANGE */ + "GR", /* OSPF6_SPF_FLAGS_GR_FINISH */ +}; + +void ospf6_spf_reason_string(uint32_t reason, char *buf, int size) { - unsigned int bit; + uint32_t bit; int len = 0; if (!buf) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 3122d616cb..894ebc7681 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -226,7 +226,7 @@ static int ospf6_vrf_enable(struct vrf *vrf) thread_add_read(master, ospf6_receive, ospf6, ospf6->fd, &ospf6->t_ospf6_receive); - ospf6_router_id_update(ospf6); + ospf6_router_id_update(ospf6, true); } } @@ -460,7 +460,7 @@ struct ospf6 *ospf6_instance_create(const char *name) if (DFLT_OSPF6_LOG_ADJACENCY_CHANGES) SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES); if (ospf6->router_id == 0) - ospf6_router_id_update(ospf6); + ospf6_router_id_update(ospf6, true); ospf6_add(ospf6); if (ospf6->vrf_id != VRF_UNKNOWN) { vrf = vrf_lookup_by_id(ospf6->vrf_id); @@ -630,15 +630,35 @@ void ospf6_maxage_remove(struct ospf6 *o) &o->maxage_remover); } -void ospf6_router_id_update(struct ospf6 *ospf6) +bool ospf6_router_id_update(struct ospf6 *ospf6, bool init) { + in_addr_t new_router_id; + struct listnode *node; + struct ospf6_area *oa; + if (!ospf6) - return; + return true; if (ospf6->router_id_static != 0) - ospf6->router_id = ospf6->router_id_static; + new_router_id = ospf6->router_id_static; else - ospf6->router_id = ospf6->router_id_zebra; + new_router_id = ospf6->router_id_zebra; + + if (ospf6->router_id == new_router_id) + return true; + + if (!init) + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { + if (oa->full_nbrs) { + zlog_err( + "%s: cannot update router-id. Run the \"clear ipv6 ospf6 process\" command\n", + __func__); + return false; + } + } + + ospf6->router_id = new_router_id; + return true; } /* start ospf6 */ @@ -731,8 +751,6 @@ static void ospf6_process_reset(struct ospf6 *ospf6) ospf6->inst_shutdown = 0; ospf6_db_clear(ospf6); - ospf6_router_id_update(ospf6); - ospf6_asbr_redistribute_reset(ospf6); FOR_ALL_INTERFACES (vrf, ifp) ospf6_interface_clear(ifp); @@ -754,10 +772,12 @@ DEFPY (clear_router_ospf6, vrf_name = name; ospf6 = ospf6_lookup_by_vrf_name(vrf_name); - if (ospf6 == NULL) + if (ospf6 == NULL) { vty_out(vty, "OSPFv3 is not configured\n"); - else + } else { + ospf6_router_id_update(ospf6, true); ospf6_process_reset(ospf6); + } return CMD_SUCCESS; } @@ -775,8 +795,6 @@ DEFUN(ospf6_router_id, int ret; const char *router_id_str; uint32_t router_id; - struct ospf6_area *oa; - struct listnode *node; argv_find(argv, argc, "A.B.C.D", &idx); router_id_str = argv[idx]->arg; @@ -789,15 +807,11 @@ DEFUN(ospf6_router_id, o->router_id_static = router_id; - for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) { - if (oa->full_nbrs) { - vty_out(vty, - "For this router-id change to take effect, run the \"clear ipv6 ospf6 process\" command\n"); - return CMD_SUCCESS; - } - } - - o->router_id = router_id; + if (ospf6_router_id_update(o, false)) + ospf6_process_reset(o); + else + vty_out(vty, + "For this router-id change to take effect run the \"clear ipv6 ospf6 process\" command\n"); return CMD_SUCCESS; } @@ -810,21 +824,15 @@ DEFUN(no_ospf6_router_id, V4NOTATION_STR) { VTY_DECLVAR_CONTEXT(ospf6, o); - struct ospf6_area *oa; - struct listnode *node; o->router_id_static = 0; - for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) { - if (oa->full_nbrs) { - vty_out(vty, - "For this router-id change to take effect, run the \"clear ipv6 ospf6 process\" command\n"); - return CMD_SUCCESS; - } - } - o->router_id = 0; - if (o->router_id_zebra) - o->router_id = o->router_id_zebra; + + if (ospf6_router_id_update(o, false)) + ospf6_process_reset(o); + else + vty_out(vty, + "For this router-id change to take effect run the \"clear ipv6 ospf6 process\" command\n"); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index 3188b1f58f..9a0b1279ce 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -239,7 +239,7 @@ extern void ospf6_master_init(struct thread_master *master); extern void install_element_ospf6_clear_process(void); extern void ospf6_top_init(void); extern void ospf6_delete(struct ospf6 *o); -extern void ospf6_router_id_update(struct ospf6 *ospf6); +extern bool ospf6_router_id_update(struct ospf6 *ospf6, bool init); extern void ospf6_maxage_remove(struct ospf6 *o); extern struct ospf6 *ospf6_instance_create(const char *name); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index c2e91d09bb..a6929b32c4 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -102,7 +102,7 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) o->router_id_zebra = router_id.u.prefix4.s_addr; - ospf6_router_id_update(o); + ospf6_router_id_update(o, false); return 0; } diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 3ae9707f5f..4109ada64a 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9894,24 +9894,17 @@ DEFUN (no_ospf_proactive_arp, /* Graceful Restart HELPER Commands */ DEFPY(ospf_gr_helper_enable, ospf_gr_helper_enable_cmd, - "graceful-restart helper-only [A.B.C.D]", + "graceful-restart helper enable [A.B.C.D$address]", "OSPF Graceful Restart\n" + "OSPF GR Helper\n" "Enable Helper support\n" - "Advertising router id\n") + "Advertising Router-ID\n") { VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); - struct in_addr addr; - int ret; - - if (argc == 3) { - ret = inet_aton(argv[2]->arg, &addr); - if (!ret) { - vty_out(vty, - "Please specify the valid routerid address.\n"); - return CMD_WARNING_CONFIG_FAILED; - } - ospf_gr_helper_support_set_per_routerid(ospf, &addr, OSPF_GR_TRUE); + if (address_str) { + ospf_gr_helper_support_set_per_routerid(ospf, &address, + OSPF_GR_TRUE); return CMD_SUCCESS; } @@ -9922,33 +9915,68 @@ DEFPY(ospf_gr_helper_enable, ospf_gr_helper_enable_cmd, DEFPY(no_ospf_gr_helper_enable, no_ospf_gr_helper_enable_cmd, - "no graceful-restart helper-only [A.B.C.D]", + "no graceful-restart helper enable [A.B.C.D$address]", NO_STR "OSPF Graceful Restart\n" - "Disable Helper support\n" + "OSPF GR Helper\n" + "Enable Helper support\n" + "Advertising Router-ID\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + + if (address_str) { + ospf_gr_helper_support_set_per_routerid(ospf, &address, + OSPF_GR_FALSE); + return CMD_SUCCESS; + } + + ospf_gr_helper_support_set(ospf, OSPF_GR_FALSE); + return CMD_SUCCESS; +} + +#if CONFDATE > 20220921 +CPP_NOTICE( + "Time to remove the deprecated \"[no] graceful-restart helper-only\" commands") +#endif + +DEFPY_HIDDEN(ospf_gr_helper_only, ospf_gr_helper_only_cmd, + "graceful-restart helper-only [A.B.C.D]", + "OSPF Graceful Restart\n" + "Enable Helper support\n" "Advertising router id\n") { VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); struct in_addr addr; int ret; - if (argc == 4) { - ret = inet_aton(argv[3]->arg, &addr); + vty_out(vty, + "%% This command is deprecated. Please, use `graceful-restart helper enable` instead.\n"); + + if (argc == 3) { + ret = inet_aton(argv[2]->arg, &addr); if (!ret) { vty_out(vty, "Please specify the valid routerid address.\n"); return CMD_WARNING_CONFIG_FAILED; } - ospf_gr_helper_support_set_per_routerid(ospf, &addr, - OSPF_GR_FALSE); + ospf_gr_helper_support_set_per_routerid(ospf, &addr, OSPF_GR_TRUE); return CMD_SUCCESS; } - ospf_gr_helper_support_set(ospf, OSPF_GR_FALSE); + ospf_gr_helper_support_set(ospf, OSPF_GR_TRUE); + return CMD_SUCCESS; } +ALIAS_HIDDEN(no_ospf_gr_helper_enable, + no_ospf_gr_helper_only_cmd, + "no graceful-restart helper-only [A.B.C.D]", + NO_STR + "OSPF Graceful Restart\n" + "Disable Helper support\n" + "Advertising router id\n") + DEFPY(ospf_gr_helper_enable_lsacheck, ospf_gr_helper_enable_lsacheck_cmd, "graceful-restart helper strict-lsa-checking", @@ -12259,7 +12287,7 @@ static int ospf_cfg_write_helper_dis_rtr_walkcb(struct hash_bucket *bucket, struct advRtr *rtr = bucket->data; struct vty *vty = (struct vty *)arg; - vty_out(vty, " graceful-restart helper-only %pI4\n", + vty_out(vty, " graceful-restart helper enable %pI4\n", &rtr->advRtrAddr); return HASHWALK_CONTINUE; } @@ -12279,7 +12307,7 @@ static void config_write_ospf_gr(struct vty *vty, struct ospf *ospf) static int config_write_ospf_gr_helper(struct vty *vty, struct ospf *ospf) { if (ospf->is_helper_supported) - vty_out(vty, " graceful-restart helper-only\n"); + vty_out(vty, " graceful-restart helper enable\n"); if (!ospf->strict_lsa_check) vty_out(vty, @@ -12742,6 +12770,8 @@ static void ospf_vty_zebra_init(void) /*Ospf garcefull restart helper configurations */ install_element(OSPF_NODE, &ospf_gr_helper_enable_cmd); install_element(OSPF_NODE, &no_ospf_gr_helper_enable_cmd); + install_element(OSPF_NODE, &ospf_gr_helper_only_cmd); + install_element(OSPF_NODE, &no_ospf_gr_helper_only_cmd); install_element(OSPF_NODE, &ospf_gr_helper_enable_lsacheck_cmd); install_element(OSPF_NODE, &no_ospf_gr_helper_enable_lsacheck_cmd); install_element(OSPF_NODE, &ospf_gr_helper_supported_grace_time_cmd); diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index da8916ddbf..ddba33ff9d 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -720,7 +720,7 @@ static int pim_msdp_sa_comp(const void *p1, const void *p2) /* XXX: this can use a bit of refining and extensions */ bool pim_msdp_peer_rpf_check(struct pim_msdp_peer *mp, struct in_addr rp) { - struct pim_nexthop nexthop; + struct pim_nexthop nexthop = {0}; if (mp->peer.s_addr == rp.s_addr) { return true; diff --git a/tests/lib/test_skiplist.c b/tests/lib/test_skiplist.c new file mode 100644 index 0000000000..2f9ca5eaea --- /dev/null +++ b/tests/lib/test_skiplist.c @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2021, LabN Consulting, L.L.C + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <zebra.h> +#include <skiplist.h> + +static void sl_debug(struct skiplist *l) +{ + int i; + + if (!l) + return; + + printf("Skiplist %p has max level %d\n", l, l->level); + for (i = l->level; i >= 0; --i) + printf(" @%d: %d\n", i, l->level_stats[i]); +} + +static void *scramble(int i) +{ + uintptr_t result; + + result = (uintptr_t)(i & 0xff) << 24; + result |= (uintptr_t)i >> 8; + + return (void *)result; +} +#define sampleSize 65536 +static int sl_test(void) +{ + struct skiplist *l; + register int i, k; + void *keys[sampleSize]; + void *v = NULL; + int errors = 0; + + l = skiplist_new(SKIPLIST_FLAG_ALLOW_DUPLICATES, NULL, NULL); + + printf("%s: skiplist_new returned %p\n", __func__, l); + + for (i = 0; i < 4; i++) { + + for (k = 0; k < sampleSize; k++) { + if (!(k % 10000)) + printf("%s: (%d:%d)\n", __func__, i, k); + /* keys[k] = (void *)random(); */ + keys[k] = scramble(k); + if (skiplist_insert(l, keys[k], keys[k])) { + ++errors; + printf("error in insert #%d,#%d\n", i, k); + } + } + + printf("%s: inserts done\n", __func__); + sl_debug(l); + + for (k = 0; k < sampleSize; k++) { + + if (!(k % 10000)) + printf("[%d:%d]\n", i, k); + /* keys[k] = (void *)random(); */ + if (skiplist_search(l, keys[k], &v)) { + ++errors; + printf("error in search #%d,#%d\n", i, k); + } + + if (v != keys[k]) { + ++errors; + printf("search returned wrong value\n"); + } + } + printf("%s: searches done\n", __func__); + + + for (k = 0; k < sampleSize; k++) { + + if (!(k % 10000)) + printf("<%d:%d>\n", i, k); + /* keys[k] = (void *)random(); */ + if (skiplist_delete(l, keys[k], keys[k])) { + ++errors; + printf("error in delete\n"); + } + keys[k] = scramble(k ^ 0xf0f0f0f0); + if (skiplist_insert(l, keys[k], keys[k])) { + ++errors; + printf("error in insert #%d,#%d\n", i, k); + } + } + + printf("%s: del+inserts done\n", __func__); + sl_debug(l); + + for (k = 0; k < sampleSize; k++) { + + if (!(k % 10000)) + printf("{%d:%d}\n", i, k); + /* keys[k] = (void *)random(); */ + if (skiplist_delete_first(l)) { + ++errors; + printf("error in delete_first\n"); + } + } + } + + sl_debug(l); + + skiplist_free(l); + + return errors; +} + +int main(int argc, char **argv) +{ + int errors = sl_test(); + + if (errors) + return 1; + return 0; +} diff --git a/tests/subdir.am b/tests/subdir.am index 1edfda9bc2..f21e12ecbb 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -98,6 +98,7 @@ check_PROGRAMS = \ tests/lib/test_segv \ tests/lib/test_seqlock \ tests/lib/test_sig \ + tests/lib/test_skiplist \ tests/lib/test_stream \ tests/lib/test_table \ tests/lib/test_timer_correctness \ @@ -366,6 +367,10 @@ tests_lib_test_sig_CFLAGS = $(TESTS_CFLAGS) tests_lib_test_sig_CPPFLAGS = $(TESTS_CPPFLAGS) tests_lib_test_sig_LDADD = $(ALL_TESTS_LDADD) tests_lib_test_sig_SOURCES = tests/lib/test_sig.c +tests_lib_test_skiplist_CFLAGS = $(TESTS_CFLAGS) +tests_lib_test_skiplist_CPPFLAGS = $(TESTS_CPPFLAGS) +tests_lib_test_skiplist_LDADD = $(ALL_TESTS_LDADD) +tests_lib_test_skiplist_SOURCES = tests/lib/test_skiplist.c tests_lib_test_srcdest_table_CFLAGS = $(TESTS_CFLAGS) tests_lib_test_srcdest_table_CPPFLAGS = $(TESTS_CPPFLAGS) tests_lib_test_srcdest_table_LDADD = $(ALL_TESTS_LDADD) diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index c21cbf0dd8..c425e121af 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -329,14 +329,14 @@ def __create_ospf_global(tgen, input_dict, router, build, load_config, ospf): cmd = "no {}".format(cmd) config_data.append(cmd) - if "helper-only" in gr_data and not gr_data["helper-only"]: - cmd = "graceful-restart helper-only" + if "helper enable" in gr_data and not gr_data["helper enable"]: + cmd = "graceful-restart helper enable" if gr_data.setdefault("delete", False): cmd = "no {}".format(cmd) config_data.append(cmd) - elif "helper-only" in gr_data and type(gr_data["helper-only"]) is list: - for rtrs in gr_data["helper-only"]: - cmd = "graceful-restart helper-only {}".format(rtrs) + elif "helper enable" in gr_data and type(gr_data["helper enable"]) is list: + for rtrs in gr_data["helper enable"]: + cmd = "graceful-restart helper enable {}".format(rtrs) if gr_data.setdefault("delete", False): cmd = "no {}".format(cmd) config_data.append(cmd) diff --git a/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf index 1ee1189766..9e2ad298a3 100644 --- a/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf @@ -26,5 +26,5 @@ router ospf6 ospf6 router-id 1.1.1.1 redistribute connected graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf index 6cd8d1a8e3..cfa8758344 100644 --- a/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf @@ -31,5 +31,5 @@ interface eth-rt3 router ospf6 ospf6 router-id 2.2.2.2 graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf index 6a63d8f788..f33f14f34f 100644 --- a/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf @@ -37,5 +37,5 @@ interface eth-rt6 router ospf6 ospf6 router-id 3.3.3.3 graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf index dff33d4094..301eb57e7d 100644 --- a/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf @@ -31,5 +31,5 @@ interface eth-rt5 router ospf6 ospf6 router-id 4.4.4.4 graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf index 49c3a8b86f..254fea75fc 100644 --- a/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf @@ -25,5 +25,5 @@ interface eth-rt4 router ospf6 ospf6 router-id 5.5.5.5 graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf index 5d6d3280b9..b1feb1ac57 100644 --- a/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf @@ -31,5 +31,5 @@ interface eth-rt7 router ospf6 ospf6 router-id 6.6.6.6 graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf index f504fba4de..d032741d1a 100644 --- a/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf @@ -26,5 +26,5 @@ router ospf6 ospf6 router-id 7.7.7.7 redistribute connected graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py b/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py index 4137712468..2c7c6df37e 100644 --- a/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py +++ b/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py @@ -226,7 +226,7 @@ def test_ospf_gr_helper_tc1_p0(request): step("Configure graceful restart in the DUT") ospf_gr_r0 = { - "r0": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r0": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r0) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -243,7 +243,7 @@ def test_ospf_gr_helper_tc1_p0(request): assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r1 = { - "r1": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r1": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r1) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -267,7 +267,7 @@ def test_ospf_gr_helper_tc1_p0(request): ospf_gr_r0 = { "r0": { "ospf": { - "graceful-restart": {"helper-only": [], "opaque": True, "delete": True} + "graceful-restart": {"helper enable": [], "opaque": True, "delete": True} } } } @@ -282,7 +282,7 @@ def test_ospf_gr_helper_tc1_p0(request): step("Configure gr helper using the router id") ospf_gr_r0 = { "r0": { - "ospf": {"graceful-restart": {"helper-only": ["1.1.1.1"], "opaque": True}} + "ospf": {"graceful-restart": {"helper enable": ["1.1.1.1"], "opaque": True}} } } result = create_router_ospf(tgen, topo, ospf_gr_r0) @@ -307,7 +307,7 @@ def test_ospf_gr_helper_tc1_p0(request): "r0": { "ospf": { "graceful-restart": { - "helper-only": ["1.1.1.1"], + "helper enable": ["1.1.1.1"], "opaque": True, "delete": True, } @@ -356,13 +356,13 @@ def test_ospf_gr_helper_tc2_p0(request): ospf_covergence is True ), "OSPF is not after reset config \n Error:" " {}".format(ospf_covergence) ospf_gr_r0 = { - "r0": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r0": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r0) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r1 = { - "r1": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r1": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r1) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -450,13 +450,13 @@ def test_ospf_gr_helper_tc3_p1(request): assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r0 = { - "r0": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r0": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r0) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r1 = { - "r1": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r1": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r1) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -544,13 +544,13 @@ def test_ospf_gr_helper_tc4_p1(request): assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r0 = { - "r0": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r0": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r0) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r1 = { - "r1": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r1": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r1) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -606,13 +606,13 @@ def test_ospf_gr_helper_tc7_p1(request): ospf_covergence is True ), "OSPF is not after reset config \n Error:" " {}".format(ospf_covergence) ospf_gr_r0 = { - "r0": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r0": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r0) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r1 = { - "r1": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r1": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r1) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -666,13 +666,13 @@ def test_ospf_gr_helper_tc8_p1(request): ospf_covergence is True ), "OSPF is not after reset config \n Error:" " {}".format(ospf_covergence) ospf_gr_r0 = { - "r0": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r0": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r0) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) ospf_gr_r1 = { - "r1": {"ospf": {"graceful-restart": {"helper-only": [], "opaque": True}}} + "r1": {"ospf": {"graceful-restart": {"helper enable": [], "opaque": True}}} } result = create_router_ospf(tgen, topo, ospf_gr_r1) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) diff --git a/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf index 9c04b74d35..9590a7cadf 100644 --- a/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf @@ -28,5 +28,5 @@ router ospf capability opaque redistribute connected graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf index 922db8c8cc..4f60d37b18 100644 --- a/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf @@ -33,5 +33,5 @@ router ospf router-id 2.2.2.2 capability opaque graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf index 51e48f13da..870878287d 100644 --- a/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf @@ -39,5 +39,5 @@ router ospf router-id 3.3.3.3 capability opaque graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf index a54f27a1d7..0aff1faf2c 100644 --- a/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf @@ -33,5 +33,5 @@ router ospf router-id 4.4.4.4 capability opaque graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf index 724af0e97c..4af89389a5 100644 --- a/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf @@ -27,5 +27,5 @@ router ospf router-id 5.5.5.5 capability opaque graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf index 0b9b83bcd2..2295a75fe7 100644 --- a/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf @@ -34,5 +34,5 @@ router ospf capability opaque area 3 nssa graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf index 49db254410..8534eda5a7 100644 --- a/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf +++ b/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf @@ -29,5 +29,5 @@ router ospf redistribute connected area 3 nssa graceful-restart grace-period 120 - graceful-restart helper-only + graceful-restart helper enable ! diff --git a/tools/valgrind.supp b/tools/valgrind.supp index fbfb640b2a..88f46bf575 100644 --- a/tools/valgrind.supp +++ b/tools/valgrind.supp @@ -30,3 +30,51 @@ ... fun:sqlite3_step } +{ + <libyang2 prefix_data stuff> + Memcheck:Leak + fun:calloc + fun:ly_store_prefix_data + ... + fun:yang_module_load +} +{ + <libyang2 lys_compile_type_union> + Memcheck:Leak + fun:realloc + fun:lys_compile_type_union + ... + fun:yang_module_load +} +{ + <libyang2 pcre2_compile> + Memcheck:Leak + fun:malloc + fun:pcre2_compile_8 + ... + fun:yang_module_load +} +{ + <libyang2 lys_compile_type_patterns malloc> + Memcheck:Leak + fun:malloc + fun:lys_compile_type_patterns + ... + fun:yang_module_load +} +{ + <libyang2 lys_compile_type_patterns calloc> + Memcheck:Leak + fun:calloc + fun:lys_compile_type_patterns + ... + fun:yang_module_load +} +{ + <libyang2 lys_compile_type> + Memcheck:Leak + fun:calloc + fun:lys_compile_type + ... + fun:yang_module_load +} diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index b74360c75f..beb7045a7d 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -602,7 +602,8 @@ static int vtysh_execute_func(const char *line, int pager) fprintf(stderr, "%s is not running\n", vtysh_client[i].name); - continue; + cmd_stat = CMD_ERR_NO_DAEMON; + break; } } cmd_stat = vtysh_client_execute( @@ -611,7 +612,7 @@ static int vtysh_execute_func(const char *line, int pager) break; } } - if (cmd_stat != CMD_SUCCESS) + if (cmd_stat != CMD_SUCCESS && cmd_stat != CMD_ERR_NO_DAEMON) break; if (cmd->func) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index acd6697b65..28a64407e5 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -1103,16 +1103,6 @@ int interface_lookup_netlink(struct zebra_ns *zns) if (ret < 0) return ret; - /* Get interface information - for bridge interfaces. */ - ret = netlink_request_intf_addr(netlink_cmd, AF_BRIDGE, RTM_GETLINK, - RTEXT_FILTER_BRVLAN); - if (ret < 0) - return ret; - ret = netlink_parse_info(netlink_interface, netlink_cmd, &dp_info, 0, - 0); - if (ret < 0) - return ret; - /* fixup linkages */ zebra_if_update_all_links(zns); return 0; |
