I see HAVE_IPV6 introduced, this should be removed. should bgp_node_safi be a switch statement?
donald On Thu, Dec 24, 2015 at 1:10 PM, Lou Berger <[email protected]> wrote: > This is part of the core VPN and Encap SAFI changes. > > Signed-off-by: Lou Berger <[email protected]> > Signed-off-by: David Lamparter <[email protected]> > --- > bgpd/bgp_vty.c | 242 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > bgpd/bgp_vty.h | 6 ++ > bgpd/bgpd.c | 14 ++- > lib/command.c | 6 ++ > lib/command.h | 2 + > lib/vty.c | 2 + > vtysh/extract.pl.in | 3 + > vtysh/vtysh.c | 64 ++++++++++++++ > vtysh/vtysh_config.c | 6 ++ > 9 files changed, 344 insertions(+), 1 deletion(-) > > diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c > index 8a102b3..1248b19 100644 > --- a/bgpd/bgp_vty.c > +++ b/bgpd/bgp_vty.c > @@ -61,6 +61,7 @@ bgp_node_afi (struct vty *vty) > case BGP_IPV6_NODE: > case BGP_IPV6M_NODE: > case BGP_VPNV6_NODE: > + case BGP_ENCAPV6_NODE: > return AFI_IP6; > break; > } > @@ -73,6 +74,10 @@ bgp_node_afi (struct vty *vty) > safi_t > bgp_node_safi (struct vty *vty) > { > + if (vty->node == BGP_ENCAP_NODE) > + return SAFI_ENCAP; > + if (vty->node == BGP_ENCAPV6_NODE) > + return SAFI_ENCAP; > if (vty->node == BGP_VPNV6_NODE) > return SAFI_MPLS_VPN; > if (vty->node == BGP_VPNV4_NODE) > @@ -82,6 +87,44 @@ bgp_node_safi (struct vty *vty) > return SAFI_UNICAST; > } > > +int > +bgp_parse_afi(const char *str, afi_t *afi) > +{ > + if (!strcmp(str, "ipv4")) { > + *afi = AFI_IP; > + return 0; > + } > +#ifdef HAVE_IPV6 > + if (!strcmp(str, "ipv6")) { > + *afi = AFI_IP6; > + return 0; > + } > +#endif /* HAVE_IPV6 */ > + return -1; > +} > + > +int > +bgp_parse_safi(const char *str, safi_t *safi) > +{ > + if (!strcmp(str, "encap")) { > + *safi = SAFI_ENCAP; > + return 0; > + } > + if (!strcmp(str, "multicast")) { > + *safi = SAFI_MULTICAST; > + return 0; > + } > + if (!strcmp(str, "unicast")) { > + *safi = SAFI_UNICAST; > + return 0; > + } > + if (!strcmp(str, "vpn")) { > + *safi = SAFI_MPLS_VPN; > + return 0; > + } > + return -1; > +} > + > static int > peer_address_self_check (union sockunion *su) > { > @@ -4310,12 +4353,41 @@ ALIAS (address_family_vpnv6, > "Address family\n" > "Address Family Modifier\n") > > +DEFUN (address_family_encap, > + address_family_encap_cmd, > + "address-family encap", > + "Enter Address Family command mode\n" > + "Address family\n") > +{ > + vty->node = BGP_ENCAP_NODE; > + return CMD_SUCCESS; > +} > + > +ALIAS (address_family_encap, > + address_family_encapv4_cmd, > + "address-family encapv4", > + "Enter Address Family command mode\n" > + "Address family\n") > + > +DEFUN (address_family_encapv6, > + address_family_encapv6_cmd, > + "address-family encapv6", > + "Enter Address Family command mode\n" > + "Address family\n") > +{ > + vty->node = BGP_ENCAPV6_NODE; > + return CMD_SUCCESS; > +} > + > DEFUN (exit_address_family, > exit_address_family_cmd, > "exit-address-family", > "Exit from Address Family configuration mode\n") > { > + /* should match list in command.c:config_exit */ > if (vty->node == BGP_IPV4_NODE > + || vty->node == BGP_ENCAP_NODE > + || vty->node == BGP_ENCAPV6_NODE > || vty->node == BGP_IPV4M_NODE > || vty->node == BGP_VPNV4_NODE > || vty->node == BGP_VPNV6_NODE > @@ -7537,12 +7609,16 @@ afi_safi_print (afi_t afi, safi_t safi) > return "IPv4 Multicast"; > else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) > return "VPN-IPv4 Unicast"; > + else if (afi == AFI_IP && safi == SAFI_ENCAP) > + return "ENCAP-IPv4 Unicast"; > else if (afi == AFI_IP6 && safi == SAFI_UNICAST) > return "IPv6 Unicast"; > else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) > return "IPv6 Multicast"; > else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN) > return "VPN-IPv6 Unicast"; > + else if (afi == AFI_IP6 && safi == SAFI_ENCAP) > + return "ENCAP-IPv6 Unicast"; > else > return "Unknown"; > } > @@ -7887,7 +7963,11 @@ bgp_show_peer (struct vty *vty, struct peer *p) > || p->afc_recv[AFI_IP6][SAFI_MULTICAST] > || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN] > || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] > + || p->afc_adv[AFI_IP6][SAFI_ENCAP] > + || p->afc_recv[AFI_IP6][SAFI_ENCAP] > #endif /* HAVE_IPV6 */ > + || p->afc_adv[AFI_IP][SAFI_ENCAP] > + || p->afc_recv[AFI_IP][SAFI_ENCAP] > || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] > || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) > { > @@ -9356,6 +9436,20 @@ static struct cmd_node bgp_vpnv6_node = > 1 > }; > > +static struct cmd_node bgp_encap_node = > +{ > + BGP_ENCAP_NODE, > + "%s(config-router-af-encap)# ", > + 1 > +}; > + > +static struct cmd_node bgp_encapv6_node = > +{ > + BGP_ENCAPV6_NODE, > + "%s(config-router-af-encapv6)# ", > + 1 > +}; > + > static void community_list_vty (void); > > void > @@ -9369,6 +9463,8 @@ bgp_vty_init (void) > install_node (&bgp_ipv6_multicast_node, NULL); > install_node (&bgp_vpnv4_node, NULL); > install_node (&bgp_vpnv6_node, NULL); > + install_node (&bgp_encap_node, NULL); > + install_node (&bgp_encapv6_node, NULL); > > /* Install default VTY commands to new nodes. */ > install_default (BGP_NODE); > @@ -9378,6 +9474,8 @@ bgp_vty_init (void) > install_default (BGP_IPV6M_NODE); > install_default (BGP_VPNV4_NODE); > install_default (BGP_VPNV6_NODE); > + install_default (BGP_ENCAP_NODE); > + install_default (BGP_ENCAPV6_NODE); > > /* "bgp multiple-instance" commands. */ > install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); > @@ -9537,6 +9635,8 @@ bgp_vty_init (void) > install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); > install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); > > /* "no neighbor activate" commands. */ > install_element (BGP_NODE, &no_neighbor_activate_cmd); > @@ -9546,6 +9646,8 @@ bgp_vty_init (void) > install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); > install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); > > /* "neighbor peer-group set" commands. */ > install_element (BGP_NODE, &neighbor_set_peer_group_cmd); > @@ -9555,6 +9657,8 @@ bgp_vty_init (void) > install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); > install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd); > > /* "no neighbor peer-group unset" commands. */ > install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); > @@ -9564,6 +9668,8 @@ bgp_vty_init (void) > install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); > install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd); > > /* "neighbor softreconfiguration inbound" commands.*/ > install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); > @@ -9580,6 +9686,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_soft_reconfiguration_cmd); > > /* "neighbor attribute-unchanged" commands. */ > install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); > @@ -9738,6 +9848,52 @@ bgp_vty_init (void) > install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd); > > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd); > + > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd); > + > /* "nexthop-local unchanged" commands */ > install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); > install_element (BGP_IPV6_NODE, > &no_neighbor_nexthop_local_unchanged_cmd); > @@ -9762,6 +9918,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); > > /* "neighbor remove-private-AS" commands. */ > install_element (BGP_NODE, &neighbor_remove_private_as_cmd); > @@ -9778,6 +9938,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); > > /* "neighbor send-community" commands.*/ > install_element (BGP_NODE, &neighbor_send_community_cmd); > @@ -9808,6 +9972,14 @@ bgp_vty_init (void) > install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_send_community_type_cmd); > > /* "neighbor route-reflector" commands.*/ > install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); > @@ -9824,6 +9996,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, > &no_neighbor_route_reflector_client_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); > install_element (BGP_VPNV6_NODE, > &no_neighbor_route_reflector_client_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); > + install_element (BGP_ENCAP_NODE, > &no_neighbor_route_reflector_client_cmd); > + install_element (BGP_ENCAPV6_NODE, > &neighbor_route_reflector_client_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_route_reflector_client_cmd); > > /* "neighbor route-server" commands.*/ > install_element (BGP_NODE, &neighbor_route_server_client_cmd); > @@ -9840,6 +10016,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_route_server_client_cmd); > > /* "neighbor passive" commands. */ > install_element (BGP_NODE, &neighbor_passive_cmd); > @@ -9970,6 +10150,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); > > /* "neighbor prefix-list" commands. */ > install_element (BGP_NODE, &neighbor_prefix_list_cmd); > @@ -9986,6 +10170,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); > > /* "neighbor filter-list" commands. */ > install_element (BGP_NODE, &neighbor_filter_list_cmd); > @@ -10002,6 +10190,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); > > /* "neighbor route-map" commands. */ > install_element (BGP_NODE, &neighbor_route_map_cmd); > @@ -10018,6 +10210,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); > > /* "neighbor unsuppress-map" commands. */ > install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); > @@ -10034,6 +10230,10 @@ bgp_vty_init (void) > install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); > > /* "neighbor maximum-prefix" commands. */ > install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); > @@ -10129,6 +10329,34 @@ bgp_vty_init (void) > install_element (BGP_VPNV6_NODE, > &no_neighbor_maximum_prefix_restart_cmd); > install_element (BGP_VPNV6_NODE, > &no_neighbor_maximum_prefix_threshold_restart_cmd); > > + install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); > + install_element (BGP_ENCAP_NODE, > &neighbor_maximum_prefix_threshold_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); > + install_element (BGP_ENCAP_NODE, > &neighbor_maximum_prefix_threshold_warning_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); > + install_element (BGP_ENCAP_NODE, > &neighbor_maximum_prefix_threshold_restart_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd); > + install_element (BGP_ENCAP_NODE, > &no_neighbor_maximum_prefix_threshold_cmd); > + install_element (BGP_ENCAP_NODE, > &no_neighbor_maximum_prefix_warning_cmd); > + install_element (BGP_ENCAP_NODE, > &no_neighbor_maximum_prefix_threshold_warning_cmd); > + install_element (BGP_ENCAP_NODE, > &no_neighbor_maximum_prefix_restart_cmd); > + install_element (BGP_ENCAP_NODE, > &no_neighbor_maximum_prefix_threshold_restart_cmd); > + > + install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); > + install_element (BGP_ENCAPV6_NODE, > &neighbor_maximum_prefix_threshold_cmd); > + install_element (BGP_ENCAPV6_NODE, > &neighbor_maximum_prefix_warning_cmd); > + install_element (BGP_ENCAPV6_NODE, > &neighbor_maximum_prefix_threshold_warning_cmd); > + install_element (BGP_ENCAPV6_NODE, > &neighbor_maximum_prefix_restart_cmd); > + install_element (BGP_ENCAPV6_NODE, > &neighbor_maximum_prefix_threshold_restart_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_maximum_prefix_threshold_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_maximum_prefix_warning_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_maximum_prefix_threshold_warning_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_maximum_prefix_restart_cmd); > + install_element (BGP_ENCAPV6_NODE, > &no_neighbor_maximum_prefix_threshold_restart_cmd); > + > /* "neighbor allowas-in" */ > install_element (BGP_NODE, &neighbor_allowas_in_cmd); > install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); > @@ -10151,6 +10379,12 @@ bgp_vty_init (void) > install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); > install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd); > install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); > + install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd); > + install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); > + install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd); > + install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); > > /* address-family commands. */ > install_element (BGP_NODE, &address_family_ipv4_cmd); > @@ -10165,6 +10399,12 @@ bgp_vty_init (void) > install_element (BGP_NODE, &address_family_vpnv6_cmd); > install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); > > + install_element (BGP_NODE, &address_family_encap_cmd); > + install_element (BGP_NODE, &address_family_encapv4_cmd); > +#ifdef HAVE_IPV6 > + install_element (BGP_NODE, &address_family_encapv6_cmd); > +#endif > + > /* "exit-address-family" command. */ > install_element (BGP_IPV4_NODE, &exit_address_family_cmd); > install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); > @@ -10172,6 +10412,8 @@ bgp_vty_init (void) > install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); > install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); > install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); > + install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); > + install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); > > /* "clear ip bgp commands" */ > install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); > diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h > index 2df8aaa..7329c5f 100644 > --- a/bgpd/bgp_vty.h > +++ b/bgpd/bgp_vty.h > @@ -26,4 +26,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, > Boston, MA > extern void bgp_vty_init (void); > extern const char *afi_safi_print (afi_t, safi_t); > > +extern int > +bgp_parse_afi(const char *str, afi_t *afi); > + > +extern int > +bgp_parse_safi(const char *str, safi_t *safi); > + > #endif /* _QUAGGA_BGP_VTY_H */ > diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c > index 94a0514..df83b5c 100644 > --- a/bgpd/bgpd.c > +++ b/bgpd/bgpd.c > @@ -5313,12 +5313,16 @@ bgp_config_write_family_header (struct vty *vty, > afi_t afi, safi_t safi, > if (safi == SAFI_MULTICAST) > vty_out (vty, "ipv4 multicast"); > else if (safi == SAFI_MPLS_VPN) > - vty_out (vty, "vpnv4 unicast"); > + vty_out (vty, "vpnv4"); > + else if (safi == SAFI_ENCAP) > + vty_out (vty, "encap"); > } > else if (afi == AFI_IP6) > { > if (safi == SAFI_MPLS_VPN) > vty_out (vty, "vpnv6"); > + else if (safi == SAFI_ENCAP) > + vty_out (vty, "encapv6"); > else > { > vty_out (vty, "ipv6"); > @@ -5560,6 +5564,9 @@ bgp_config_write (struct vty *vty) > /* IPv4 VPN configuration. */ > write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_MPLS_VPN); > > + /* ENCAPv4 configuration. */ > + write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_ENCAP); > + > /* IPv6 unicast configuration. */ > write += bgp_config_write_family (vty, bgp, AFI_IP6, SAFI_UNICAST); > > @@ -5569,6 +5576,11 @@ bgp_config_write (struct vty *vty) > /* IPv6 VPN configuration. */ > write += bgp_config_write_family (vty, bgp, AFI_IP6, SAFI_MPLS_VPN); > > + /* ENCAPv6 configuration. */ > + write += bgp_config_write_family (vty, bgp, AFI_IP6, SAFI_ENCAP); > + > + vty_out (vty, " exit%s", VTY_NEWLINE); > + > write++; > } > return write; > diff --git a/lib/command.c b/lib/command.c > index 7526dc7..8720c15 100644 > --- a/lib/command.c > +++ b/lib/command.c > @@ -2591,6 +2591,8 @@ node_parent ( enum node_type node ) > { > case BGP_VPNV4_NODE: > case BGP_VPNV6_NODE: > + case BGP_ENCAP_NODE: > + case BGP_ENCAPV6_NODE: > case BGP_IPV4_NODE: > case BGP_IPV4M_NODE: > case BGP_IPV6_NODE: > @@ -2962,6 +2964,8 @@ DEFUN (config_exit, > case BGP_IPV4M_NODE: > case BGP_VPNV4_NODE: > case BGP_VPNV6_NODE: > + case BGP_ENCAP_NODE: > + case BGP_ENCAPV6_NODE: > case BGP_IPV6_NODE: > case BGP_IPV6M_NODE: > vty->node = BGP_NODE; > @@ -3001,6 +3005,8 @@ DEFUN (config_end, > case RIPNG_NODE: > case BABEL_NODE: > case BGP_NODE: > + case BGP_ENCAP_NODE: > + case BGP_ENCAPV6_NODE: > case BGP_VPNV4_NODE: > case BGP_VPNV6_NODE: > case BGP_IPV4_NODE: > diff --git a/lib/command.h b/lib/command.h > index b5c73ab..fd55f2d 100644 > --- a/lib/command.h > +++ b/lib/command.h > @@ -87,6 +87,8 @@ enum node_type > BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ > BGP_IPV6_NODE, /* BGP IPv6 address family */ > BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ > + BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ > + BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ > OSPF_NODE, /* OSPF protocol mode */ > OSPF6_NODE, /* OSPF protocol for IPv6 mode */ > ISIS_NODE, /* ISIS protocol mode */ > diff --git a/lib/vty.c b/lib/vty.c > index b01122c..5b983a3 100644 > --- a/lib/vty.c > +++ b/lib/vty.c > @@ -739,6 +739,8 @@ vty_end_config (struct vty *vty) > case BGP_NODE: > case BGP_VPNV4_NODE: > case BGP_VPNV6_NODE: > + case BGP_ENCAP_NODE: > + case BGP_ENCAPV6_NODE: > case BGP_IPV4_NODE: > case BGP_IPV4M_NODE: > case BGP_IPV6_NODE: > diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in > index 82532da..ca869b6 100755 > --- a/vtysh/extract.pl.in > +++ b/vtysh/extract.pl.in > @@ -49,6 +49,9 @@ $ignore{'"address-family ipv6 unicast"'} = "ignore"; > $ignore{'"address-family vpnv4"'} = "ignore"; > $ignore{'"address-family vpnv4 unicast"'} = "ignore"; > $ignore{'"address-family ipv4 vrf NAME"'} = "ignore"; > +$ignore{'"address-family encap"'} = "ignore"; > +$ignore{'"address-family encapv4"'} = "ignore"; > +$ignore{'"address-family encapv6"'} = "ignore"; > $ignore{'"exit-address-family"'} = "ignore"; > $ignore{'"key chain WORD"'} = "ignore"; > $ignore{'"key <0-2147483647>"'} = "ignore"; > diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c > index d665050..bb8b820 100644 > --- a/vtysh/vtysh.c > +++ b/vtysh/vtysh.c > @@ -304,6 +304,7 @@ vtysh_execute_func (const char *line, int pager) > if (ret == CMD_SUCCESS || ret == CMD_SUCCESS_DAEMON || ret == > CMD_WARNING) > { > if ((saved_node == BGP_VPNV4_NODE || saved_node == BGP_VPNV6_NODE > + || saved_node == BGP_ENCAP_NODE || saved_node == > BGP_ENCAPV6_NODE > || saved_node == BGP_IPV4_NODE > || saved_node == BGP_IPV6_NODE || saved_node == BGP_IPV4M_NODE > || saved_node == BGP_IPV6M_NODE) > @@ -714,6 +715,18 @@ static struct cmd_node bgp_vpnv6_node = > "%s(config-router-af)# " > }; > > +static struct cmd_node bgp_encap_node = > +{ > + BGP_ENCAP_NODE, > + "%s(config-router-af)# " > +}; > + > +static struct cmd_node bgp_encapv6_node = > +{ > + BGP_ENCAPV6_NODE, > + "%s(config-router-af)# " > +}; > + > static struct cmd_node bgp_ipv4_node = > { > BGP_IPV4_NODE, > @@ -872,6 +885,39 @@ DEFUNSH (VTYSH_BGPD, > } > > DEFUNSH (VTYSH_BGPD, > + address_family_encap, > + address_family_encap_cmd, > + "address-family encap", > + "Enter Address Family command mode\n" > + "Address family\n") > +{ > + vty->node = BGP_ENCAP_NODE; > + return CMD_SUCCESS; > +} > + > +DEFUNSH (VTYSH_BGPD, > + address_family_encapv4, > + address_family_encapv4_cmd, > + "address-family encapv4", > + "Enter Address Family command mode\n" > + "Address family\n") > +{ > + vty->node = BGP_ENCAP_NODE; > + return CMD_SUCCESS; > +} > + > +DEFUNSH (VTYSH_BGPD, > + address_family_encapv6, > + address_family_encapv6_cmd, > + "address-family encapv6", > + "Enter Address Family command mode\n" > + "Address family\n") > +{ > + vty->node = BGP_ENCAPV6_NODE; > + return CMD_SUCCESS; > +} > + > +DEFUNSH (VTYSH_BGPD, > address_family_ipv4_unicast, > address_family_ipv4_unicast_cmd, > "address-family ipv4 unicast", > @@ -1097,6 +1143,8 @@ vtysh_exit (struct vty *vty) > break; > case BGP_VPNV4_NODE: > case BGP_VPNV6_NODE: > + case BGP_ENCAP_NODE: > + case BGP_ENCAPV6_NODE: > case BGP_IPV4_NODE: > case BGP_IPV4M_NODE: > case BGP_IPV6_NODE: > @@ -1136,6 +1184,8 @@ DEFUNSH (VTYSH_BGPD, > || vty->node == BGP_IPV4M_NODE > || vty->node == BGP_VPNV4_NODE > || vty->node == BGP_VPNV6_NODE > + || vty->node == BGP_ENCAP_NODE > + || vty->node == BGP_ENCAPV6_NODE > || vty->node == BGP_IPV6_NODE > || vty->node == BGP_IPV6M_NODE) > vty->node = BGP_NODE; > @@ -2331,6 +2381,8 @@ vtysh_init_vty (void) > install_node (&zebra_node, NULL); > install_node (&bgp_vpnv4_node, NULL); > install_node (&bgp_vpnv6_node, NULL); > + install_node (&bgp_encap_node, NULL); > + install_node (&bgp_encapv6_node, NULL); > install_node (&bgp_ipv4_node, NULL); > install_node (&bgp_ipv4m_node, NULL); > /* #ifdef HAVE_IPV6 */ > @@ -2358,6 +2410,8 @@ vtysh_init_vty (void) > vtysh_install_default (ZEBRA_NODE); > vtysh_install_default (BGP_VPNV4_NODE); > vtysh_install_default (BGP_VPNV6_NODE); > + vtysh_install_default (BGP_ENCAP_NODE); > + vtysh_install_default (BGP_ENCAPV6_NODE); > vtysh_install_default (BGP_IPV4_NODE); > vtysh_install_default (BGP_IPV4M_NODE); > vtysh_install_default (BGP_IPV6_NODE); > @@ -2396,6 +2450,10 @@ vtysh_init_vty (void) > install_element (BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd); > install_element (BGP_VPNV6_NODE, &vtysh_exit_bgpd_cmd); > install_element (BGP_VPNV6_NODE, &vtysh_quit_bgpd_cmd); > + install_element (BGP_ENCAP_NODE, &vtysh_exit_bgpd_cmd); > + install_element (BGP_ENCAP_NODE, &vtysh_quit_bgpd_cmd); > + install_element (BGP_ENCAPV6_NODE, &vtysh_exit_bgpd_cmd); > + install_element (BGP_ENCAPV6_NODE, &vtysh_quit_bgpd_cmd); > install_element (BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd); > install_element (BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd); > install_element (BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd); > @@ -2428,6 +2486,8 @@ vtysh_init_vty (void) > install_element (BGP_IPV4M_NODE, &vtysh_end_all_cmd); > install_element (BGP_VPNV4_NODE, &vtysh_end_all_cmd); > install_element (BGP_VPNV6_NODE, &vtysh_end_all_cmd); > + install_element (BGP_ENCAP_NODE, &vtysh_end_all_cmd); > + install_element (BGP_ENCAPV6_NODE, &vtysh_end_all_cmd); > install_element (BGP_IPV6_NODE, &vtysh_end_all_cmd); > install_element (BGP_IPV6M_NODE, &vtysh_end_all_cmd); > install_element (ISIS_NODE, &vtysh_end_all_cmd); > @@ -2456,6 +2516,8 @@ vtysh_init_vty (void) > install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); > install_element (BGP_NODE, &address_family_vpnv6_cmd); > install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); > + install_element (BGP_NODE, &address_family_encap_cmd); > + install_element (BGP_NODE, &address_family_encapv6_cmd); > install_element (BGP_NODE, &address_family_ipv4_unicast_cmd); > install_element (BGP_NODE, &address_family_ipv4_multicast_cmd); > #ifdef HAVE_IPV6 > @@ -2464,6 +2526,8 @@ vtysh_init_vty (void) > #endif > install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); > install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); > + install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); > + install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); > install_element (BGP_IPV4_NODE, &exit_address_family_cmd); > install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); > install_element (BGP_IPV6_NODE, &exit_address_family_cmd); > diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c > index dcbb70f..a069164 100644 > --- a/vtysh/vtysh_config.c > +++ b/vtysh/vtysh_config.c > @@ -172,6 +172,12 @@ vtysh_config_parse_line (const char *line) > else if (strncmp (line, " address-family vpn6", > strlen (" address-family vpn6")) == 0) > config = config_get (BGP_VPNV6_NODE, line); > + else if (strncmp (line, " address-family encapv6", > + strlen (" address-family encapv6")) == 0) > + config = config_get (BGP_ENCAPV6_NODE, line); > + else if (strncmp (line, " address-family encap", > + strlen (" address-family encap")) == 0) > + config = config_get (BGP_ENCAP_NODE, line); > else if (strncmp (line, " address-family ipv4 multicast", > strlen (" address-family ipv4 multicast")) == 0) > config = config_get (BGP_IPV4M_NODE, line); > -- > 2.1.3 > > > _______________________________________________ > Quagga-dev mailing list > [email protected] > https://lists.quagga.net/mailman/listinfo/quagga-dev >
_______________________________________________ Quagga-dev mailing list [email protected] https://lists.quagga.net/mailman/listinfo/quagga-dev
