diff options
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_abr.c | 24 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_flood.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_intra.c | 8 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.c | 15 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.h | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_main.c | 1 | ||||
| -rw-r--r-- | ospf6d/ospf6_message.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 13 | ||||
| -rw-r--r-- | ospf6d/ospf6_zebra.c | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6d.c | 8 |
13 files changed, 73 insertions, 42 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index ead186b6fc..1f6cc9d527 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -1200,9 +1200,23 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) listcount(old_route->nh_list)); } } else { - /* adv. router exists in the list, update the nhs */ - list_delete_all_node(o_path->nh_list); - ospf6_copy_nexthops(o_path->nh_list, route->nh_list); + struct ospf6_route *tmp_route = ospf6_route_create(); + + ospf6_copy_nexthops(tmp_route->nh_list, + o_path->nh_list); + + if (ospf6_route_cmp_nexthops(tmp_route, route) != 0) { + /* adv. router exists in the list, update nhs */ + list_delete_all_node(o_path->nh_list); + ospf6_copy_nexthops(o_path->nh_list, + route->nh_list); + ospf6_route_delete(tmp_route); + } else { + /* adv. router has no change in nhs */ + old_entry_updated = false; + ospf6_route_delete(tmp_route); + continue; + } } if (is_debug) @@ -1427,7 +1441,7 @@ void install_element_ospf6_debug_abr(void) install_element(CONFIG_NODE, &no_debug_ospf6_abr_cmd); } -static const struct ospf6_lsa_handler inter_prefix_handler = { +static struct ospf6_lsa_handler inter_prefix_handler = { .lh_type = OSPF6_LSTYPE_INTER_PREFIX, .lh_name = "Inter-Prefix", .lh_short_name = "IAP", @@ -1435,7 +1449,7 @@ static const struct ospf6_lsa_handler inter_prefix_handler = { .lh_get_prefix_str = ospf6_inter_area_prefix_lsa_get_prefix_str, .lh_debug = 0}; -static const struct ospf6_lsa_handler inter_router_handler = { +static struct ospf6_lsa_handler inter_router_handler = { .lh_type = OSPF6_LSTYPE_INTER_ROUTER, .lh_name = "Inter-Router", .lh_short_name = "IAR", diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 805e411c7b..6e71a21bd5 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -918,8 +918,8 @@ void ospf6_asbr_distribute_list_update(int type) ZROUTE_NAME(type)); ospf6->t_distribute_update = NULL; - thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, - (void **)args, OSPF_MIN_LS_INTERVAL, + thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, args, + OSPF_MIN_LS_INTERVAL, &ospf6->t_distribute_update); } @@ -1853,7 +1853,7 @@ DEFUN (show_ipv6_ospf6_redistribute, return CMD_SUCCESS; } -static const struct ospf6_lsa_handler as_external_handler = { +static struct ospf6_lsa_handler as_external_handler = { .lh_type = OSPF6_LSTYPE_AS_EXTERNAL, .lh_name = "AS-External", .lh_short_name = "ASE", diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 85d02c186b..b144c6804e 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -332,11 +332,12 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, if (req == on->last_ls_req) { /* sanity check refcount */ assert(req->lock >= 2); - ospf6_lsa_unlock(req); + req = ospf6_lsa_unlock(req); on->last_ls_req = NULL; } - ospf6_lsdb_remove(req, - on->request_list); + if (req) + ospf6_lsdb_remove( + req, on->request_list); ospf6_check_nbr_loading(on); continue; } @@ -348,7 +349,7 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, zlog_debug( "Received is newer, remove requesting"); if (req == on->last_ls_req) { - ospf6_lsa_unlock(req); + req = ospf6_lsa_unlock(req); on->last_ls_req = NULL; } if (req) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 93265afc43..1209997514 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1943,8 +1943,13 @@ static int config_write_ospf6_interface(struct vty *vty) return 0; } +static int config_write_ospf6_interface(struct vty *vty); static struct cmd_node interface_node = { - INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */ + .name = "interface", + .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-if)# ", + .config_write = config_write_ospf6_interface, }; static int ospf6_ifp_create(struct interface *ifp) @@ -2001,7 +2006,7 @@ static int ospf6_ifp_destroy(struct interface *ifp) void ospf6_interface_init(void) { /* Install interface node. */ - install_node(&interface_node, config_write_ospf6_interface); + install_node(&interface_node); if_cmd_init(); if_zapi_callbacks(ospf6_ifp_create, ospf6_ifp_up, ospf6_ifp_down, ospf6_ifp_destroy); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 9c239b75ff..b700899ccf 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -2235,7 +2235,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) __func__, oa->name); } -static const struct ospf6_lsa_handler router_handler = { +static struct ospf6_lsa_handler router_handler = { .lh_type = OSPF6_LSTYPE_ROUTER, .lh_name = "Router", .lh_short_name = "Rtr", @@ -2243,7 +2243,7 @@ static const struct ospf6_lsa_handler router_handler = { .lh_get_prefix_str = ospf6_router_lsa_get_nbr_id, .lh_debug = 0}; -static const struct ospf6_lsa_handler network_handler = { +static struct ospf6_lsa_handler network_handler = { .lh_type = OSPF6_LSTYPE_NETWORK, .lh_name = "Network", .lh_short_name = "Net", @@ -2251,7 +2251,7 @@ static const struct ospf6_lsa_handler network_handler = { .lh_get_prefix_str = ospf6_network_lsa_get_ar_id, .lh_debug = 0}; -static const struct ospf6_lsa_handler link_handler = { +static struct ospf6_lsa_handler link_handler = { .lh_type = OSPF6_LSTYPE_LINK, .lh_name = "Link", .lh_short_name = "Lnk", @@ -2259,7 +2259,7 @@ static const struct ospf6_lsa_handler link_handler = { .lh_get_prefix_str = ospf6_link_lsa_get_prefix_str, .lh_debug = 0}; -static const struct ospf6_lsa_handler intra_prefix_handler = { +static struct ospf6_lsa_handler intra_prefix_handler = { .lh_type = OSPF6_LSTYPE_INTRA_PREFIX, .lh_name = "Intra-Prefix", .lh_short_name = "INP", diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 9acbd09b1a..aa32fae6ad 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -77,16 +77,16 @@ static struct ospf6_lsa_handler unknown_handler = { .lh_debug = 0 /* No default debug */ }; -void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler) +void ospf6_install_lsa_handler(struct ospf6_lsa_handler *handler) { /* type in handler is host byte order */ int index = handler->lh_type & OSPF6_LSTYPE_FCODE_MASK; vector_set_index(ospf6_lsa_handler_vector, index, (void *)handler); } -const struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type) +struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type) { - const struct ospf6_lsa_handler *handler = NULL; + struct ospf6_lsa_handler *handler = NULL; unsigned int index = ntohs(type) & OSPF6_LSTYPE_FCODE_MASK; if (index >= vector_active(ospf6_lsa_handler_vector)) @@ -527,7 +527,7 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header) /* allocate memory */ lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa)); - lsa->header = (struct ospf6_lsa_header *)new_header; + lsa->header = new_header; /* dump string */ ospf6_lsa_printbuf(lsa, lsa->name, sizeof(lsa->name)); @@ -554,7 +554,7 @@ struct ospf6_lsa *ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header) /* allocate memory */ lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa)); - lsa->header = (struct ospf6_lsa_header *)new_header; + lsa->header = new_header; SET_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY); /* dump string */ @@ -608,16 +608,17 @@ void ospf6_lsa_lock(struct ospf6_lsa *lsa) } /* decrement reference counter of struct ospf6_lsa */ -void ospf6_lsa_unlock(struct ospf6_lsa *lsa) +struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa) { /* decrement reference counter */ assert(lsa->lock > 0); lsa->lock--; if (lsa->lock != 0) - return; + return lsa; ospf6_lsa_delete(lsa); + return NULL; } diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index d871a8842e..5519dd1b80 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -227,7 +227,7 @@ extern void ospf6_lsa_delete(struct ospf6_lsa *lsa); extern struct ospf6_lsa *ospf6_lsa_copy(struct ospf6_lsa *); extern void ospf6_lsa_lock(struct ospf6_lsa *); -extern void ospf6_lsa_unlock(struct ospf6_lsa *); +extern struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *); extern int ospf6_lsa_expire(struct thread *); extern int ospf6_lsa_refresh(struct thread *); @@ -237,8 +237,8 @@ extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *); extern int ospf6_lsa_prohibited_duration(uint16_t type, uint32_t id, uint32_t adv_router, void *scope); -extern void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler); -extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type); +extern void ospf6_install_lsa_handler(struct ospf6_lsa_handler *handler); +extern struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type); extern void ospf6_lsa_init(void); extern void ospf6_lsa_terminate(void); diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index e4bed7a79d..4dbe5ca321 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -168,6 +168,7 @@ struct quagga_signal_t ospf6_signals[] = { static const struct frr_yang_module_info *const ospf6d_yang_modules[] = { &frr_interface_info, &frr_route_map_info, + &frr_vrf_info, }; FRR_DAEMON_INFO(ospf6d, OSPF6, .vty_port = OSPF6_VTY_PORT, diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 21f9b0722c..31862a2298 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1948,9 +1948,9 @@ int ospf6_lsreq_send(struct thread *thread) } if (last_req != NULL) { - if (on->last_ls_req != NULL) { - ospf6_lsa_unlock(on->last_ls_req); - } + if (on->last_ls_req != NULL) + on->last_ls_req = ospf6_lsa_unlock(on->last_ls_req); + ospf6_lsa_lock(last_req); on->last_ls_req = last_req; } diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index b0fe890d33..80bff5795f 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -989,7 +989,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, rtr_lsa = ospf6_lsdb_next(end, rtr_lsa); continue; } - lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; + lsa_header = rtr_lsa->header; total_lsa_length += (ntohs(lsa_header->length) - lsa_length); num_lsa++; rtr_lsa = ospf6_lsdb_next(end, rtr_lsa); @@ -1027,7 +1027,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, assert(rtr_lsa); if (!OSPF6_LSA_IS_MAXAGE(rtr_lsa)) { /* Append first Link State ID LSA */ - lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; + lsa_header = rtr_lsa->header; memcpy(new_header, lsa_header, ntohs(lsa_header->length)); /* Assign new lsa length as aggregated length. */ ((struct ospf6_lsa_header *)new_header)->length = @@ -1057,7 +1057,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, } /* Append Next Link State ID LSA */ - lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; + lsa_header = rtr_lsa->header; memcpy(new_header, (OSPF6_LSA_HEADER_END(rtr_lsa->header) + 4), (ntohs(lsa_header->length) - lsa_length)); new_header += (ntohs(lsa_header->length) - lsa_length); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 96eee51929..dd672dd1c5 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -52,8 +52,8 @@ DEFINE_QOBJ_TYPE(ospf6) FRR_CFG_DEFAULT_BOOL(OSPF6_LOG_ADJACENCY_CHANGES, - { .val_long = true, .match_profile = "datacenter", }, - { .val_long = false }, + { .val_bool = true, .match_profile = "datacenter", }, + { .val_bool = false }, ) /* global ospf6d variable */ @@ -1112,16 +1112,21 @@ static int config_write_ospf6(struct vty *vty) return 0; } +static int config_write_ospf6(struct vty *vty); /* OSPF6 node structure. */ static struct cmd_node ospf6_node = { - OSPF6_NODE, "%s(config-ospf6)# ", 1 /* VTYSH */ + .name = "ospf6", + .node = OSPF6_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-ospf6)# ", + .config_write = config_write_ospf6, }; /* Install ospf related commands. */ void ospf6_top_init(void) { /* Install ospf6 top node. */ - install_node(&ospf6_node, config_write_ospf6); + install_node(&ospf6_node); install_element(VIEW_NODE, &show_ipv6_ospf6_cmd); install_element(CONFIG_NODE, &router_ospf6_cmd); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index f8df37094f..2773a666a3 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -171,8 +171,8 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128]; - prefix2str((struct prefix *)&api.prefix, prefixstr, - sizeof(prefixstr)); + + prefix2str(&api.prefix, prefixstr, sizeof(prefixstr)); inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr)); zlog_debug( diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index db61fe087b..17e33902d9 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -69,8 +69,12 @@ struct route_node *route_prev(struct route_node *node) return prev; } +static int config_write_ospf6_debug(struct vty *vty); static struct cmd_node debug_node = { - DEBUG_NODE, "", 1 /* VTYSH */ + .name = "debug", + .node = DEBUG_NODE, + .prompt = "", + .config_write = config_write_ospf6_debug, }; static int config_write_ospf6_debug(struct vty *vty) @@ -1216,7 +1220,7 @@ void ospf6_init(void) prefix_list_delete_hook(ospf6_plist_del); ospf6_bfd_init(); - install_node(&debug_node, config_write_ospf6_debug); + install_node(&debug_node); install_element_ospf6_debug_message(); install_element_ospf6_debug_lsa(); |
