diff options
| author | David Lamparter <equinox@diac24.net> | 2016-12-07 17:15:32 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2016-12-09 17:36:25 +0100 |
| commit | cdc2d7650764bda9b84c3a1c43f26b83fdcb767c (patch) | |
| tree | 4a6391d630d7d140b31a4bc4dc5bc89c749614eb /ospf6d | |
| parent | 3c5070bec0a64918ae87b0992221b8e6c98ff136 (diff) | |
*: coccinelle-replace vty->index
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 29 | ||||
| -rw-r--r-- | ospf6d/ospf6_bfd.c | 11 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 71 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 38 |
5 files changed, 59 insertions, 92 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index c00445e34a..d31b4b95b4 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1103,8 +1103,9 @@ DEFUN (ospf6_routemap_match_address_prefixlist, "Match entries of prefix-lists\n" "IPv6 prefix-list name\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_word = 4; - int ret = route_map_add_match ((struct route_map_index *) vty->index, + int ret = route_map_add_match (route_map_index, "ipv6 address prefix-list", argv[idx_word]->arg); return route_map_command_status (vty, ret); } @@ -1120,8 +1121,9 @@ DEFUN (ospf6_routemap_no_match_address_prefixlist, "Match entries of prefix-lists\n" "IPv6 prefix-list name\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_word = 5; - int ret = route_map_delete_match ((struct route_map_index *) vty->index, + int ret = route_map_delete_match (route_map_index, "ipv6 address prefix-list", argv[idx_word]->arg); return route_map_command_status (vty, ret); } @@ -1134,8 +1136,9 @@ DEFUN (ospf6_routemap_match_interface, "Match first hop interface of route\n" "Interface name\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_word = 2; - return route_map_add_match ((struct route_map_index *) vty->index, + return route_map_add_match (route_map_index, "interface", argv[idx_word]->arg); } @@ -1148,14 +1151,15 @@ DEFUN (ospf6_routemap_no_match_interface, "Match first hop interface of route\n" "Interface name\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_word = 3; int ret; if (argc == 4) - ret = route_map_delete_match ((struct route_map_index *) vty->index, + ret = route_map_delete_match (route_map_index, "interface", argv[idx_word]->arg); else - ret = route_map_delete_match ((struct route_map_index *) vty->index, + ret = route_map_delete_match (route_map_index, "interface", NULL); return route_map_command_status (vty, ret); } @@ -1169,8 +1173,9 @@ DEFUN (ospf6_routemap_set_metric_type, "OSPF6 external type 1 metric\n" "OSPF6 external type 2 metric\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_external = 2; - int ret = route_map_add_set ((struct route_map_index *) vty->index, + int ret = route_map_add_set (route_map_index, "metric-type", argv[idx_external]->arg); return route_map_command_status (vty, ret); } @@ -1185,8 +1190,9 @@ DEFUN (ospf6_routemap_no_set_metric_type, "OSPF6 external type 1 metric\n" "OSPF6 external type 2 metric\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_external = 3; - int ret = route_map_delete_set ((struct route_map_index *) vty->index, + int ret = route_map_delete_set (route_map_index, "metric-type", argv[idx_external]->arg); return route_map_command_status (vty, ret); } @@ -1199,8 +1205,9 @@ DEFUN (ospf6_routemap_set_forwarding, "Forwarding Address\n" "IPv6 Address\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_ipv6 = 2; - int ret = route_map_add_set ((struct route_map_index *) vty->index, + int ret = route_map_add_set (route_map_index, "forwarding-address", argv[idx_ipv6]->arg); return route_map_command_status (vty, ret); } @@ -1214,8 +1221,9 @@ DEFUN (ospf6_routemap_no_set_forwarding, "Forwarding Address\n" "IPv6 Address\n") { + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); int idx_ipv6 = 3; - int ret = route_map_delete_set ((struct route_map_index *) vty->index, + int ret = route_map_delete_set (route_map_index, "forwarding-address", argv[idx_ipv6]->arg); return route_map_command_status (vty, ret); } @@ -1228,7 +1236,8 @@ DEFUN (ospf6_routemap_set_tag, "Tag value for routing protocol\n" "Tag value\n") { - int ret = route_map_add_set ((struct route_map_index *) vty->index, + VTY_DECLVAR_CONTEXT(route_map_index, route_map_index); + int ret = route_map_add_set (route_map_index, "tag", argv[2]->arg); return route_map_command_status (vty, ret); } diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index ffbefd139d..28126918b5 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -328,10 +328,8 @@ DEFUN (ipv6_ospf6_bfd, "Enables BFD support\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -354,17 +352,16 @@ DEFUN (ipv6_ospf6_bfd_param, "Required min receive interval\n" "Desired min transmit interval\n") { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 5; struct ospf6_interface *oi; - struct interface *ifp; u_int32_t rx_val; u_int32_t tx_val; u_int8_t dm_val; int ret; - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -390,10 +387,8 @@ DEFUN (no_ipv6_ospf6_bfd, "Disables BFD support\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index dd63f00c7e..0ed8d30a8b 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1102,14 +1102,13 @@ DEFUN (ipv6_ospf6_ifmtu, "OSPFv3 Interface MTU\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; unsigned int ifmtu, iobuflen; struct listnode *node, *nnode; struct ospf6_neighbor *on; - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1163,13 +1162,12 @@ DEFUN (no_ipv6_ospf6_ifmtu, "Interface MTU\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; unsigned int iobuflen; struct listnode *node, *nnode; struct ospf6_neighbor *on; - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1211,12 +1209,11 @@ DEFUN (ipv6_ospf6_cost, "Outgoing metric of this interface\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; unsigned long int lcost; - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1252,10 +1249,8 @@ DEFUN (no_ipv6_ospf6_cost, "Calculate interface cost from bandwidth\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1277,8 +1272,8 @@ DEFUN (auto_cost_reference_bandwidth, "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n") { + VTY_DECLVAR_CONTEXT(ospf6, o); int idx_number = 2; - struct ospf6 *o = vty->index; struct ospf6_area *oa; struct ospf6_interface *oi; struct listnode *i, *j; @@ -1311,7 +1306,7 @@ DEFUN (no_auto_cost_reference_bandwidth, "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); struct ospf6_area *oa; struct ospf6_interface *oi; struct listnode *i, *j; @@ -1337,11 +1332,9 @@ DEFUN (ipv6_ospf6_hellointerval, SECONDS_STR ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1363,11 +1356,9 @@ DEFUN (ipv6_ospf6_deadinterval, SECONDS_STR ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1388,11 +1379,9 @@ DEFUN (ipv6_ospf6_transmitdelay, "Link state transmit delay\n" SECONDS_STR) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1414,11 +1403,9 @@ DEFUN (ipv6_ospf6_retransmitinterval, SECONDS_STR ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1440,11 +1427,9 @@ DEFUN (ipv6_ospf6_priority, "Priority value\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1472,11 +1457,9 @@ DEFUN (ipv6_ospf6_instance, "Instance ID value\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *)vty->index; assert (ifp); oi = (struct ospf6_interface *)ifp->info; @@ -1496,12 +1479,11 @@ DEFUN (ipv6_ospf6_passive, "Passive interface; no adjacency will be formed on this interface\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; struct listnode *node, *nnode; struct ospf6_neighbor *on; - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1530,10 +1512,8 @@ DEFUN (no_ipv6_ospf6_passive, "passive interface: No Adjacency will be formed on this I/F\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1557,10 +1537,8 @@ DEFUN (ipv6_ospf6_mtu_ignore, "Disable MTU mismatch detection on this interface\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1582,10 +1560,8 @@ DEFUN (no_ipv6_ospf6_mtu_ignore, "Disable MTU mismatch detection on this interface\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1608,11 +1584,9 @@ DEFUN (ipv6_ospf6_advertise_prefix_list, "Prefix list name\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_word = 4; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1650,10 +1624,8 @@ DEFUN (no_ipv6_ospf6_advertise_prefix_list, "Filter prefix using prefix-list\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1693,11 +1665,9 @@ DEFUN (ipv6_ospf6_network, "Specify OSPF6 point-to-point network\n" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); int idx_network = 3; struct ospf6_interface *oi; - struct interface *ifp; - - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; @@ -1738,11 +1708,10 @@ DEFUN (no_ipv6_ospf6_network, "Default to whatever interface type system specifies" ) { + VTY_DECLVAR_CONTEXT(interface, ifp); struct ospf6_interface *oi; - struct interface *ifp; int type; - ifp = (struct interface *) vty->index; assert (ifp); oi = (struct ospf6_interface *) ifp->info; diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index df8925c453..04519e7d46 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -866,7 +866,7 @@ ospf6_timers_spf_set (struct vty *vty, unsigned int delay, unsigned int hold, unsigned int max) { - struct ospf6 *ospf = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, ospf); ospf->spf_delay = delay; ospf->spf_holdtime = hold; diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 238053231a..32d7a33912 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -298,8 +298,7 @@ DEFUN (router_ospf6, ospf6 = ospf6_create (); /* set current ospf point. */ - vty->node = OSPF6_NODE; - vty->index = ospf6; + VTY_PUSH_CONTEXT(OSPF6_NODE, ospf6); return CMD_SUCCESS; } @@ -313,8 +312,7 @@ DEFUN (no_router_ospf6, OSPF6_STR) { /* return to config node . */ - vty->node = CONFIG_NODE; - vty->index = NULL; + VTY_PUSH_CONTEXT_NULL(CONFIG_NODE); return CMD_SUCCESS; } @@ -326,12 +324,10 @@ DEFUN (ospf6_router_id, "Configure OSPF Router-ID\n" V4NOTATION_STR) { + VTY_DECLVAR_CONTEXT(ospf6, o); int idx_ipv4 = 1; int ret; u_int32_t router_id; - struct ospf6 *o; - - o = (struct ospf6 *) vty->index; ret = inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id); if (ret == 0) @@ -352,7 +348,7 @@ DEFUN (ospf6_log_adjacency_changes, "log-adjacency-changes", "Log changes in adjacency state\n") { - struct ospf6 *ospf6 = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES); UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL); @@ -365,7 +361,7 @@ DEFUN (ospf6_log_adjacency_changes_detail, "Log changes in adjacency state\n" "Log all state changes\n") { - struct ospf6 *ospf6 = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES); SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL); @@ -378,7 +374,7 @@ DEFUN (no_ospf6_log_adjacency_changes, NO_STR "Log changes in adjacency state\n") { - struct ospf6 *ospf6 = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL); UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES); @@ -392,7 +388,7 @@ DEFUN (no_ospf6_log_adjacency_changes_detail, "Log changes in adjacency state\n" "Log all state changes\n") { - struct ospf6 *ospf6 = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL); UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES); @@ -407,9 +403,9 @@ DEFUN (ospf6_timers_lsa, "Minimum delay in receiving new version of a LSA\n" "Delay in milliseconds\n") { + VTY_DECLVAR_CONTEXT(ospf6, ospf); int idx_number = 3; unsigned int minarrival; - struct ospf6 *ospf = vty->index; if (!ospf) return CMD_SUCCESS; @@ -429,9 +425,9 @@ DEFUN (no_ospf6_timers_lsa, "Minimum delay in receiving new version of a LSA\n" "Delay in milliseconds\n") { + VTY_DECLVAR_CONTEXT(ospf6, ospf); int idx_number = 4; unsigned int minarrival; - struct ospf6 *ospf = vty->index; if (!ospf) return CMD_SUCCESS; @@ -457,7 +453,7 @@ DEFUN (ospf6_distance, "Administrative distance\n" "OSPF6 Administrative distance\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); o->distance_all = atoi (argv[1]->arg); @@ -471,7 +467,7 @@ DEFUN (no_ospf6_distance, "Administrative distance\n" "OSPF6 Administrative distance\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); o->distance_all = 0; @@ -502,7 +498,7 @@ DEFUN (ospf6_distance_ospf6, "External routes\n" "Distance for external routes\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); char *intra, *inter, *external; intra = inter = external = NULL; @@ -572,7 +568,7 @@ DEFUN (no_ospf6_distance_ospf6, "External routes\n" "Distance for external routes\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); char *intra, *inter, *external; intra = inter = external = NULL; @@ -636,7 +632,7 @@ DEFUN (ospf6_distance_source, "IP source prefix\n" "Access list name\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); char *alname = (argc == 4) ? argv[3]->arg : NULL; ospf6_distance_set (vty, o, argv[1]->arg, argv[2]->arg, alname); @@ -652,7 +648,7 @@ DEFUN (no_ospf6_distance_source, "IP source prefix\n" "Access list name\n") { - struct ospf6 *o = vty->index; + VTY_DECLVAR_CONTEXT(ospf6, o); char *alname = (argc == 5) ? argv[4]->arg : NULL; ospf6_distance_unset (vty, o, argv[2]->arg, argv[3]->arg, alname); @@ -669,16 +665,14 @@ DEFUN (ospf6_interface_area, "OSPF6 area ID in IPv4 address notation\n" ) { + VTY_DECLVAR_CONTEXT(ospf6, o); int idx_ifname = 1; int idx_ipv4 = 3; - struct ospf6 *o; struct ospf6_area *oa; struct ospf6_interface *oi; struct interface *ifp; u_int32_t area_id; - o = (struct ospf6 *) vty->index; - /* find/create ospf6 interface */ ifp = if_get_by_name (argv[idx_ifname]->arg); oi = (struct ospf6_interface *) ifp->info; |
