diff options
Diffstat (limited to 'bgpd/rfapi/bgp_rfapi_cfg.c')
| -rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 52c5267bf5..4e8325b709 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -297,7 +297,7 @@ DEFUN (vnc_advertise_un_method, "Via Encapsulation SAFI\n" "Via Tunnel Encap attribute (in VPN SAFI)\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -386,7 +386,7 @@ DEFUN (vnc_defaults_rt_import, "Import filter\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); @@ -403,7 +403,7 @@ DEFUN (vnc_defaults_rt_export, "Export filter\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); @@ -420,8 +420,8 @@ DEFUN (vnc_defaults_rt_both, "Export+import filters\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); int rc; - struct bgp *bgp = vty->index; if (!bgp) { @@ -442,9 +442,9 @@ DEFUN (vnc_defaults_rd, "Specify default route distinguisher\n" "Route Distinguisher (<as-number>:<number> | <ip-address>:<number> | auto:vn:<number> )\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); int ret; struct prefix_rd prd; - struct bgp *bgp = vty->index; if (!bgp) { @@ -505,7 +505,7 @@ DEFUN (vnc_defaults_l2rd, "Fixed value 1-255\n" "use the low-order octet of the NVE's VN address\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); uint8_t value = 0; if (!bgp) @@ -550,7 +550,7 @@ DEFUN (vnc_defaults_no_l2rd, NO_STR "Specify default Local Nve ID value to use in RD for L2 routes\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -570,8 +570,8 @@ DEFUN (vnc_defaults_responselifetime, "Specify default response lifetime\n" "Response lifetime in seconds\n" "Infinite response lifetime\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); uint32_t rspint; - struct bgp *bgp = vty->index; struct rfapi *h = NULL; struct listnode *hdnode; struct rfapi_descriptor *rfd; @@ -830,7 +830,7 @@ DEFUN (vnc_redistribute_rh_roo_localadmin, "Resolve-NVE mode\n" "Route Origin Extended Community Local Admin Field\n" "Field value\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); uint32_t localadmin; char *endptr; @@ -892,7 +892,7 @@ DEFUN (vnc_redistribute_mode, "Based on redistribute nve-group\n" "Unmodified\n" "Resolve each nexthop to connected NVEs\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); vnc_redist_mode_t newmode; if (!bgp) @@ -951,8 +951,8 @@ DEFUN (vnc_redistribute_protocol, "From Open Shortest Path First (OSPF)\n" "From Routing Information Protocol (RIP)\n" "From Static routes\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); int type = ZEBRA_ROUTE_MAX; /* init to bogus value */ - struct bgp *bgp = vty->index; afi_t afi; if (!bgp) @@ -1004,8 +1004,8 @@ DEFUN (vnc_no_redistribute_protocol, "From Open Shortest Path First (OSPF)\n" "From Routing Information Protocol (RIP)\n" "From Static routes\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); int type; - struct bgp *bgp = vty->index; afi_t afi; if (!bgp) @@ -1050,8 +1050,8 @@ DEFUN (vnc_redistribute_bgp_exterior, "From BGP without Zebra, only to configured NVE groups\n" "From BGP view\n" "BGP view name\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); int type; - struct bgp *bgp = vty->index; afi_t afi; if (!bgp) @@ -1089,7 +1089,7 @@ DEFUN (vnc_redistribute_nvegroup, "Assign a NVE group to routes redistributed from another routing protocol\n" "NVE group\n" "Group name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -1127,7 +1127,7 @@ DEFUN (vnc_redistribute_no_nvegroup, "Redistribute from other protocol\n" "Assign a NVE group to routes redistributed from another routing protocol\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -1161,7 +1161,7 @@ DEFUN (vnc_redistribute_lifetime, "Assign a lifetime to routes redistributed from another routing protocol\n" "lifetime value (32 bit)\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -1205,7 +1205,7 @@ DEFUN (vnc_redist_bgpdirect_no_prefixlist, "IPv4 routes\n" "IPv6 routes\n" "Prefix-list for filtering redistributed routes\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); afi_t afi; struct rfapi_cfg *hc; uint8_t route_type = 0; @@ -1264,7 +1264,7 @@ DEFUN (vnc_redist_bgpdirect_prefixlist, "Prefix-list for filtering redistributed routes\n" "prefix list name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; afi_t afi; uint8_t route_type = 0; @@ -1321,7 +1321,7 @@ DEFUN (vnc_redist_bgpdirect_no_routemap, "Redistribute from BGP without Zebra, only to configured NVE groups\n" "Route-map for filtering redistributed routes\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; uint8_t route_type = 0; @@ -1367,7 +1367,7 @@ DEFUN (vnc_redist_bgpdirect_routemap, "Redistribute from BGP without Zebra, only to configured NVE groups\n" "Route-map for filtering exported routes\n" "route map name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; uint8_t route_type = 0; @@ -1418,7 +1418,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_prefixlist, "IPv4 routes\n" "IPv6 routes\n" "Prefix-list for filtering redistributed routes\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg) afi_t afi; @@ -1473,7 +1473,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist, "Prefix-list for filtering redistributed routes\n" "prefix list name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); afi_t afi; @@ -1528,7 +1528,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_routemap, "Disable redistribute filter\n" "Route-map for filtering redistributed routes\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) @@ -1570,7 +1570,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_routemap, "Redistribute from BGP directly\n" "Route-map for filtering exported routes\n" "route map name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) @@ -1624,7 +1624,7 @@ DEFUN (vnc_export_mode, "Export routes with NVE connected router next-hops\n" "Disable export\n" "Export routes with registering NVE as next-hop\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); uint32_t oldmode = 0; uint32_t newmode = 0; @@ -1753,7 +1753,7 @@ DEFUN (vnc_export_nvegroup, "NVE group, used in 'group-nve' export mode\n" "NVE group\n" "Group name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_nve_group_cfg *rfg_new; if (!bgp) @@ -1860,7 +1860,7 @@ DEFUN (vnc_no_export_nvegroup, "NVE group, used in 'group-nve' export mode\n" "Disable export of VNC routes\n" "NVE group\n" "Group name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct listnode *node, *nnode; struct rfapi_rfg_name *rfgn; @@ -1927,7 +1927,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist, "IPv6 routes\n" "Prefix-list for filtering exported routes\n" "prefix list name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); afi_t afi; @@ -2002,7 +2002,7 @@ DEFUN (vnc_nve_group_export_prefixlist, "IPv6 routes\n" "Prefix-list for filtering exported routes\n" "prefix list name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); afi_t afi; @@ -2066,7 +2066,7 @@ DEFUN (vnc_nve_group_export_no_routemap, "Export to Zebra (experimental)\n" "Route-map for filtering exported routes\n" "route map name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) @@ -2131,7 +2131,7 @@ DEFUN (vnc_nve_group_export_routemap, "Export to Zebra (experimental)\n" "Route-map for filtering exported routes\n" "route map name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) @@ -2187,7 +2187,7 @@ DEFUN (vnc_nve_export_no_prefixlist, "IPv6 prefixes\n" "Prefix-list for filtering exported routes\n" "Prefix list name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; afi_t afi; @@ -2255,7 +2255,7 @@ DEFUN (vnc_nve_export_prefixlist, "IPv6 prefixes\n" "Prefix-list for filtering exported routes\n" "Prefix list name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; afi_t afi; @@ -2309,7 +2309,7 @@ DEFUN (vnc_nve_export_no_routemap, "Export to Zebra (experimental)\n" "Route-map for filtering exported routes\n" "Route map name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; if (!bgp) @@ -2367,7 +2367,7 @@ DEFUN (vnc_nve_export_routemap, "Filters, used in 'registering-nve' export mode\n" "Route-map for filtering exported routes\n" "Route map name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_cfg *hc; if (!bgp) @@ -2611,8 +2611,8 @@ DEFUN (vnc_nve_group, "vnc nve-group NAME", VNC_CONFIG_STR "Configure a NVE group\n" "Group name\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_nve_group_cfg *rfg; - struct bgp *bgp = vty->index; struct listnode *node, *nnode; struct rfapi_rfg_name *rfgn; @@ -2911,7 +2911,7 @@ DEFUN (vnc_no_nve_group, "Configure a NVE group\n" "Group name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -2930,6 +2930,7 @@ DEFUN (vnc_nve_group_prefix, "IPv4 prefix\n" "IPv6 prefix\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct prefix p; int afi; @@ -2937,8 +2938,6 @@ DEFUN (vnc_nve_group_prefix, struct route_node *rn; int is_un_prefix = 0; - struct bgp *bgp = vty->index; - if (!bgp) { vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); @@ -3056,8 +3055,8 @@ DEFUN (vnc_nve_group_rt_import, "Import filter\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; int rc; struct listnode *node; struct rfapi_rfg_name *rfgn; @@ -3132,8 +3131,8 @@ DEFUN (vnc_nve_group_rt_export, "Export filter\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; int rc; if (!bgp) @@ -3172,8 +3171,8 @@ DEFUN (vnc_nve_group_rt_both, "Export+import filters\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; int rc; int is_export_bgp = 0; int is_export_zebra = 0; @@ -3264,8 +3263,8 @@ DEFUN (vnc_nve_group_l2rd, "Fixed value 1-255\n" "use the low-order octet of the NVE's VN address\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; if (!bgp) { @@ -3318,8 +3317,8 @@ DEFUN (vnc_nve_group_no_l2rd, NO_STR "Specify default Local Nve ID value to use in RD for L2 routes\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; if (!bgp) { @@ -3347,10 +3346,10 @@ DEFUN (vnc_nve_group_rd, "Specify route distinguisher\n" "Route Distinguisher (<as-number>:<number> | <ip-address>:<number> | auto:vn:<number> )\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); int ret; struct prefix_rd prd; VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; if (!bgp) { @@ -3428,9 +3427,9 @@ DEFUN (vnc_nve_group_responselifetime, "Specify response lifetime\n" "Response lifetime in seconds\n" "Infinite response lifetime\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); unsigned int rspint; VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); - struct bgp *bgp = vty->index; struct rfapi_descriptor *rfd; struct listnode *hdnode; @@ -3507,8 +3506,8 @@ DEFUN (vnc_l2_group, "vnc l2-group NAME", VNC_CONFIG_STR "Configure a L2 group\n" "Group name\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); struct rfapi_l2_group_cfg *rfg; - struct bgp *bgp = vty->index; if (!bgp) { @@ -3600,7 +3599,7 @@ DEFUN (vnc_no_l2_group, "Configure a L2 group\n" "Group name\n") { - struct bgp *bgp = vty->index; + VTY_DECLVAR_CONTEXT(bgp, bgp); if (!bgp) { @@ -3617,8 +3616,8 @@ DEFUN (vnc_l2_group_lni, "Specify Logical Network ID associated with group\n" "value\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); - struct bgp *bgp = vty->index; if (!bgp) { @@ -3645,8 +3644,8 @@ DEFUN (vnc_l2_group_labels, "Specify label values associated with group\n" "Space separated list of label values <0-1048575>\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); - struct bgp *bgp = vty->index; struct list *ll; if (!bgp) @@ -3691,8 +3690,8 @@ DEFUN (vnc_l2_group_no_labels, "Specify label values associated with L2 group\n" "Space separated list of label values <0-1048575>\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); - struct bgp *bgp = vty->index; struct list *ll; if (!bgp) @@ -3737,8 +3736,8 @@ DEFUN (vnc_l2_group_rt, "Import filters\n" "A route target\n") { + VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); - struct bgp *bgp = vty->index; int rc = CMD_SUCCESS; int do_import = 0; int do_export = 0; |
