From 4575cfc3bd9e7ffc90495a9b686694091aa40a8f Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 15 Jan 2017 11:58:06 -0500 Subject: [PATCH 01/64] bgpd: partial revert of vpn/encap safi show changes (Issue #14) To remove commands duplicated in bgp_mplsvpn/_encap Also until vpn/encap specific show pieces are merged into generic afi/safi show. Signed-off-by: Lou Berger --- bgpd/bgp_route.c | 174 ++++++++++++++++++++++++++++------------------- 1 file changed, 105 insertions(+), 69 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 90904e946c..240dd32ef1 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8161,12 +8161,13 @@ DEFUN (show_ip_bgp, DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" {json}", + "show ip bgp ipv4 (unicast|multicast) {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); @@ -8178,11 +8179,12 @@ DEFUN (show_ip_bgp_ipv4, ALIAS (show_ip_bgp_ipv4, show_bgp_ipv4_safi_cmd, - "show bgp ipv4 "BGP_SAFI_CMD_STR" {json}", + "show bgp ipv4 (unicast|multicast) {json}", SHOW_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "JavaScript Object Notation\n") DEFUN (show_ip_bgp_route, @@ -8636,11 +8638,12 @@ ALIAS (show_bgp, DEFUN (show_bgp_ipv6_safi, show_bgp_ipv6_safi_cmd, - "show bgp ipv6 "BGP_SAFI_CMD_STR" {json}", + "show bgp ipv6 (unicast|multicast) {json}", SHOW_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); @@ -9246,12 +9249,13 @@ ALIAS (show_ip_bgp_flap_regexp, DEFUN (show_ip_bgp_ipv4_regexp, show_ip_bgp_ipv4_regexp_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" regexp .LINE", + "show ip bgp ipv4 (unicast|multicast) regexp .LINE", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the AS path regular expression\n" "A regular-expression to match the BGP AS paths\n") { @@ -9393,12 +9397,13 @@ ALIAS (show_ip_bgp_flap_prefix_list, DEFUN (show_ip_bgp_ipv4_prefix_list, show_ip_bgp_ipv4_prefix_list_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" prefix-list WORD", + "show ip bgp ipv4 (unicast|multicast) prefix-list WORD", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { @@ -9539,12 +9544,13 @@ ALIAS (show_ip_bgp_flap_filter_list, DEFUN (show_ip_bgp_ipv4_filter_list, show_ip_bgp_ipv4_filter_list_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" filter-list WORD", + "show ip bgp ipv4 (unicast|multicast) filter-list WORD", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { @@ -9622,12 +9628,13 @@ DEFUN (show_ip_bgp_dampening_info, DEFUN (show_ip_bgp_ipv4_dampening_parameters, show_ip_bgp_ipv4_dampening_parameters_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening parameters", + "show ip bgp ipv4 (unicast|multicast) dampening parameters", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display detailed information about dampening\n" "Display detail of configured dampening parameters\n") { @@ -9639,12 +9646,13 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, show_ip_bgp_ipv4_dampening_flap_stats_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening flap-statistics", + "show ip bgp ipv4 (unicast|multicast) dampening flap-statistics", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display detailed information about dampening\n" "Display flap statistics of routes\n") { @@ -9656,12 +9664,13 @@ DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths, show_ip_bgp_ipv4_dampening_dampd_paths_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening dampened-paths", + "show ip bgp ipv4 (unicast|multicast) dampening dampened-paths", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display detailed information about dampening\n" "Display paths suppressed due to dampening\n") { @@ -9750,12 +9759,13 @@ ALIAS (show_ip_bgp_flap_route_map, DEFUN (show_ip_bgp_ipv4_route_map, show_ip_bgp_ipv4_route_map_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" route-map WORD", + "show ip bgp ipv4 (unicast|multicast) route-map WORD", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the route-map\n" "A route-map to match on\n") { @@ -9823,12 +9833,13 @@ ALIAS (show_ip_bgp_flap_cidr_only, DEFUN (show_ip_bgp_ipv4_cidr_only, show_ip_bgp_ipv4_cidr_only_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" cidr-only", + "show ip bgp ipv4 (unicast|multicast) cidr-only", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display only routes with non-natural netmasks\n") { safi_t safi; @@ -9851,12 +9862,13 @@ DEFUN (show_ip_bgp_community_all, DEFUN (show_ip_bgp_ipv4_community_all, show_ip_bgp_ipv4_community_all_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community", + "show ip bgp ipv4 (unicast|multicast) community", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n") { safi_t safi; @@ -10054,12 +10066,13 @@ ALIAS (show_ip_bgp_community, DEFUN (show_ip_bgp_ipv4_community, show_ip_bgp_ipv4_community_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export)", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10073,12 +10086,13 @@ DEFUN (show_ip_bgp_ipv4_community, ALIAS (show_ip_bgp_ipv4_community, show_ip_bgp_ipv4_community2_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10091,12 +10105,13 @@ ALIAS (show_ip_bgp_ipv4_community, ALIAS (show_ip_bgp_ipv4_community, show_ip_bgp_ipv4_community3_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10113,12 +10128,13 @@ ALIAS (show_ip_bgp_ipv4_community, ALIAS (show_ip_bgp_ipv4_community, show_ip_bgp_ipv4_community4_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10139,11 +10155,14 @@ ALIAS (show_ip_bgp_ipv4_community, DEFUN (show_bgp_instance_afi_safi_community_all, show_bgp_instance_afi_safi_community_all_cmd, - "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - BGP_AFI_SAFI_HELP_STR + "Address family\n" + "Address family\n" + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n") { int afi; @@ -10165,7 +10184,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all, DEFUN (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community_cmd, - "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export)", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10189,7 +10208,7 @@ DEFUN (show_bgp_instance_afi_safi_community, ALIAS (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community2_cmd, - "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10209,7 +10228,7 @@ ALIAS (show_bgp_instance_afi_safi_community, ALIAS (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community3_cmd, - "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10233,7 +10252,7 @@ ALIAS (show_bgp_instance_afi_safi_community, ALIAS (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community4_cmd, - "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10340,12 +10359,13 @@ ALIAS (show_ip_bgp_community_exact, DEFUN (show_ip_bgp_ipv4_community_exact, show_ip_bgp_ipv4_community_exact_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10360,12 +10380,13 @@ DEFUN (show_ip_bgp_ipv4_community_exact, ALIAS (show_ip_bgp_ipv4_community_exact, show_ip_bgp_ipv4_community2_exact_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10379,12 +10400,13 @@ ALIAS (show_ip_bgp_ipv4_community_exact, ALIAS (show_ip_bgp_ipv4_community_exact, show_ip_bgp_ipv4_community3_exact_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -10402,12 +10424,13 @@ ALIAS (show_ip_bgp_ipv4_community_exact, ALIAS (show_ip_bgp_ipv4_community_exact, show_ip_bgp_ipv4_community4_exact_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the communities\n" COMMUNITY_AANN_STR "Do not send outside local AS (well-known community)\n" @@ -11107,12 +11130,13 @@ DEFUN (show_ip_bgp_instance_community_list, DEFUN (show_ip_bgp_ipv4_community_list, show_ip_bgp_ipv4_community_list_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community-list (<1-500>|WORD)", + "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the community-list\n" "community-list number\n" "community-list name\n") @@ -11138,12 +11162,13 @@ DEFUN (show_ip_bgp_community_list_exact, DEFUN (show_ip_bgp_ipv4_community_list_exact, show_ip_bgp_ipv4_community_list_exact_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community-list (<1-500>|WORD) exact-match", + "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Display routes matching the community-list\n" "community-list number\n" "community-list name\n" @@ -11343,12 +11368,13 @@ ALIAS (show_ip_bgp_flap_prefix_longer, DEFUN (show_ip_bgp_ipv4_prefix_longer, show_ip_bgp_ipv4_prefix_longer_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M longer-prefixes", + "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { @@ -11840,7 +11866,7 @@ DEFUN (show_bgp_statistics, "show bgp "BGP_AFI_SAFI_CMD_STR" statistics", SHOW_STR BGP_STR - BGP_INSTANCE_HELP_STR + BGP_AFI_SAFI_HELP_STR "BGP RIB advertisement statistics\n") { return bgp_table_stats_vty (vty, NULL, argv[0], argv[1]); @@ -12145,12 +12171,13 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, show_ip_bgp_ipv4_neighbor_prefix_counts_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -12495,12 +12522,13 @@ ALIAS (show_ip_bgp_instance_neighbor_advertised_route, "JavaScript Object Notation\n") DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, show_ip_bgp_ipv4_neighbor_advertised_route_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -12527,12 +12555,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route, show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -12784,12 +12813,13 @@ ALIAS (show_ip_bgp_instance_neighbor_received_routes, DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, show_ip_bgp_ipv4_neighbor_received_routes_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -12815,12 +12845,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, ALIAS (show_ip_bgp_ipv4_neighbor_received_routes, show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -12830,11 +12861,14 @@ ALIAS (show_ip_bgp_ipv4_neighbor_received_routes, DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - BGP_AFI_SAFI_HELP_STR + "Address family\n" + "Address family\n" + "Address family modifier\n" + "Address family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -12950,12 +12984,13 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -13450,12 +13485,13 @@ DEFUN (show_ip_bgp_neighbor_damp, DEFUN (show_ip_bgp_ipv4_neighbor_routes, show_ip_bgp_ipv4_neighbor_routes_cmd, - "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", SHOW_STR IP_STR BGP_STR "Address family\n" - BGP_SAFI_HELP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" From 9857dafd6254f52bbab507932d2f7e65423389a4 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 14 Jan 2017 09:46:54 -0500 Subject: [PATCH 02/64] bgpd: fix RD stomping by update group code (Issue #71) Signed-off-by: Lou Berger --- bgpd/bgp_updgrp_packet.c | 51 ++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index e18ba235c7..20bf28967d 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -418,10 +418,21 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) if (CHECK_FLAG (vec->flags, BPKT_ATTRVEC_FLAGS_UPDATED)) { u_int8_t nhlen; + afi_t nhafi = AFI_MAX; /* NH AFI is based on nhlen! */ int route_map_sets_nh; nhlen = stream_getc_from (s, vec->offset); + if (paf->afi == AFI_IP || paf->afi == AFI_IP6) + { + if (nhlen < IPV6_MAX_BYTELEN && !peer_cap_enhe(peer)) + nhafi = AFI_IP; + else + nhafi = AFI_IP6; + if (paf->safi == SAFI_MPLS_VPN && /* if VPN */ + nhlen != 48) /* and ! GLOBAL_AND_LL */ + nhafi = AFI_MAX; /* no change allowed */ + } - if (paf->afi == AFI_IP && !peer_cap_enhe(peer)) + if (nhafi == AFI_IP) { struct in_addr v4nh, *mod_v4nh; int nh_modified = 0; @@ -462,23 +473,24 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) (bgp_multiaccess_check_v4 (v4nh, peer) == 0) && !CHECK_FLAG(vec->flags, BPKT_ATTRVEC_FLAGS_RMAP_NH_UNCHANGED) && - !peer_af_flag_check (peer, paf->afi, paf->safi, + !peer_af_flag_check (peer, nhafi, paf->safi, PEER_FLAG_NEXTHOP_UNCHANGED)) { + /* NOTE: not handling case where NH has new AFI */ mod_v4nh = &peer->nexthop.v4; nh_modified = 1; } - if (nh_modified) - stream_put_in_addr_at (s, vec->offset + 1, mod_v4nh); + if (nh_modified) /* allow for VPN RD */ + stream_put_in_addr_at (s, vec->offset + 1 + nhlen - 4, mod_v4nh); if (bgp_debug_update(peer, NULL, NULL, 0)) - zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s", + zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s%s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, - peer->host, inet_ntoa (*mod_v4nh)); - + peer->host, inet_ntoa (*mod_v4nh), + (nhlen == 12 ? " and RD" : "")); } - else if (paf->afi == AFI_IP6 || peer_cap_enhe(peer)) + else if (nhafi == AFI_IP6) { struct in6_addr v6nhglobal, *mod_v6nhg; struct in6_addr v6nhlocal, *mod_v6nhl; @@ -515,17 +527,18 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) else if (peer->sort == BGP_PEER_EBGP && !CHECK_FLAG(vec->flags, BPKT_ATTRVEC_FLAGS_RMAP_NH_UNCHANGED) && - !peer_af_flag_check (peer, paf->afi, paf->safi, + !peer_af_flag_check (peer, nhafi, paf->safi, PEER_FLAG_NEXTHOP_UNCHANGED)) { + /* NOTE: not handling case where NH has new AFI */ mod_v6nhg = &peer->nexthop.v6_global; gnh_modified = 1; } - if (nhlen == 32) + if (nhlen == 32 || nhlen == 48) /* 48 == VPN */ { - stream_get_from (&v6nhlocal, s, vec->offset + 1 + 16, 16); + stream_get_from (&v6nhlocal, s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), IPV6_MAX_BYTELEN); if (IN6_IS_ADDR_UNSPECIFIED (&v6nhlocal)) { mod_v6nhl = &peer->nexthop.v6_local; @@ -534,25 +547,27 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } if (gnh_modified) - stream_put_in6_addr_at (s, vec->offset + 1, mod_v6nhg); + stream_put_in6_addr_at (s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), mod_v6nhg); if (lnh_modified) - stream_put_in6_addr_at (s, vec->offset + 1 + 16, mod_v6nhl); + stream_put_in6_addr_at (s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), mod_v6nhl); if (bgp_debug_update(peer, NULL, NULL, 0)) { - if (nhlen == 32) - zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s", + if (nhlen == 32 || nhlen == 48) + zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s%s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ), - inet_ntop (AF_INET6, mod_v6nhl, buf2, BUFSIZ)); + inet_ntop (AF_INET6, mod_v6nhl, buf2, BUFSIZ), + (nhlen == 48 ? " and RD" : "")); else - zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s", + zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s%s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, - inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ)); + inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ), + (nhlen == 24 ? " and RD" : "")); } } } From 4c6f219aa2ecc89d51f4f7f95b264b93634a68f8 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 14 Jan 2017 08:34:22 -0500 Subject: [PATCH 03/64] bgpd: allow VPN next hop to be different AFI than NLRI next hop (Issue #71) Signed-off-by: Lou Berger --- bgpd/bgp_attr.c | 5 ++++- bgpd/bgp_route.c | 5 +++-- bgpd/bgp_route.h | 4 ++++ bgpd/bgp_updgrp_packet.c | 14 +++++++------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 2115fb5efc..b1b245d42c 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2643,6 +2643,8 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, stream_putw (s, afi); stream_putc (s, (safi == SAFI_MPLS_VPN) ? SAFI_MPLS_LABELED_VPN : safi); + if (nh_afi == AFI_MAX) + nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len); /* Nexthop */ switch (nh_afi) { @@ -2894,7 +2896,8 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer, size_t mpattrlen_pos = 0; mpattrlen_pos = bgp_packet_mpattr_start(s, afi, safi, - (peer_cap_enhe(peer) ? AFI_IP6 : afi), + (peer_cap_enhe(peer) ? AFI_IP6 : + AFI_MAX), /* get from NH */ vecarr, attr); bgp_packet_mpattr_prefix(s, afi, safi, p, prd, tag, addpath_encode, addpath_tx_id); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 240dd32ef1..023d1f8fdd 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1435,9 +1435,10 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, #ifdef HAVE_IPV6 #define NEXTHOP_IS_V6 (\ - (safi != SAFI_ENCAP && \ + (safi != SAFI_ENCAP && safi != SAFI_MPLS_VPN &&\ (p->family == AF_INET6 || peer_cap_enhe(peer))) || \ - (safi == SAFI_ENCAP && attr->extra->mp_nexthop_len == 16)) + ((safi == SAFI_ENCAP || safi != SAFI_MPLS_VPN) &&\ + attr->extra->mp_nexthop_len >= IPV6_MAX_BYTELEN)) /* IPv6/MP starts with 1 nexthop. The link-local address is passed only if * the peer (group) is configured to receive link-local nexthop unchanged diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 63b18aa2d8..3c7aa83a0e 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -179,6 +179,10 @@ struct bgp_static u_char tag[3]; }; +#define BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen) \ + ((nhlen) < IPV4_MAX_BYTELEN ? 0 : \ + ((nhlen) < IPV6_MAX_BYTELEN ? AFI_IP : AFI_IP6)) + #define BGP_ATTR_NEXTHOP_AFI_IP6(attr) \ (! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP)) && \ (attr)->extra && ((attr)->extra->mp_nexthop_len == 16 || \ diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 20bf28967d..ce2e0dbca0 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -423,12 +423,11 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) nhlen = stream_getc_from (s, vec->offset); if (paf->afi == AFI_IP || paf->afi == AFI_IP6) { - if (nhlen < IPV6_MAX_BYTELEN && !peer_cap_enhe(peer)) - nhafi = AFI_IP; - else + nhafi = BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen); + if (peer_cap_enhe(peer)) nhafi = AFI_IP6; - if (paf->safi == SAFI_MPLS_VPN && /* if VPN */ - nhlen != 48) /* and ! GLOBAL_AND_LL */ + if (paf->safi == SAFI_MPLS_VPN && /* if VPN && not global */ + nhlen != BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) nhafi = AFI_MAX; /* no change allowed */ } @@ -486,7 +485,7 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) if (bgp_debug_update(peer, NULL, NULL, 0)) zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s%s", - PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, + PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, inet_ntoa (*mod_v4nh), (nhlen == 12 ? " and RD" : "")); } @@ -762,7 +761,8 @@ subgroup_update_packet (struct update_subgroup *subgrp) if (stream_empty (snlri)) mpattrlen_pos = bgp_packet_mpattr_start (snlri, afi, safi, - (peer_cap_enhe(peer) ? AFI_IP6 : afi), + (peer_cap_enhe(peer) ? AFI_IP6 : + AFI_MAX), /* get from NH */ &vecarr, adv->baa->attr); bgp_packet_mpattr_prefix (snlri, afi, safi, &rn->p, prd, tag, addpath_encode, addpath_tx_id); From 764581d2864162a4278e09f76a47c2b7106e8977 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Fri, 13 Jan 2017 10:18:48 -0500 Subject: [PATCH 04/64] bgpd rfapi: use VN as nexthop for MPLS tunnels too Also minor show format cleanup Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi.c | 1 - bgpd/rfapi/rfapi_encap_tlv.c | 3 +-- bgpd/rfapi/rfapi_import.c | 5 +---- bgpd/rfapi/rfapi_vty.c | 9 +-------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 5945eb09e6..bc2fb9526f 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -768,7 +768,6 @@ add_vnc_route ( bgp_attr_extra_free (&attr); return; } - nexthop = un_addr; /* UN used as MPLS NLRI nexthop */ } if (local_pref) diff --git a/bgpd/rfapi/rfapi_encap_tlv.c b/bgpd/rfapi/rfapi_encap_tlv.c index d8713a26b2..171ea8f24d 100644 --- a/bgpd/rfapi/rfapi_encap_tlv.c +++ b/bgpd/rfapi/rfapi_encap_tlv.c @@ -131,8 +131,7 @@ rfapi_tunneltype_option_to_tlv ( break; case BGP_ENCAP_TYPE_MPLS: - _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS (mpls); - bgp_encap_type_mpls_to_tlv (&tto->bgpinfo.mpls, attr); + /* nothing to do for MPLS */ break; case BGP_ENCAP_TYPE_MPLS_IN_GRE: diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 25c05e65f8..ba26497207 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -423,10 +423,7 @@ rfapiGetVncTunnelUnAddr (struct attr *attr, struct prefix *p) rfapiGetTunnelType (attr, &tun_type); if (p && tun_type == BGP_ENCAP_TYPE_MPLS) { - /* MPLS carries UN address in next hop */ - rfapiNexthop2Prefix (attr, p); - if (p->family != 0) - return 0; + return ENOENT; /* no UN for MPLS */ } if (attr && attr->extra) { diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index fe9b8a3f50..572ca7f0a6 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -490,14 +490,7 @@ rfapi_vty_out_vncinfo ( if (bi->extra != NULL) vty_out (vty, " label=%u", decode_label (bi->extra->tag)); - if (rfapiGetVncLifetime (bi->attr, &lifetime)) - { - if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP) - { - vty_out (vty, " life=none"); - } - } - else + if (!rfapiGetVncLifetime (bi->attr, &lifetime)) { vty_out (vty, " life=%d", lifetime); } From d1dc07bb04d85f8439b759630a5443596d0db420 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 15 Jan 2017 16:43:20 -0500 Subject: [PATCH 05/64] bgpd rfapi: fix issue where advertised prefixes were not being disambiguated by RD Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi.c | 2 +- bgpd/rfapi/rfapi_ap.c | 60 +++++++++++++++++--------------------- bgpd/rfapi/rfapi_ap.h | 1 + bgpd/rfapi/rfapi_private.h | 19 ------------ bgpd/rfapi/rfapi_rib.c | 18 +++++++++++- bgpd/rfapi/rfapi_rib.h | 33 +++++++++++++++++++++ bgpd/rfapi/rfapi_vty.c | 27 +++++++++-------- 7 files changed, 92 insertions(+), 68 deletions(-) diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index bc2fb9526f..599d6e88bf 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -2777,7 +2777,7 @@ rfapi_register ( NULL, action == RFAPI_REGISTER_KILL); - if (0 == rfapiApDelete (bgp, rfd, &p, pfx_mac, &adv_tunnel)) + if (0 == rfapiApDelete (bgp, rfd, &p, pfx_mac, &prd, &adv_tunnel)) { if (adv_tunnel) rfapiTunnelRouteAnnounce (bgp, rfd, &rfd->max_prefix_lifetime); diff --git a/bgpd/rfapi/rfapi_ap.c b/bgpd/rfapi/rfapi_ap.c index 4b8eb9511b..4c415504fa 100644 --- a/bgpd/rfapi/rfapi_ap.c +++ b/bgpd/rfapi/rfapi_ap.c @@ -103,12 +103,11 @@ sl_adb_lifetime_cmp (void *adb1, void *adb2) return 0; } - void rfapiApInit (struct rfapi_advertised_prefixes *ap) { - ap->ipN_by_prefix = skiplist_new (0, vnc_prefix_cmp, NULL); - ap->ip0_by_ether = skiplist_new (0, vnc_prefix_cmp, NULL); + ap->ipN_by_prefix = skiplist_new (0, rfapi_rib_key_cmp, NULL); + ap->ip0_by_ether = skiplist_new (0, rfapi_rib_key_cmp, NULL); ap->by_lifetime = skiplist_new (0, sl_adb_lifetime_cmp, NULL); } @@ -192,7 +191,7 @@ rfapiApReadvertiseAll (struct bgp *bgp, struct rfapi_descriptor *rfd) * TBD this is not quite right. When pfx_ip is 0/32 or 0/128, * we need to substitute the VN address as the prefix */ - add_vnc_route (rfd, bgp, SAFI_MPLS_VPN, &adb->prefix_ip, &prd, /* RD to use (0 for ENCAP) */ + add_vnc_route (rfd, bgp, SAFI_MPLS_VPN, &adb->u.s.prefix_ip, &prd, /* RD to use (0 for ENCAP) */ &rfd->vn_addr, /* nexthop */ &local_pref, &adb->lifetime, NULL, NULL, /* struct rfapi_un_option */ NULL, /* struct rfapi_vn_option */ @@ -221,11 +220,11 @@ rfapiApWithdrawAll (struct bgp *bgp, struct rfapi_descriptor *rfd) struct prefix pfx_vn_buf; struct prefix *pfx_ip; - if (!(RFAPI_0_PREFIX (&adb->prefix_ip) && - RFAPI_HOST_PREFIX (&adb->prefix_ip))) + if (!(RFAPI_0_PREFIX (&adb->u.s.prefix_ip) && + RFAPI_HOST_PREFIX (&adb->u.s.prefix_ip))) { - pfx_ip = &adb->prefix_ip; + pfx_ip = &adb->u.s.prefix_ip; } else @@ -247,7 +246,7 @@ rfapiApWithdrawAll (struct bgp *bgp, struct rfapi_descriptor *rfd) } } - del_vnc_route (rfd, rfd->peer, bgp, SAFI_MPLS_VPN, pfx_ip ? pfx_ip : &pfx_vn_buf, &adb->prd, /* RD to use (0 for ENCAP) */ + del_vnc_route (rfd, rfd->peer, bgp, SAFI_MPLS_VPN, pfx_ip ? pfx_ip : &pfx_vn_buf, &adb->u.s.prd, /* RD to use (0 for ENCAP) */ ZEBRA_ROUTE_BGP, BGP_ROUTE_RFP, NULL, 0); } } @@ -404,19 +403,19 @@ rfapiApAdjustLifetimeStats ( { void *cursor; - struct prefix *prefix; - struct rfapi_adb *adb; + struct rfapi_rib_key rk; + struct rfapi_adb *adb; int rc; vnc_zlog_debug_verbose ("%s: walking to find new min/max", __func__); cursor = NULL; for (rc = skiplist_next (rfd->advertised.ipN_by_prefix, - (void **) &prefix, (void **) &adb, + (void **) &rk, (void **) &adb, &cursor); !rc; rc = skiplist_next (rfd->advertised.ipN_by_prefix, - (void **) &prefix, (void **) &adb, &cursor)) + (void **) &rk, (void **) &adb, &cursor)) { uint32_t lt = adb->lifetime; @@ -428,10 +427,10 @@ rfapiApAdjustLifetimeStats ( } cursor = NULL; for (rc = skiplist_next (rfd->advertised.ip0_by_ether, - (void **) &prefix, (void **) &adb, + (void **) &rk, (void **) &adb, &cursor); !rc; rc = - skiplist_next (rfd->advertised.ip0_by_ether, (void **) &prefix, + skiplist_next (rfd->advertised.ip0_by_ether, (void **) &rk, (void **) &adb, &cursor)) { @@ -483,14 +482,15 @@ rfapiApAdd ( struct rfapi_adb *adb; uint32_t old_lifetime = 0; int use_ip0 = 0; + struct rfapi_rib_key rk; + rfapi_rib_key_init(pfx_ip, prd, pfx_eth, &rk); if (RFAPI_0_PREFIX (pfx_ip) && RFAPI_HOST_PREFIX (pfx_ip)) { use_ip0 = 1; assert (pfx_eth); - rc = - skiplist_search (rfd->advertised.ip0_by_ether, pfx_eth, + skiplist_search (rfd->advertised.ip0_by_ether, &rk, (void **) &adb); } @@ -499,7 +499,7 @@ rfapiApAdd ( /* find prefix in advertised prefixes list */ rc = - skiplist_search (rfd->advertised.ipN_by_prefix, pfx_ip, + skiplist_search (rfd->advertised.ipN_by_prefix, &rk, (void **) &adb); } @@ -510,19 +510,17 @@ rfapiApAdd ( adb = XCALLOC (MTYPE_RFAPI_ADB, sizeof (struct rfapi_adb)); assert (adb); adb->lifetime = lifetime; - adb->prefix_ip = *pfx_ip; - if (pfx_eth) - adb->prefix_eth = *pfx_eth; + adb->u.key = rk; if (use_ip0) { assert (pfx_eth); - skiplist_insert (rfd->advertised.ip0_by_ether, &adb->prefix_eth, + skiplist_insert (rfd->advertised.ip0_by_ether, &adb->u.key, adb); } else { - skiplist_insert (rfd->advertised.ipN_by_prefix, &adb->prefix_ip, + skiplist_insert (rfd->advertised.ipN_by_prefix, &adb->u.key, adb); } @@ -537,19 +535,12 @@ rfapiApAdd ( adb->lifetime = lifetime; assert (!skiplist_insert (rfd->advertised.by_lifetime, adb, adb)); } - - if (!use_ip0 && pfx_eth && prefix_cmp (&adb->prefix_eth, pfx_eth)) - { - /* mac address changed */ - adb->prefix_eth = *pfx_eth; - } } adb->cost = cost; if (l2o) adb->l2o = *l2o; else memset (&adb->l2o, 0, sizeof (struct rfapi_l2address_option)); - adb->prd = *prd; if (rfapiApAdjustLifetimeStats (rfd, (rc ? NULL : &old_lifetime), &lifetime)) @@ -568,16 +559,19 @@ rfapiApDelete ( struct rfapi_descriptor *rfd, struct prefix *pfx_ip, struct prefix *pfx_eth, + struct prefix_rd *prd, int *advertise_tunnel) /* out */ { int rc; struct rfapi_adb *adb; uint32_t old_lifetime; int use_ip0 = 0; + struct rfapi_rib_key rk; if (advertise_tunnel) *advertise_tunnel = 0; + rfapi_rib_key_init(pfx_ip, prd, pfx_eth, &rk); /* find prefix in advertised prefixes list */ if (RFAPI_0_PREFIX (pfx_ip) && RFAPI_HOST_PREFIX (pfx_ip)) { @@ -585,7 +579,7 @@ rfapiApDelete ( assert (pfx_eth); rc = - skiplist_search (rfd->advertised.ip0_by_ether, pfx_eth, + skiplist_search (rfd->advertised.ip0_by_ether, &rk, (void **) &adb); } @@ -594,7 +588,7 @@ rfapiApDelete ( /* find prefix in advertised prefixes list */ rc = - skiplist_search (rfd->advertised.ipN_by_prefix, pfx_ip, + skiplist_search (rfd->advertised.ipN_by_prefix, &rk, (void **) &adb); } @@ -607,11 +601,11 @@ rfapiApDelete ( if (use_ip0) { - rc = skiplist_delete (rfd->advertised.ip0_by_ether, pfx_eth, NULL); + rc = skiplist_delete (rfd->advertised.ip0_by_ether, &rk, NULL); } else { - rc = skiplist_delete (rfd->advertised.ipN_by_prefix, pfx_ip, NULL); + rc = skiplist_delete (rfd->advertised.ipN_by_prefix, &rk, NULL); } assert (!rc); diff --git a/bgpd/rfapi/rfapi_ap.h b/bgpd/rfapi/rfapi_ap.h index f2805f49cb..8a59f05274 100644 --- a/bgpd/rfapi/rfapi_ap.h +++ b/bgpd/rfapi/rfapi_ap.h @@ -93,6 +93,7 @@ rfapiApDelete ( struct rfapi_descriptor *rfd, struct prefix *pfx_ip, struct prefix *pfx_eth, + struct prefix_rd *prd, int *advertise_tunnel); /* out */ diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h index 33390c4f55..00f90e35fc 100644 --- a/bgpd/rfapi/rfapi_private.h +++ b/bgpd/rfapi/rfapi_private.h @@ -34,21 +34,6 @@ #include "rfapi.h" -/* - * RFAPI Advertisement Data Block - * - * Holds NVE prefix advertisement information - */ -struct rfapi_adb -{ - struct prefix prefix_ip; - struct prefix prefix_eth; /* now redundant with l2o */ - struct prefix_rd prd; - uint32_t lifetime; - uint8_t cost; - struct rfapi_l2address_option l2o; -}; - /* * Lists of rfapi_adb. Each rfapi_adb is referenced twice: * @@ -62,7 +47,6 @@ struct rfapi_advertised_prefixes struct skiplist *by_lifetime; /* all */ }; - struct rfapi_descriptor { struct route_node *un_node; /* backref to un table */ @@ -378,9 +362,6 @@ rfp_cost_to_localpref (uint8_t cost); extern int rfapi_set_autord_from_vn (struct prefix_rd *rd, struct rfapi_ip_addr *vn); -extern void -rfapiAdbFree (struct rfapi_adb *adb); - extern struct rfapi_nexthop * rfapi_nexthop_new (struct rfapi_nexthop *copyme); diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 6aae35e635..3a4a159215 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -405,10 +405,26 @@ rfapiRibStartTimer ( assert (ri->timer); } +extern void +rfapi_rib_key_init (struct prefix *prefix, /* may be NULL */ + struct prefix_rd *rd, /* may be NULL */ + struct prefix *aux, /* may be NULL */ + struct rfapi_rib_key *rk) + +{ + memset((void *)rk, 0, sizeof(struct rfapi_rib_key)); + if (prefix) + rk->vn = *prefix; + if (rd) + rk->rd = *rd; + if (aux) + rk->aux_prefix = *aux; +} + /* * Compares two s */ -static int +int rfapi_rib_key_cmp (void *k1, void *k2) { struct rfapi_rib_key *a = (struct rfapi_rib_key *) k1; diff --git a/bgpd/rfapi/rfapi_rib.h b/bgpd/rfapi/rfapi_rib.h index 2a111946f7..74331a28d0 100644 --- a/bgpd/rfapi/rfapi_rib.h +++ b/bgpd/rfapi/rfapi_rib.h @@ -45,6 +45,27 @@ struct rfapi_rib_key */ struct prefix aux_prefix; }; +#include "rfapi.h" + +/* + * RFAPI Advertisement Data Block + * + * Holds NVE prefix advertisement information + */ +struct rfapi_adb +{ + union { + struct { + struct prefix prefix_ip; + struct prefix_rd prd; + struct prefix prefix_eth; + } s; /* mainly for legacy use */ + struct rfapi_rib_key key; + } u; + uint32_t lifetime; + uint8_t cost; + struct rfapi_l2address_option l2o; +}; struct rfapi_info { @@ -151,4 +172,16 @@ rfapiRibCheckCounts ( #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) #endif +extern void +rfapi_rib_key_init (struct prefix *prefix, /* may be NULL */ + struct prefix_rd *rd, /* may be NULL */ + struct prefix *aux, /* may be NULL */ + struct rfapi_rib_key *rk); + +extern int +rfapi_rib_key_cmp (void *k1, void *k2); + +extern void +rfapiAdbFree (struct rfapi_adb *adb); + #endif /* QUAGGA_HGP_RFAPI_RIB_H */ diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 572ca7f0a6..1118cfd76f 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1846,14 +1846,14 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) { /* group like family prefixes together in output */ - if (family != adb->prefix_ip.family) + if (family != adb->u.s.prefix_ip.family) continue; - prefix2str (&adb->prefix_ip, buf, BUFSIZ); + prefix2str (&adb->u.s.prefix_ip, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE); - rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->prefix_ip); + rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip); } } for (rc = @@ -1864,14 +1864,14 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) &cursor)) { - prefix2str (&adb->prefix_eth, buf, BUFSIZ); + prefix2str (&adb->u.s.prefix_eth, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE); /* TBD update the following function to print ethernet info */ /* Also need to pass/use rd */ - rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->prefix_ip); + rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip); } vty_out (vty, "%s", HVTY_NEWLINE); } @@ -3363,7 +3363,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) if (pPrefix) { - if (!prefix_same (pPrefix, &adb->prefix_ip)) + if (!prefix_same (pPrefix, &adb->u.s.prefix_ip)) { #if DEBUG_L2_EXTRA vnc_zlog_debug_verbose ("%s: adb=%p, prefix doesn't match, skipping", @@ -3376,7 +3376,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) { if (memcmp (cda->l2o.o.macaddr.octet, - adb->prefix_eth.u.prefix_eth.octet, ETHER_ADDR_LEN)) + adb->u.s.prefix_eth.u.prefix_eth.octet, ETHER_ADDR_LEN)) { #if DEBUG_L2_EXTRA vnc_zlog_debug_verbose ("%s: adb=%p, macaddr doesn't match, skipping", @@ -3418,24 +3418,23 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) this_advertisement_prefix_count = 1; - rfapiQprefix2Rprefix (&adb->prefix_ip, &rp); + rfapiQprefix2Rprefix (&adb->u.s.prefix_ip, &rp); /* if mac addr present in advert, make l2o vn option */ - if (adb->prefix_eth.family == AF_ETHERNET) + if (adb->u.s.prefix_eth.family == AF_ETHERNET) { - memset (&vn1, 0, sizeof (vn1)); memset (&vn2, 0, sizeof (vn2)); vn1.type = RFAPI_VN_OPTION_TYPE_L2ADDR; - vn1.v.l2addr.macaddr = adb->prefix_eth.u.prefix_eth; + vn1.v.l2addr.macaddr = adb->u.s.prefix_eth.u.prefix_eth; /* * use saved RD value instead of trying to invert * complex L2-style RD computation in rfapi_register() */ vn2.type = RFAPI_VN_OPTION_TYPE_INTERNAL_RD; - vn2.v.internal_rd = adb->prd; + vn2.v.internal_rd = adb->u.s.prd; vn1.next = &vn2; @@ -3487,7 +3486,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) if (CHECK_FLAG (cda->l2o.flags, RFAPI_L2O_MACADDR)) { if (memcmp (cda->l2o.o.macaddr.octet, - adb->prefix_eth.u.prefix_eth.octet, + adb->u.s.prefix_eth.u.prefix_eth.octet, ETHER_ADDR_LEN)) { @@ -3514,7 +3513,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) struct rfapi_vn_option vn; - rfapiQprefix2Rprefix (&adb->prefix_ip, &rp); + rfapiQprefix2Rprefix (&adb->u.s.prefix_ip, &rp); memset (&vn, 0, sizeof (vn)); vn.type = RFAPI_VN_OPTION_TYPE_L2ADDR; From 24d3752405ab849b47ae3866d590ddfd4e73d0de Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 17 Jan 2017 13:45:46 -0500 Subject: [PATCH 06/64] bgpd: use address-family in show running for vpn&encap (Issue #80) Signed-off-by: Lou Berger --- bgpd/bgpd.c | 8 ++++---- vtysh/extract.pl.in | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 2e07ba98ad..244b1930b3 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7142,9 +7142,9 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi, else if (safi == SAFI_MULTICAST) vty_out (vty, "ipv4 multicast"); else if (safi == SAFI_MPLS_VPN) - vty_out (vty, "vpnv4"); + vty_out (vty, "ipv4 vpn"); else if (safi == SAFI_ENCAP) - vty_out (vty, "encap"); + vty_out (vty, "ipv4 encap"); } else if (afi == AFI_IP6) { @@ -7153,9 +7153,9 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi, else if (safi == SAFI_MULTICAST) vty_out (vty, "ipv6 multicast"); else if (safi == SAFI_MPLS_VPN) - vty_out (vty, "vpnv6"); + vty_out (vty, "ipv6 vpn"); else if (safi == SAFI_ENCAP) - vty_out (vty, "encapv6"); + vty_out (vty, "ipv6 encap"); } vty_out (vty, "%s", VTY_NEWLINE); diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 3e85936069..9813b19ced 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -56,12 +56,16 @@ $ignore{'"address-family ipv4"'} = "ignore"; $ignore{'"address-family ipv4 (unicast|multicast)"'} = "ignore"; $ignore{'"address-family ipv6"'} = "ignore"; $ignore{'"address-family ipv6 (unicast|multicast)"'} = "ignore"; +$ignore{'"address-family ipv4 vpn"'} = "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{'"address-family ipv4 encap"'} = "ignore"; +$ignore{'"address-family ipv6 encap"'} = "ignore"; +$ignore{'"address-family ipv6 vpn"'} = "ignore"; $ignore{'"address-family vpnv6"'} = "ignore"; $ignore{'"address-family vpnv6 unicast"'} = "ignore"; $ignore{'"exit-address-family"'} = "ignore"; From 88e5a8cbe199c33039108c0d1d41790438f96235 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 18 Jan 2017 06:09:26 +0000 Subject: [PATCH 07/64] lib: additional patch for 496e83a Fixes a couple off-by-ones introduced in previous commit. Signed-off-by: Quentin Young [cherry-picked from master d1e4a518e6f55ccf80c67b58d16eeb1cbf5923e3] Signed-off-by: David Lamparter --- lib/vty.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/vty.c b/lib/vty.c index 23d7153417..adcfaca4f3 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -515,7 +515,7 @@ vty_self_insert (struct vty *vty, char c) int i; int length; - if (vty->length + 1 > VTY_BUFSIZ) + if (vty->length + 1 >= VTY_BUFSIZ) return; length = vty->length - vty->cp; @@ -528,6 +528,8 @@ vty_self_insert (struct vty *vty, char c) vty->cp++; vty->length++; + + vty->buf[vty->length] = '\0'; } /* Self insert character 'c' in overwrite mode. */ @@ -553,11 +555,15 @@ vty_self_insert_overwrite (struct vty *vty, char c) static void vty_insert_word_overwrite (struct vty *vty, char *str) { - size_t nwrite = MIN ((int) strlen (str), VTY_BUFSIZ - vty->cp); - vty_write (vty, str, nwrite); - strncpy (&vty->buf[vty->cp], str, nwrite); + if (vty->cp == VTY_BUFSIZ) + return; + + size_t nwrite = MIN ((int) strlen (str), VTY_BUFSIZ - vty->cp - 1); + memcpy (&vty->buf[vty->cp], str, nwrite); vty->cp += nwrite; - vty->length = vty->cp; + vty->length = MAX (vty->cp, vty->length); + vty->buf[vty->length] = '\0'; + vty_write (vty, str, nwrite); } /* Forward character. */ @@ -614,6 +620,7 @@ vty_history_print (struct vty *vty) length = strlen (vty->hist[vty->hp]); memcpy (vty->buf, vty->hist[vty->hp], length); vty->cp = vty->length = length; + vty->buf[vty->length] = '\0'; /* Redraw current line */ vty_redraw_line (vty); @@ -2210,7 +2217,7 @@ vtysh_read (struct thread *thread) printf ("line: %.*s\n", nbytes, buf); #endif /* VTYSH_DEBUG */ - if (vty->length + nbytes > VTY_BUFSIZ) + if (vty->length + nbytes >= VTY_BUFSIZ) { /* Clear command line buffer. */ vty->cp = vty->length = 0; From 7a4732c12b5e2dddba1c546fb02264db54581547 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Wed, 18 Jan 2017 11:36:32 -0500 Subject: [PATCH 08/64] bgpd: fix typo in VPN next hop V6 test (Issue #71) On top of: bgpd: allow VPN next hop to be different AFI than NLRI next hop (Issue #71) Signed-off-by: Lou Berger --- bgpd/bgp_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 023d1f8fdd..81516640bd 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1437,7 +1437,7 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, #define NEXTHOP_IS_V6 (\ (safi != SAFI_ENCAP && safi != SAFI_MPLS_VPN &&\ (p->family == AF_INET6 || peer_cap_enhe(peer))) || \ - ((safi == SAFI_ENCAP || safi != SAFI_MPLS_VPN) &&\ + ((safi == SAFI_ENCAP || safi == SAFI_MPLS_VPN) &&\ attr->extra->mp_nexthop_len >= IPV6_MAX_BYTELEN)) /* IPv6/MP starts with 1 nexthop. The link-local address is passed only if From 16e32678b1da6fbf9685ccdbd77c6b040642db68 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Thu, 19 Jan 2017 17:45:51 +0100 Subject: [PATCH 09/64] release: FRR 2.0-rc1 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6375e5d78a..14f6292da5 100755 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ ## AC_PREREQ(2.60) -AC_INIT(frr, 2.0-rc0, [https://bugzilla.quagga.net]) +AC_INIT(frr, 2.0-rc1, [https://github.com/freerangerouting/frr/issues]) PACKAGE_URL="https://freerangerouting.org/" PACKAGE_FULLNAME="FreeRangeRouting" AC_SUBST(PACKAGE_FULLNAME) From 7f8512d9af81072a3a604755df3e8ff877f268e4 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 00:07:02 +0700 Subject: [PATCH 10/64] Solaris Package files: Rename Quagga to FRR Signed-off-by: Martin Winter --- solaris/Makefile.am | 18 +-- solaris/README.txt | 144 ++++++++++++------------ solaris/depend.daemons.in | 2 +- solaris/depend.dev.in | 2 +- solaris/depend.libs.in | 4 +- solaris/depend.smf.in | 2 +- solaris/{quagga.init.in => frr.init.in} | 62 +++++----- solaris/{quagga.xml.in => frr.xml.in} | 120 ++++++++++---------- solaris/pkginfo.daemons.tmpl.in | 2 +- solaris/pkginfo.dev.tmpl.in | 2 +- solaris/pkginfo.doc.tmpl.in | 2 +- solaris/pkginfo.libs.tmpl.in | 2 +- solaris/pkginfo.smf.tmpl.in | 2 +- solaris/pkginfo.tmpl.in | 4 +- solaris/prototype.daemons.in | 2 +- solaris/prototype.dev.in | 94 ++++++++-------- solaris/prototype.doc.in | 2 +- solaris/prototype.smf.in | 4 +- 18 files changed, 234 insertions(+), 236 deletions(-) rename solaris/{quagga.init.in => frr.init.in} (79%) rename solaris/{quagga.xml.in => frr.xml.in} (88%) diff --git a/solaris/Makefile.am b/solaris/Makefile.am index dcee240c62..5633991d1a 100644 --- a/solaris/Makefile.am +++ b/solaris/Makefile.am @@ -7,13 +7,13 @@ # the names of the various subpackages, and some convenient # derived variables. pkg_names = daemons dev doc libs smf -pkg_quagga_daemons = zebra bgpd ospfd ospf6d ripd ripngd +pkg_frr_daemons = zebra bgpd ospfd ospf6d ripd ripngd pkg_name_rev = @PACKAGE_VERSION@-@CONFDATE@-@target_os@-@target_cpu@ pkg_depends = $(pkg_names:%=depend.%) pkg_packages = $(pkg_names:%=@PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg) pkg_pkginfos = $(pkg_names:%=pkginfo.%.full) pkg_prototypes = $(pkg_names:%=prototype.%) -pkg_manifests = quagga.xml +pkg_manifests = frr.xml # pkgmk variable substitutions wont grok ${variable} in prototype # file, so we cant let autoconf generate the file sadly @@ -35,7 +35,7 @@ edit = $(SED) \ -e 's,@enable_user\@,$(enable_user),g' \ -e 's,@enable_group\@,$(enable_group),g' \ -e 's,@enable_vty_group\@,$(enable_vty_group),g' \ - -e 's,@quagga_statedir\@,$(quagga_statedir),g' \ + -e 's,@frr_statedir\@,$(frr_statedir),g' \ -e 's,[@]PACKAGE_NAME[@],@PACKAGE_NAME@,g' \ -e 's,[@]PACKAGE_TARNAME[@],@PACKAGE_TARNAME@,g' \ -e 's,[@]PACKAGE_VERSION[@],@PACKAGE_VERSION@,g' \ @@ -90,15 +90,15 @@ depend.%: $(srcdir)/depend.%.in Makefile $(edit) $< > $@ # method file (bit like init script) -quagga.init: $(srcdir)/quagga.init.in Makefile +frr.init: $(srcdir)/frr.init.in Makefile rm -f $@ $(edit) $< > $@ # construct the pkg @PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg: prototype.% \ - depend.% quagga.init pkginfo.%.full + depend.% frr.init pkginfo.%.full ($(pkg_make) && \ - $(pkg_trans) "QUAGGA$*") + $(pkg_trans) "FRR$*") %.pkg.gz : %.pkg (gzip -c $< > $@) @@ -107,17 +107,17 @@ quagga.init: $(srcdir)/quagga.init.in Makefile #BUILT_SOURCES = pkginfo.daemons pkginfo.dev pkginfo.doc pkginfo.libs \ # prototype.daemons prototype.dev prototype.doc prototype.libs BUILT_SOURCES = $(pkg_pkginfos) pkginfo.tmpl $(pkg_prototypes) \ - $(pkg_manifests) $(pkg_depends) quagga.init + $(pkg_manifests) $(pkg_depends) frr.init CLEANFILES = $(BUILT_SOURCES) $(pkg_packages) EXTRA_DIST = $(pkg_manifests:%=%.in) $(pkg_prototypes:%=%.in) \ $(pkg_names:%=pkginfo.%.tmpl.in) $(srcdir)/pkginfo.tmpl.in \ - $(pkg_depends:%=%.in) quagga.init.in README.txt + $(pkg_depends:%=%.in) frr.init.in README.txt pkg-root-install: (cd $(top_builddir) && \ - $(MAKE) DESTDIR=$(abs_builddir)/quagga-root install) + $(MAKE) DESTDIR=$(abs_builddir)/frr-root install) packages: $(pkg_packages) diff --git a/solaris/README.txt b/solaris/README.txt index 811e9d0fd4..01f725b8fa 100644 --- a/solaris/README.txt +++ b/solaris/README.txt @@ -15,21 +15,20 @@ Requirements: i.manifest must be at least version 1.5. Place these scripts in this directory if you are using Solaris 10 GA (which does not ship with - these scripts), or in the solaris/ directory in the Quagga source. + these scripts), or in the solaris/ directory in the FreeRangeRouting source. Package creation instructions: ------------------------------ -1. Configure and build Quagga in the top level build directory as per -normal, eg: +1. Configure and build FreeRangeRouting (frr) in the top level build directory as per normal, eg: - ./configure --prefix=/usr/local/quagga \ - --localstatedir=/var/run/quagga + ./configure --prefix=/usr/local/frr \ + --localstatedir=/var/run/frr \ --enable-gcc-rdynamic --enable-opaque-lsa --enable-ospf-te \ - --enable-multipath=64 --enable-user=quagga \ + --enable-multipath=64 --enable-user=frr \ --enable-ospfclient=yes --enable-ospfapi=yes \ - --enable-group=quagga --enable-nssa --enable-opaque-lsa + --enable-group=frr --enable-nssa --enable-opaque-lsa You will need /usr/sfw/bin and /usr/ccs/bin in your path. @@ -45,13 +44,13 @@ appropriate, eg: This should result in 4 packages being created: - quagga-libs-...-$ARCH.pkg - QUAGGAlibs - quagga-daemons-...-$ARCH.pkg - QUAGGAdaemons - quagga-doc-...-$ARCH.pkg - QUAGGAdoc - quagga-dev-...-$ARCH.pkg - QUAGGAdev - quagga-smf-...-$ARCH.pkg - QUAGGAsmf + frr-libs-...-$ARCH.pkg - FRRlibs + frr-daemons-...-$ARCH.pkg - FRRdaemons + frr-doc-...-$ARCH.pkg - FRRdoc + frr-dev-...-$ARCH.pkg - FRRdev + frr-smf-...-$ARCH.pkg - FRRsmf -QUAGGAlibs and QUAGGAdaemons are needed for daemon runtime. QUAGGAsmf +FRRlibs and FRRdaemons are needed for daemon runtime. FRRsmf provides the required bits for Solaris 10+ SMF support. @@ -59,7 +58,7 @@ Install and post-install configuration notes: --------------------------------------------- - If you specified a user/group which does not exist per default on Solaris - (eg quagga/quagga) you *must* create these before installing these on a + (eg frr/frr) you *must* create these before installing these on a system. The packages do *not* create the users. - The configuration files are not created. You must create the configuration @@ -69,107 +68,107 @@ Install and post-install configuration notes: password whatever - The user which quagga runs as must have write permissions on this file, no + The user which frr runs as must have write permissions on this file, no other user should have read permissions, and you would also have to enable the telnet interface (see below). - SMF notes: - - QUAGGAsmf installs a svc:/network/routing/quagga service, with an + - FRRsmf installs a svc:/network/routing/frr service, with an instance for each daemon - - The state of all instances of quagga service can be inspected with: + - The state of all instances of frr service can be inspected with: - svcs -l svc:/network/routing/quagga + svcs -l svc:/network/routing/frr - or typically just with a shortcut of 'quagga': + or typically just with a shortcut of 'frr': - svcs -l quagga + svcs -l frr - - A specific instance of the quagga service can be inspected by specifying - the daemon name as the instance, ie quagga:: + - A specific instance of the frr service can be inspected by specifying + the daemon name as the instance, ie frr:: - svcs -l svc:/network/routing/quagga:zebra - svcs -l svc:/network/routing/quagga:ospfd + svcs -l svc:/network/routing/frr:zebra + svcs -l svc:/network/routing/frr:ospfd - or typically just with the shortcut of 'quagga:' or even + or typically just with the shortcut of 'frr:' or even : - svcs -l quagga:zebra + svcs -l frr:zebra svcs -l ospfd Eg: # # svcs -l ripd - fmri svc:/network/routing/quagga:ripd - name Quagga: ripd, RIPv1/2 IPv4 routing protocol daemon. + fmri svc:/network/routing/frr:ripd + name FreeRangeRouting: ripd, RIPv1/2 IPv4 routing protocol daemon. enabled true state online next_state none state_time Wed Jun 15 16:21:02 2005 - logfile /var/svc/log/network-routing-quagga:ripd.log + logfile /var/svc/log/network-routing-frr:ripd.log restarter svc:/system/svc/restarter:default contract_id 93 - dependency require_all/restart svc:/network/routing/quagga:zebra (online) - dependency require_all/restart file://localhost//usr/local/quagga/etc/ripd.conf (online) + dependency require_all/restart svc:/network/routing/frr:zebra (online) + dependency require_all/restart file://localhost//usr/local/frr/etc/ripd.conf (online) dependency require_all/none svc:/system/filesystem/usr:default (online) dependency require_all/none svc:/network/loopback (online) - Configuration of startup options is by way of SMF properties in a - property group named 'quagga'. The defaults should automatically be - inline with how you configured Quagga in Step 1 above. + property group named 'frr'. The defaults should automatically be + inline with how you configured FreeRangeRouting in Step 1 above. - By default the VTY interface is disabled. To change this, see below for - how to set the 'quagga/vty_port' property as appropriate for + how to set the 'frr/vty_port' property as appropriate for /each/ service. Also, the VTY is set to listen only to localhost by - default, you may change the 'quagga/vty_addr' property as appropriate - for both of the 'quagga' service and specific individual instances of - the 'quagga' service (ie quagga:zebra, quagga:ospfd, etc..). + default, you may change the 'frr/vty_addr' property as appropriate + for both of the 'frr' service and specific individual instances of + the 'frr' service (ie frr:zebra, frr:ospfd, etc..). - - Properties belonging to the 'quagga' service are inherited by all + - Properties belonging to the 'frr' service are inherited by all instances. Eg: - # svcprop -p quagga svc:/network/routing/quagga - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_addr astring 127.1 - quagga/vty_port integer 0 + # svcprop -p frr svc:/network/routing/frr + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_addr astring 127.1 + frr/vty_port integer 0 - # svcprop -p quagga svc:/network/routing/quagga:ospfd - quagga/retain_routes boolean false - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_addr astring 127.1 - quagga/vty_port integer 0 + # svcprop -p frr svc:/network/routing/frr:ospfd + frr/retain_routes boolean false + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_addr astring 127.1 + frr/vty_port integer 0 All instances will inherit these properties, unless the instance itself overrides these defaults. This also implies one can modify properties of - the 'quagga' service and have them apply to all daemons. + the 'frr' service and have them apply to all daemons. - # svccfg -s svc:/network/routing/quagga \ - setprop quagga/vty_addr = astring: ::1 + # svccfg -s svc:/network/routing/frr \ + setprop frr/vty_addr = astring: ::1 - # svcprop -p quagga svc:/network/routing/quagga - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_port integer 0 - quagga/vty_addr astring ::1 + # svcprop -p frr svc:/network/routing/frr + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_port integer 0 + frr/vty_addr astring ::1 # # You *must* refresh instances to have the property change # # take affect for the 'running snapshot' of service state. - # svcadm refresh quagga:ospfd + # svcadm refresh frr:ospfd - # svcprop -p quagga svc:/network/routing/quagga:ospfd - quagga/retain_routes boolean false - quagga/group astring root - quagga/retain boolean false - quagga/user astring root - quagga/vty_port integer 0 - quagga/vty_addr astring ::1 + # svcprop -p frr svc:/network/routing/frr:ospfd + frr/retain_routes boolean false + frr/group astring root + frr/retain boolean false + frr/user astring root + frr/vty_port integer 0 + frr/vty_addr astring ::1 Other daemon-specific options/properties may be available, however they are not yet honoured/used (eg ospfd/apiserver on svc:/network/ospf). @@ -177,12 +176,11 @@ Install and post-install configuration notes: - As SMF is dependency aware, restarting network/zebra will restart all the other daemons. - - To upgrade from one set of Quagga packages to a newer release, one must - first pkgrm the installed packages. When one pkgrm's QUAGGAsmf all + - To upgrade from one set of FreeRangeRouting packages to a newer release, + one must first pkgrm the installed packages. When one pkgrm's FRRsmf all property configuration will be lost, and any customisations will have to - redone after installing the updated QUAGGAsmf package. + redone after installing the updated FRRsmf package. - These packages are not supported by Sun Microsystems, report bugs via the - usual Quagga channels, ie Bugzilla. Improvements/contributions of course - would be greatly appreciated. + usual FreeRangeRouting channels, ie Issue Tracker. Improvements/contributions of course would be greatly appreciated. diff --git a/solaris/depend.daemons.in b/solaris/depend.daemons.in index 3430e8c964..64fb03ac19 100644 --- a/solaris/depend.daemons.in +++ b/solaris/depend.daemons.in @@ -1,4 +1,4 @@ -P QUAGGAlibs Quagga common runtime libraries +P FRRlibs FreeRangeRouting common runtime libraries @PACKAGE_VERSION@,REV=@CONFDATE@ P SUNWcsu Core Solaris, (Usr) P SUNWcsr Core Solaris Libraries (Root) diff --git a/solaris/depend.dev.in b/solaris/depend.dev.in index 8f234826b2..5d8bf16ed6 100644 --- a/solaris/depend.dev.in +++ b/solaris/depend.dev.in @@ -1,2 +1,2 @@ -P QUAGGAlibs Quagga common runtime libraries +P FRRlibs FreeRangeRouting common runtime libraries @PACKAGE_VERSION@,REV=@CONFDATE@ diff --git a/solaris/depend.libs.in b/solaris/depend.libs.in index 41859770a8..6ead0b2867 100644 --- a/solaris/depend.libs.in +++ b/solaris/depend.libs.in @@ -1,5 +1,5 @@ P SUNWcslr Core Solaris Libraries (Root) P SUNWcsl Core Solaris, (Shared Libs) P SUNWlibmsr Math & Microtasking Libraries (Root) -R QUAGGAdaemons Quagga daemons -R QUAGGAdev +R FRRdaemons FreeRangeRouting daemons +R FRRdev diff --git a/solaris/depend.smf.in b/solaris/depend.smf.in index 6d928d2df7..66b11eba2a 100644 --- a/solaris/depend.smf.in +++ b/solaris/depend.smf.in @@ -1,4 +1,4 @@ -P QUAGGAdaemons Quagga daemons +P FRRaemons FreeRangeRouting daemons @PACKAGE_VERSION@,REV=@CONFDATE@ P SUNWcsu Core Solaris, (Usr) P SUNWcsr Core Solaris Libraries (Root) diff --git a/solaris/quagga.init.in b/solaris/frr.init.in similarity index 79% rename from solaris/quagga.init.in rename to solaris/frr.init.in index ee3a987f33..580fd9b35c 100755 --- a/solaris/quagga.init.in +++ b/solaris/frr.init.in @@ -3,22 +3,22 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This file is part of Quagga. +# This file is part of FreeRangeRouting. # -# Quagga is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the +# FreeRangeRouting 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, or (at your option) any # later version. # -# Quagga is distributed in the hope that it will be useful, but +# FreeRangeRouting 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 Quagga; see the file COPYING. If not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# along with FreeRangeRouting; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. # # Starts/stops the given daemon @@ -74,36 +74,36 @@ handle_routeadm_upgrade () { upgrade_config () { DAEMON=$1 - # handle upgrade of SUNWzebra to Quagga - if [ -d "/etc/quagga" -a ! -f "/etc/quagga/${DAEMON}.conf" ] ; then + # handle upgrade of SUNWzebra to FreeRangeRouting + if [ -d "/etc/frr" -a ! -f "/etc/frr/${DAEMON}.conf" ] ; then if [ -f "/etc/sfw/zebra/${DAEMON}.conf" ] ; then cp "/etc/sfw/zebra/${DAEMON}.conf" \ - "/etc/quagga/${DAEMON}.conf.upgrade" \ + "/etc/frr/${DAEMON}.conf.upgrade" \ || exit $SMF_EXIT_ERR_FATAL - chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.upgrade" \ + chown "${USER}:${GROUP}" "/etc/frr/${DAEMON}.conf.upgrade" \ || exit $SMF_EXIT_ERR_FATAL - chmod 0600 "/etc/quagga/${DAEMON}.conf.upgrade" \ + chmod 0600 "/etc/frr/${DAEMON}.conf.upgrade" \ || exit $SMF_EXIT_ERR_FATAL - mv "/etc/quagga/${DAEMON}.conf.upgrade" "/etc/quagga/${DAEMON}.conf" \ + mv "/etc/frr/${DAEMON}.conf.upgrade" "/etc/frr/${DAEMON}.conf" \ || exit $SMF_EXIT_ERR_FATAL fi fi - if [ ! -f "/etc/quagga/${DAEMON}.conf" ] ; then - touch "/etc/quagga/${DAEMON}.conf.new" \ + if [ ! -f "/etc/frr/${DAEMON}.conf" ] ; then + touch "/etc/frr/${DAEMON}.conf.new" \ || exit $SMF_EXIT_ERR_FATAL - chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.new" \ + chown "${USER}:${GROUP}" "/etc/frr/${DAEMON}.conf.new" \ || exit $SMF_EXIT_ERR_FATAL - chmod 0600 "/etc/quagga/${DAEMON}.conf.new" \ + chmod 0600 "/etc/frr/${DAEMON}.conf.new" \ || exit $SMF_EXIT_ERR_FATAL - mv "/etc/quagga/${DAEMON}.conf.new" "/etc/quagga/${DAEMON}.conf" \ + mv "/etc/frr/${DAEMON}.conf.new" "/etc/frr/${DAEMON}.conf" \ || exit $SMF_EXIT_ERR_FATAL fi } # Relevant to S10+ -quagga_is_globalzone () { - if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \ +frr_is_globalzone () { + if [ "${FRR_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \ -o `/sbin/zonename -t` = "exclusive" ]; then return 0 else @@ -188,9 +188,9 @@ case $1 in esac if smf_present ; then - QUAGGA_METHOD="start" + FRR_METHOD="start" else - QUAGGA_METHOD="$1" + FRR_METHOD="$1" shift; fi @@ -208,7 +208,7 @@ case "${DAEMON}" in bgpd) ;; zebra | ospfd | ospf6d | ripd | ripngd ) - quagga_is_globalzone || exit $SMF_EXIT_OK + frr_is_globalzone || exit $SMF_EXIT_OK ;; *) usage @@ -216,7 +216,7 @@ case "${DAEMON}" in ;; esac -# Older Quagga SMF packages pass daemon args on the commandline +# Older FreeRangeRouting SMF packages pass daemon args on the commandline # Newer SMF routeadm model uses properties for each argument # so we must handle that. if [ smf_present -a -f "$ROUTEADMINCLUDE" ]; then @@ -236,14 +236,14 @@ if [ ! -f "@sysconfdir@/${DAEMON}.conf" ] ; then exit $SMF_EXIT_ERR_CONFIG fi -# we need @quagga_statedir@ to exist, it probably is on tmpfs. -if [ ! -d @quagga_statedir@ ] ; then - mkdir -p @quagga_statedir@ - chown @enable_user@:@enable_group@ @quagga_statedir@ - chmod 751 @quagga_statedir@ +# we need @frr_statedir@ to exist, it probably is on tmpfs. +if [ ! -d @frr_statedir@ ] ; then + mkdir -p @frr_statedir@ + chown @enable_user@:@enable_group@ @frr_statedir@ + chmod 751 @frr_statedir@ fi -PIDFILE="@quagga_statedir@/${DAEMON}.pid" +PIDFILE="@frr_statedir@/${DAEMON}.pid" start () { if [ ! -x "$DAEMON_PATH/$DAEMON" ] ; then @@ -259,7 +259,7 @@ stop_by_pidfile () { fi } -case "$QUAGGA_METHOD" in +case "$FRR_METHOD" in 'start') start ;; diff --git a/solaris/quagga.xml.in b/solaris/frr.xml.in similarity index 88% rename from solaris/quagga.xml.in rename to solaris/frr.xml.in index 60427b06e9..5ac7e52721 100644 --- a/solaris/quagga.xml.in +++ b/solaris/frr.xml.in @@ -1,32 +1,32 @@ - + - + - + option name, consult FreeRangeRouting documentation --> + @frr_statedir@ --> @@ -142,14 +142,14 @@ @@ -161,7 +161,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -273,14 +273,14 @@ @@ -292,7 +292,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -402,14 +402,14 @@ @@ -421,7 +421,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -533,14 +533,14 @@ @@ -552,7 +552,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -659,14 +659,14 @@ @@ -679,7 +679,7 @@ type='service' version='1'> - + - + - + + @frr_statedir@ --> @@ -812,14 +812,14 @@ diff --git a/solaris/pkginfo.daemons.tmpl.in b/solaris/pkginfo.daemons.tmpl.in index cab0e3c231..7070d6dc97 100644 --- a/solaris/pkginfo.daemons.tmpl.in +++ b/solaris/pkginfo.daemons.tmpl.in @@ -1,2 +1,2 @@ -PKG="QUAGGAdaemons" +PKG="FRRdaemons" NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ daemons" diff --git a/solaris/pkginfo.dev.tmpl.in b/solaris/pkginfo.dev.tmpl.in index 9c5d23e28b..23796ba226 100644 --- a/solaris/pkginfo.dev.tmpl.in +++ b/solaris/pkginfo.dev.tmpl.in @@ -1,3 +1,3 @@ -PKG=QUAGGAdev +PKG=FRRdev NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ development files" diff --git a/solaris/pkginfo.doc.tmpl.in b/solaris/pkginfo.doc.tmpl.in index 809ec77518..727fbb526f 100644 --- a/solaris/pkginfo.doc.tmpl.in +++ b/solaris/pkginfo.doc.tmpl.in @@ -1,2 +1,2 @@ -PKG=QUAGGAdoc +PKG=FRRdoc NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ documentation" diff --git a/solaris/pkginfo.libs.tmpl.in b/solaris/pkginfo.libs.tmpl.in index 42adc6e1b7..adf945862c 100644 --- a/solaris/pkginfo.libs.tmpl.in +++ b/solaris/pkginfo.libs.tmpl.in @@ -1,2 +1,2 @@ -PKG=QUAGGAlibs +PKG=FRRlibs NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ common runtime libraries" diff --git a/solaris/pkginfo.smf.tmpl.in b/solaris/pkginfo.smf.tmpl.in index 4aa03936e4..a90cb1bdee 100644 --- a/solaris/pkginfo.smf.tmpl.in +++ b/solaris/pkginfo.smf.tmpl.in @@ -1,2 +1,2 @@ -PKG="QUAGGAsmf" +PKG="FRRsmf" NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ SMF support" diff --git a/solaris/pkginfo.tmpl.in b/solaris/pkginfo.tmpl.in index 2dd27fd2cf..02abb0f96b 100644 --- a/solaris/pkginfo.tmpl.in +++ b/solaris/pkginfo.tmpl.in @@ -1,9 +1,9 @@ ARCH="@target_cpu@" CATEGORY="system" VERSION="@PACKAGE_VERSION@,REV=@CONFDATE@" -VENDOR="http://www.quagga.net/" +VENDOR="http://www.freerangerouting.org/" HOTLINE="@PACKAGE_BUGREPORT@" -EMAIL=paul@quagga.net +EMAIL=maintainers@freerangerouting.org DESC="@PACKAGE_NAME@ Routing Protocols" MAXINST=1 CLASSES="none preserve renamenew manifest" diff --git a/solaris/prototype.daemons.in b/solaris/prototype.daemons.in index 8a906c9d0a..9af275a17f 100644 --- a/solaris/prototype.daemons.in +++ b/solaris/prototype.daemons.in @@ -17,4 +17,4 @@ f none @sysconfdir@/ripd.conf.sample=$DESTDIR/@sysconfdir@/ripd.conf.sample 0644 f none @sysconfdir@/ripngd.conf.sample=$DESTDIR/@sysconfdir@/ripngd.conf.sample 0644 root bin f none @sysconfdir@/ospfd.conf.sample=$DESTDIR/@sysconfdir@/ospfd.conf.sample 0644 root bin f none @sysconfdir@/ospf6d.conf.sample=$DESTDIR/@sysconfdir@/ospf6d.conf.sample 0644 root bin -d none @quagga_statedir@=$DESTDIR/@quagga_statedir@ 0711 @enable_user@ @enable_group@ +d none @frr_statedir@=$DESTDIR/@frr_statedir@ 0711 @enable_user@ @enable_group@ diff --git a/solaris/prototype.dev.in b/solaris/prototype.dev.in index 2ad937b78a..dd3ae399ae 100644 --- a/solaris/prototype.dev.in +++ b/solaris/prototype.dev.in @@ -8,50 +8,50 @@ f none @libdir@/libospf.a=$DESTDIR/@libdir@/libospf.a 0644 root bin f none @libdir@/libospfapiclient.la=$DESTDIR/@libdir@/libospfapiclient.la 0755 root bin f none @libdir@/libospfapiclient.a=$DESTDIR/@libdir@/libospfapiclient.a 0644 root bin d none @includedir@=$DESTDIR/@includedir@ 0755 root bin -d none @includedir@/quagga=$DESTDIR/@includedir@/quagga 0755 root bin -d none @includedir@/quagga/ospfd=$DESTDIR/@includedir@/quagga/ospfd 0755 root bin -f none @includedir@/quagga/ospfd/ospf_api.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_api.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_asbr.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_asbr.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_dump.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_dump.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_lsa.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_lsa.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_lsdb.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_lsdb.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_nsm.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_nsm.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_ism.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_ism.h 0644 root bin -f none @includedir@/quagga/ospfd/ospf_opaque.h=$DESTDIR/@includedir@/quagga/ospfd/ospf_opaque.h 0644 root bin -f none @includedir@/quagga/ospfd/ospfd.h=$DESTDIR/@includedir@/quagga/ospfd/ospfd.h 0644 root bin -f none @includedir@/quagga/buffer.h=$DESTDIR/@includedir@/quagga/buffer.h 0644 root bin -f none @includedir@/quagga/command.h=$DESTDIR/@includedir@/quagga/command.h 0644 root bin -f none @includedir@/quagga/filter.h=$DESTDIR/@includedir@/quagga/filter.h 0644 root bin -f none @includedir@/quagga/getopt.h=$DESTDIR/@includedir@/quagga/getopt.h 0644 root bin -f none @includedir@/quagga/hash.h=$DESTDIR/@includedir@/quagga/hash.h 0644 root bin -f none @includedir@/quagga/if.h=$DESTDIR/@includedir@/quagga/if.h 0644 root bin -f none @includedir@/quagga/linklist.h=$DESTDIR/@includedir@/quagga/linklist.h 0644 root bin -f none @includedir@/quagga/log.h=$DESTDIR/@includedir@/quagga/log.h 0644 root bin -f none @includedir@/quagga/memory.h=$DESTDIR/@includedir@/quagga/memory.h 0644 root bin -f none @includedir@/quagga/network.h=$DESTDIR/@includedir@/quagga/network.h 0644 root bin -f none @includedir@/quagga/prefix.h=$DESTDIR/@includedir@/quagga/prefix.h 0644 root bin -f none @includedir@/quagga/routemap.h=$DESTDIR/@includedir@/quagga/routemap.h 0644 root bin -f none @includedir@/quagga/distribute.h=$DESTDIR/@includedir@/quagga/distribute.h 0644 root bin -f none @includedir@/quagga/sockunion.h=$DESTDIR/@includedir@/quagga/sockunion.h 0644 root bin -f none @includedir@/quagga/str.h=$DESTDIR/@includedir@/quagga/str.h 0644 root bin -f none @includedir@/quagga/stream.h=$DESTDIR/@includedir@/quagga/stream.h 0644 root bin -f none @includedir@/quagga/table.h=$DESTDIR/@includedir@/quagga/table.h 0644 root bin -f none @includedir@/quagga/thread.h=$DESTDIR/@includedir@/quagga/thread.h 0644 root bin -f none @includedir@/quagga/vector.h=$DESTDIR/@includedir@/quagga/vector.h 0644 root bin -f none @includedir@/quagga/version.h=$DESTDIR/@includedir@/quagga/version.h 0644 root bin -f none @includedir@/quagga/vty.h=$DESTDIR/@includedir@/quagga/vty.h 0644 root bin -f none @includedir@/quagga/zebra.h=$DESTDIR/@includedir@/quagga/zebra.h 0644 root bin -f none @includedir@/quagga/plist.h=$DESTDIR/@includedir@/quagga/plist.h 0644 root bin -f none @includedir@/quagga/zclient.h=$DESTDIR/@includedir@/quagga/zclient.h 0644 root bin -f none @includedir@/quagga/sockopt.h=$DESTDIR/@includedir@/quagga/sockopt.h 0644 root bin -f none @includedir@/quagga/smux.h=$DESTDIR/@includedir@/quagga/smux.h 0644 root bin -f none @includedir@/quagga/md5.h=$DESTDIR/@includedir@/quagga/md5.h 0644 root bin -f none @includedir@/quagga/if_rmap.h=$DESTDIR/@includedir@/quagga/if_rmap.h 0644 root bin -f none @includedir@/quagga/keychain.h=$DESTDIR/@includedir@/quagga/keychain.h 0644 root bin -f none @includedir@/quagga/privs.h=$DESTDIR/@includedir@/quagga/privs.h 0644 root bin -f none @includedir@/quagga/sigevent.h=$DESTDIR/@includedir@/quagga/sigevent.h 0644 root bin -f none @includedir@/quagga/pqueue.h=$DESTDIR/@includedir@/quagga/pqueue.h 0644 root bin -f none @includedir@/quagga/jhash.h=$DESTDIR/@includedir@/quagga/jhash.h 0644 root bin -f none @includedir@/quagga/zassert.h=$DESTDIR/@includedir@/quagga/zassert.h 0644 root bin -d none @includedir@/quagga/ospfapi=$DESTDIR/@includedir@/quagga/ospfapi 0755 root bin -f none @includedir@/quagga/ospfapi/ospf_apiclient.h=$DESTDIR/@includedir@/quagga/ospfapi/ospf_apiclient.h 0644 root bin +d none @includedir@/frr=$DESTDIR/@includedir@/frr 0755 root bin +d none @includedir@/frr/ospfd=$DESTDIR/@includedir@/frr/ospfd 0755 root bin +f none @includedir@/frr/ospfd/ospf_api.h=$DESTDIR/@includedir@/frr/ospfd/ospf_api.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_asbr.h=$DESTDIR/@includedir@/frr/ospfd/ospf_asbr.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_dump.h=$DESTDIR/@includedir@/frr/ospfd/ospf_dump.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_lsa.h=$DESTDIR/@includedir@/frr/ospfd/ospf_lsa.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_lsdb.h=$DESTDIR/@includedir@/frr/ospfd/ospf_lsdb.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_nsm.h=$DESTDIR/@includedir@/frr/ospfd/ospf_nsm.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_ism.h=$DESTDIR/@includedir@/frr/ospfd/ospf_ism.h 0644 root bin +f none @includedir@/frr/ospfd/ospf_opaque.h=$DESTDIR/@includedir@/frr/ospfd/ospf_opaque.h 0644 root bin +f none @includedir@/frr/ospfd/ospfd.h=$DESTDIR/@includedir@/frr/ospfd/ospfd.h 0644 root bin +f none @includedir@/frr/buffer.h=$DESTDIR/@includedir@/frr/buffer.h 0644 root bin +f none @includedir@/frr/command.h=$DESTDIR/@includedir@/frr/command.h 0644 root bin +f none @includedir@/frr/filter.h=$DESTDIR/@includedir@/frr/filter.h 0644 root bin +f none @includedir@/frr/getopt.h=$DESTDIR/@includedir@/frr/getopt.h 0644 root bin +f none @includedir@/frr/hash.h=$DESTDIR/@includedir@/frr/hash.h 0644 root bin +f none @includedir@/frr/if.h=$DESTDIR/@includedir@/frr/if.h 0644 root bin +f none @includedir@/frr/linklist.h=$DESTDIR/@includedir@/frr/linklist.h 0644 root bin +f none @includedir@/frr/log.h=$DESTDIR/@includedir@/frr/log.h 0644 root bin +f none @includedir@/frr/memory.h=$DESTDIR/@includedir@/frr/memory.h 0644 root bin +f none @includedir@/frr/network.h=$DESTDIR/@includedir@/frr/network.h 0644 root bin +f none @includedir@/frr/prefix.h=$DESTDIR/@includedir@/frr/prefix.h 0644 root bin +f none @includedir@/frr/routemap.h=$DESTDIR/@includedir@/frr/routemap.h 0644 root bin +f none @includedir@/frr/distribute.h=$DESTDIR/@includedir@/frr/distribute.h 0644 root bin +f none @includedir@/frr/sockunion.h=$DESTDIR/@includedir@/frr/sockunion.h 0644 root bin +f none @includedir@/frr/str.h=$DESTDIR/@includedir@/frr/str.h 0644 root bin +f none @includedir@/frr/stream.h=$DESTDIR/@includedir@/frr/stream.h 0644 root bin +f none @includedir@/frr/table.h=$DESTDIR/@includedir@/frr/table.h 0644 root bin +f none @includedir@/frr/thread.h=$DESTDIR/@includedir@/frr/thread.h 0644 root bin +f none @includedir@/frr/vector.h=$DESTDIR/@includedir@/frr/vector.h 0644 root bin +f none @includedir@/frr/version.h=$DESTDIR/@includedir@/frr/version.h 0644 root bin +f none @includedir@/frr/vty.h=$DESTDIR/@includedir@/frr/vty.h 0644 root bin +f none @includedir@/frr/zebra.h=$DESTDIR/@includedir@/frr/zebra.h 0644 root bin +f none @includedir@/frr/plist.h=$DESTDIR/@includedir@/frr/plist.h 0644 root bin +f none @includedir@/frr/zclient.h=$DESTDIR/@includedir@/frr/zclient.h 0644 root bin +f none @includedir@/frr/sockopt.h=$DESTDIR/@includedir@/frr/sockopt.h 0644 root bin +f none @includedir@/frr/smux.h=$DESTDIR/@includedir@/frr/smux.h 0644 root bin +f none @includedir@/frr/md5.h=$DESTDIR/@includedir@/frr/md5.h 0644 root bin +f none @includedir@/frr/if_rmap.h=$DESTDIR/@includedir@/frr/if_rmap.h 0644 root bin +f none @includedir@/frr/keychain.h=$DESTDIR/@includedir@/frr/keychain.h 0644 root bin +f none @includedir@/frr/privs.h=$DESTDIR/@includedir@/frr/privs.h 0644 root bin +f none @includedir@/frr/sigevent.h=$DESTDIR/@includedir@/frr/sigevent.h 0644 root bin +f none @includedir@/frr/pqueue.h=$DESTDIR/@includedir@/frr/pqueue.h 0644 root bin +f none @includedir@/frr/jhash.h=$DESTDIR/@includedir@/frr/jhash.h 0644 root bin +f none @includedir@/frr/zassert.h=$DESTDIR/@includedir@/frr/zassert.h 0644 root bin +d none @includedir@/frr/ospfapi=$DESTDIR/@includedir@/frr/ospfapi 0755 root bin +f none @includedir@/frr/ospfapi/ospf_apiclient.h=$DESTDIR/@includedir@/frr/ospfapi/ospf_apiclient.h 0644 root bin diff --git a/solaris/prototype.doc.in b/solaris/prototype.doc.in index 42b076d0ec..a8644b3145 100644 --- a/solaris/prototype.doc.in +++ b/solaris/prototype.doc.in @@ -3,7 +3,7 @@ i depend=$abs_builddir/depend.doc i copying=$abs_top_srcdir/COPYING d none @infodir@=$DESTDIR/@infodir@ 0755 root bin #f none @infodir@/dir=$DESTDIR/@infodir@/dir 0644 root bin -f none @infodir@/quagga.info=$DESTDIR/@infodir@/quagga.info 0644 root bin +f none @infodir@/frr.info=$DESTDIR/@infodir@/frr.info 0644 root bin d none @mandir@=$DESTDIR/@mandir@ 0755 root bin d none @mandir@/man1=$DESTDIR/@mandir@/man1 0755 root bin f none @mandir@/man1/vtysh.1=$DESTDIR/@mandir@/man1/vtysh.1 0644 root bin diff --git a/solaris/prototype.smf.in b/solaris/prototype.smf.in index 3c80f39b1e..5755a8827d 100644 --- a/solaris/prototype.smf.in +++ b/solaris/prototype.smf.in @@ -3,6 +3,6 @@ i depend=$abs_builddir/depend.smf i copying=$abs_top_srcdir/COPYING i i.manifest i r.manifest -f manifest var/svc/manifest/network/quagga.xml 0444 root bin +f manifest var/svc/manifest/network/frr.xml 0444 root bin #f none var/svc/profile/@PACKAGE_TARNAME@_options.xml=$abs_builddir/options.xml 0755 root sys -f none lib/svc/method/quagga=$abs_builddir/quagga.init 0755 root bin +f none lib/svc/method/frr=$abs_builddir/frr.init 0755 root bin From f89f4f108e43b4bd29e3e2b006994322419e750c Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 00:10:48 +0700 Subject: [PATCH 11/64] redhat: Fix spec file changelog to use automatic version for last entry Signed-off-by: Martin Winter --- redhat/frr.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a815e151df..c53e8459c9 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -570,10 +570,10 @@ rm -rf %{buildroot} %endif %changelog -* Fri Jan 6 2017 Martin Winter +* Fri Jan 6 2017 Martin Winter - %{version} - Renamed to frr for FreeRangeRouting fork of Quagga -* Thu Feb 11 2016 Paul Jakma - %{version} +* Thu Feb 11 2016 Paul Jakma - remove with_ipv6 conditionals, always build v6 - Fix UTF-8 char in spec changelog - remove quagga.pam.stack, long deprecated. From b189cfb3c9d51fd971464e9ee8d9072f47ee86c0 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 00:31:01 +0700 Subject: [PATCH 12/64] Doc: Update Bug Reporting instructions to FreeRangeRouting and Github Issue Tracker Signed-off-by: Martin Winter --- REPORTING-BUGS | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/REPORTING-BUGS b/REPORTING-BUGS index 83f4eb990a..ea36ff5eed 100644 --- a/REPORTING-BUGS +++ b/REPORTING-BUGS @@ -1,5 +1,5 @@ -This file describes the procedure for reporting Quagga bugs. You are not -obliged to follow this format, but it would be great help for Quagga developers +This file describes the procedure for reporting FreeRangeRouting bugs. You are not +obliged to follow this format, but it would be great help for FreeRangeRouting developers if you report a bug as described below. Bugs submitted with woefully incomplete information may be summarily @@ -9,23 +9,24 @@ additional information. Bugs may be closed after 30 days of non-response to requests to reconfirm or supply additional information. -Report bugs http://bugzilla.quagga.net +Report bugs on Github Issue Tracker at + https://github.com/freerangerouting/frr/issues Please supply the following information: -1. Your Quagga version or if it is from git then the commit reference. +1. Your FreeRangeRouting version or if it is from git then the commit reference. Please try to report bugs against git master or the latest release. -2. Quagga daemons you run e.g. bgpd or ripd and full name of your OS. Any +2. FRR daemons you run e.g. bgpd or ripd and full name of your OS. Any specific options you compiled Quagga with. 3. Problem description. Copy and paste relative commands and their output to describe your network setup e.g. "zebra>show ip route". Please, also give your simple network layout and output of relative OS commands (e.g., ifconfig (BSD) or ip (Linux)). -4. All Quagga configuration files you use. If you don't want to publish your +4. All FRR configuration files you use. If you don't want to publish your network numbers change 2 middle bytes in IPv4 address to be XXX (e.g. 192.XXX.XXX.32/24). Similar could be done with IPv6. -5. If any Quagga daemon core dumped, please, supply stack trace using the +5. If any FRR daemon core dumped, please, supply stack trace using the following commands: host> gdb exec_file core_file , (gdb) bt . -6. Run all Quagga daemons with full debugging on (see documentation on +6. Run all FRR daemons with full debugging on (see documentation on debugging) and send _only_ part of logs which are relative to your problem. 7. If the problem is difficult to reproduce please send a shell script to reproduce it. From 89ebfbb49d0b07b737b907d0b8f44502c1475041 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 00:34:03 +0700 Subject: [PATCH 13/64] Doc: Update URL to freerangerouting.org Signed-off-by: Martin Winter --- ChangeLog | 4 ++-- debian/README.Debian | 2 +- debian/copyright | 4 ++-- doc/frr.texi | 12 ++++++------ doc/overview.texi | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ed5061be4..a201bb6819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -ChangeLog information for Quagga is now recorded in our source-code +ChangeLog information for FreeRangeRouting is for now recorded in source-code management system. Please see: - http://www.quagga.net/devel.php + http://www.freerangerouting.org/ diff --git a/debian/README.Debian b/debian/README.Debian index fb481eb456..f21c10742d 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -14,7 +14,7 @@ available forcing you to explicitly type "apt-get install frr" to upgrade it. * What is frr? ================= -http://www.freerangerouting.net/ +http://www.freerangerouting.org/ > Frr is a routing software suite, providing implementations of OSPFv2, > OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms, particularly > FreeBSD and Linux and also NetBSD, to mention a few. Frr is a fork of GNU diff --git a/debian/copyright b/debian/copyright index ab392027c8..6a5ed98f91 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Frr -Upstream-Contact: maintainers@freerangerouting.net, security@freerangerouting.net -Source: http://www.freerangerouting.net/ +Upstream-Contact: maintainers@freerangerouting.org, security@freerangerouting.org +Source: http://www.freerangerouting.org/ Files: * Copyright: 1996-2003 by the original Zebra authors: diff --git a/doc/frr.texi b/doc/frr.texi index 360acebe16..d4a78b7b81 100644 --- a/doc/frr.texi +++ b/doc/frr.texi @@ -7,7 +7,7 @@ @setfilename frr.info @c Set variables - sourced from defines.texi @include defines.texi -@settitle @uref{http://www.freerangerouting.net,,@value{PACKAGE_NAME}} +@settitle @uref{http://www.freerangerouting.org,,@value{PACKAGE_NAME}} @c %**end of header @c automake will automatically generate version.texi @@ -48,16 +48,16 @@ This file documents the Frr Software Routing Suite which manages common TCP/IP routing protocols. This is Edition @value{EDITION}, last updated @value{UPDATED} of -@cite{The Frr Manual}, for @uref{http://www.freerangerouting.net/,,@value{PACKAGE_NAME}} +@cite{The Frr Manual}, for @uref{http://www.freerangerouting.org/,,@value{PACKAGE_NAME}} Version @value{VERSION}. @insertcopying @end ifinfo @titlepage -@title @uref{http://www.freerangerouting.net,,Frr} +@title @uref{http://www.freerangerouting.org,,Frr} @subtitle A routing software package for TCP/IP networks -@subtitle @uref{http://www.freerangerouting.net,,@value{PACKAGE_NAME}} @value{VERSION} +@subtitle @uref{http://www.freerangerouting.org,,@value{PACKAGE_NAME}} @value{VERSION} @subtitle @value{UPDATED-MONTH} @author @value{AUTHORS} @@ -72,9 +72,9 @@ Version @value{VERSION}. @node Top @top Frr -- With Virtual Network Control -@uref{http://www.freerangerouting.net,,Frr} is an advanced routing software package +@uref{http://www.freerangerouting.org,,Frr} is an advanced routing software package that provides a suite of TCP/IP based routing protocols. This is the Manual -for @value{PACKAGE_STRING}. @uref{http://www.freerangerouting.net,,Frr} is a fork of +for @value{PACKAGE_STRING}. @uref{http://www.freerangerouting.org,,Frr} is a fork of @uref{http://www.quagga.net,,Quagga}. @insertcopying diff --git a/doc/overview.texi b/doc/overview.texi index d1e8ea48b2..370ada3f8a 100644 --- a/doc/overview.texi +++ b/doc/overview.texi @@ -2,7 +2,7 @@ @chapter Overview @cindex Overview - @uref{http://www.freerangerouting.net,,Frr} is a routing software package that + @uref{http://www.freerangerouting.org,,Frr} is a routing software package that provides TCP/IP based routing services with routing protocols support such as RIPv1, RIPv2, RIPng, OSPFv2, OSPFv3, IS-IS, BGP-4, and BGP-4+ (@pxref{Supported RFCs}). Frr also supports special BGP Route Reflector and Route Server @@ -275,12 +275,12 @@ November 1995.} The official Frr web-site is located at: -@uref{http://www.freerangerouting.net/} +@uref{http://www.freerangerouting.org/} and contains further information, as well as links to additional resources. -@uref{http://www.freerangerouting.net/,Frr} is a fork of Quagga, whose +@uref{http://www.freerangerouting.org/,Frr} is a fork of Quagga, whose web-site is located at: @uref{http://www.quagga.net/}. @@ -298,7 +298,7 @@ comments or suggestions to Frr, please subscribe to: @uref{http://lists.nox.tf/listinfo/frr-users}. -The @uref{http://www.freerangerouting.net/,,Frr} site has further information on +The @uref{http://www.freerangerouting.org/,,Frr} site has further information on the available mailing lists, see: @uref{http://lists.nox.tf/lists.php} From 555d1e3a4e0c08fe46d963b49a32fe45ac438cd2 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 00:36:29 +0700 Subject: [PATCH 14/64] buildtest.sh: Change name from quagga to frr Signed-off-by: Martin Winter --- buildtest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildtest.sh b/buildtest.sh index eafd57dbf3..cbe6962a43 100755 --- a/buildtest.sh +++ b/buildtest.sh @@ -4,7 +4,7 @@ # builds some git commit of Quagga in some different configurations # usage: buildtest.sh [commit [configurations...]] -basecfg="--prefix=/usr --enable-user=quagga --enable-group=quagga --enable-vty-group=quagga --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/quagga --enable-exampledir=/etc/quagga/samples --localstatedir=/var/run/quagga --libdir=/usr/lib64/quagga --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror" +basecfg="--prefix=/usr --enable-user=frr --enable-group=frr --enable-vty-group=frr --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/frr --enable-exampledir=/etc/frr/samples --localstatedir=/var/run/frr --libdir=/usr/lib64/frr --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror" configs_base="gcc|$basecfg" @@ -36,7 +36,7 @@ trap errfunc ERR COMMITREF="$1" COMMITISH="`git rev-list --max-count=1 ${COMMITREF:-HEAD}`" -TEMP="`mktemp -t -d quaggabuild.XXXXXX`" +TEMP="`mktemp -t -d frrbuild.XXXXXX`" BASE="`pwd`" CONFIGS="$2" From 63a79ae1c223ad01d29a19c093da564952904f5b Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 02:53:21 +0700 Subject: [PATCH 15/64] Debian/Doc: Fix correct reference about FRR fork from Quagga Signed-off-by: Martin Winter --- debian/README.Debian | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index f21c10742d..893c1decaa 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -15,38 +15,25 @@ available forcing you to explicitly type "apt-get install frr" to upgrade it. ================= http://www.freerangerouting.org/ -> Frr is a routing software suite, providing implementations of OSPFv2, -> OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms, particularly -> FreeBSD and Linux and also NetBSD, to mention a few. Frr is a fork of GNU -> Zebra which was developed by Kunihiro Ishiguro. Development of GNU Zebra -> slowed dramatically to the point where eventually GNU Zebra was forked into -> Frr. - -> The Frr tree is an attempt to provide a zebra tree with at least the -> bug-fixes, which have accumulated, applied, while tracking any significant -> changes made to the zebra.org tree. Ultimately, this tree hopes to revitalise -> development of this code base. - -I packaged zebra-pj which was then renamed to frr to get people used to it -and offer Debian users the choice which versions they like to use. I hope this -brings frr some feedback and helps it evolving to a good successor of the -orphaned zebra. - - -- Christian Hammers , Jul/Aug 2003 +FRR is a routing software suite, providing implementations of OSPFv2, +OSPFv3, RIP v1 and v2, RIPng, ISIS, PIM, BGP and LDP for Unix platforms, particularly +FreeBSD and Linux and also NetBSD, to mention a few. FRR is a fork of Quagga +which itself is a fork of Zebra. +Zebra was developed by Kunihiro Ishiguro. * Why has SNMP support been disabled? ===================================== -Frr used to link against the NetSNMP libraries to provide SNMP +FRR used to link against the NetSNMP libraries to provide SNMP support. Those libraries sadly link against the OpenSSL libraries to provide crypto support for SNMPv3 among others. OpenSSL now is not compatible with the GNU GENERAL PUBLIC LICENSE (GPL) -licence that Frr is distributed under. For more explanation read: +licence that FRR is distributed under. For more explanation read: http://www.gnome.org/~markmc/openssl-and-the-gpl.html http://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs Updating the licence to explecitly allow linking against OpenSSL would requite the affirmation of all people that ever contributed -a significant part to Zebra or Frr and thus are the collective +a significant part to Zebra / Quagga or FRR and thus are the collective "copyright holder". That's too much work. Using a shrinked down version of NetSNMP without OpenSSL or convincing the NetSNMP people to change to GnuTLS are maybe good solutions but not reachable @@ -55,7 +42,7 @@ during the last days before the Sarge release :-( *BUT* It is allowed by the used licence mix that you fetch the sources and -build Frr yourself with SNMP with +build FRR yourself with SNMP with # export WANT_SNMP=1 # apt-get -b source frr @@ -73,9 +60,9 @@ Default is not to start anything, since it can hose your system's routing table if not set up properly. Priorities were suggested by Dancer . -They're used to start the Frr daemons in more than one step +They're used to start the FRR daemons in more than one step (for example start one or two at network initialization and the -rest later). The number of Frr daemons being small, priorities +rest later). The number of FRR daemons being small, priorities must be between 1 and 9, inclusive (or the initscript has to be changed). /etc/init.d/frr then can be started as @@ -99,7 +86,7 @@ If this message occurs the receive buffer should be increased by adding the following to /etc/sysctl.conf and "--nl-bufsize" to /etc/frr/debian.conf. > net.core.rmem_default = 262144 > net.core.rmem_max = 262144 -See message #4525 from 2005-05-09 in the frr-users mailing list. +See message #4525 from 2005-05-09 in the quagga-users mailing list. * vtysh immediately exists: From fc5300bdbc9dba3221ad8f1e3d1beeb99a94bed6 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Jan 2017 02:58:55 +0700 Subject: [PATCH 16/64] Protobuf: Update library name to reflect name change to FRR Signed-off-by: Martin Winter --- common.am | 4 ++-- qpb/Makefile.am | 8 ++++---- qpb/README.txt | 2 +- qpb/qpb.proto | 2 +- qpb/qpb_allocator.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common.am b/common.am index ac7a3230da..c6da3d75e8 100644 --- a/common.am +++ b/common.am @@ -30,9 +30,9 @@ Q_PROTOBUF_SRCS = $(Q_PROTOBUF_CFILES) $(Q_PROTOBUF_HFILES) # # Information about how to link to various libraries. # -Q_QUAGGA_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libquagga_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS) +Q_FRR_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libfrr_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS) -Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfpm_pb.la $(Q_QUAGGA_PB_CLIENT_LDOPTS) +Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfpm_pb.la $(Q_FRR_PB_CLIENT_LDOPTS) endif # HAVE_PROTOBUF diff --git a/qpb/Makefile.am b/qpb/Makefile.am index 0fbda61f3c..e5951b2be9 100644 --- a/qpb/Makefile.am +++ b/qpb/Makefile.am @@ -5,8 +5,8 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib $(Q PROTOBUF_INCLUDES=-I$(top_srcdir) PROTOBUF_PACKAGE = qpb -lib_LTLIBRARIES = libquagga_pb.la -libquagga_pb_la_LDFLAGS = -version-info 0:0:0 +lib_LTLIBRARIES = libfrr_pb.la +libfrr_pb_la_LDFLAGS = -version-info 0:0:0 if HAVE_PROTOBUF protobuf_srcs = \ @@ -16,14 +16,14 @@ protobuf_srcs_nodist = \ qpb.pb-c.c endif -libquagga_pb_la_SOURCES = \ +libfrr_pb_la_SOURCES = \ linear_allocator.h \ qpb.h \ qpb.c \ qpb_allocator.h \ $(protobuf_srcs) -nodist_libquagga_pb_la_SOURCES = $(protobuf_srcs_nodist) +nodist_libfrr_pb_la_SOURCES = $(protobuf_srcs_nodist) CLEANFILES = $(Q_CLEANFILES) BUILT_SOURCES = $(Q_PROTOBUF_SRCS) diff --git a/qpb/README.txt b/qpb/README.txt index 99ccd05511..7a09452c6f 100644 --- a/qpb/README.txt +++ b/qpb/README.txt @@ -1 +1 @@ -Protobuf definitions and code that is applicable to all of quagga. +Protobuf definitions and code that is applicable to all of Quagga/FRR. diff --git a/qpb/qpb.proto b/qpb/qpb.proto index 8323d3ed73..a1595a9abd 100644 --- a/qpb/qpb.proto +++ b/qpb/qpb.proto @@ -21,7 +21,7 @@ */ /* - * Protobuf definitions pertaining to the Quagga Protobuf component. + * Protobuf definitions pertaining to the Quagga/FRR Protobuf component. */ package qpb; diff --git a/qpb/qpb_allocator.h b/qpb/qpb_allocator.h index 83ddf56cbc..bb7dcf38f3 100644 --- a/qpb/qpb_allocator.h +++ b/qpb/qpb_allocator.h @@ -24,7 +24,7 @@ */ /* - * Header file for quagga protobuf memory management code. + * Header file for Quagga/FRR protobuf memory management code. */ #ifndef _QPB_ALLOCATOR_H_ From 8a2a37324cd27677817fdec5d044c1b73eea1040 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 21 Jan 2017 07:51:22 -0500 Subject: [PATCH 17/64] debian: Fix changelog so sbuild will work Fix the changelog so a sbuild issued for the creation of a .deb works. Signed-off-by: Donald Sharp --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index ef019b4d23..e4635baa5d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ frr (2.0) Released; urgency=medium * Switchover to FRR + -- frr Mon, 23 Jan 2017 16:30:22 -0400 + quagga (0.99.24+cl3u5) RELEASED; urgency=medium * Closes: CM-12846 - Resolve Memory leaks in 'show ip bgp neighbor json' From eb78bc468effe7ca07f4bf5d62f3f10170e8f64f Mon Sep 17 00:00:00 2001 From: "G. Paul Ziemba" Date: Mon, 16 Jan 2017 11:09:12 -0800 Subject: [PATCH 18/64] bgpd rfapi: Shift rfapi receive hooks for vpn and encap safis into bgp_update/bgp_withdraw (Issue #91) Signed-off-by: G. Paul Ziemba --- bgpd/bgp_encap.c | 8 -------- bgpd/bgp_mplsvpn.c | 20 ++------------------ bgpd/bgp_route.c | 37 +++++++++++++++++++++++++++++++++++++ bgpd/rfapi/rfapi.c | 5 +++-- bgpd/rfapi/rfapi_import.c | 6 ++++++ 5 files changed, 48 insertions(+), 28 deletions(-) diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index 69f6c6157e..282815a596 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -188,15 +188,7 @@ bgp_nlri_parse_encap( if (attr) { bgp_update (peer, &p, 0, attr, afi, SAFI_ENCAP, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0); -#if ENABLE_BGP_VNC - rfapiProcessUpdate(peer, NULL, &p, &prd, attr, afi, SAFI_ENCAP, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL); -#endif } else { -#if ENABLE_BGP_VNC - rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, afi, SAFI_ENCAP, - ZEBRA_ROUTE_BGP, 0); -#endif bgp_withdraw (peer, &p, 0, attr, afi, SAFI_ENCAP, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL); } diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index e494f8cbb7..deb187abd2 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -154,9 +154,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr, safi_t safi; int addpath_encoded; u_int32_t addpath_id; -#if ENABLE_BGP_VNC - u_int32_t label = 0; -#endif /* Check peer status. */ if (peer->status != Established) @@ -232,10 +229,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr, return -1; } -#if ENABLE_BGP_VNC - label = decode_label (pnt); -#endif - /* Copyr label to prefix. */ tagpnt = pnt; @@ -277,18 +270,9 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr, { bgp_update (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0); -#if ENABLE_BGP_VNC - rfapiProcessUpdate(peer, NULL, &p, &prd, attr, packet->afi, - SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, - &label); -#endif } else { -#if ENABLE_BGP_VNC - rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, packet->afi, - SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, 0); -#endif bgp_withdraw (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt); } @@ -588,7 +572,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, afi_t afi, struct prefix struct rd_as rd_as; struct rd_ip rd_ip = {0}; #if ENABLE_BGP_VNC - struct rd_vnc_eth rd_vnc_eth; + struct rd_vnc_eth rd_vnc_eth = {0}; #endif u_char *pnt; @@ -798,7 +782,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, struct rd_as rd_as; struct rd_ip rd_ip = {0}; #if ENABLE_BGP_VNC - struct rd_vnc_eth rd_vnc_eth; + struct rd_vnc_eth rd_vnc_eth = {0}; #endif u_char *pnt; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 81516640bd..1db68e7195 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2686,6 +2686,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, bgp_process (bgp, rn, afi, safi); bgp_unlock_node (rn); +#if ENABLE_BGP_VNC + if (SAFI_MPLS_VPN == safi) + { + uint32_t label = decode_label(tag); + + rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, + &label); + } + if (SAFI_ENCAP == safi) + { + rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, + NULL); + } +#endif + return 0; } // End of implicit withdraw @@ -2780,6 +2795,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, /* Process change. */ bgp_process (bgp, rn, afi, safi); +#if ENABLE_BGP_VNC + if (SAFI_MPLS_VPN == safi) + { + uint32_t label = decode_label(tag); + + rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, + &label); + } + if (SAFI_ENCAP == safi) + { + rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, + NULL); + } +#endif + return 0; /* This BGP update is filtered. Log the reason then update BGP @@ -2819,6 +2849,13 @@ bgp_withdraw (struct peer *peer, struct prefix *p, u_int32_t addpath_id, struct bgp_node *rn; struct bgp_info *ri; +#if ENABLE_BGP_VNC + if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi)) + { + rfapiProcessWithdraw(peer, NULL, p, prd, NULL, afi, safi, type, 0); + } +#endif + bgp = peer->bgp; /* Lookup node. */ diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 599d6e88bf..ebd369f3ac 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -417,9 +417,10 @@ del_vnc_route ( { vnc_zlog_debug_verbose - ("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p", + ("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p, local_pref=%u", __func__, bi, bi->peer, bi->type, bi->sub_type, - (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL)); + (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL), + ((bi->attr && CHECK_FLAG(bi->attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))? bi->attr->local_pref: 0)); if (bi->peer == peer && bi->type == type && diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index ba26497207..4d35af2641 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -3724,6 +3724,12 @@ rfapiBgpInfoFilteredImportVPN ( if (rn->info) original_had_routes = 1; + if (VNC_DEBUG(VERBOSE)) + { + vnc_zlog_debug_verbose ("%s: showing IT node on entry", __func__); + rfapiShowItNode (NULL, rn); /* debug */ + } + /* * Look for same route (will have same RD and peer) */ From 780cff2f08530e449fb3bec45483e753a3ce2189 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 21 Jan 2017 02:29:25 +0700 Subject: [PATCH 19/64] pimd: Add missing 'socket' getopt cmdline option Signed-off-by: Martin Winter --- pimd/pim_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 29432ea230..7dfddd2991 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -56,6 +56,7 @@ struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, + { "socket", required_argument, NULL, 'z'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, { "version", no_argument, NULL, 'v'}, From 950765ba1034f125ae8106f1f554bb362abfa108 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:42:11 +0700 Subject: [PATCH 20/64] lib: Add set_socket_path() to sockopt.c to override the path element of a (vty) socket (but keep filename) Signed-off-by: Martin Winter --- lib/sockopt.c | 23 +++++++++++++++++++++++ lib/sockopt.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/lib/sockopt.c b/lib/sockopt.c index 461e1f7f54..570b575a7a 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -29,6 +29,29 @@ #include "sockopt.h" #include "sockunion.h" +/* Replace the path of given defaultpath with newpath, but keep filename */ +void +set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize) +{ + char *sock_name; + + sock_name = strrchr(defaultpath, '/'); + if (sock_name) + /* skip '/' */ + sock_name++; + else + /* + * VTYSH_PATH configured as relative path + * during config? Should really never happen for + * sensible config + */ + sock_name = defaultpath; + + strlcpy (path, newpath, maxsize); + strlcat (path, "/", maxsize); + strlcat (path, sock_name, maxsize); +} + void setsockopt_so_recvbuf (int sock, int size) { diff --git a/lib/sockopt.h b/lib/sockopt.h index b3ab57ab71..8e7895dd6f 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -24,6 +24,9 @@ #include "sockunion.h" +/* Override (vty) socket paths, but keep the filename */ +extern void set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize); + extern void setsockopt_so_recvbuf (int sock, int size); extern void setsockopt_so_sendbuf (const int sock, int size); extern int getsockopt_so_sendbuf (const int sock); From 48f8480d4c4e82c926e8f17f9041a54407833d1b Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:44:28 +0700 Subject: [PATCH 21/64] zebra: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- zebra/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/zebra/main.c b/zebra/main.c index 9abc8f87ff..aa1cbc3b26 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -59,6 +59,9 @@ struct zebra_t zebrad = /* process id. */ pid_t pid; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = ZEBRA_VTYSH_PATH; + /* Pacify zclient.o in libzebra, which expects this variable. */ struct thread_master *master; @@ -77,6 +80,7 @@ u_int32_t nl_rcvbufsize = 4194304; #endif /* HAVE_NETLINK */ /* Command line options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "batch", no_argument, NULL, 'b'}, @@ -90,6 +94,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK }, { "retain", no_argument, NULL, 'r'}, { "dryrun", no_argument, NULL, 'C'}, #ifdef HAVE_NETLINK @@ -152,6 +157,7 @@ usage (char *progname, int status) "-C, --dryrun Check configuration for validity and exit\n"\ "-A, --vty_addr Set vty's bind address\n"\ "-P, --vty_port Set vty's port number\n"\ + " --vty_socket Override vty socket path\n"\ "-r, --retain When program terminates, retain added route "\ "by zebra.\n"\ "-u, --user User to run as\n"\ @@ -259,6 +265,7 @@ main (int argc, char **argv) char *p; char *vty_addr = NULL; int vty_port = ZEBRA_VTY_PORT; + char *vty_sock_name; int dryrun = 0; int batch_mode = 0; int daemon_mode = 0; @@ -339,6 +346,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = ZEBRA_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, ZEBRA_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -463,7 +473,7 @@ main (int argc, char **argv) zebra_zserv_socket_init (zserv_path); /* Make vty server socket. */ - vty_serv_sock (vty_addr, vty_port, ZEBRA_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("Zebra %s starting: vty@%d", FRR_VERSION, vty_port); From 98bd8260b69b4cbaac37bf648c12c6274fc6fbf1 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:45:50 +0700 Subject: [PATCH 22/64] bgpd: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- bgpd/bgp_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 33191f0a98..e6f5cdcb67 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -59,6 +59,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #endif /* bgpd options, we use GNU getopt library. */ +#define OPTION_VTYSOCK 1000 static const struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -69,6 +70,7 @@ static const struct option longopts[] = { "listenon", required_argument, NULL, 'l'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK }, { "retain", no_argument, NULL, 'r'}, { "no_kernel", no_argument, NULL, 'n'}, { "user", required_argument, NULL, 'u'}, @@ -111,6 +113,9 @@ static struct quagga_signal_t bgp_signals[] = /* Configuration file and directory. */ char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = BGP_VTYSH_PATH; + /* Route retain mode flag. */ static int retain_mode = 0; @@ -123,6 +128,7 @@ static const char *pid_file = PATH_BGPD_PID; /* VTY port number and address. */ int vty_port = BGP_VTY_PORT; char *vty_addr = NULL; +char *vty_sock_name; /* privileges */ static zebra_capabilities_t _caps_p [] = @@ -165,6 +171,7 @@ redistribution between different routing protocols.\n\n\ -l, --listenon Listen on specified address (implies -n)\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -r, --retain When program terminates, retain added route by bgpd.\n\ -n, --no_kernel Do not install route to kernel.\n\ -u, --user User to run as\n\ @@ -195,7 +202,7 @@ sighup (void) vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -469,6 +476,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = BGP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, BGP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -544,7 +554,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Make bgp vty socket. */ - vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", FRR_COPYRIGHT, From bcaefc1f4de4c0ff05b42e8ac58639d3e16dc5b3 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:52:49 +0700 Subject: [PATCH 23/64] isisd: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- isisd/isis_main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/isisd/isis_main.c b/isisd/isis_main.c index f34be99eca..865f5c5f94 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -81,6 +81,7 @@ struct zebra_privs_t isisd_privs = { }; /* isisd options */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { {"daemon", no_argument, NULL, 'd'}, {"config_file", required_argument, NULL, 'f'}, @@ -88,6 +89,7 @@ struct option longopts[] = { {"socket", required_argument, NULL, 'z'}, {"vty_addr", required_argument, NULL, 'A'}, {"vty_port", required_argument, NULL, 'P'}, + {"vty_socket", required_argument, NULL, OPTION_VTYSOCK}, {"user", required_argument, NULL, 'u'}, {"group", required_argument, NULL, 'g'}, {"version", no_argument, NULL, 'v'}, @@ -103,6 +105,9 @@ char *config_file = NULL; /* isisd program name. */ char *progname; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = ISIS_VTYSH_PATH; + int daemon_mode = 0; /* Master of threads. */ @@ -144,6 +149,7 @@ Daemon which manages IS-IS routing\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -240,6 +246,7 @@ main (int argc, char **argv, char **envp) struct thread thread; char *config_file = NULL; char *vty_addr = NULL; + char *vty_sock_name; int dryrun = 0; /* Get the programname without the preceding path. */ @@ -305,6 +312,9 @@ main (int argc, char **argv, char **envp) vty_port = atoi (optarg); vty_port = (vty_port ? vty_port : ISISD_VTY_PORT); break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, ISIS_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': isisd_privs.user = optarg; break; @@ -379,7 +389,7 @@ main (int argc, char **argv, char **envp) pid_output (pid_file); /* Make isis vty socket. */ - vty_serv_sock (vty_addr, vty_port, ISIS_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("Quagga-ISISd %s starting: vty@%d", FRR_VERSION, vty_port); From a766b038f51f7716d928f3d4695b40d4bdc01e32 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:55:26 +0700 Subject: [PATCH 24/64] ospf6d: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- ospf6d/ospf6_main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index bd3a2faa5d..68d2b6894d 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -51,6 +51,9 @@ /* Default configuration file name for ospf6d. */ #define OSPF6_DEFAULT_CONFIG "ospf6d.conf" +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = OSPF6_VTYSH_PATH; + /* Default port values. */ #define OSPF6_VTY_PORT 2606 @@ -78,6 +81,7 @@ struct zebra_privs_t ospf6d_privs = }; /* ospf6d options, we use GNU getopt library. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -86,6 +90,7 @@ struct option longopts[] = { "socket", required_argument, NULL, 'z'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "version", no_argument, NULL, 'v'}, @@ -125,6 +130,7 @@ Daemon which manages OSPF version 3.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -233,6 +239,7 @@ main (int argc, char *argv[], char *envp[]) int opt; char *vty_addr = NULL; int vty_port = 0; + char *vty_sock_name; char *config_file = NULL; struct thread thread; int dryrun = 0; @@ -285,6 +292,9 @@ main (int argc, char *argv[], char *envp[]) if (vty_port <= 0 || vty_port > 0xffff) vty_port = OSPF6_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, OSPF6_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': ospf6d_privs.user = optarg; break; @@ -357,7 +367,7 @@ main (int argc, char *argv[], char *envp[]) /* Make ospf6 vty socket. */ if (!vty_port) vty_port = OSPF6_VTY_PORT; - vty_serv_sock (vty_addr, vty_port, OSPF6_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print start message */ zlog_notice ("OSPF6d (Quagga-%s ospf6d-%s) starts: vty@%d", From 9cbb96304cf0c4967c033378c09a121df86106ea Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:57:15 +0700 Subject: [PATCH 25/64] ospfd: Add vty_socket cli option to override the compiled-in location for the VTY Socket and add instance number for multi-instance ospf Signed-off-by: Martin Winter --- ospfd/ospf_main.c | 53 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index e0719b397a..6719eb2497 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -79,6 +79,7 @@ struct zebra_privs_t ospfd_privs = char config_default[100]; /* OSPFd options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -90,6 +91,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "apiserver", no_argument, NULL, 'a'}, @@ -99,6 +101,9 @@ struct option longopts[] = /* OSPFd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = OSPF_VTYSH_PATH; + /* Master of threads. */ struct thread_master *master; @@ -126,6 +131,7 @@ Daemon which manages OSPF.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -a. --apiserver Enable OSPF apiserver\n\ @@ -188,6 +194,7 @@ main (int argc, char **argv) char *vty_addr = NULL; int vty_port = OSPF_VTY_PORT; char vty_path[100]; + char *vty_sock_name; int daemon_mode = 0; char *config_file = NULL; char *progname; @@ -253,6 +260,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = OSPF_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, OSPF_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': ospfd_privs.user = optarg; break; @@ -357,19 +367,48 @@ main (int argc, char **argv) exit (1); } - /* Create VTY socket */ + /* Create PID file */ if (instance) { - sprintf(pid_file, "%s/ospfd-%d.pid", DAEMON_VTY_DIR, instance); - sprintf(vty_path, "%s/ospfd-%d.vty", DAEMON_VTY_DIR, instance); - } - else - { - strcpy(vty_path, OSPF_VTYSH_PATH); + char pidfile_temp[100]; + + /* Override the single file with file including instance + number in case of multi-instance */ + if (strrchr(pid_file, '/') != NULL) + /* cut of pid_file at last / char * to get directory */ + *strrchr(pid_file, '/') = '\0'; + else + /* pid_file contains no directory - should never happen, but deal with it anyway */ + /* throw-away all pid_file and assume it's only the filename */ + pid_file[0] = '\0'; + + snprintf(pidfile_temp, sizeof(pidfile_temp), "%s/ospfd-%d.pid", pid_file, instance ); + strncpy(pid_file, pidfile_temp, sizeof(pid_file)); } /* Process id file create. */ pid_output (pid_file); + /* Create VTY socket */ + if (instance) + { + /* Multi-Instance. Use only path section of vty_sock_path with new file incl instance */ + if (strrchr(vty_sock_path, '/') != NULL) + { + /* cut of pid_file at last / char * to get directory */ + *strrchr(vty_sock_path, '/') = '\0'; + } + else + { + /* pid_file contains no directory - should never happen, but deal with it anyway */ + /* throw-away all pid_file and assume it's only the filename */ + vty_sock_path[0] = '\0'; + } + snprintf(vty_path, sizeof(vty_path), "%s/ospfd-%d.vty", vty_sock_path, instance ); + } + else + { + strcpy(vty_path, vty_sock_path); + } vty_serv_sock (vty_addr, vty_port, vty_path); /* Print banner. */ From a8cdea56f44d2d2a3d09ea444ac03fc15a65ff49 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Tue, 24 Jan 2017 22:58:52 +0700 Subject: [PATCH 26/64] pimd: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- pimd/pim_main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 7dfddd2991..1a3c8165e4 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -52,6 +52,8 @@ extern struct host host; char config_default[] = SYSCONFDIR PIMD_DEFAULT_CONFIG; +/* pimd options */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, { "config_file", required_argument, NULL, 'f'}, @@ -59,12 +61,16 @@ struct option longopts[] = { { "socket", required_argument, NULL, 'z'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "version", no_argument, NULL, 'v'}, { "debug_zclient", no_argument, NULL, 'Z'}, { "help", no_argument, NULL, 'h'}, { 0 } }; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = PIM_VTYSH_PATH; + /* pimd privileges */ zebra_capabilities_t _caps_p [] = { @@ -104,6 +110,7 @@ Daemon which manages PIM.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -v, --version Print program version\n\ " @@ -126,6 +133,7 @@ Report bugs to %s\n", progname, PIMD_BUG_ADDRESS); int main(int argc, char** argv, char** envp) { char *p; char *vty_addr = NULL; + char *vty_sock_name; int vty_port = -1; int daemon_mode = 0; char *config_file = NULL; @@ -173,6 +181,9 @@ int main(int argc, char** argv, char** envp) { case 'P': vty_port = atoi (optarg); break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, PIM_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'v': printf(PIMD_PROGNAME " version %s\n", PIMD_VERSION); print_version(progname); @@ -239,7 +250,7 @@ int main(int argc, char** argv, char** envp) { /* Create pimd VTY socket */ if (vty_port < 0) vty_port = PIMD_VTY_PORT; - vty_serv_sock(vty_addr, vty_port, PIM_VTYSH_PATH); + vty_serv_sock(vty_addr, vty_port, vty_sock_path); zlog_notice("Quagga %s " PIMD_PROGNAME " %s starting, VTY interface at port TCP %d", FRR_VERSION, PIMD_VERSION, vty_port); From 66f7d8303ce844da0a5170a5f639294ca7e6b2cb Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 25 Jan 2017 00:19:25 +0700 Subject: [PATCH 27/64] ldpd: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- ldpd/ldpd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 8a9847bdfd..5d0e79aec7 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -115,7 +115,11 @@ struct zebra_privs_t ldpd_privs = .cap_num_i = 0 }; +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = LDP_VTYSH_PATH; + /* LDPd options. */ +#define OPTION_VTYSOCK 1000 static struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -126,6 +130,7 @@ static struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "version", no_argument, NULL, 'v'}, @@ -148,6 +153,7 @@ Daemon which manages LDP.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -212,6 +218,7 @@ main(int argc, char *argv[]) char *p; char *vty_addr = NULL; int vty_port = LDP_VTY_PORT; + char *vty_sock_name; int daemon_mode = 0; const char *user = NULL; const char *group = NULL; @@ -272,6 +279,9 @@ main(int argc, char *argv[]) if (vty_port <= 0 || vty_port > 0xffff) vty_port = LDP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, LDP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'u': user = optarg; break; @@ -410,7 +420,7 @@ main(int argc, char *argv[]) pid_output(pid_file); /* Create VTY socket */ - vty_serv_sock(vty_addr, vty_port, LDP_VTYSH_PATH); + vty_serv_sock(vty_addr, vty_port, vty_sock_path); /* Print banner. */ log_notice("LDPd %s starting: vty@%d", FRR_VERSION, vty_port); From a5c83e7acac6c58d19174047fce543f4fb01b073 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 25 Jan 2017 00:22:59 +0700 Subject: [PATCH 28/64] ripd: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- ripd/rip_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ripd/rip_main.c b/ripd/rip_main.c index cfcb60168a..e46f867952 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -39,6 +39,7 @@ #include "ripd/ripd.h" /* ripd options. */ +#define OPTION_VTYSOCK 1000 static struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -49,6 +50,7 @@ static struct option longopts[] = { "dryrun", no_argument, NULL, 'C'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "retain", no_argument, NULL, 'r'}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, @@ -85,6 +87,9 @@ char *config_file = NULL; /* ripd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = RIP_VTYSH_PATH; + /* Route retain mode flag. */ int retain_mode = 0; @@ -116,6 +121,7 @@ Daemon which manages RIP version 1 and 2.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -C, --dryrun Check configuration for validity and exit\n\ -r, --retain When program terminates, retain added route by ripd.\n\ -u, --user User to run as\n\ @@ -142,7 +148,7 @@ sighup (void) vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -195,6 +201,7 @@ main (int argc, char **argv) int dryrun = 0; char *progname; struct thread thread; + char *vty_sock_name; /* Set umask before anything for security */ umask (0027); @@ -251,6 +258,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = RIP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, RIP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -311,7 +321,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("RIPd %s starting: vty@%d", FRR_VERSION, vty_port); From 7fa382d1d0f4c34dd7f8bf161666d04b6f608898 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 25 Jan 2017 00:25:28 +0700 Subject: [PATCH 29/64] ripngd: Add vty_socket cli option to override the compiled-in location for the VTY Socket Signed-off-by: Martin Winter --- ripngd/ripng_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 14711a1a65..1677996eaa 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -44,6 +44,7 @@ char config_default[] = SYSCONFDIR RIPNG_DEFAULT_CONFIG; char *config_file = NULL; /* RIPngd options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -54,6 +55,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "retain", no_argument, NULL, 'r'}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, @@ -87,6 +89,9 @@ struct zebra_privs_t ripngd_privs = /* RIPngd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = RIPNG_VTYSH_PATH; + /* Route retain mode flag. */ int retain_mode = 0; @@ -118,6 +123,7 @@ Daemon which manages RIPng.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -r, --retain When program terminates, retain added route by ripngd.\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ @@ -141,7 +147,7 @@ sighup (void) /* Reload config file. */ vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -195,6 +201,7 @@ main (int argc, char **argv) char *progname; struct thread thread; int dryrun = 0; + char *vty_sock_name; /* Set umask before anything for security */ umask (0027); @@ -249,6 +256,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = RIPNG_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, RIPNG_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -303,7 +313,7 @@ main (int argc, char **argv) } /* Create VTY socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Process id file create. */ pid_output (pid_file); From 87d79a9f79015421d8bf7cd07f8486a2bae15ef2 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Thu, 26 Jan 2017 00:43:58 +0700 Subject: [PATCH 30/64] vtysh: Add vty_socket cli option to override the compiled-in location for the VTY daemon sockets Signed-off-by: Martin Winter --- vtysh/vtysh.c | 52 ++++++++++++++++++++++++++++++++++++---------- vtysh/vtysh.h | 2 ++ vtysh/vtysh_main.c | 9 ++++++++ 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 6d6fe61306..17f6bfa5a5 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2898,13 +2898,34 @@ vtysh_connect (struct vtysh_client *vclient) int sock, len; struct sockaddr_un addr; struct stat s_stat; + char path[MAXPATHLEN]; + + if (vty_sock_path == NULL) + strlcpy (path, vclient->path, sizeof (path)); + else { + /* Different path for VTY Socket specified + overriding the default path, but keep the filename */ + strlcpy (path, vty_sock_path, sizeof (path)); + + if (strrchr (vclient->path, '/') != NULL) + strlcat (path, strrchr (vclient->path, '/'), sizeof (path)); + else { + /* + * vclient->path configured as relative path during config? Should + * really never happen for sensible config + */ + strlcat (path, "/", sizeof (path)); + strlcat (path, vclient->path, sizeof (path)); + } + } + path[sizeof(path)-1] = '\0'; /* Stat socket to see if we have permission to access it. */ - ret = stat (vclient->path, &s_stat); + ret = stat (path, &s_stat); if (ret < 0 && errno != ENOENT) { fprintf (stderr, "vtysh_connect(%s): stat = %s\n", - vclient->path, safe_strerror(errno)); + path, safe_strerror(errno)); exit(1); } @@ -2913,7 +2934,7 @@ vtysh_connect (struct vtysh_client *vclient) if (! S_ISSOCK(s_stat.st_mode)) { fprintf (stderr, "vtysh_connect(%s): Not a socket\n", - vclient->path); + path); exit (1); } @@ -2923,7 +2944,7 @@ vtysh_connect (struct vtysh_client *vclient) if (sock < 0) { #ifdef DEBUG - fprintf(stderr, "vtysh_connect(%s): socket = %s\n", vclient->path, + fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path, safe_strerror(errno)); #endif /* DEBUG */ return -1; @@ -2931,7 +2952,7 @@ vtysh_connect (struct vtysh_client *vclient) memset (&addr, 0, sizeof (struct sockaddr_un)); addr.sun_family = AF_UNIX; - strncpy (addr.sun_path, vclient->path, strlen (vclient->path)); + strncpy (addr.sun_path, path, strlen (path)); #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN len = addr.sun_len = SUN_LEN(&addr); #else @@ -2942,7 +2963,7 @@ vtysh_connect (struct vtysh_client *vclient) if (ret < 0) { #ifdef DEBUG - fprintf(stderr, "vtysh_connect(%s): connect = %s\n", vclient->path, + fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path, safe_strerror(errno)); #endif /* DEBUG */ close (sock); @@ -2993,14 +3014,23 @@ vtysh_update_all_insances(struct vtysh_client * head_client) { struct vtysh_client *client; char *ptr; + char vty_dir[MAXPATHLEN]; DIR *dir; struct dirent *file; int n = 0; if (head_client->flag != VTYSH_OSPFD) return; - /* ls DAEMON_VTY_DIR and look for all files ending in .vty */ - dir = opendir(DAEMON_VTY_DIR "/"); + if (vty_sock_path == NULL) + /* ls DAEMON_VTY_DIR and look for all files ending in .vty */ + strlcpy(vty_dir, DAEMON_VTY_DIR "/", MAXPATHLEN); + else + { + /* ls vty_sock_dir and look for all files ending in .vty */ + strlcpy(vty_dir, vty_sock_path, MAXPATHLEN); + strlcat(vty_dir, "/", MAXPATHLEN); + } + dir = opendir(vty_dir); if (dir) { while ((file = readdir(dir)) != NULL) @@ -3010,8 +3040,8 @@ vtysh_update_all_insances(struct vtysh_client * head_client) if (n == MAXIMUM_INSTANCES) { fprintf(stderr, - "Parsing %s/, client limit(%d) reached!\n", - DAEMON_VTY_DIR, n); + "Parsing %s, client limit(%d) reached!\n", + vty_dir, n); break; } client = (struct vtysh_client *) malloc(sizeof(struct vtysh_client)); @@ -3019,7 +3049,7 @@ vtysh_update_all_insances(struct vtysh_client * head_client) client->name = "ospfd"; client->flag = VTYSH_OSPFD; ptr = (char *) malloc(100); - sprintf(ptr, "%s/%s", DAEMON_VTY_DIR, file->d_name); + sprintf(ptr, "%s%s", vty_dir, file->d_name); client->path = (const char *)ptr; client->next = NULL; vtysh_client_sorted_insert(head_client, client); diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h index 46ed001919..537f944a7a 100644 --- a/vtysh/vtysh.h +++ b/vtysh/vtysh.h @@ -96,4 +96,6 @@ extern int execute_flag; extern struct vty *vty; +extern char * vty_sock_path; + #endif /* VTYSH_H */ diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 6b33fca39b..956f97321f 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -53,6 +53,9 @@ char history_file[MAXPATHLEN]; /* Flag for indicate executing child command. */ int execute_flag = 0; +/* VTY Socket prefix */ +char * vty_sock_path = NULL; + /* For sigsetjmp() & siglongjmp(). */ static sigjmp_buf jmpbuf; @@ -144,6 +147,7 @@ usage (int status) "-f, --inputfile Execute commands from specific file and exit\n" \ "-E, --echo Echo prompt and command in -c mode\n" \ "-C, --dryrun Check configuration for validity and exit\n" \ + " --vty_socket Override vty socket path\n" \ "-m, --markfile Mark input file with context end\n" "-w, --writeconfig Write integrated config (Quagga.conf) and exit\n" "-h, --help Display this help and exit\n\n" \ @@ -156,6 +160,7 @@ usage (int status) } /* VTY shell options, we use GNU getopt library. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "boot", no_argument, NULL, 'b'}, @@ -163,6 +168,7 @@ struct option longopts[] = { "eval", required_argument, NULL, 'e'}, { "command", required_argument, NULL, 'c'}, { "daemon", required_argument, NULL, 'd'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "inputfile", required_argument, NULL, 'f'}, { "echo", no_argument, NULL, 'E'}, { "dryrun", no_argument, NULL, 'C'}, @@ -310,6 +316,9 @@ main (int argc, char **argv, char **env) tail = cr; } break; + case OPTION_VTYSOCK: + vty_sock_path = optarg; + break; case 'd': daemon_name = optarg; break; From f38e9e49f5dcab8ff40118b8020fbb086ce03ccb Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 21 Jan 2017 02:48:06 +0700 Subject: [PATCH 31/64] vtysh: Use HOME environment variable to get homedir and only fallback to passed entry if no HOME is defined Snap packages have a local HOME defined inside the SNAP container, but don't get access to passwd entry. Signed-off-by: Martin Winter --- vtysh/vtysh_user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index 3a64ae0a96..73f7c1be98 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -218,7 +218,12 @@ char * vtysh_get_home (void) { struct passwd *passwd; + char * homedir; + if ((homedir = getenv("HOME")) != 0) + return homedir; + + /* Fallback if HOME is undefined */ passwd = getpwuid (getuid ()); return passwd ? passwd->pw_dir : NULL; From 372b8bd381661d6df8ff6d2b96da31d653a6f16b Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 25 Jan 2017 00:31:40 +0700 Subject: [PATCH 32/64] ldpd: add ctl_socket cli option to override the compiled-in location for the control socket Signed-off-by: Renato Westphal --- ldpd/control.c | 14 +++++++------- ldpd/ldp_vty_exec.c | 4 ++-- ldpd/ldpd.c | 43 +++++++++++++++++++++++++++++++++++++------ ldpd/ldpd.h | 1 + ldpd/ldpe.c | 3 ++- ldpd/ldpe.h | 2 +- 6 files changed, 50 insertions(+), 17 deletions(-) diff --git a/ldpd/control.c b/ldpd/control.c index ba303cc12c..8a2280be07 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -51,28 +51,28 @@ control_init(void) memset(&s_un, 0, sizeof(s_un)); s_un.sun_family = AF_UNIX; - strlcpy(s_un.sun_path, LDPD_SOCKET, sizeof(s_un.sun_path)); + strlcpy(s_un.sun_path, ctl_sock_path, sizeof(s_un.sun_path)); - if (unlink(LDPD_SOCKET) == -1) + if (unlink(ctl_sock_path) == -1) if (errno != ENOENT) { - log_warn("%s: unlink %s", __func__, LDPD_SOCKET); + log_warn("%s: unlink %s", __func__, ctl_sock_path); close(fd); return (-1); } old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH); if (bind(fd, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) { - log_warn("%s: bind: %s", __func__, LDPD_SOCKET); + log_warn("%s: bind: %s", __func__, ctl_sock_path); close(fd); umask(old_umask); return (-1); } umask(old_umask); - if (chmod(LDPD_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) { + if (chmod(ctl_sock_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) { log_warn("%s: chmod", __func__); close(fd); - (void)unlink(LDPD_SOCKET); + (void)unlink(ctl_sock_path); return (-1); } @@ -97,7 +97,7 @@ control_cleanup(void) { accept_del(control_fd); close(control_fd); - unlink(LDPD_SOCKET); + unlink(ctl_sock_path); } /* ARGSUSED */ diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c index a57cf3c3f6..a9138be2f2 100644 --- a/ldpd/ldp_vty_exec.c +++ b/ldpd/ldp_vty_exec.c @@ -405,9 +405,9 @@ ldp_vty_connect(struct imsgbuf *ibuf) memset(&s_un, 0, sizeof(s_un)); s_un.sun_family = AF_UNIX; - strlcpy(s_un.sun_path, LDPD_SOCKET, sizeof(s_un.sun_path)); + strlcpy(s_un.sun_path, ctl_sock_path, sizeof(s_un.sun_path)); if (connect(ctl_sock, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) { - log_warn("%s: connect: %s", __func__, LDPD_SOCKET); + log_warn("%s: connect: %s", __func__, ctl_sock_path); close(ctl_sock); return (-1); } diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 5d0e79aec7..40726ba0bb 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -43,7 +43,7 @@ static void ldpd_shutdown(void); static pid_t start_child(enum ldpd_process, char *, int, - const char *, const char *); + const char *, const char *, const char *); static int main_dispatch_ldpe(struct thread *); static int main_dispatch_lde(struct thread *); static int main_imsg_send_ipc_sockets(struct imsgbuf *, @@ -118,8 +118,12 @@ struct zebra_privs_t ldpd_privs = /* VTY Socket prefix */ char vty_sock_path[MAXPATHLEN] = LDP_VTYSH_PATH; +/* CTL Socket path */ +char ctl_sock_path[MAXPATHLEN] = LDPD_SOCKET; + /* LDPd options. */ #define OPTION_VTYSOCK 1000 +#define OPTION_CTLSOCK 1001 static struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -131,6 +135,7 @@ static struct option longopts[] = { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, + { "ctl_socket", required_argument, NULL, OPTION_CTLSOCK}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, { "version", no_argument, NULL, 'v'}, @@ -154,6 +159,7 @@ Daemon which manages LDP.\n\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ --vty_socket Override vty socket path\n\ + --ctl_socket Override ctl socket path\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ -v, --version Print program version\n\ @@ -219,6 +225,8 @@ main(int argc, char *argv[]) char *vty_addr = NULL; int vty_port = LDP_VTY_PORT; char *vty_sock_name; + char *ctl_sock_custom_path = NULL; + char *ctl_sock_name; int daemon_mode = 0; const char *user = NULL; const char *group = NULL; @@ -282,6 +290,25 @@ main(int argc, char *argv[]) case OPTION_VTYSOCK: set_socket_path(vty_sock_path, LDP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); break; + case OPTION_CTLSOCK: + ctl_sock_name = strrchr(LDPD_SOCKET, '/'); + if (ctl_sock_name) + /* skip '/' */ + ctl_sock_name++; + else + /* + * LDPD_SOCKET configured as relative path + * during config? Should really never happen for + * sensible config + */ + ctl_sock_name = (char *)LDPD_SOCKET; + ctl_sock_custom_path = optarg; + strlcpy(ctl_sock_path, ctl_sock_custom_path, + sizeof(ctl_sock_path)); + strlcat(ctl_sock_path, "/", sizeof(ctl_sock_path)); + strlcat(ctl_sock_path, ctl_sock_name, + sizeof(ctl_sock_path)); + break; case 'u': user = optarg; break; @@ -328,7 +355,7 @@ main(int argc, char *argv[]) if (lflag) lde(user, group); else if (eflag) - ldpe(user, group); + ldpe(user, group, ctl_sock_path); master = thread_master_create(); @@ -370,9 +397,9 @@ main(int argc, char *argv[]) /* start children */ lde_pid = start_child(PROC_LDE_ENGINE, saved_argv0, - pipe_parent2lde[1], user, group); + pipe_parent2lde[1], user, group, ctl_sock_custom_path); ldpe_pid = start_child(PROC_LDP_ENGINE, saved_argv0, - pipe_parent2ldpe[1], user, group); + pipe_parent2ldpe[1], user, group, ctl_sock_custom_path); /* drop privileges */ if (user) @@ -468,9 +495,9 @@ ldpd_shutdown(void) static pid_t start_child(enum ldpd_process p, char *argv0, int fd, const char *user, - const char *group) + const char *group, const char *ctl_sock_custom_path) { - char *argv[7]; + char *argv[9]; int argc = 0; pid_t pid; @@ -506,6 +533,10 @@ start_child(enum ldpd_process p, char *argv0, int fd, const char *user, argv[argc++] = (char *)"-g"; argv[argc++] = (char *)group; } + if (ctl_sock_custom_path) { + argv[argc++] = (char *)"--ctl_socket"; + argv[argc++] = (char *)ctl_sock_custom_path; + } argv[argc++] = NULL; execvp(argv0, argv); diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index 630b192489..e58d8e4852 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -672,6 +672,7 @@ int sock_set_ipv6_mcast_loop(int); /* quagga */ extern struct thread_master *master; +extern char ctl_sock_path[MAXPATHLEN]; /* ldp_zebra.c */ void ldp_zebra_init(struct thread_master *); diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 37a3d79a28..0d0fe5c9e9 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -99,7 +99,7 @@ static struct quagga_signal_t ldpe_signals[] = /* label distribution protocol engine */ void -ldpe(const char *user, const char *group) +ldpe(const char *user, const char *group, const char *ctl_path) { struct thread thread; @@ -128,6 +128,7 @@ ldpe(const char *user, const char *group) ldpe_privs.group = group; zprivs_init(&ldpe_privs); + strlcpy(ctl_sock_path, ctl_path, sizeof(ctl_sock_path)); if (control_init() == -1) fatalx("control socket setup failed"); diff --git a/ldpd/ldpe.h b/ldpd/ldpe.h index aab1a7fd9b..da90c7cad7 100644 --- a/ldpd/ldpe.h +++ b/ldpd/ldpe.h @@ -183,7 +183,7 @@ int tlv_decode_fec_elm(struct nbr *, struct ldp_msg *, char *, uint16_t, struct map *); /* ldpe.c */ -void ldpe(const char *, const char *); +void ldpe(const char *, const char *, const char *); int ldpe_imsg_compose_parent(int, pid_t, void *, uint16_t); int ldpe_imsg_compose_lde(int, uint32_t, pid_t, void *, From ce2e9ec3ad0e9bf8199da613cb72f70792469782 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 10 Dec 2016 19:06:54 -0800 Subject: [PATCH 33/64] vtysh: Add --config_dir option to override compiled in location for vtysh.conf and Quagga.conf Only allow the override if vtysh is not run with setuid() Signed-off-by: Martin Winter --- vtysh/vtysh_main.c | 62 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 956f97321f..bad21ae661 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -45,8 +45,8 @@ char *progname; /* Configuration file name and directory. */ -static char vtysh_config_always[] = SYSCONFDIR VTYSH_DEFAULT_CONFIG; -static char quagga_config_default[] = SYSCONFDIR QUAGGA_DEFAULT_CONFIG; +static char vtysh_config_always[MAXPATHLEN] = SYSCONFDIR VTYSH_DEFAULT_CONFIG; +static char quagga_config_default[MAXPATHLEN] = SYSCONFDIR QUAGGA_DEFAULT_CONFIG; char *quagga_config = quagga_config_default; char history_file[MAXPATHLEN]; @@ -148,8 +148,10 @@ usage (int status) "-E, --echo Echo prompt and command in -c mode\n" \ "-C, --dryrun Check configuration for validity and exit\n" \ " --vty_socket Override vty socket path\n" \ - "-m, --markfile Mark input file with context end\n" - "-w, --writeconfig Write integrated config (Quagga.conf) and exit\n" + "-m, --markfile Mark input file with context end\n" \ + " --vty_socket Override vty socket path\n" \ + " --config_dir Override config directory path\n" \ + "-w, --writeconfig Write integrated config (Quagga.conf) and exit\n" \ "-h, --help Display this help and exit\n\n" \ "Note that multiple commands may be executed from the command\n" \ "line by passing multiple -c args, or by embedding linefeed\n" \ @@ -161,6 +163,7 @@ usage (int status) /* VTY shell options, we use GNU getopt library. */ #define OPTION_VTYSOCK 1000 +#define OPTION_CONFDIR 1001 struct option longopts[] = { { "boot", no_argument, NULL, 'b'}, @@ -169,6 +172,7 @@ struct option longopts[] = { "command", required_argument, NULL, 'c'}, { "daemon", required_argument, NULL, 'd'}, { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, + { "config_dir", required_argument, NULL, OPTION_CONFDIR}, { "inputfile", required_argument, NULL, 'f'}, { "echo", no_argument, NULL, 'E'}, { "dryrun", no_argument, NULL, 'C'}, @@ -268,6 +272,7 @@ main (int argc, char **argv, char **env) int boot_flag = 0; const char *daemon_name = NULL; const char *inputfile = NULL; + char *vtysh_configfile_name; struct cmd_rec { const char *line; struct cmd_rec *next; @@ -280,6 +285,9 @@ main (int argc, char **argv, char **env) int ret = 0; char *homedir = NULL; + /* check for restricted functionality if vtysh is run setuid */ + int restricted = (getuid() != geteuid()) || (getgid() != getegid()); + /* Preserve name of myself. */ progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]); @@ -319,6 +327,52 @@ main (int argc, char **argv, char **env) case OPTION_VTYSOCK: vty_sock_path = optarg; break; + case OPTION_CONFDIR: + /* + * Skip option for Config Directory if setuid + */ + if (restricted) + { + fprintf (stderr, "Overriding of Config Directory blocked for vtysh with setuid"); + return 1; + } + /* + * Overwrite location for vtysh.conf + */ + vtysh_configfile_name = strrchr(VTYSH_DEFAULT_CONFIG, '/'); + if (vtysh_configfile_name) + /* skip '/' */ + vtysh_configfile_name++; + else + /* + * VTYSH_DEFAULT_CONFIG configured with relative path + * during config? Should really never happen for + * sensible config + */ + vtysh_configfile_name = (char *) VTYSH_DEFAULT_CONFIG; + strlcpy(vtysh_config_always, optarg, sizeof(vtysh_config_always)); + strlcat(vtysh_config_always, "/", sizeof(vtysh_config_always)); + strlcat(vtysh_config_always, vtysh_configfile_name, + sizeof(vtysh_config_always)); + /* + * Overwrite location for Quagga.conf + */ + vtysh_configfile_name = strrchr(QUAGGA_DEFAULT_CONFIG, '/'); + if (vtysh_configfile_name) + /* skip '/' */ + vtysh_configfile_name++; + else + /* + * QUAGGA_DEFAULT_CONFIG configured with relative path + * during config? Should really never happen for + * sensible config + */ + vtysh_configfile_name = (char *) QUAGGA_DEFAULT_CONFIG; + strlcpy(quagga_config_default, optarg, sizeof(vtysh_config_always)); + strlcat(quagga_config_default, "/", sizeof(vtysh_config_always)); + strlcat(quagga_config_default, vtysh_configfile_name, + sizeof(quagga_config_default)); + break; case 'd': daemon_name = optarg; break; From 38657f2ebd65fce3cfcba3ff4d29b29056af2df1 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Sat, 21 Jan 2017 02:48:45 +0700 Subject: [PATCH 34/64] lib: Don't change uid/gid if we are already the correct uid/gid Signed-off-by: Martin Winter --- lib/privs.c | 21 ++++++++++++++------- lib/vty.c | 7 +++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/privs.c b/lib/privs.c index ac2a8454c5..376d6f3365 100644 --- a/lib/privs.c +++ b/lib/privs.c @@ -251,7 +251,8 @@ zprivs_caps_init (struct zebra_privs_t *zprivs) } /* we have caps, we have no need to ever change back the original user */ - if (zprivs_state.zuid) + /* only change uid if we don't have the correct one */ + if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) ) { @@ -531,7 +532,8 @@ zprivs_caps_init (struct zebra_privs_t *zprivs) /* we have caps, we have no need to ever change back the original user * change real, effective and saved to the specified user. */ - if (zprivs_state.zuid) + /* only change uid if we don't have the correct one */ + if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) ) { @@ -602,7 +604,8 @@ zprivs_caps_terminate (void) int zprivs_change_uid (zebra_privs_ops_t op) { - + if (zprivs_state.zsuid == zprivs_state.zuid) + return 0; if (op == ZPRIVS_RAISE) return seteuid (zprivs_state.zsuid); else if (op == ZPRIVS_LOWER) @@ -766,7 +769,8 @@ zprivs_init(struct zebra_privs_t *zprivs) } } - if (ngroups) + /* add groups only if we changed uid - otherwise skip */ + if ((ngroups) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setgroups (ngroups, groups) ) { @@ -776,7 +780,8 @@ zprivs_init(struct zebra_privs_t *zprivs) } } - if (zprivs_state.zgid) + /* change gid only if we changed uid - otherwise skip */ + if ((zprivs_state.zgid) && (zprivs_state.zsuid != zprivs_state.zuid)) { /* change group now, forever. uid we do later */ if ( setregid (zprivs_state.zgid, zprivs_state.zgid) ) @@ -797,7 +802,8 @@ zprivs_init(struct zebra_privs_t *zprivs) * This is not worth that much security wise, but all we can do. */ zprivs_state.zsuid = geteuid(); - if ( zprivs_state.zuid ) + /* only change uid if we don't have the correct one */ + if (( zprivs_state.zuid ) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (-1, zprivs_state.zuid) ) { @@ -824,7 +830,8 @@ zprivs_terminate (struct zebra_privs_t *zprivs) #ifdef HAVE_CAPABILITIES zprivs_caps_terminate(); #else /* !HAVE_CAPABILITIES */ - if (zprivs_state.zuid) + /* only change uid if we don't have the correct one */ + if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) { if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) ) { diff --git a/lib/vty.c b/lib/vty.c index adcfaca4f3..9594d68ebd 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2091,8 +2091,11 @@ vty_serv_un (const char *path) umask (old_mask); zprivs_get_ids(&ids); - - if (ids.gid_vty > 0) + + /* Hack: ids.gid_vty is actually a uint, but we stored -1 in it + earlier for the case when we don't need to chown the file + type casting it here to make a compare */ + if ((int)ids.gid_vty > 0) { /* set group of socket */ if ( chown (path, -1, ids.gid_vty) ) From 3ab11ecc7ba6de37393d334bf9f6cbc88a3eeec1 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Thu, 26 Jan 2017 04:23:43 +0700 Subject: [PATCH 35/64] snapcraft: Add snapcraft build and definition files Signed-off-by: Martin Winter --- Makefile.am | 4 +- configure.ac | 3 + snapcraft/.gitignore | 6 + snapcraft/Makefile.am | 11 ++ snapcraft/README.snap_build.md | 93 ++++++++++ snapcraft/README.usage.md | 77 ++++++++ snapcraft/defaults/bgpd.conf.default | 0 snapcraft/defaults/isisd.conf.default | 0 snapcraft/defaults/ldpd.conf.default | 0 snapcraft/defaults/ospf6d.conf.default | 0 snapcraft/defaults/ospfd.conf.default | 0 snapcraft/defaults/pimd.conf.default | 0 snapcraft/defaults/ripd.conf.default | 0 snapcraft/defaults/ripngd.conf.default | 0 snapcraft/defaults/vtysh.conf.default | 1 + snapcraft/defaults/zebra.conf.default | 0 snapcraft/helpers/Makefile | 7 + snapcraft/scripts/Makefile | 14 ++ snapcraft/scripts/bgpd-service | 13 ++ snapcraft/scripts/isisd-service | 13 ++ snapcraft/scripts/ldpd-service | 14 ++ snapcraft/scripts/ospf6d-service | 13 ++ snapcraft/scripts/ospfd-service | 13 ++ snapcraft/scripts/pimd-service | 13 ++ snapcraft/scripts/ripd-service | 13 ++ snapcraft/scripts/ripngd-service | 13 ++ snapcraft/scripts/zebra-service | 16 ++ snapcraft/setup/gui/icon.png | Bin 0 -> 21830 bytes snapcraft/snapcraft.yaml.in | 235 +++++++++++++++++++++++++ 29 files changed, 570 insertions(+), 2 deletions(-) create mode 100644 snapcraft/.gitignore create mode 100644 snapcraft/Makefile.am create mode 100644 snapcraft/README.snap_build.md create mode 100644 snapcraft/README.usage.md create mode 100644 snapcraft/defaults/bgpd.conf.default create mode 100644 snapcraft/defaults/isisd.conf.default create mode 100644 snapcraft/defaults/ldpd.conf.default create mode 100644 snapcraft/defaults/ospf6d.conf.default create mode 100644 snapcraft/defaults/ospfd.conf.default create mode 100644 snapcraft/defaults/pimd.conf.default create mode 100644 snapcraft/defaults/ripd.conf.default create mode 100644 snapcraft/defaults/ripngd.conf.default create mode 100644 snapcraft/defaults/vtysh.conf.default create mode 100644 snapcraft/defaults/zebra.conf.default create mode 100644 snapcraft/helpers/Makefile create mode 100644 snapcraft/scripts/Makefile create mode 100644 snapcraft/scripts/bgpd-service create mode 100644 snapcraft/scripts/isisd-service create mode 100644 snapcraft/scripts/ldpd-service create mode 100644 snapcraft/scripts/ospf6d-service create mode 100644 snapcraft/scripts/ospfd-service create mode 100644 snapcraft/scripts/pimd-service create mode 100644 snapcraft/scripts/ripd-service create mode 100644 snapcraft/scripts/ripngd-service create mode 100644 snapcraft/scripts/zebra-service create mode 100644 snapcraft/setup/gui/icon.png create mode 100644 snapcraft/snapcraft.yaml.in diff --git a/Makefile.am b/Makefile.am index d9b57a5eae..63dedeac06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,11 +3,11 @@ SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \ @BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \ @ISISD@ @PIMD@ @WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \ - redhat @SOLARIS@ tests tools cumulus + redhat @SOLARIS@ tests tools cumulus snapcraft DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \ isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \ - solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus + solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus snapcraft EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \ update-autotools \ diff --git a/configure.ac b/configure.ac index 14f6292da5..da22962577 100755 --- a/configure.ac +++ b/configure.ac @@ -483,6 +483,7 @@ dnl ----------------------------------- if test "x${EXTRAVERSION}" != "x" ; then VERSION="${VERSION}${EXTRAVERSION}" PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}" + AC_SUBST(PACKAGE_EXTRAVERSION, ["${EXTRAVERSION}"]) PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}" fi @@ -1617,6 +1618,8 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile pkgsrc/Makefile fpm/Makefile redhat/frr.spec + snapcraft/Makefile + snapcraft/snapcraft.yaml lib/version.h doc/defines.texi doc/bgpd.8 diff --git a/snapcraft/.gitignore b/snapcraft/.gitignore new file mode 100644 index 0000000000..e050ff0c8d --- /dev/null +++ b/snapcraft/.gitignore @@ -0,0 +1,6 @@ +snapcraft.yaml +parts +prime +stage +quagga*.snap +!*/Makefile diff --git a/snapcraft/Makefile.am b/snapcraft/Makefile.am new file mode 100644 index 0000000000..15813be72f --- /dev/null +++ b/snapcraft/Makefile.am @@ -0,0 +1,11 @@ +EXTRA_DIST = snapcraft.yaml \ + scripts/Makefile scripts/zebra-service scripts/bgpd-service \ + scripts/isisd-service scripts/ripd-service scripts/ripngd-service \ + scripts/ospf6d-service scripts/ospfd-service \ + scripts/isisd-service scripts/pimd-service \ + scripts/ldpd-service \ + defaults/bgpd.conf.default defaults/isisd.conf.default \ + defaults/ospf6d.conf.default defaults/ospfd.conf.default \ + defaults/pimd.conf.default defaults/zebra.conf.default \ + defaults/ripd.conf.default defaults/ripngd.conf.default \ + defaults/ldpd.conf.default defaults/vtysh.conf.default diff --git a/snapcraft/README.snap_build.md b/snapcraft/README.snap_build.md new file mode 100644 index 0000000000..341b210f71 --- /dev/null +++ b/snapcraft/README.snap_build.md @@ -0,0 +1,93 @@ +Building your own FreeRangeRouting Snap +======================================== +(Tested on Ubuntu 16.04 with Snap Version 2, does not work on Ubuntu 15.x +which uses earlier versions of snaps) + +1. Install snapcraft: + + sudo apt-get install snapcraft + +2. Checkout FreeRangeRouting under a **unpriviledged** user account + + git clone https://github.com/freerangerouting/frr.git + cd frr + +3. Run Bootstrap and make distribution tar.gz + + ./bootstrap.sh + ./configure --with-pkg-extra-version=-MySnapVersion + make dist + + Note: configure parameters are not important for the Snap building, + except the `with-pkg-extra-version` if you want to give the Snap + a specific name to mark your own unoffical build + + This will build `frr-something.tar.gz` - the distribution tar and + the snapcraft/snapcraft.yaml with the matching version number + +4. Create snap + + cd snapcraft + snapcraft + + You should now end up with `frr_something.snap` + +Installing the snap +=================== +(This can be done on a different system) + +1. Install snapd + + sudo apt-get install snapd + +2. Install self-built frr snap. (`--force-dangerous` is required to + install a unsigned self-built snap) + + snap install --force-dangerous ./frr*.snap + + Connect the priviledged `network-control` plug to the snap: + + snap connect frr:network-control ubuntu-core:network-control + +DONE. + +The Snap will be auto-started and running. + +Operations +========== + +### FreeRangeRouting Daemons +At this time, all FreeRangeRouting daemons are auto-started. + +A daemon can be stopped/started with (ie ospf6d) + + systemctl stop snap.frr.ospf6d.service + systemctl start snap.frr.ospf6d.service + +or disabled/enabled with + + systemctl disable snap.frr.ospf6d.service + systemctl enable snap.frr.ospf6d.service + +### FreeRangeRouting Commands +All the commands are prefixed with frr. + + frr.vtysh -> vtysh + frr.version -> Just gives version output (zebra --version) + frr.readme -> Returns simple README with hints on using FRR + + frr.bgpd-debug -> Directly start each daemon (without service) + frr.isisd-debug + frr.ospf6d-debug + frr.ospfd-debug + frr.pimd-debug + frr.ripd-debug + frr.ripngd-debug + frr.ldp-debug + frr.zebra-debug + +vtysh can be accessed as frr.vtysh (Make sure you have /snap/bin in your +path). If access as `vtysh` instead of `frr.vtysh` is needed, a symlink +can be created: + + sudo ln -s /snap/bin/frr.vtysh /usr/local/bin/vtysh diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md new file mode 100644 index 0000000000..2d2b32b6b7 --- /dev/null +++ b/snapcraft/README.usage.md @@ -0,0 +1,77 @@ +Using the FreeRangeRouting Snap +=============================== + +After installing the Snap, the priviledged plug need to be connected: + + snap connect frr:network-control ubuntu-core:network-control + +Enabling/Disabling FreeRangeRouting Daemons +------------------------------------------- + +By default (at this time), all FreeRangeRouting daemons will be enabled +on installation. If you want to disable a specific daemon, then use +the systemctl commands + +ie for `ospf6d` (OSPFv3): + + systemctl disable snap.frr.ospf6d.service + systemctl enable snap.frr.ospf6d.service + +The daemons are: `ripd`, `ripngd`, `ospfd`, `ospf6d`, `isisd`, `bgpd`, +`pimd`, `zebra` + +Commands defined by this snap +----------------------------- + +- `frr.vtysh`: + FreeRangeRouting VTY Shell (configuration tool) +- `frr.version`: + Returns output of `zebra --version` to display version and configured + options +- `frr.readme`: + Returns this document `cat README_usage.md` + +and for debugging defined at this time (May get removed later - do not +depend on them). These are mainly intended to debug the Snap + +- `frr.zebra-debug`: + Starts zebra daemon in foreground +- `frr.ripd-debug`: + Starts ripd daemon in foreground +- `frr.ripngd-debug`: + Starts ripng daemon in foreground +- `frr.ospfd-debug`: + Starts ospfd daemon in foreground +- `frr.ospf6d-debug`: + Starts ospf6d daemon in foreground +- `frr.isisd-debug`: + Starts isisd daemon in foreground +- `frr.bgpd-debug`: + Starts bgpd daemon in foreground +- `frr.pimd-debug`: + Starts pimd daemon in foreground +- `frr.ldpd-debug`: + Starts ldpd daemon in foreground + +FAQ +--- +- frr.vtysh displays `--MORE--` on long output. How to suppress this? + - Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add + `export VTYSH_PAGER=cat` to the end of your `.profile`) + +Sourcecode available +==================== + +The source for this SNAP is available as part of the FreeRangeRouting +Source Code Distribution. + + https://github.com/freerangerouting/frr.git + +Instructions for rebuilding the snap are in `README.snap_build.md` + +Feedback welcome +================ + +Please send Feedback about this snap to Martin Winter at +`mwinter@opensourcerouting.org` + diff --git a/snapcraft/defaults/bgpd.conf.default b/snapcraft/defaults/bgpd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/isisd.conf.default b/snapcraft/defaults/isisd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ldpd.conf.default b/snapcraft/defaults/ldpd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ospf6d.conf.default b/snapcraft/defaults/ospf6d.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ospfd.conf.default b/snapcraft/defaults/ospfd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/pimd.conf.default b/snapcraft/defaults/pimd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ripd.conf.default b/snapcraft/defaults/ripd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/ripngd.conf.default b/snapcraft/defaults/ripngd.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/defaults/vtysh.conf.default b/snapcraft/defaults/vtysh.conf.default new file mode 100644 index 0000000000..5c15e6bc4a --- /dev/null +++ b/snapcraft/defaults/vtysh.conf.default @@ -0,0 +1 @@ +no service integrated-vtysh-config diff --git a/snapcraft/defaults/zebra.conf.default b/snapcraft/defaults/zebra.conf.default new file mode 100644 index 0000000000..e69de29bb2 diff --git a/snapcraft/helpers/Makefile b/snapcraft/helpers/Makefile new file mode 100644 index 0000000000..c44bee7b4e --- /dev/null +++ b/snapcraft/helpers/Makefile @@ -0,0 +1,7 @@ +all: + +install: + install -D -m 0755 $(DESTDIR)/usr/bin/telnet.netkit $(DESTDIR)/bin/telnet + install -D -m 0755 $(DESTDIR)/usr/bin/traceroute.db $(DESTDIR)/bin/traceroute + install -D -m 0755 $(DESTDIR)/usr/bin/traceroute6.db $(DESTDIR)/bin/traceroute6 + diff --git a/snapcraft/scripts/Makefile b/snapcraft/scripts/Makefile new file mode 100644 index 0000000000..00984c2afa --- /dev/null +++ b/snapcraft/scripts/Makefile @@ -0,0 +1,14 @@ +all: + +install: + mkdir -p $(DESTDIR)/bin + install -D -m 0755 zebra-service $(DESTDIR)/bin/ + install -D -m 0755 bgpd-service $(DESTDIR)/bin/ + install -D -m 0755 ospfd-service $(DESTDIR)/bin/ + install -D -m 0755 ospf6d-service $(DESTDIR)/bin/ + install -D -m 0755 ripd-service $(DESTDIR)/bin/ + install -D -m 0755 ripngd-service $(DESTDIR)/bin/ + install -D -m 0755 isisd-service $(DESTDIR)/bin/ + install -D -m 0755 pimd-service $(DESTDIR)/bin/ + install -D -m 0755 ldpd-service $(DESTDIR)/bin/ + diff --git a/snapcraft/scripts/bgpd-service b/snapcraft/scripts/bgpd-service new file mode 100644 index 0000000000..4072031eda --- /dev/null +++ b/snapcraft/scripts/bgpd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/bgpd.conf ]; then + cp $SNAP/etc/frr/bgpd.conf.default $SNAP_DATA/bgpd.conf +fi +exec $SNAP/sbin/bgpd \ + -f $SNAP_DATA/bgpd.conf \ + --pid_file $SNAP_DATA/bgpd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/isisd-service b/snapcraft/scripts/isisd-service new file mode 100644 index 0000000000..aef92e997a --- /dev/null +++ b/snapcraft/scripts/isisd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/isisd.conf ]; then + cp $SNAP/etc/frr/isisd.conf.default $SNAP_DATA/isisd.conf +fi +exec $SNAP/sbin/isisd \ + -f $SNAP_DATA/isisd.conf \ + --pid_file $SNAP_DATA/isisd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ldpd-service b/snapcraft/scripts/ldpd-service new file mode 100644 index 0000000000..4c4a8ebae7 --- /dev/null +++ b/snapcraft/scripts/ldpd-service @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ldpd.conf ]; then + cp $SNAP/etc/frr/ldpd.conf.default $SNAP_DATA/ldpd.conf +fi +exec $SNAP/sbin/ldpd \ + -f $SNAP_DATA/ldpd.conf \ + --pid_file $SNAP_DATA/ldpd.pid \ + --socket $SNAP_DATA/zsock \ + --ctl_socket $SNAP_DATA \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ospf6d-service b/snapcraft/scripts/ospf6d-service new file mode 100644 index 0000000000..4dc3cb0849 --- /dev/null +++ b/snapcraft/scripts/ospf6d-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ospf6d.conf ]; then + cp $SNAP/etc/frr/ospf6d.conf.default $SNAP_DATA/ospf6d.conf +fi +exec $SNAP/sbin/ospf6d \ + -f $SNAP_DATA/ospf6d.conf \ + --pid_file $SNAP_DATA/ospf6d.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ospfd-service b/snapcraft/scripts/ospfd-service new file mode 100644 index 0000000000..7cac34b510 --- /dev/null +++ b/snapcraft/scripts/ospfd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ospfd.conf ]; then + cp $SNAP/etc/frr/ospfd.conf.default $SNAP_DATA/ospfd.conf +fi +exec $SNAP/sbin/ospfd \ + -f $SNAP_DATA/ospfd.conf \ + --pid_file $SNAP_DATA/ospfd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/pimd-service b/snapcraft/scripts/pimd-service new file mode 100644 index 0000000000..3ddd394ee0 --- /dev/null +++ b/snapcraft/scripts/pimd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/pimd.conf ]; then + cp $SNAP/etc/frr/pimd.conf.default $SNAP_DATA/pimd.conf +fi +exec $SNAP/sbin/pimd \ + -f $SNAP_DATA/pimd.conf \ + --pid_file $SNAP_DATA/pimd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ripd-service b/snapcraft/scripts/ripd-service new file mode 100644 index 0000000000..f9959be4cb --- /dev/null +++ b/snapcraft/scripts/ripd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ripd.conf ]; then + cp $SNAP/etc/frr/ripd.conf.default $SNAP_DATA/ripd.conf +fi +exec $SNAP/sbin/ripd \ + -f $SNAP_DATA/ripd.conf \ + --pid_file $SNAP_DATA/ripd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/ripngd-service b/snapcraft/scripts/ripngd-service new file mode 100644 index 0000000000..bd06e6bae5 --- /dev/null +++ b/snapcraft/scripts/ripngd-service @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/ripngd.conf ]; then + cp $SNAP/etc/frr/ripngd.conf.default $SNAP_DATA/ripngd.conf +fi +exec $SNAP/sbin/ripngd \ + -f $SNAP_DATA/ripngd.conf \ + --pid_file $SNAP_DATA/ripngd.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/scripts/zebra-service b/snapcraft/scripts/zebra-service new file mode 100644 index 0000000000..9119a4055d --- /dev/null +++ b/snapcraft/scripts/zebra-service @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e -x + +if ! [ -e $SNAP_DATA/zebra.conf ]; then + cp $SNAP/etc/frr/zebra.conf.default $SNAP_DATA/zebra.conf +fi +if ! [ -e $SNAP_DATA/vtysh.conf ]; then + cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf +fi +exec $SNAP/sbin/zebra \ + -f $SNAP_DATA/zebra.conf \ + --pid_file $SNAP_DATA/zebra.pid \ + --socket $SNAP_DATA/zsock \ + --vty_socket $SNAP_DATA + diff --git a/snapcraft/setup/gui/icon.png b/snapcraft/setup/gui/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..e8f68e6ddea002f7a3f87ae71742444603640fb4 GIT binary patch literal 21830 zcmc$lQ*`7_)b2Z&j&0kvHL-0clZkEHnmC!*$;7rb6Wg|Jo_^0dSLga$>$}KGI;pOz zf2C^I-p}*vNF@bH1Xx^H004j>EhVM`0Dysh1Oq?=LErS8%6kmQ!4qDs=DqQpv0 z_CGCc%m4sxlu-38`!zLm!AN_RB1|D-Ey?hxp&E5n-8MYjs$rmXQt^chX7R}~E%`n# zS7bRJ)Y?h&A4Ts#F5o+u@CpQy6h8?9(8PP?vA0oLHJtX3w3PSpAQB1X#W(ex4mT4j z)j_?7*D;obw0ioJFi1im=W@XF)!*3Gi$Jy37YmMy^bJN)Z8 zPDtUMbTq(2iHsuGQz zrgoU(9a~twkQg&v@6YvvwcfId+e}-LA~)$C)w&~vmYVMIuVrfuYucoZ{l7iOzs~xA zdk`t#mnZtVY#vD(8djli0yn>T&p4FA$-h~-vUuZT*UdaooTdLI<6d$#M{Ov=3b@jE zZd^7!PAL1UYPoH^-6!MwC&Tc!qsC####n<+#yB`x{Ewc}iTwbm0HMaJ&a!V4v%Fkv z1(>(8n$~vJ_)Wh2xqO`aC86ja!nn> zyR8a1pOIHoYX0c8TR)5k8G(Qv*c=7Inf{eWAD1=1C6i=3kvnkzMb zYG`15Mq63+7bL?mCfG5i4yZZZTf6$B3(32KN#l-1Hs89%-8SHDFLlMjzxw&kG%R$> z(0nhDA9`?C!>$#44%rH#p&r`1c8?0B_JIkiytP|z1Shh)8!jy~9sy74Q&eJnL|nLE z)m*rIhNNGZGiG-}+5krn8$3ERP}qQRkkWPr02s;s`vUVQ7IFgsgaOiGB5EFB7uisq zYC{hr;hTKau(Yt$;^KV<1W=CXvI~;)O;gv5^+^Gi7y!!?@n)L%?MW z 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 WztLIZ{|Nvck{Ril=r(9SNc=xHQvkjI literal 0 HcmV?d00001 diff --git a/snapcraft/snapcraft.yaml.in b/snapcraft/snapcraft.yaml.in new file mode 100644 index 0000000000..a703766f0b --- /dev/null +++ b/snapcraft/snapcraft.yaml.in @@ -0,0 +1,235 @@ +name: frr +version: @VERSION@ +summary: FreeRangeRouting BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM/LDP routing daemon +description: BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM routing daemon + FreeRangeRouting (FRR) is free software which manages TCP/IP based routing + protocols. It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2, + RIPng, PIM and LDP as well as the IPv6 versions of these. + FreeRangeRouting (frr) is a fork of Quagga. +confinement: strict +grade: devel + +apps: + vtysh: + command: bin/vtysh --vty_socket $SNAP_DATA --config_dir $SNAP_DATA + plugs: + - network + - network-bind + - network-control + version: + command: sbin/zebra --version + readme: + command: bin/cat $SNAP/doc/README.usage.md + zebra: + command: bin/zebra-service + daemon: simple + plugs: + - network + - network-bind + - network-control + bgpd: + command: bin/bgpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ospfd: + command: bin/ospfd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ospf6d: + command: bin/ospf6d-service + daemon: simple + plugs: + - network + - network-bind + - network-control + isisd: + command: bin/isisd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ripd: + command: bin/ripd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ripngd: + command: bin/ripngd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + pimd: + command: bin/pimd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + ldpd: + command: bin/ldpd-service + daemon: simple + plugs: + - network + - network-bind + - network-control + zebra-debug: + command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + bgpd-debug: + command: sbin/bgpd -f $SNAP_DATA/bgpd.conf --pid_file $SNAP_DATA/bgpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ospfd-debug: + command: sbin/ospfd -f $SNAP_DATA/ospfd.conf --pid_file $SNAP_DATA/ospfd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ospf6d-debug: + command: sbin/ospf6d -f $SNAP_DATA/ospf6d.conf --pid_file $SNAP_DATA/ospf6d.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + isisd-debug: + command: sbin/isisd -f $SNAP_DATA/isisd.conf --pid_file $SNAP_DATA/isisd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ripd-debug: + command: sbin/ripd -f $SNAP_DATA/ripd.conf --pid_file $SNAP_DATA/ripd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ripngd-debug: + command: sbin/ripngd -f $SNAP_DATA/ripngd.conf --pid_file $SNAP_DATA/ripngd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + pimd-debug: + command: sbin/pimd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + ldpd-debug: + command: sbin/ldpd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA + plugs: + - network + - network-bind + - network-control + +parts: + frr: + build-packages: + - autoconf + - automake + - libtool + - make + - gawk + - libreadline-dev + - texinfo + - dejagnu + - libncurses5-dev + - texlive-latex-base + - texlive-generic-recommended + - libcap-dev + - imagemagick + - ghostscript + - groff + - hardening-wrapper + - libpcre3-dev + - chrpath + - pkg-config + - libjson-c-dev + stage-packages: + - coreutils + - iproute2 + - logrotate + - libcap2 + - libc6 + - libtinfo5 + - libreadline6 + - libjson-c2 + plugin: autotools + source: ../frr-@PACKAGE_VERSION@.tar.gz + configflags: + - --with-cflags=-g + - --with-cflags=-O0 + - --with-cflags=-std=gnu99 + - --with-cflags=-fpie + - --with-cflags=-fno-omit-frame-pointer + - --with-cflags=-Wall + - --enable-vtysh + - --enable-isisd + - --enable-watchfrr + - --enable-ospfclient=yes + - --enable-ospfapi=yes + - --enable-multipath=64 + - --enable-rtadv + - --enable-irdp + - --enable-gcc-rdynamic + - --enable-user=root + - --enable-group=root + - --enable-pimd + - --enable-ldpd + - --enable-configfile-mask=0640 + - --enable-logfile-mask=0640 + - --localstatedir=/var/run + - --sbindir=/sbin + - --bindir=/bin + - --sysconfdir=/etc/frr + - --with-pkg-extra-version=@PACKAGE_EXTRAVERSION@ + frr-defaults: + plugin: dump + source: defaults + organize: + zebra.conf.default: etc/frr/zebra.conf.default + bgpd.conf.default: etc/frr/bgpd.conf.default + isisd.conf.default: etc/frr/isisd.conf.default + ospf6d.conf.default: etc/frr/ospf6d.conf.default + ospfd.conf.default: etc/frr/ospfd.conf.default + pimd.conf.default: etc/frr/pimd.conf.default + ripd.conf.default: etc/frr/ripd.conf.default + ripngd.conf.default: etc/frr/ripngd.conf.default + ldpd.conf.default: etc/frr/ldpd.conf.default + vtysh.conf.default: etc/frr/vtysh.conf.default + frr-scripts: + plugin: make + source: scripts + helpers: + stage-packages: + - telnet + - traceroute + plugin: make + source: helpers + prime: + - bin/telnet + - bin/traceroute + - bin/traceroute6 + docs: + plugin: dump + source: . + organize: + README.usage.md: doc/README.usage.md + README.snap_build.md: doc/README.snap_build.md + From 78e31f4663d413a7ab18bb9c4b77e55fc8007396 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Tue, 13 Dec 2016 02:46:52 -0800 Subject: [PATCH 36/64] tools: Fix unnecessary routing perturbations due to old style config Ticket: CM-14060 Reviewed By: Testing Done: There are two harmful problems (cause routing changes in the network) with the 2.5.x style config: one with the old style specification of "multipath as-relax", and the other with ip import-table, used by redistribute neighbor In 2.5, we had the user specify 'no-as-set' as the suffix to 'bgp bestpath as-path multipath relax' to avoid quagga's default behavior which'd cause weird routing problems. However, in 3.x, we made 'no-as-set' as the default, and so its neither required to specify it nor is it shown in the running config. This means when we do quagga reload, we remove the multipath as-relax line and add it back with the no-as-set line. This causes all BGP sessions to be reset. The problem with the "ip import-table" is that it causes us to unimport the routes and then add it back again, causing routing prefix changes throughout the network, potentially causing blackholing of traffic. This fix addresses both these issues and avoids the unnecessary routing blips. Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 463784de11..e14d78d54c 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -579,6 +579,41 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del): lines_to_add_to_del.append((ctx_keys, swpx_interface)) lines_to_add_to_del.append((tmp_ctx_keys, swpx_remoteas)) + ''' + In 3.0, we made bgp bestpath multipath as-relax command + automatically assume no-as-set since the lack of this option caused + weird routing problems and this problem was peculiar to this + implementation. When the running config is shown in relases after + 3.0, the no-as-set is not shown as its the default. This causes + reload to unnecessarily unapply this option to only apply it back + again, causing unnecessary session resets. Handle this. + ''' + if ctx_keys[0].startswith('router bgp') and line and 'multipath-relax' in line: + re_asrelax_new = re.search('^bgp\s+bestpath\s+as-path\s+multipath-relax$', line) + old_asrelax_cmd = 'bgp bestpath as-path multipath-relax no-as-set' + found_asrelax_old = line_exist(lines_to_add, ctx_keys, old_asrelax_cmd) + + if re_asrelax_new and found_asrelax_old: + deleted = True + lines_to_del_to_del.append((ctx_keys, line)) + lines_to_add_to_del.append((ctx_keys, old_asrelax_cmd)) + + ''' + More old-to-new config handling. ip import-table no longer accepts + distance, but we honor the old syntax. But 'show running' shows only + the new syntax. This causes an unnecessary 'no import-table' followed + by the same old 'ip import-table' which causes perturbations in + announced routes leading to traffic blackholes. Fix this issue. + ''' + re_importtbl = re.search('^ip\s+import-table\s+(\d+)$', ctx_keys[0]) + if re_importtbl: + table_num = re_importtbl.group(1) + for ctx in lines_to_add: + if ctx[0][0].startswith('ip import-table %s distance' % table_num): + deleted = True + lines_to_del_to_del.append((('ip import-table %s' % table_num,), None)) + lines_to_add_to_del.append((ctx[0], None)) + if not deleted: found_add_line = line_exist(lines_to_add, ctx_keys, line) From 3fa113f00cf15f8248db399b6da7210e8db3ceb4 Mon Sep 17 00:00:00 2001 From: radhika Date: Fri, 6 Jan 2017 12:54:25 -0800 Subject: [PATCH 37/64] bgpd, zebra: Fix for ignored non-default VRF single-hop BFD status messages in Quagga MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ticket: CM-13425 Reviewed By: Donald, Kanna Testing Done: Unit, Min tests, PTM Smoke and Nightly, BGP Smoke Issue: BFD status up/down not reflected in the Quagga for non-default VRF single-hop BFD sessions. Root Cause: PTM doesn’t keep track of VRF for Single hop BFD sessions since they are interface-based sessions. The status up/down messages to the quagga for single hop sessions do not have VRF information. In zebra daemon, the interface search based on the interface name extracted from the BFD status message is done across all VRFs. So, the search does not fail in zebra daemon. But, the interface search in bgpd/ospd is done per vrf and default VRF is used for search if no VRF is sent in the status message. So, the search fails and the BFD status changes are ignored. Fix: The VRF information is extracted from the interface if VRF is not sent in the BFD status messages in zebra daemon and passed to bgpd/ospfd. The interface search will not fail since the appropriate VRF is passed to bgpd/ospfd and BFD satus changes are not ignored. Signed-off-by: Radhika Mahankali --- bgpd/bgp_bfd.c | 8 ++++---- zebra/zebra_ptm.c | 14 +++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index ad221d922d..4f76fd17fb 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -311,14 +311,14 @@ bgp_bfd_dest_update (int command, struct zclient *zclient, prefix2str(&dp, buf[0], sizeof(buf[0])); if (ifp) { - zlog_debug("Zebra: interface %s bfd destination %s %s", - ifp->name, buf[0], bfd_get_status_str(status)); + zlog_debug("Zebra: vrf %d interface %s bfd destination %s %s", + vrf_id, ifp->name, buf[0], bfd_get_status_str(status)); } else { prefix2str(&sp, buf[1], sizeof(buf[1])); - zlog_debug("Zebra: source %s bfd destination %s %s", - buf[1], buf[0], bfd_get_status_str(status)); + zlog_debug("Zebra: vrf %d source %s bfd destination %s %s", + vrf_id, buf[1], buf[0], bfd_get_status_str(status)); } } diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index c5223199a4..a633ce6332 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -459,6 +459,7 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp) char vrf_str[64]; struct prefix dest_prefix; struct prefix src_prefix; + vrf_id_t vrf_id; ptm_lib_find_key_in_msg(in_ctxt, ZEBRA_PTM_BFDSTATUS_STR, bfdst_str); @@ -491,7 +492,8 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp) } if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("%s: Recv Port [%s] bfd status [%s] vrf [%s] peer [%s] local [%s]", + zlog_debug("%s: Recv Port [%s] bfd status [%s] vrf [%s]" + " peer [%s] local [%s]", __func__, ifp ? ifp->name : "N/A", bfdst_str, vrf_str, dest_str, src_str); @@ -510,12 +512,18 @@ zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, struct interface *ifp) } } + if (!strcmp(ZEBRA_PTM_INVALID_VRF, vrf_str) && ifp) { + vrf_id = ifp->vrf_id; + } else { + vrf_id = vrf_name_to_id(vrf_str); + } + if (!strcmp (bfdst_str, ZEBRA_PTM_BFDSTATUS_DOWN_STR)) { if_bfd_session_update(ifp, &dest_prefix, &src_prefix, BFD_STATUS_DOWN, - vrf_name_to_id(vrf_str)); + vrf_id); } else { if_bfd_session_update(ifp, &dest_prefix, &src_prefix, BFD_STATUS_UP, - vrf_name_to_id(vrf_str)); + vrf_id); } return 0; From 4b78098d79d97abef352345221c3979efab1c373 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Thu, 5 Jan 2017 18:49:13 -0800 Subject: [PATCH 38/64] tools: Don't overwrite Quagga.conf on reload, unless user specified. Ticket: CM-14059 Reviewed By: CCR-5524 Testing Done: the usual At some point in the 3.x release cycle, it was decided to overwrite the user's Quagga.conf configuration file with the output of running config when the user did a quagga reload. This is problematic for several reasons such as: losing user-specified comments, upsetting network automation scripts which think some thing has changed all the time from the specified config etc. This patch fixes this issue by not overwriting the Quagga.conf file unless the user specifies it via an additional option, or the file being used as input to quagga reload isn't the default configuration file (incl. path). Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index e14d78d54c..729f817d63 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -732,6 +732,7 @@ if __name__ == '__main__': parser.add_argument('--debug', action='store_true', help='Enable debugs', default=False) parser.add_argument('--stdout', action='store_true', help='Log to STDOUT', default=False) parser.add_argument('filename', help='Location of new frr config file') + parser.add_argument('--overwrite', action='store_true', help='Overwrite Quagga.conf with running config output', default=False) args = parser.parse_args() # Logging @@ -939,5 +940,6 @@ if __name__ == '__main__': subprocess.call(['/usr/bin/vtysh', '-f', filename]) os.unlink(filename) - # Make these changes persistent + # Make these changes persistent + if args.overwrite or args.filename != '/etc/quagga/Quagga.conf': subprocess.call(['/usr/bin/vtysh', '-c', 'write']) From 0bf7cc2888a984883522f07ddeb897fb1fdb9621 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Fri, 6 Jan 2017 06:50:47 -0800 Subject: [PATCH 39/64] tools: Handle lack of "seq" in prefix-list statements. Ticket: CM-14259 Reviewed By: CCR-5527 Testing Done: If users specify "ip prefix-list FOO permit 1.2.3.4/24", running config displays that line as "ip prefix-list FOO seq 5 permit 1.2.3.4/24", which causes reload to delete the running config line and add back the one in the config. This patch fixes that. Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 729f817d63..e15eab4a8f 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -610,10 +610,29 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del): table_num = re_importtbl.group(1) for ctx in lines_to_add: if ctx[0][0].startswith('ip import-table %s distance' % table_num): - deleted = True lines_to_del_to_del.append((('ip import-table %s' % table_num,), None)) lines_to_add_to_del.append((ctx[0], None)) - + + ''' + ip/ipv6 prefix-list can be specified without a seq number. However, + the running config always adds 'seq x', where x is a number incremented + by 5 for every element, to the prefix list. So, ignore such lines as + well. Sample prefix-list lines: + ip prefix-list PR-TABLE-2 seq 5 permit 20.8.2.0/24 le 32 + ip prefix-list PR-TABLE-2 seq 10 permit 20.8.2.0/24 le 32 + ipv6 prefix-list vrfdev6-12 permit 2000:9:2::/64 gt 64 + ''' + re_ip_pfxlst = re.search('^(ip|ipv6)(\s+prefix-list\s+)(\S+\s+)(seq \d+\s+)(permit|deny)(.*)$', + ctx_keys[0]) + if re_ip_pfxlst: + tmpline = (re_ip_pfxlst.group(1) + re_ip_pfxlst.group(2) + + re_ip_pfxlst.group(3) + re_ip_pfxlst.group(5) + + re_ip_pfxlst.group(6)) + for ctx in lines_to_add: + if ctx[0][0] == tmpline: + lines_to_del_to_del.append((ctx_keys, None)) + lines_to_add_to_del.append(((tmpline,), None)) + if not deleted: found_add_line = line_exist(lines_to_add, ctx_keys, line) From 768bf950cf94b48576d4ddd974971c126ab68f31 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Fri, 6 Jan 2017 14:52:25 -0800 Subject: [PATCH 40/64] tools: Handle deletes of entire interface context as deleting each line Ticket: CM-14260 Reviewed By: CCR-14260 Testing Done: quagga reload tests (quagga_service, bgp_enhe etc.) Quagga reload handles deletes of entire context by issuing a "no.." on the entire context itself instead of deleting each individual line of the context. However, this doesn't work when the context is "interface" since its not allowed to do "no interface " inside quagga. So special case this by deleting each individual line of the context. Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index e15eab4a8f..57e9f026e3 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -700,6 +700,11 @@ def compare_context_objects(newconf, running): delete_bgpd = True lines_to_del.append((running_ctx_keys, None)) + # We cannot do 'no interface' in quagga, and so deal with it + elif running_ctx_keys[0].startswith('interface'): + for line in running_ctx.lines: + lines_to_del.append((running_ctx_keys, line)) + # If this is an address-family under 'router bgp' and we are already deleting the # entire 'router bgp' context then ignore this sub-context elif "router bgp" in running_ctx_keys[0] and len(running_ctx_keys) > 1 and delete_bgpd: From a27647f946b1eb3b83c824942e36762038bf79f5 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Sat, 7 Jan 2017 16:44:55 -0800 Subject: [PATCH 41/64] FRR: Add various TAGS format files to be ignored by git. Add some missing files to .gitignore Signed-off-by: Dinesh Dutt --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 30006f7e28..d592e8b3f3 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,10 @@ cscope.* *.pb.h *.pb-c.h *.pb-c.c +TAGS +tags +GTAGS +GSYMS +GRTAGS +GPATH + From 3b69fd51184da846df41c40e8ebbbdc356f3aa8a Mon Sep 17 00:00:00 2001 From: Don Slice Date: Thu, 5 Jan 2017 10:49:23 -0800 Subject: [PATCH 42/64] bgpd: do not allow prefix length on update-source A common misconfiguration that was silently accepted but wouldn't work was including the prefix length on the update-source; i.e. 10.1.1.1/32. This commit rejects this config and notifies the user. Ticket: CM-13485 Signed-off-by: Don Slice Date: Sun, 8 Jan 2017 07:08:12 -0800 Subject: [PATCH 43/64] tools: Normalize prefix-lists and IP networks for avoiding unnecessary reload Ticket: CM-14280, CM-14281, CM-14286 Reviewed By: CCR-5546 Testing Done: quagga_service_test, bgp_enhe, bgp_vrf etc. If the user specifies a network statement such as "network 1.1.1.1/24", the running config shows this as "network 1.1.1.0/24" which causes unnecessary withdrawl of the prefix and re-advertisement causing perturbations. The same thing applies to prefix-lists and of course, IPv6 addresses. IPv6 addresses were being normalized already, and so we use that same function to handle the IPv6 portion of the issue. Interestingly community strings were also getting ensnared in the normalized IPv6 function due to the presence of ':', but thats OK. quagga's running config changes 'null0' and 'blackhole' keywords into 'Null0'. For example: ip route 10.1.1.0/24 blackhole' is displayed as 'ip route 10.1.1.0/24 Null0'. Reload mistakes this and issues a delete of the Null0 route followed by an add of the "blackhole" route. Unnecessary, and results in unexpected routing perturabations. Also fix prefix-list's le/ge behavior: It always prints ge first even if the user has specified le followed by ge, and it doesn't print l3 32/128 if ge is also specified, else it prints them. Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 113 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 107 insertions(+), 6 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 57e9f026e3..d26758ab17 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -38,7 +38,7 @@ import string import subprocess import sys from collections import OrderedDict -from ipaddr import IPv6Address +from ipaddr import IPv6Address, IPNetwork from pprint import pformat @@ -173,6 +173,98 @@ class Config(object): if not key: return + ''' + IP addresses specified in "network" statements, "ip prefix-lists" + etc. can differ in the host part of the specification the user + provides and what the running config displays. For example, user + can specify 11.1.1.1/24, and the running config displays this as + 11.1.1.0/24. Ensure we don't do a needless operation for such + lines. IS-IS & OSPFv3 have no "network" support. + ''' + re_key_rt = re.match(r'ip\s+route\s+([A-Fa-f:.0-9/]+)(.*)$', key[0]) + if re_key_rt: + addr = re_key_rt.group(2) + if '/' in addr: + try: + newaddr = IPNetwork(addr) + key[0] = 'ip %s %s/%s%s' % (re_key_rt.group(1), + newaddr.network, + newaddr.prefixlen, + re_key_rt.group(3)) + except ValueError: + pass + + re_key_rt = re.match( + r'(ip|ipv6)\s+prefix-list(.*)(permit|deny)\s+([A-Fa-f:.0-9/]+)(.*)$', + key[0] + ) + if re_key_rt: + addr = re_key_rt.group(4) + if '/' in addr: + try: + newaddr = '%s/%s' % (IPNetwork(addr).network, + IPNetwork(addr).prefixlen) + except ValueError: + newaddr = addr + + legestr = re_key_rt.group(5) + re_lege = re.search(r'(.*)le\s+(\d+)\s+ge\s+(\d+)(.*)', legestr) + if re_lege: + legestr = '%sge %s le %s%s' % (re_lege.group(1), + re_lege.group(3), + re_lege.group(2), + re_lege.group(4)) + re_lege = re.search(r'(.*)ge\s+(\d+)\s+le\s+(\d+)(.*)', legestr) + + if (re_lege and ((re_key_rt.group(1) == "ip" and + re_lege.group(3) == "32") or + (re_key_rt.group(1) == "ipv6" and + re_lege.group(3) == "128"))): + legestr = '%sge %s%s' % (re_lege.group(1), + re_lege.group(2), + re_lege.group(4)) + + key[0] = '%s prefix-list%s%s %s%s' % (re_key_rt.group(1), + re_key_rt.group(2), + re_key_rt.group(3), + newaddr, + legestr) + + if lines and key[0].startswith('router bgp'): + newlines = [] + for line in lines: + re_net = re.match(r'network\s+([A-Fa-f:.0-9/]+)(.*)$', line) + if re_net: + addr = re_net.group(1) + if '/' not in addr and key[0].startswith('router bgp'): + # This is most likely an error because with no + # prefixlen, BGP treats the prefixlen as 8 + addr = addr + '/8' + + try: + newaddr = IPNetwork(addr) + line = 'network %s/%s %s' % (newaddr.network, + newaddr.prefixlen, + re_net.group(2)) + newlines.append(line) + except: + # Really this should be an error. Whats a network + # without an IP Address following it ? + newlines.append(line) + else: + newlines.append(line) + lines = newlines + + ''' + More fixups in user specification and what running config shows. + "null0" in routes must be replaced by Null0, and "blackhole" must + be replaced by Null0 as well. + ''' + if (key[0].startswith('ip route') or key[0].startswith('ipv6 route') and + 'null0' in key[0] or 'blackhole' in key[0]): + key[0] = re.sub(r'\s+null0(\s*$)', ' Null0', key[0]) + key[0] = re.sub(r'\s+blackhole(\s*$)', ' Null0', key[0]) + if lines: if tuple(key) not in self.contexts: ctx = Context(tuple(key), lines) @@ -437,16 +529,25 @@ def get_normalized_ipv6_line(line): """ Return a normalized IPv6 line as produced by frr, with all letters in lower case and trailing and leading - zeros removed + zeros removed, and only the network portion present if + the IPv6 word is a network """ norm_line = "" words = line.split(' ') for word in words: if ":" in word: - try: - norm_word = str(IPv6Address(word)).lower() - except: - norm_word = word + norm_word = None + if "/" in word: + try: + v6word = IPNetwork(word) + norm_word = '%s/%s' % (v6word.network, v6word.prefixlen) + except ValueError: + pass + if not norm_word: + try: + norm_word = '%s' % IPv6Address(word) + except: + norm_word = word else: norm_word = word norm_line = norm_line + " " + norm_word From 0845b8727a90768a1a8e6ff389bfe83c2e87d2e9 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Wed, 11 Jan 2017 11:33:15 -0800 Subject: [PATCH 44/64] tools: Fix unbound newaddr variable, fix too-broad except clauses Ticket: CM-14351 Reviewed By: dwalton Testing Done:attempts to run NCLU test failed, Daniel verified. Uninit variable bug, plus missed adding ValueError to the except clauses in a couple of places. Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index d26758ab17..f6ddd35f66 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -206,6 +206,8 @@ class Config(object): IPNetwork(addr).prefixlen) except ValueError: newaddr = addr + else: + newaddr = addr legestr = re_key_rt.group(5) re_lege = re.search(r'(.*)le\s+(\d+)\s+ge\s+(\d+)(.*)', legestr) @@ -247,7 +249,7 @@ class Config(object): newaddr.prefixlen, re_net.group(2)) newlines.append(line) - except: + except ValueError: # Really this should be an error. Whats a network # without an IP Address following it ? newlines.append(line) @@ -546,7 +548,7 @@ def get_normalized_ipv6_line(line): if not norm_word: try: norm_word = '%s' % IPv6Address(word) - except: + except ValueError: norm_word = word else: norm_word = word From 1a11782c408a60afb464fe232fc2e3fa1e298436 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Wed, 11 Jan 2017 14:33:39 -0800 Subject: [PATCH 45/64] *: Add source of route as protocol string in ip route pushed into kernel Ticket: CM-14313 Reviewed By: Testing Done: bgpmin, ospfmin, bgp_kitchen_sink_test 'ip route show' displays all routes as belonging to protocol zebra. The user has to run an additional command (in vtysh) to get the actual source of a route (bgp/ospf/static etc.). This patch addresses that by pushing the appropriate protocol string into the protocol field of the netlink route update message. Now you can see routes with the correct origin as well as filter on them (ip route show proto ospf). 'ospf' is used for both IPv4 and IPv6 routes, even though the OSPF version is different in both cases. Sample output (old): 9.9.12.13 via 69.254.2.38 dev swp3.2 proto zebra metric 20 9.9.13.3 proto zebra metric 20 nexthop via 69.254.2.30 dev swp1.2 weight 1 nexthop via 69.254.2.34 dev swp2.2 weight 1 nexthop via 69.254.2.38 dev swp3.2 weight 1 Sample output (new): 9.9.12.13 via 69.254.2.38 dev swp3.2 proto bgp metric 20 9.9.13.3 proto bgp metric 20 nexthop via 69.254.2.30 dev swp1.2 weight 1 nexthop via 69.254.2.34 dev swp2.2 weight 1 nexthop via 69.254.2.38 dev swp3.2 weight 1 Signed-off-by: Dinesh Dutt --- cumulus/etc/iproute2/rt_protos.d/frr.conf | 8 ++++ debian/frr.dirs | 1 + tools/frr | 9 ++++- zebra/kernel_netlink.c | 5 +++ zebra/rt_netlink.c | 49 +++++++++++++++++++++-- zebra/rt_netlink.h | 8 ++++ 6 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 cumulus/etc/iproute2/rt_protos.d/frr.conf diff --git a/cumulus/etc/iproute2/rt_protos.d/frr.conf b/cumulus/etc/iproute2/rt_protos.d/frr.conf new file mode 100644 index 0000000000..883782e4dd --- /dev/null +++ b/cumulus/etc/iproute2/rt_protos.d/frr.conf @@ -0,0 +1,8 @@ +# Additional protocol strings defined by quagga for each of its daemons + +186 bgp +187 isis +188 ospf +189 rip +190 ripng +191 static diff --git a/debian/frr.dirs b/debian/frr.dirs index 58290080d0..56699b2daa 100644 --- a/debian/frr.dirs +++ b/debian/frr.dirs @@ -1,5 +1,6 @@ etc/logrotate.d/ etc/frr/ +etc/iproute2/rt_protos.d/ usr/share/doc/frr/ usr/share/doc/frr/examples/ usr/share/lintian/overrides/ diff --git a/tools/frr b/tools/frr index 2ecaadbb53..a6d99feaf6 100755 --- a/tools/frr +++ b/tools/frr @@ -532,8 +532,15 @@ case "$1" in fi if [ -z "$dmn" -o "$dmn" = "zebra" ]; then - echo "Removing all routes made by zebra." + echo "Removing all routes made by quagga." + ip route flush proto bgp + ip route flush proto ospf + ip route flush proto static + ip route flush proto rip + ip route flush proto ripng ip route flush proto zebra + ip route flush proto isis + else [ -n "$dmn" ] && eval "${dmn/-/_}=0" start_watchfrr diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 9f9a62f384..20cb62e318 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -91,6 +91,11 @@ static const struct message rtproto_str[] = { #ifdef RTPROT_BIRD {RTPROT_BIRD, "BIRD"}, #endif /* RTPROT_BIRD */ + {RTPROT_BGP, "BGP"}, + {RTPROT_OSPF, "OSPF"}, + {RTPROT_ISIS, "IS-IS"}, + {RTPROT_RIP, "RIP"}, + {RTPROT_RIPNG, "RIPNG"}, {0, NULL} }; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index c04f9188fa..01922e1ad5 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -92,6 +92,47 @@ struct gw_family_t union g_addr gate; }; +static inline int is_selfroute(int proto) +{ + if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) || + (proto == RTPROT_STATIC) || (proto == RTPROT_ZEBRA) || + (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG)) { + return 1; + } + + return 0; +} + +static inline int get_rt_proto(int proto) +{ + switch (proto) { + case ZEBRA_ROUTE_BGP: + proto = RTPROT_BGP; + break; + case ZEBRA_ROUTE_OSPF: + case ZEBRA_ROUTE_OSPF6: + proto = RTPROT_OSPF; + break; + case ZEBRA_ROUTE_STATIC: + proto = RTPROT_STATIC; + break; + case ZEBRA_ROUTE_ISIS: + proto = RTPROT_ISIS; + break; + case ZEBRA_ROUTE_RIP: + proto = RTPROT_RIP; + break; + case ZEBRA_ROUTE_RIPNG: + proto = RTPROT_RIPNG; + break; + default: + proto = RTPROT_ZEBRA; + break; + } + + return proto; +} + /* Pending: create an efficient table_id (in a tree/hash) based lookup) */ @@ -181,7 +222,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h, } /* Route which inserted by Zebra. */ - if (rtm->rtm_protocol == RTPROT_ZEBRA) + if (is_selfroute(rtm->rtm_protocol)) flags |= ZEBRA_FLAG_SELFROUTE; index = 0; @@ -367,9 +408,9 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (rtm->rtm_protocol == RTPROT_KERNEL) return 0; - if (rtm->rtm_protocol == RTPROT_ZEBRA && h->nlmsg_type == RTM_NEWROUTE) + if (is_selfroute(rtm->rtm_protocol) && h->nlmsg_type == RTM_NEWROUTE) return 0; - if (rtm->rtm_protocol == RTPROT_ZEBRA) + if (is_selfroute(rtm->rtm_protocol)) SET_FLAG(zebra_flags, ZEBRA_FLAG_SELFROUTE); if (rtm->rtm_src_len != 0) @@ -1151,7 +1192,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, req.n.nlmsg_type = cmd; req.r.rtm_family = family; req.r.rtm_dst_len = p->prefixlen; - req.r.rtm_protocol = RTPROT_ZEBRA; + req.r.rtm_protocol = get_rt_proto(rib->type); req.r.rtm_scope = RT_SCOPE_UNIVERSE; if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT)) diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index 7183525fba..d1f01bda4c 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -28,6 +28,14 @@ #define NL_DEFAULT_ROUTE_METRIC 20 +/* Additional protocol strings to push into routes */ +#define RTPROT_BGP 186 +#define RTPROT_ISIS 187 +#define RTPROT_OSPF 188 +#define RTPROT_RIP 189 +#define RTPROT_RIPNG 190 + + extern void clear_nhlfe_installed (zebra_lsp_t *lsp); extern int From cca1dda8bf5aca42aec577b2e156b5e56a2bc996 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Mon, 16 Jan 2017 06:24:09 -0800 Subject: [PATCH 46/64] bgpd: Add decoded notification code strings to JSON output Ticket: CM-14136 Reviewed By: CCR-5585 Testing Done: bgpmin The JSON output of 'bgp neighbor show' lacked the decoded strings for the last notification error code/subcode. Decoding these strings outside quagga is painful, and then needs to match with any updates to the codes from RFCs/drafts. Further, all apps that look to understanding this need to then add their own decoders for these strings. Just add the decoded strings to the JSON output as well. JSON key name for this is 'lastNotificationReason'. Signed-off-by: Dinesh Dutt --- bgpd/bgp_vty.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 52ce1273c3..79e5a0c332 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -11917,11 +11917,19 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js tm = gmtime(&uptime); json_object_int_add(json_neigh, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); json_object_string_add(json_neigh, "lastResetDueTo", peer_down_str[(int) p->last_reset]); - if (p->last_reset_cause_size) + if (p->last_reset == PEER_DOWN_NOTIFY_SEND || + p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) { char errorcodesubcode_hexstr[5]; + char errorcodesubcode_str[256]; + + code_str = bgp_notify_code_str(p->notify.code); + subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); + sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); json_object_string_add(json_neigh, "lastErrorCodeSubcode", errorcodesubcode_hexstr); + snprintf(errorcodesubcode_str, 255, "%s%s", code_str, subcode_str); + json_object_string_add(json_neigh, "lastNotificationReason", errorcodesubcode_str); } } else From 5c940836ab4c5e6716cc178f976e2d1a9d386bbf Mon Sep 17 00:00:00 2001 From: radhika Date: Thu, 19 Jan 2017 14:23:21 -0800 Subject: [PATCH 47/64] bgpd: Update BFD status when de-registering with PTM Ticket: CM-14301 Reviewed By: Donald, Vivek Testing Done: Unit, Min tests, PTM and BFD Smoke, BGP Smoke Issue: BFD status is not changed from up to down for bgp peer even after the BFD session has been de-registered by bgpd. Root Cause: This issue happens when bgpd detects peer down before getting the BFD down from PTM. bgpd will send the de-reg bfd session message to ptm after detecting peer down. If ptm receives the de-reg message before it detects the peer down, then the down message will not be sent to Quagga. This causes the bfd status in bgpd to remain unchanged. Fix: Update the BFD status to down in bgpd before de-registering the session from PTM. Signed-off-by: Radhika Mahankali --- bgpd/bgp_bfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 4f76fd17fb..3def3421a8 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -171,6 +171,9 @@ bgp_bfd_deregister_peer (struct peer *peer) if (!CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_REG)) return; + bfd_info->status = BFD_STATUS_DOWN; + bfd_info->last_update = bgp_clock(); + bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER); } From 64a608dbae92eb9ec084b22004ced29efa48defd Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 20 Jan 2017 04:17:09 +0000 Subject: [PATCH 48/64] bgpd: timers config is accepted but not recorded in running config Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-14463 --- bgpd/bgpd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 244b1930b3..ef633c16e7 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6680,26 +6680,27 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp, } /* advertisement-interval */ - if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) - && peer->v_routeadv != BGP_DEFAULT_EBGP_ROUTEADV - && ! peer_group_active (peer)) + if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) && + ((! peer_group_active (peer) && peer->v_routeadv != BGP_DEFAULT_EBGP_ROUTEADV) || + (peer_group_active (peer) && peer->v_routeadv != g_peer->v_routeadv))) { vty_out (vty, " neighbor %s advertisement-interval %d%s", addr, peer->v_routeadv, VTY_NEWLINE); } /* timers */ - if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER) - && (peer->keepalive != BGP_DEFAULT_KEEPALIVE || peer->holdtime != BGP_DEFAULT_HOLDTIME) - && ! peer_group_active (peer)) + if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER) && + ((! peer_group_active (peer) && (peer->keepalive != BGP_DEFAULT_KEEPALIVE || peer->holdtime != BGP_DEFAULT_HOLDTIME)) || + (peer_group_active (peer) && (peer->keepalive != g_peer->keepalive || peer->holdtime != g_peer->holdtime)))) { vty_out (vty, " neighbor %s timers %d %d%s", addr, peer->keepalive, peer->holdtime, VTY_NEWLINE); } if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) && - peer->connect != BGP_DEFAULT_CONNECT_RETRY && - ! peer_group_active (peer)) + ((! peer_group_active (peer) && peer->connect != BGP_DEFAULT_CONNECT_RETRY) || + (peer_group_active (peer) && peer->connect != g_peer->connect))) + { vty_out (vty, " neighbor %s timers connect %d%s", addr, peer->connect, VTY_NEWLINE); From 659b52a8456ea70ee4d7a21c9cb46c58d01ea296 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Fri, 13 Jan 2017 11:23:03 -0800 Subject: [PATCH 49/64] zebra: send ipv4 singlepath delete messages to kernel without nexthop Problem reported was stale routes left in the kernel in certain cases when overlapping static routes were used and links were bounced. The problem was determined to be an issue where the nexthop was changed due to recursion as the link is going down, and the next-hop at the time of deletion doesn't match what was previously installed by the kernel. This caused the kernel to reject the deletion and the route stuck around. It was pointed out that the kernel doesn't actually require a next-hop value on the netlink deletion call. In this fix, we are eliminating the nexthop for RTM_DELROUTE messages to the kernel in the ipv4 singlepath case. This approach could also be valid for other cases but the fix as is resolved the reported failure case. More testing should be performed before similar changes are made for other cases. Testing included manual testing for the failure condition as well as complete bgp-smoke and ospf-smoke tests with no new failures. Ticket: CM-13328 Signed-off-by: Don Slice Reviewed-by: CCR-5562 --- zebra/rt_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 01922e1ad5..5d1ef26487 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -777,8 +777,10 @@ _netlink_route_build_singlepath( if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { - _netlink_route_nl_add_gateway_info (rtmsg->rtm_family, AF_INET, nlmsg, - req_size, bytelen, nexthop); + /* Send deletes to the kernel without specifying the next-hop */ + if (cmd != RTM_DELROUTE) + _netlink_route_nl_add_gateway_info (rtmsg->rtm_family, AF_INET, nlmsg, + req_size, bytelen, nexthop); if (cmd == RTM_NEWROUTE) { From 4d760f42552b8d8abe5280f049477649a054dcdd Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Wed, 25 Jan 2017 11:55:02 -0800 Subject: [PATCH 50/64] tools: Silly typo in regex for catching ip route syntax Ticket: CM-14600 Reviewed By: CCR-5615 Testing Done: Verifying the issue with/without the fix I had intended the regexp to catch both ip and ipv6 routes, but somewhere along the way, I left out the grouping in the regexp to catch if it was ip or ipv6 at the start. This caused all the rest of the matches and replaces to be off causing the issue reported by the bug. Signed-off-by: Dinesh Dutt --- tools/frr-reload.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index f6ddd35f66..1cad55ac34 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -181,16 +181,16 @@ class Config(object): 11.1.1.0/24. Ensure we don't do a needless operation for such lines. IS-IS & OSPFv3 have no "network" support. ''' - re_key_rt = re.match(r'ip\s+route\s+([A-Fa-f:.0-9/]+)(.*)$', key[0]) + re_key_rt = re.match(r'(ip|ipv6)\s+route\s+([A-Fa-f:.0-9/]+)(.*)$', key[0]) if re_key_rt: addr = re_key_rt.group(2) if '/' in addr: try: newaddr = IPNetwork(addr) - key[0] = 'ip %s %s/%s%s' % (re_key_rt.group(1), - newaddr.network, - newaddr.prefixlen, - re_key_rt.group(3)) + key[0] = '%s route %s/%s%s' % (re_key_rt.group(1), + newaddr.network, + newaddr.prefixlen, + re_key_rt.group(3)) except ValueError: pass From 8017695fa957af91d555eb1e59bc5f775cf29a37 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Thu, 26 Jan 2017 12:49:00 -0800 Subject: [PATCH 51/64] zebra: pass correct parameters to remove static routes with tags Problem found in testing where certain "no ip route ... tag x" commands would fail. This was due to a change in tag processing where the tag value is validated and previously some of the parameters were passed incorrectly. This caused the validation to fail. This change ensures the correct parameters are passed for evaluation as tags. Manual testing completed and the previously failing test now passes. bgp and ospf smoke tests will also be performed before pushing. Ticket: CM-14605 Signed-off-by: Don Slice Reviewed-by: CCR-5627 --- zebra/zebra_vty.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 5088198624..40bf0eac78 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -791,7 +791,7 @@ ALIAS (no_ip_route, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") -ALIAS (no_ip_route_tag, +DEFUN (no_ip_route_flags_tag, no_ip_route_flags_tag_cmd, "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>", NO_STR @@ -804,6 +804,10 @@ ALIAS (no_ip_route_tag, "Silently discard pkts when matched\n" "Tag of this route\n" "Tag value\n") +{ + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], + NULL, NULL, NULL); +} DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, @@ -831,7 +835,7 @@ DEFUN (no_ip_route_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, argv[1], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, argv[2], NULL, NULL, NULL); } @@ -882,7 +886,7 @@ ALIAS (no_ip_route_mask, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") -ALIAS (no_ip_route_mask_tag, +DEFUN (no_ip_route_mask_flags_tag, no_ip_route_mask_flags_tag_cmd, "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>", NO_STR @@ -896,6 +900,10 @@ ALIAS (no_ip_route_mask_tag, "Silently discard pkts when matched\n" "Tag of this route\n" "Tag value\n") +{ + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[4], + NULL, NULL, NULL); +} DEFUN (no_ip_route_mask_flags2, no_ip_route_mask_flags2_cmd, @@ -925,7 +933,7 @@ DEFUN (no_ip_route_mask_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, argv[3], NULL, NULL, NULL); } From 104665b17188cc3bd2c290e72fddfcd0e80dc81b Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 28 Jan 2017 18:57:28 -0500 Subject: [PATCH 52/64] bgpd rfapi: only auto add default tunnel type for local registrations Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index ebd369f3ac..e32b407ba2 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -753,10 +753,11 @@ add_vnc_route ( bgp, un_addr, &rfd->default_tunneltype_option, &attr, l2o != NULL); } - else - TunnelType = rfapi_tunneltype_option_to_tlv ( - bgp, un_addr, NULL, - /* create one to carry un_addr */ &attr, l2o != NULL); + else /* create default for local addse */ + if (type == ZEBRA_ROUTE_BGP && sub_type == BGP_ROUTE_RFP) + TunnelType = + rfapi_tunneltype_option_to_tlv (bgp, un_addr, NULL, + &attr, l2o != NULL); } if (TunnelType == BGP_ENCAP_TYPE_MPLS) From f191d4fa6eb352c454038154053e8443ded4ac46 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 28 Jan 2017 19:21:03 -0500 Subject: [PATCH 53/64] bgpd rfapi: pass received label on resolved NVE imports Signed-off-by: Lou Berger --- bgpd/rfapi/vnc_import_bgp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 4801e2906a..867c27fc63 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -464,6 +464,7 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi ( uint32_t lifetime; uint32_t *plifetime; struct bgp_attr_encap_subtlv *encaptlvs; + uint32_t label = 0; vnc_zlog_debug_verbose ("%s: entry", __func__); @@ -519,6 +520,9 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi ( if (bi->attr && bi->attr->extra && bi->attr->extra->ecommunity) ecommunity_merge (new_ecom, bi->attr->extra->ecommunity); + if (bi->extra) + label = decode_label (bi->extra->tag); + add_vnc_route ( &vncHDResolveNve, bgp, @@ -533,7 +537,7 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi ( NULL, new_ecom, med, /* NULL => don't set med */ - NULL, /* label: default */ + (label?&label:NULL), /* NULL= default */ ZEBRA_ROUTE_BGP_DIRECT, BGP_ROUTE_REDISTRIBUTE, RFAPI_AHR_RFPOPT_IS_VNCTLV); /* flags */ From 144b5c111f8a1e844d5adbe9fe366d12be1d54ee Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 29 Jan 2017 08:15:23 -0500 Subject: [PATCH 54/64] bgpd rfapi: fix UN address in show with MPLS TT Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi_vty.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 1118cfd76f..0a5ee9428d 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1174,16 +1174,18 @@ rfapiPrintRemoteRegBi ( inet_ntop (pfx_un.family, &pfx_un.u.prefix, buf_ntop, BUFSIZ)); } - buf_un[BUFSIZ - 1] = 0; rfapiGetTunnelType(bi->attr,&tun_type); /* * VN addr */ buf_vn[0] = 0; + rfapiNexthop2Prefix (bi->attr, &pfx_vn); if (tun_type == BGP_ENCAP_TYPE_MPLS) { /* MPLS carries un in nrli next hop (same as vn for IP tunnels) */ + snprintf (buf_un, BUFSIZ, "%s", + inet_ntop (pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ)); if (bi->extra) { u_int32_t l = decode_label (bi->extra->tag); @@ -1196,13 +1198,12 @@ rfapiPrintRemoteRegBi ( } else { - rfapiNexthop2Prefix (bi->attr, &pfx_vn); snprintf (buf_vn, BUFSIZ, "%s", inet_ntop (pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ)); } buf_vn[BUFSIZ - 1] = 0; + buf_un[BUFSIZ - 1] = 0; - /* * Cost is encoded in local_pref as (255-cost) * See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion From 3cb50bf1ee8fe08a36f702c61c6b911fe0c0e6a8 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 31 Jan 2017 13:51:27 +0100 Subject: [PATCH 55/64] Revert "*: Add source of route as protocol string in ip route pushed into kernel" This reverts commit 1a11782c408a60afb464fe232fc2e3fa1e298436. The change is not suitable for stable/2.0, it's not a bugfix and has quite a visible user impact. Signed-off-by: David Lamparter Acked-by: Donald Sharp --- cumulus/etc/iproute2/rt_protos.d/frr.conf | 8 ---- debian/frr.dirs | 1 - tools/frr | 9 +---- zebra/kernel_netlink.c | 5 --- zebra/rt_netlink.c | 49 ++--------------------- zebra/rt_netlink.h | 8 ---- 6 files changed, 5 insertions(+), 75 deletions(-) delete mode 100644 cumulus/etc/iproute2/rt_protos.d/frr.conf diff --git a/cumulus/etc/iproute2/rt_protos.d/frr.conf b/cumulus/etc/iproute2/rt_protos.d/frr.conf deleted file mode 100644 index 883782e4dd..0000000000 --- a/cumulus/etc/iproute2/rt_protos.d/frr.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Additional protocol strings defined by quagga for each of its daemons - -186 bgp -187 isis -188 ospf -189 rip -190 ripng -191 static diff --git a/debian/frr.dirs b/debian/frr.dirs index 56699b2daa..58290080d0 100644 --- a/debian/frr.dirs +++ b/debian/frr.dirs @@ -1,6 +1,5 @@ etc/logrotate.d/ etc/frr/ -etc/iproute2/rt_protos.d/ usr/share/doc/frr/ usr/share/doc/frr/examples/ usr/share/lintian/overrides/ diff --git a/tools/frr b/tools/frr index a6d99feaf6..2ecaadbb53 100755 --- a/tools/frr +++ b/tools/frr @@ -532,15 +532,8 @@ case "$1" in fi if [ -z "$dmn" -o "$dmn" = "zebra" ]; then - echo "Removing all routes made by quagga." - ip route flush proto bgp - ip route flush proto ospf - ip route flush proto static - ip route flush proto rip - ip route flush proto ripng + echo "Removing all routes made by zebra." ip route flush proto zebra - ip route flush proto isis - else [ -n "$dmn" ] && eval "${dmn/-/_}=0" start_watchfrr diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 20cb62e318..9f9a62f384 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -91,11 +91,6 @@ static const struct message rtproto_str[] = { #ifdef RTPROT_BIRD {RTPROT_BIRD, "BIRD"}, #endif /* RTPROT_BIRD */ - {RTPROT_BGP, "BGP"}, - {RTPROT_OSPF, "OSPF"}, - {RTPROT_ISIS, "IS-IS"}, - {RTPROT_RIP, "RIP"}, - {RTPROT_RIPNG, "RIPNG"}, {0, NULL} }; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 5d1ef26487..4913aa878f 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -92,47 +92,6 @@ struct gw_family_t union g_addr gate; }; -static inline int is_selfroute(int proto) -{ - if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) || - (proto == RTPROT_STATIC) || (proto == RTPROT_ZEBRA) || - (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG)) { - return 1; - } - - return 0; -} - -static inline int get_rt_proto(int proto) -{ - switch (proto) { - case ZEBRA_ROUTE_BGP: - proto = RTPROT_BGP; - break; - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - proto = RTPROT_OSPF; - break; - case ZEBRA_ROUTE_STATIC: - proto = RTPROT_STATIC; - break; - case ZEBRA_ROUTE_ISIS: - proto = RTPROT_ISIS; - break; - case ZEBRA_ROUTE_RIP: - proto = RTPROT_RIP; - break; - case ZEBRA_ROUTE_RIPNG: - proto = RTPROT_RIPNG; - break; - default: - proto = RTPROT_ZEBRA; - break; - } - - return proto; -} - /* Pending: create an efficient table_id (in a tree/hash) based lookup) */ @@ -222,7 +181,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h, } /* Route which inserted by Zebra. */ - if (is_selfroute(rtm->rtm_protocol)) + if (rtm->rtm_protocol == RTPROT_ZEBRA) flags |= ZEBRA_FLAG_SELFROUTE; index = 0; @@ -408,9 +367,9 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (rtm->rtm_protocol == RTPROT_KERNEL) return 0; - if (is_selfroute(rtm->rtm_protocol) && h->nlmsg_type == RTM_NEWROUTE) + if (rtm->rtm_protocol == RTPROT_ZEBRA && h->nlmsg_type == RTM_NEWROUTE) return 0; - if (is_selfroute(rtm->rtm_protocol)) + if (rtm->rtm_protocol == RTPROT_ZEBRA) SET_FLAG(zebra_flags, ZEBRA_FLAG_SELFROUTE); if (rtm->rtm_src_len != 0) @@ -1194,7 +1153,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, req.n.nlmsg_type = cmd; req.r.rtm_family = family; req.r.rtm_dst_len = p->prefixlen; - req.r.rtm_protocol = get_rt_proto(rib->type); + req.r.rtm_protocol = RTPROT_ZEBRA; req.r.rtm_scope = RT_SCOPE_UNIVERSE; if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT)) diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index d1f01bda4c..7183525fba 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -28,14 +28,6 @@ #define NL_DEFAULT_ROUTE_METRIC 20 -/* Additional protocol strings to push into routes */ -#define RTPROT_BGP 186 -#define RTPROT_ISIS 187 -#define RTPROT_OSPF 188 -#define RTPROT_RIP 189 -#define RTPROT_RIPNG 190 - - extern void clear_nhlfe_installed (zebra_lsp_t *lsp); extern int From 0de64cbbd3413038818586af733b115cddca6b83 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 31 Jan 2017 16:10:25 +0100 Subject: [PATCH 56/64] isisd: parse TE-IP reachability and IPv6 reachability subtlvs Signed-off-by: Christian Franke --- isisd/isis_tlv.c | 56 ++++++++++++++++++++++++++++++++++++++++++------ isisd/isis_tlv.h | 2 +- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index 1d29d78287..b19a181a3f 100644 --- a/isisd/isis_tlv.c +++ b/isisd/isis_tlv.c @@ -614,12 +614,32 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, if (!tlvs->te_ipv4_reachs) tlvs->te_ipv4_reachs = list_new (); listnode_add (tlvs->te_ipv4_reachs, te_ipv4_reach); - /* this trickery is permitable since no subtlvs are defined */ - value_len += 5 + ((te_ipv4_reach->control & 0x3F) ? - ((((te_ipv4_reach->control & 0x3F) - - 1) >> 3) + 1) : 0); - pnt += 5 + ((te_ipv4_reach->control & 0x3F) ? - ((((te_ipv4_reach->control & 0x3F) - 1) >> 3) + 1) : 0); + + /* Metric + Control-Byte + Prefix */ + unsigned int entry_len = 5 + PSIZE(te_ipv4_reach->control & 0x3F); + value_len += entry_len; + pnt += entry_len; + + if (te_ipv4_reach->control & TE_IPV4_HAS_SUBTLV) + { + if (length <= value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv4 extended reachability SubTLV missing", + areatag); + retval = ISIS_WARNING; + break; + } + u_char subtlv_len = *pnt; + value_len += subtlv_len + 1; + pnt += subtlv_len + 1; + if (length < value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv4 extended reachability SubTLVs have oversize", + areatag); + retval = ISIS_WARNING; + break; + } + } } } @@ -687,6 +707,27 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, prefix_octets = ((ipv6_reach->prefix_len + 7) / 8); value_len += prefix_octets + 6; pnt += prefix_octets + 6; + + if (ipv6_reach->control_info & CTRL_INFO_SUBTLVS) + { + if (length <= value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv6 extended reachability SubTLV missing", + areatag); + retval = ISIS_WARNING; + break; + } + u_char subtlv_len = *pnt; + value_len += subtlv_len + 1; + pnt += subtlv_len + 1; + if (length < value_len) + { + zlog_warn("ISIS-TLV (%s): invalid IPv6 extended reachability SubTLVs have oversize", + areatag); + retval = ISIS_WARNING; + break; + } + } /* FIXME: sub-tlvs */ if (!tlvs->ipv6_reachs) tlvs->ipv6_reachs = list_new (); @@ -758,6 +799,9 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, pnt += length; break; } + /* Abort Parsing if error occured */ + if (retval != ISIS_OK) + return retval; } return retval; diff --git a/isisd/isis_tlv.h b/isisd/isis_tlv.h index 5a39d564dc..27ded7a0e8 100644 --- a/isisd/isis_tlv.h +++ b/isisd/isis_tlv.h @@ -223,7 +223,7 @@ struct te_ipv4_reachability u_char prefix_start; /* since this is variable length by nature it only */ }; /* points to an approximate location */ - +#define TE_IPV4_HAS_SUBTLV (0x40) struct idrp_info { From bc818608f1d95dcc775a4fb1861f43e734d79f09 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 31 Jan 2017 16:42:47 -0500 Subject: [PATCH 57/64] bgp rfapi: fix resolution / lookup failure when using MPLS TT Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi_import.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 4d35af2641..adb54fd0e1 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -421,9 +421,16 @@ rfapiGetVncTunnelUnAddr (struct attr *attr, struct prefix *p) bgp_encap_types tun_type; rfapiGetTunnelType (attr, &tun_type); - if (p && tun_type == BGP_ENCAP_TYPE_MPLS) + if (tun_type == BGP_ENCAP_TYPE_MPLS) { - return ENOENT; /* no UN for MPLS */ + if (!p) + return 0; + /* MPLS carries UN address in next hop */ + rfapiNexthop2Prefix (attr, p); + if (p->family != 0) + return 0; + + return ENOENT; } if (attr && attr->extra) { From ff1c42fb9fc6c7f33657a06d26b3722a5bc86c07 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 1 Feb 2017 13:12:16 +0100 Subject: [PATCH 58/64] *: fix warning fallout from set_socket_path Signed-off-by: David Lamparter --- bgpd/bgp_main.c | 1 + isisd/isis_main.c | 2 +- ldpd/ldpd.c | 2 +- lib/sockopt.c | 4 ++-- lib/sockopt.h | 3 ++- ospf6d/ospf6_main.c | 2 +- ospfd/ospf_main.c | 2 +- pimd/pim_main.c | 2 +- ripd/rip_main.c | 2 +- ripngd/ripng_main.c | 2 +- vtysh/vtysh_main.c | 2 +- zebra/main.c | 2 +- 12 files changed, 14 insertions(+), 12 deletions(-) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index e6f5cdcb67..ba59365a6e 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -40,6 +40,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "queue.h" #include "vrf.h" #include "bfd.h" +#include "sockopt.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 865f5c5f94..1b9fa68051 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -38,6 +38,7 @@ #include "plist.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "qobj.h" #include "isisd/dict.h" @@ -246,7 +247,6 @@ main (int argc, char **argv, char **envp) struct thread thread; char *config_file = NULL; char *vty_addr = NULL; - char *vty_sock_name; int dryrun = 0; /* Get the programname without the preceding path. */ diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 40726ba0bb..927af682a1 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -39,6 +39,7 @@ #include "sigevent.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "qobj.h" static void ldpd_shutdown(void); @@ -224,7 +225,6 @@ main(int argc, char *argv[]) char *p; char *vty_addr = NULL; int vty_port = LDP_VTY_PORT; - char *vty_sock_name; char *ctl_sock_custom_path = NULL; char *ctl_sock_name; int daemon_mode = 0; diff --git a/lib/sockopt.c b/lib/sockopt.c index 570b575a7a..e661b4cc56 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -31,9 +31,9 @@ /* Replace the path of given defaultpath with newpath, but keep filename */ void -set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize) +set_socket_path (char *path, const char *defaultpath, char *newpath, int maxsize) { - char *sock_name; + const char *sock_name; sock_name = strrchr(defaultpath, '/'); if (sock_name) diff --git a/lib/sockopt.h b/lib/sockopt.h index 8e7895dd6f..7e1bd62446 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -25,7 +25,8 @@ #include "sockunion.h" /* Override (vty) socket paths, but keep the filename */ -extern void set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize); +extern void set_socket_path (char *path, const char *defaultpath, + char *newpath, int maxsize); extern void setsockopt_so_recvbuf (int sock, int size); extern void setsockopt_so_sendbuf (const int sock, int size); diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 68d2b6894d..f85580fa59 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -39,6 +39,7 @@ #include "zclient.h" #include "vrf.h" #include "bfd.h" +#include "sockopt.h" #include "ospf6d.h" #include "ospf6_top.h" @@ -239,7 +240,6 @@ main (int argc, char *argv[], char *envp[]) int opt; char *vty_addr = NULL; int vty_port = 0; - char *vty_sock_name; char *config_file = NULL; struct thread thread; int dryrun = 0; diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 6719eb2497..845d96032b 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -41,6 +41,7 @@ #include "sigevent.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" @@ -194,7 +195,6 @@ main (int argc, char **argv) char *vty_addr = NULL; int vty_port = OSPF_VTY_PORT; char vty_path[100]; - char *vty_sock_name; int daemon_mode = 0; char *config_file = NULL; char *progname; diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 1a3c8165e4..e4aa2de594 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -38,6 +38,7 @@ #include "prefix.h" #include "plist.h" #include "vrf.h" +#include "sockopt.h" #include "pimd.h" #include "pim_version.h" @@ -133,7 +134,6 @@ Report bugs to %s\n", progname, PIMD_BUG_ADDRESS); int main(int argc, char** argv, char** envp) { char *p; char *vty_addr = NULL; - char *vty_sock_name; int vty_port = -1; int daemon_mode = 0; char *config_file = NULL; diff --git a/ripd/rip_main.c b/ripd/rip_main.c index e46f867952..58dd2df6fa 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -35,6 +35,7 @@ #include "sigevent.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "ripd/ripd.h" @@ -201,7 +202,6 @@ main (int argc, char **argv) int dryrun = 0; char *progname; struct thread thread; - char *vty_sock_name; /* Set umask before anything for security */ umask (0027); diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 1677996eaa..a90dffce14 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -36,6 +36,7 @@ #include "privs.h" #include "sigevent.h" #include "vrf.h" +#include "sockopt.h" #include "ripngd/ripngd.h" @@ -201,7 +202,6 @@ main (int argc, char **argv) char *progname; struct thread thread; int dryrun = 0; - char *vty_sock_name; /* Set umask before anything for security */ umask (0027); diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index bad21ae661..78b17be058 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -272,7 +272,7 @@ main (int argc, char **argv, char **env) int boot_flag = 0; const char *daemon_name = NULL; const char *inputfile = NULL; - char *vtysh_configfile_name; + const char *vtysh_configfile_name; struct cmd_rec { const char *line; struct cmd_rec *next; diff --git a/zebra/main.c b/zebra/main.c index aa1cbc3b26..a68e8adeb6 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -35,6 +35,7 @@ #include "privs.h" #include "sigevent.h" #include "vrf.h" +#include "sockopt.h" #include "zebra/rib.h" #include "zebra/zserv.h" @@ -265,7 +266,6 @@ main (int argc, char **argv) char *p; char *vty_addr = NULL; int vty_port = ZEBRA_VTY_PORT; - char *vty_sock_name; int dryrun = 0; int batch_mode = 0; int daemon_mode = 0; From b5a8526b1328f801edd9558825e5b025e54e503f Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 23 Jan 2017 23:32:01 +0100 Subject: [PATCH 59/64] zebra: fpm: fix --enable-dev-build I guess no one uses --enable-dev-build... Signed-off-by: David Lamparter --- zebra/zebra_fpm_dt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zebra/zebra_fpm_dt.c b/zebra/zebra_fpm_dt.c index bd171c89b2..715e250a66 100644 --- a/zebra/zebra_fpm_dt.c +++ b/zebra/zebra_fpm_dt.c @@ -42,6 +42,8 @@ #include "vrf.h" #include "zebra/rib.h" +#include "zebra/zserv.h" +#include "zebra/zebra_vrf.h" #include "zebra_fpm_private.h" From 98645ada192f0e359bda8eff4656827443edda39 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 1 Feb 2017 13:21:40 +0100 Subject: [PATCH 60/64] lib: plug leak in prefix_list_delete() prefix_list_delete wasn't releasing chained trie entries, only the main one. Just call the proper trie_del. Signed-off-by: David Lamparter --- lib/plist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/plist.c b/lib/plist.c index 2b93d880f6..6f19565688 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -328,6 +328,9 @@ prefix_list_get (afi_t afi, int orf, const char *name) return plist; } +static void prefix_list_trie_del (struct prefix_list *plist, + struct prefix_list_entry *pentry); + /* Delete prefix-list from prefix_list_master and free it. */ static void prefix_list_delete (struct prefix_list *plist) @@ -341,6 +344,7 @@ prefix_list_delete (struct prefix_list *plist) for (pentry = plist->head; pentry; pentry = next) { next = pentry->next; + prefix_list_trie_del (plist, pentry); prefix_list_entry_free (pentry); plist->count--; } From b8438f6d0c3cb9282103216e92aba5673e04170f Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 1 Feb 2017 13:39:26 +0100 Subject: [PATCH 61/64] bgpd: clean up dump config at exit Signed-off-by: David Lamparter --- bgpd/bgp_dump.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 7a4d4e701f..a8c9dad843 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -91,7 +91,7 @@ struct bgp_dump struct thread *t_interval; }; -static int bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump); +static int bgp_dump_unset (struct bgp_dump *bgp_dump); static int bgp_dump_interval_func (struct thread *); /* BGP packet dump output buffer. */ @@ -661,7 +661,7 @@ bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, } /* Removing previous config */ - bgp_dump_unset(vty, bgp_dump); + bgp_dump_unset(bgp_dump); if (interval_str) { @@ -700,7 +700,7 @@ bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, } static int -bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump) +bgp_dump_unset (struct bgp_dump *bgp_dump) { /* Removing file name. */ if (bgp_dump->filename) @@ -815,7 +815,7 @@ DEFUN (no_dump_bgp_all, break; } - return bgp_dump_unset (vty, bgp_dump_struct); + return bgp_dump_unset (bgp_dump_struct); } /* BGP node structure. */ @@ -913,6 +913,10 @@ bgp_dump_init (void) void bgp_dump_finish (void) { + bgp_dump_unset (&bgp_dump_all); + bgp_dump_unset (&bgp_dump_updates); + bgp_dump_unset (&bgp_dump_routes); + stream_free (bgp_dump_obuf); bgp_dump_obuf = NULL; } From 46857efe0d453410a829f773c1be3fc91ec8f34d Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 1 Feb 2017 13:40:00 +0100 Subject: [PATCH 62/64] bgpd: clear bgp_master at exit to help valgrind bgp_master can retain pointers keeping allocated structures "reachable" in valgrind. Clear to 0 to tell valgrind that everything should've been freed really. Signed-off-by: David Lamparter --- bgpd/bgp_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index ba59365a6e..979471dc49 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -310,6 +310,8 @@ bgp_exit (int status) if (zlog_default) closezlog (zlog_default); + memset (bm, 0, sizeof (*bm)); + if (bgp_debug_count()) log_memstats_stderr ("bgpd"); exit (status); From d24736fa17f9970dd58c5e6417bf3a5444011f5e Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 1 Feb 2017 15:33:55 +0100 Subject: [PATCH 63/64] zebra: fix SEGV on exit or vrf delete table->info must be free'd last, it's used in rib_unlink(). Signed-off-by: David Lamparter --- zebra/zebra_vrf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index b1c5e4dd35..4715f6e12c 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -217,6 +217,7 @@ zebra_vrf_delete (struct vrf *vrf) { struct zebra_vrf *zvrf = vrf->info; struct route_table *table; + rib_table_info_t *info; u_int32_t table_id; afi_t afi; safi_t safi; @@ -273,8 +274,9 @@ zebra_vrf_delete (struct vrf *vrf) for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) { table = zvrf->table[afi][safi]; - XFREE (MTYPE_RIB_TABLE_INFO, table->info); + info = table->info; route_table_finish (table); + XFREE (MTYPE_RIB_TABLE_INFO, info); table = zvrf->stable[afi][safi]; route_table_finish (table); @@ -284,8 +286,9 @@ zebra_vrf_delete (struct vrf *vrf) if (zvrf->other_table[afi][table_id]) { table = zvrf->other_table[afi][table_id]; - XFREE (MTYPE_RIB_TABLE_INFO, table->info); + info = table->info; route_table_finish (table); + XFREE (MTYPE_RIB_TABLE_INFO, info); } route_table_finish (zvrf->rnh_table[afi]); From 63f6bb813fa9d4dd6b149623c5d8436282ce3300 Mon Sep 17 00:00:00 2001 From: "G. Paul Ziemba" Date: Wed, 1 Feb 2017 16:13:33 -0800 Subject: [PATCH 64/64] bgpd rfapi: RR replated (Issue #91) treat filtered update as implicit withdraw for rfapi Signed-off-by: G. Paul Ziemba --- bgpd/bgp_route.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 1db68e7195..29953cae02 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2835,6 +2835,17 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, bgp_unlock_node (rn); +#if ENABLE_BGP_VNC + /* + * Filtered update is treated as an implicit withdrawal (see bgp_rib_remove() + * a few lines above) + */ + if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi)) + { + rfapiProcessWithdraw(peer, NULL, p, prd, NULL, afi, safi, type, 0); + } +#endif + return 0; }