diff options
-rw-r--r-- | bgpd/ChangeLog | 17 | ||||
-rw-r--r-- | bgpd/bgp_routemap.c | 5 | ||||
-rw-r--r-- | bgpd/bgp_table.c | 13 | ||||
-rw-r--r-- | bgpd/bgp_table.h | 3 | ||||
-rw-r--r-- | bgpd/bgp_vty.c | 96 | ||||
-rw-r--r-- | bgpd/bgpd.c | 4 | ||||
-rw-r--r-- | solaris/ChangeLog | 10 | ||||
-rwxr-xr-x | solaris/quagga.init.in | 193 | ||||
-rw-r--r-- | solaris/quagga.xml.in | 510 | ||||
-rw-r--r-- | vtysh/ChangeLog | 10 | ||||
-rwxr-xr-x | vtysh/extract.pl.in | 4 | ||||
-rw-r--r-- | vtysh/vtysh.c | 14 | ||||
-rw-r--r-- | zebra/ChangeLog | 9 | ||||
-rw-r--r-- | zebra/ioctl.c | 37 |
14 files changed, 696 insertions, 229 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 2da28213..d6e02036 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,20 @@ +2008-07-02 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * *.c: CMD_AS_RANGE was being used inside command strings, and thus + not being expanded, fix by dequoting. + +2008-07-02 Stephen Hemminger <stephen.hemminger@vyatta.com> + + * bgp_table.{c,h}: (bgp_table_finish) Take a double pointer and + scrub pointer in caller, so fixing double-free crashes seen + with route-server-client configuration. + * *.c: Adjust all callers of bgp_table_finish + +2008-07-02 Paul Jakma <paul.jakma@sun.com> + + * bgp_table.{c,h}: (bgp_node_delete, bgp_table_free) shouldn't be + exported. + 2008-06-07 Paul Jakma <paul@jakma.org> * bgp_attr.{c,h}: (bgp_mp_{un,}reach_parse) export, for unit tests. diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index b93b2682..78ad3f08 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -47,6 +47,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_filter.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_ecommunity.h" +#include "bgpd/bgp_vty.h" /* Memo of route-map commands. @@ -3451,7 +3452,7 @@ DEFUN (no_set_atomic_aggregate, DEFUN (set_aggregator_as, set_aggregator_as_cmd, - "set aggregator as CMD_AS_RANGE A.B.C.D", + "set aggregator as " CMD_AS_RANGE " A.B.C.D", SET_STR "BGP aggregator attribute\n" "AS number of aggregator\n" @@ -3523,7 +3524,7 @@ DEFUN (no_set_aggregator_as, ALIAS (no_set_aggregator_as, no_set_aggregator_as_val_cmd, - "no set aggregator as CMD_AS_RANGE A.B.C.D", + "no set aggregator as " CMD_AS_RANGE " A.B.C.D", NO_STR SET_STR "BGP aggregator attribute\n" diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 810dab54..be598328 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -28,8 +28,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" -void bgp_node_delete (struct bgp_node *); -void bgp_table_free (struct bgp_table *); +static void bgp_node_delete (struct bgp_node *); +static void bgp_table_free (struct bgp_table *); struct bgp_table * bgp_table_init (afi_t afi, safi_t safi) @@ -47,9 +47,10 @@ bgp_table_init (afi_t afi, safi_t safi) } void -bgp_table_finish (struct bgp_table *rt) +bgp_table_finish (struct bgp_table **rt) { - bgp_table_free (rt); + bgp_table_free (*rt); + *rt = NULL; } static struct bgp_node * @@ -84,7 +85,7 @@ bgp_node_free (struct bgp_node *node) } /* Free route table. */ -void +static void bgp_table_free (struct bgp_table *rt) { struct bgp_node *tmp_node; @@ -360,7 +361,7 @@ bgp_node_get (struct bgp_table *table, struct prefix *p) } /* Delete node from the routing table. */ -void +static void bgp_node_delete (struct bgp_node *node) { struct bgp_node *child; diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 62421e71..0387c247 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -68,9 +68,8 @@ struct bgp_node }; extern struct bgp_table *bgp_table_init (afi_t, safi_t); -extern void bgp_table_finish (struct bgp_table *); +extern void bgp_table_finish (struct bgp_table **); extern void bgp_unlock_node (struct bgp_node *node); -extern void bgp_node_delete (struct bgp_node *node); extern struct bgp_node *bgp_table_top (struct bgp_table *); extern struct bgp_node *bgp_route_next (struct bgp_node *); extern struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 927e99a1..7a7b3fdf 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -308,7 +308,7 @@ DEFUN_DEPRECATED (neighbor_version, /* "router bgp" commands. */ DEFUN (router_bgp, router_bgp_cmd, - "router bgp CMD_AS_RANGE", + "router bgp " CMD_AS_RANGE, ROUTER_STR BGP_STR AS_STR) @@ -348,7 +348,7 @@ DEFUN (router_bgp, ALIAS (router_bgp, router_bgp_view_cmd, - "router bgp CMD_AS_RANGE view WORD", + "router bgp " CMD_AS_RANGE " view WORD", ROUTER_STR BGP_STR AS_STR @@ -358,7 +358,7 @@ ALIAS (router_bgp, /* "no router bgp" commands. */ DEFUN (no_router_bgp, no_router_bgp_cmd, - "no router bgp CMD_AS_RANGE", + "no router bgp " CMD_AS_RANGE, NO_STR ROUTER_STR BGP_STR @@ -388,7 +388,7 @@ DEFUN (no_router_bgp, ALIAS (no_router_bgp, no_router_bgp_view_cmd, - "no router bgp CMD_AS_RANGE view WORD", + "no router bgp " CMD_AS_RANGE " view WORD", NO_STR ROUTER_STR BGP_STR @@ -539,7 +539,7 @@ ALIAS (no_bgp_cluster_id, DEFUN (bgp_confederation_identifier, bgp_confederation_identifier_cmd, - "bgp confederation identifier CMD_AS_RANGE", + "bgp confederation identifier " CMD_AS_RANGE, "BGP specific commands\n" "AS confederation parameters\n" "AS number\n" @@ -580,7 +580,7 @@ DEFUN (no_bgp_confederation_identifier, ALIAS (no_bgp_confederation_identifier, no_bgp_confederation_identifier_arg_cmd, - "no bgp confederation identifier CMD_AS_RANGE", + "no bgp confederation identifier " CMD_AS_RANGE, NO_STR "BGP specific commands\n" "AS confederation parameters\n" @@ -589,7 +589,7 @@ ALIAS (no_bgp_confederation_identifier, DEFUN (bgp_confederation_peers, bgp_confederation_peers_cmd, - "bgp confederation peers .CMD_AS_RANGE", + "bgp confederation peers ." CMD_AS_RANGE, "BGP specific commands\n" "AS confederation parameters\n" "Peer ASs in BGP confederation\n" @@ -619,7 +619,7 @@ DEFUN (bgp_confederation_peers, DEFUN (no_bgp_confederation_peers, no_bgp_confederation_peers_cmd, - "no bgp confederation peers .CMD_AS_RANGE", + "no bgp confederation peers ." CMD_AS_RANGE, NO_STR "BGP specific commands\n" "AS confederation parameters\n" @@ -1288,7 +1288,7 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, DEFUN (neighbor_remote_as, neighbor_remote_as_cmd, - NEIGHBOR_CMD2 "remote-as CMD_AS_RANGE", + NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" @@ -1352,7 +1352,7 @@ DEFUN (no_neighbor, ALIAS (no_neighbor, no_neighbor_remote_as_cmd, - NO_NEIGHBOR_CMD "remote-as CMD_AS_RANGE", + NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR @@ -1382,7 +1382,7 @@ DEFUN (no_neighbor_peer_group, DEFUN (no_neighbor_peer_group_remote_as, no_neighbor_peer_group_remote_as_cmd, - "no neighbor WORD remote-as CMD_AS_RANGE", + "no neighbor WORD remote-as " CMD_AS_RANGE, NO_STR NEIGHBOR_STR "Neighbor tag\n" @@ -1404,7 +1404,7 @@ DEFUN (no_neighbor_peer_group_remote_as, DEFUN (neighbor_local_as, neighbor_local_as_cmd, - NEIGHBOR_CMD2 "local-as CMD_AS_RANGE", + NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -1423,7 +1423,7 @@ DEFUN (neighbor_local_as, DEFUN (neighbor_local_as_no_prepend, neighbor_local_as_no_prepend_cmd, - NEIGHBOR_CMD2 "local-as CMD_AS_RANGE no-prepend", + NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -1462,7 +1462,7 @@ DEFUN (no_neighbor_local_as, ALIAS (no_neighbor_local_as, no_neighbor_local_as_val_cmd, - NO_NEIGHBOR_CMD2 "local-as CMD_AS_RANGE", + NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -1471,7 +1471,7 @@ ALIAS (no_neighbor_local_as, ALIAS (no_neighbor_local_as, no_neighbor_local_as_val2_cmd, - NO_NEIGHBOR_CMD2 "local-as CMD_AS_RANGE no-prepend", + NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -2153,7 +2153,7 @@ peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, listnode_delete (bgp->rsclient, peer); } - bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); + bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); return CMD_SUCCESS; } @@ -4322,7 +4322,7 @@ ALIAS (clear_ip_bgp_external, DEFUN (clear_ip_bgp_as, clear_ip_bgp_as_cmd, - "clear ip bgp CMD_AS_RANGE", + "clear ip bgp " CMD_AS_RANGE, CLEAR_STR IP_STR BGP_STR @@ -4333,14 +4333,14 @@ DEFUN (clear_ip_bgp_as, ALIAS (clear_ip_bgp_as, clear_bgp_as_cmd, - "clear bgp CMD_AS_RANGE", + "clear bgp " CMD_AS_RANGE, CLEAR_STR BGP_STR "Clear peers with the AS number\n") ALIAS (clear_ip_bgp_as, clear_bgp_ipv6_as_cmd, - "clear bgp ipv6 CMD_AS_RANGE", + "clear bgp ipv6 " CMD_AS_RANGE, CLEAR_STR BGP_STR "Address family\n" @@ -4852,7 +4852,7 @@ ALIAS (clear_bgp_external_soft_out, DEFUN (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_soft_out_cmd, - "clear ip bgp CMD_AS_RANGE soft out", + "clear ip bgp " CMD_AS_RANGE " soft out", CLEAR_STR IP_STR BGP_STR @@ -4866,7 +4866,7 @@ DEFUN (clear_ip_bgp_as_soft_out, ALIAS (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_out_cmd, - "clear ip bgp CMD_AS_RANGE out", + "clear ip bgp " CMD_AS_RANGE " out", CLEAR_STR IP_STR BGP_STR @@ -4875,7 +4875,7 @@ ALIAS (clear_ip_bgp_as_soft_out, DEFUN (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_soft_out_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) soft out", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", CLEAR_STR IP_STR BGP_STR @@ -4896,7 +4896,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, ALIAS (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_out_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) out", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", CLEAR_STR IP_STR BGP_STR @@ -4908,7 +4908,7 @@ ALIAS (clear_ip_bgp_as_ipv4_soft_out, DEFUN (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_soft_out_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast soft out", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", CLEAR_STR IP_STR BGP_STR @@ -4924,7 +4924,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, ALIAS (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_out_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast out", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", CLEAR_STR IP_STR BGP_STR @@ -4935,7 +4935,7 @@ ALIAS (clear_ip_bgp_as_vpnv4_soft_out, DEFUN (clear_bgp_as_soft_out, clear_bgp_as_soft_out_cmd, - "clear bgp CMD_AS_RANGE soft out", + "clear bgp " CMD_AS_RANGE " soft out", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -4948,7 +4948,7 @@ DEFUN (clear_bgp_as_soft_out, ALIAS (clear_bgp_as_soft_out, clear_bgp_ipv6_as_soft_out_cmd, - "clear bgp ipv6 CMD_AS_RANGE soft out", + "clear bgp ipv6 " CMD_AS_RANGE " soft out", CLEAR_STR BGP_STR "Address family\n" @@ -4958,7 +4958,7 @@ ALIAS (clear_bgp_as_soft_out, ALIAS (clear_bgp_as_soft_out, clear_bgp_as_out_cmd, - "clear bgp CMD_AS_RANGE out", + "clear bgp " CMD_AS_RANGE " out", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -4966,7 +4966,7 @@ ALIAS (clear_bgp_as_soft_out, ALIAS (clear_bgp_as_soft_out, clear_bgp_ipv6_as_out_cmd, - "clear bgp ipv6 CMD_AS_RANGE out", + "clear bgp ipv6 " CMD_AS_RANGE " out", CLEAR_STR BGP_STR "Address family\n" @@ -5756,7 +5756,7 @@ ALIAS (clear_bgp_external_in_prefix_filter, DEFUN (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_soft_in_cmd, - "clear ip bgp CMD_AS_RANGE soft in", + "clear ip bgp " CMD_AS_RANGE " soft in", CLEAR_STR IP_STR BGP_STR @@ -5770,7 +5770,7 @@ DEFUN (clear_ip_bgp_as_soft_in, ALIAS (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_in_cmd, - "clear ip bgp CMD_AS_RANGE in", + "clear ip bgp " CMD_AS_RANGE " in", CLEAR_STR IP_STR BGP_STR @@ -5779,7 +5779,7 @@ ALIAS (clear_ip_bgp_as_soft_in, DEFUN (clear_ip_bgp_as_in_prefix_filter, clear_ip_bgp_as_in_prefix_filter_cmd, - "clear ip bgp CMD_AS_RANGE in prefix-filter", + "clear ip bgp " CMD_AS_RANGE " in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -5793,7 +5793,7 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) soft in", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", CLEAR_STR IP_STR BGP_STR @@ -5814,7 +5814,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, ALIAS (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_in_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) in", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", CLEAR_STR IP_STR BGP_STR @@ -5826,7 +5826,7 @@ ALIAS (clear_ip_bgp_as_ipv4_soft_in, DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -5847,7 +5847,7 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, DEFUN (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_soft_in_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast soft in", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", CLEAR_STR IP_STR BGP_STR @@ -5863,7 +5863,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, ALIAS (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_in_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast in", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", CLEAR_STR IP_STR BGP_STR @@ -5874,7 +5874,7 @@ ALIAS (clear_ip_bgp_as_vpnv4_soft_in, DEFUN (clear_bgp_as_soft_in, clear_bgp_as_soft_in_cmd, - "clear bgp CMD_AS_RANGE soft in", + "clear bgp " CMD_AS_RANGE " soft in", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5887,7 +5887,7 @@ DEFUN (clear_bgp_as_soft_in, ALIAS (clear_bgp_as_soft_in, clear_bgp_ipv6_as_soft_in_cmd, - "clear bgp ipv6 CMD_AS_RANGE soft in", + "clear bgp ipv6 " CMD_AS_RANGE " soft in", CLEAR_STR BGP_STR "Address family\n" @@ -5897,7 +5897,7 @@ ALIAS (clear_bgp_as_soft_in, ALIAS (clear_bgp_as_soft_in, clear_bgp_as_in_cmd, - "clear bgp CMD_AS_RANGE in", + "clear bgp " CMD_AS_RANGE " in", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5905,7 +5905,7 @@ ALIAS (clear_bgp_as_soft_in, ALIAS (clear_bgp_as_soft_in, clear_bgp_ipv6_as_in_cmd, - "clear bgp ipv6 CMD_AS_RANGE in", + "clear bgp ipv6 " CMD_AS_RANGE " in", CLEAR_STR BGP_STR "Address family\n" @@ -5914,7 +5914,7 @@ ALIAS (clear_bgp_as_soft_in, DEFUN (clear_bgp_as_in_prefix_filter, clear_bgp_as_in_prefix_filter_cmd, - "clear bgp CMD_AS_RANGE in prefix-filter", + "clear bgp " CMD_AS_RANGE " in prefix-filter", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5927,7 +5927,7 @@ DEFUN (clear_bgp_as_in_prefix_filter, ALIAS (clear_bgp_as_in_prefix_filter, clear_bgp_ipv6_as_in_prefix_filter_cmd, - "clear bgp ipv6 CMD_AS_RANGE in prefix-filter", + "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", CLEAR_STR BGP_STR "Address family\n" @@ -6242,7 +6242,7 @@ ALIAS (clear_bgp_external_soft, DEFUN (clear_ip_bgp_as_soft, clear_ip_bgp_as_soft_cmd, - "clear ip bgp CMD_AS_RANGE soft", + "clear ip bgp " CMD_AS_RANGE " soft", CLEAR_STR IP_STR BGP_STR @@ -6255,7 +6255,7 @@ DEFUN (clear_ip_bgp_as_soft, DEFUN (clear_ip_bgp_as_ipv4_soft, clear_ip_bgp_as_ipv4_soft_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) soft", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", CLEAR_STR IP_STR BGP_STR @@ -6275,7 +6275,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft, DEFUN (clear_ip_bgp_as_vpnv4_soft, clear_ip_bgp_as_vpnv4_soft_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast soft", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", CLEAR_STR IP_STR BGP_STR @@ -6290,7 +6290,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft, DEFUN (clear_bgp_as_soft, clear_bgp_as_soft_cmd, - "clear bgp CMD_AS_RANGE soft", + "clear bgp " CMD_AS_RANGE " soft", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -6302,7 +6302,7 @@ DEFUN (clear_bgp_as_soft, ALIAS (clear_bgp_as_soft, clear_bgp_ipv6_as_soft_cmd, - "clear bgp ipv6 CMD_AS_RANGE soft", + "clear bgp ipv6 " CMD_AS_RANGE " soft", CLEAR_STR BGP_STR "Address family\n" diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 374c4c52..4dc6621d 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1228,7 +1228,7 @@ peer_delete (struct peer *peer) for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) if (peer->rib[afi][safi] && ! peer->af_group[afi][safi]) - bgp_table_finish (peer->rib[afi][safi]); + bgp_table_finish (&peer->rib[afi][safi]); /* Buffers. */ if (peer->ibuf) @@ -1798,7 +1798,7 @@ peer_group_bind (struct bgp *bgp, union sockunion *su, list_delete_node (bgp->rsclient, pn); } - bgp_table_finish (peer->rib[afi][safi]); + bgp_table_finish (&peer->rib[afi][safi]); /* Import policy. */ if (peer->filter[afi][safi].map[RMAP_IMPORT].name) diff --git a/solaris/ChangeLog b/solaris/ChangeLog index 8a2ad7d3..65135d99 100644 --- a/solaris/ChangeLog +++ b/solaris/ChangeLog @@ -1,3 +1,13 @@ +2008-07-03 Paul Jakma <paul.jakma@sun.com> + + * quagga.{xml,init}.in: Sync with OpenSolaris SFW. This changes the + SMF schema used, from the SMF schema supplied initially with + Quagga, to the version which was approved by the Sun PSARC for + inclusion into Solaris. This change is incompatible. Settings, + such as vty_port, etc. will not transfer over. The Sun schema is + however supported by Sun, and supports running Quagga in a zone + with IP instances, and configuration via the routeadm utility. + 2008-01-13 Paul Jakma <paul.jakma@sun.com> * Makefile.am: pkg target should depend on the 'depend.%' files. diff --git a/solaris/quagga.init.in b/solaris/quagga.init.in index 7d04b70d..b489b28e 100755 --- a/solaris/quagga.init.in +++ b/solaris/quagga.init.in @@ -1,6 +1,6 @@ #!/sbin/sh # -# Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This file is part of Quagga. @@ -20,18 +20,156 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # -# $Id: quagga.init.in,v 1.7 2007/02/22 17:55:20 paul Exp $ +# $Id: quagga.init.in,v 1.8 2008/07/03 20:41:08 paul Exp $ # # Starts/stops the given daemon SMFINCLUDE=/lib/svc/share/smf_include.sh +ROUTEADMINCLUDE=/lib/svc/share/routing_include.sh +GLOBAL_OPTIONS="PAfiug" DAEMON_PATH=@sbindir@ +USER=@enable_user@ +GROUP=@enable_group@ +# handle upgrade of daemon-args SMF property to new routeadm properties +# used during upgrade too by routeadm. +# relevant to S10U4+ only. +handle_routeadm_upgrade () { + GLOBAL_OPTIONS="PAfiug" + + daemon_args=`get_daemon_args $SMF_FMRI` + + if [ -n "$daemon_args" ]; then + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "P" vty_port 0 + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "A" vty_address + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "f" config_file + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "i" pid_file + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "u" user + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "g" group + + case "$1" in + zebra) + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}b" "b" batch true false + ;; + ripd|ripngd) + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}r" "r" retain true false + ;; + bgpd) + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}rnp" "r" retain true false + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}rnp" "n" no_kernel true false + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}rnp" "p" bgp_port + esac + clear_daemon_args $SMF_FMRI + fi +} + +upgrade_config () { + DAEMON=$1 + # handle upgrade of SUNWzebra to Quagga + if [ -d "/etc/quagga" -a ! -f "/etc/quagga/${DAEMON}.conf" ] ; then + if [ -f "/etc/sfw/zebra/${DAEMON}.conf" ] ; then + cp "/etc/sfw/zebra/${DAEMON}.conf" \ + "/etc/quagga/${DAEMON}.conf.upgrade" \ + || exit $SMF_EXIT_ERR_FATAL + chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.upgrade" \ + || exit $SMF_EXIT_ERR_FATAL + chmod 0600 "/etc/quagga/${DAEMON}.conf.upgrade" \ + || exit $SMF_EXIT_ERR_FATAL + mv "/etc/quagga/${DAEMON}.conf.upgrade" "/etc/quagga/${DAEMON}.conf" \ + || exit $SMF_EXIT_ERR_FATAL + fi + fi + + if [ ! -f "/etc/quagga/${DAEMON}.conf" ] ; then + touch "/etc/quagga/${DAEMON}.conf.new" \ + || exit $SMF_EXIT_ERR_FATAL + chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.new" \ + || exit $SMF_EXIT_ERR_FATAL + chmod 0600 "/etc/quagga/${DAEMON}.conf.new" \ + || exit $SMF_EXIT_ERR_FATAL + mv "/etc/quagga/${DAEMON}.conf.new" "/etc/quagga/${DAEMON}.conf" \ + || exit $SMF_EXIT_ERR_FATAL + fi +} + +# Relevant to S10+ quagga_is_globalzone () { - if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then - return 1 - else + if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \ + -o `/sbin/zonename -t` = "exclusive" ]; then return 0 + else + return 1 + fi +} + +routeadm_daemon_args () { + # globals + args="`get_daemon_option_from_property $SMF_FMRI config_file f`" + args="${args} `get_daemon_option_from_property $SMF_FMRI vty_port P`" + args="${args} `get_daemon_option_from_property $SMF_FMRI vty_address A`" + args="${args} `get_daemon_option_from_property $SMF_FMRI pid_file i`" + + # user and group we need for config file upgrade.. + SMF_USER=`get_routeadm_property $SMF_FMRI user` + SMF_GROUP=`get_routeadm_property()$SMF_FMRI group` + if [ "${SMF_USER}" ] ; then + USER="${SMF_USER}" + args="${args} -u ${SMF_USER}" + fi + if [ "${SMF_GROUP}" ] ; then + GROUP="${SMF_GROUP}" + args="${args} -g ${SMF_GROUP}" + fi + + case $1 in + zebra) + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI batch -b true`" + ;; + ripd|ripngd) + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`" + ;; + bgpd) + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`" + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI no_kernel -n true`" + args="${args} `get_daemon_option_from_property $SMF_FMRI bgp_port p 179`" + ;; + esac + echo ${args} +} + +# certain daemons need zebra +routeadm_zebra_enable () { + + if [ "$DAEMON" = "zebra" ]; then + return + fi + + enable_zebra=`/usr/bin/svcprop -p \ + routing/enable_zebra $SMF_FMRI 2> /dev/null` + if [ "$enable_zebra" != "false" ]; then + zenabled=`/usr/bin/svcprop -p general/enabled zebra:quagga` + zenabledt=`/usr/bin/svcprop -p general_ovr/enabled zebra:quagga` + if [ "$zenabled" = "true" -o "$zenabledt" = "true" ]; then + /usr/sbin/svcadm disable zebra:quagga + /usr/sbin/svcadm enable -st zebra:quagga + else + /usr/sbin/svcadm enable -st zebra:quagga + fi + if [ "$?" != "0" ]; then + echo "Could not enable zebra:quagga" + exit $SMF_EXIT_ERR_FATAL + fi fi } @@ -39,6 +177,11 @@ quagga_is_globalzone () { # there is no SMF. Should allow this script to work pre-S10. if [ -f "$SMFINCLUDE" ] ; then . "$SMFINCLUDE"; + + # source the SMF-routeadm include if present.. + if [ -f "$ROUTEADMINCLUDE" ] ; then + . "$ROUTEADMINCLUDE" + fi else # pre-SMF system, fake up any functions and exit codes # which SMFINCLUDE usually provides. @@ -55,7 +198,7 @@ smf_present || DAEMON_ARGS="" usage () { if smf_present ; then - echo "Usage: $0 <daemon> <daemon arguments>"; + echo "Usage: $0 <daemon>"; else echo "Usage: $0 <stop|start> <daemon> <daemon arguments>"; fi @@ -67,7 +210,7 @@ usage () { case $1 in 'help' | 'usage') usage - exit SMF_EXIT_OK + exit $SMF_EXIT_OK ;; esac @@ -79,8 +222,6 @@ else fi DAEMON="$1" -shift -DAEMON_ARGS="$@" # daemon path must be given if [ -z "$DAEMON_PATH/$DAEMON" ]; then @@ -91,12 +232,9 @@ fi # only bgpd is suitable for running in a non-global zone, at this # time. case "${DAEMON}" in - zebra) - quagga_is_globalzone || exit $SMF_EXIT_OK - ;; bgpd) ;; - ospfd | ospf6d | ripd | ripngd ) + zebra | ospfd | ospf6d | ripd | ripngd ) quagga_is_globalzone || exit $SMF_EXIT_OK ;; *) @@ -105,6 +243,27 @@ case "${DAEMON}" in ;; esac +# Older Quagga 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 + handle_routeadm_upgrade $DAEMON; + DAEMON_ARGS=`routeadm_daemon_args`; + routeadm_zebra_enable $DAEMON; +else + if [ $# -gt 0 ] ; then + shift + DAEMON_ARGS="$@" + fi +fi + +upgrade_config "$DAEMON" + +if [ ! -f "@sysconfdir@/${DAEMON}.conf" ] ; then + echo "Could not find config file, @sysconfdir@/${DAEMON}.conf" + 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@ @@ -115,7 +274,11 @@ fi PIDFILE="@quagga_statedir@/${DAEMON}.pid" start () { - $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} & + if [ ! -x "$DAEMON_PATH/$DAEMON" ] ; then + echo "Error, could not find daemon, $DAEMON_PATH/$DAEMON" + exit $SMF_EXIT_ERR_FATAL + fi + eval exec $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} & } stop () { @@ -134,7 +297,7 @@ case "$QUAGGA_METHOD" in *) usage - exit SMF_EXIT_ERR_FATAL + exit $SMF_EXIT_ERR_FATAL ;; esac diff --git a/solaris/quagga.xml.in b/solaris/quagga.xml.in index 3cd402f6..50c52c22 100644 --- a/solaris/quagga.xml.in +++ b/solaris/quagga.xml.in @@ -18,18 +18,20 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Copyright 2005 Sun Microsystems, Inc. All rights reserved. + Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. ident "@(#)quagga.xml 1.0 05/03/15 SMI" --> -<service_bundle type='manifest' name='QUAGGAdaemons:quagga'> +<service_bundle type='manifest' name='SUNWquagga-daemons:quagga'> + <service name='network/routing/zebra' type='service' version='1'> - + + <single_instance /> <instance name='quagga' enabled='false'> <dependency name='fs' @@ -46,24 +48,24 @@ type='service'> <service_fmri value='svc:/network/initial' /> </dependency> - - <dependency name='config_data' + + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' grouping='require_all' - restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/zebra.conf' /> + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga zebra %{routing/daemon-args}' + exec='/lib/svc/method/quagga zebra' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_rawaccess,sys_admin,sys_net_config'/> + user='root' group='root'/> </method_context> </exec_method> @@ -84,17 +86,55 @@ <propval name='ignore_error' type='astring' value='core,signal' /> </property_group> - + + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/zebra' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <!-- zebra should not contribute to ipv4/ipv6 routing state --> + <propval name='protocol' type='astring' value='zebra' /> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> + <stability value='Evolving' /> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons + Property names are equivalent to the long + option name, consult Quagga documentation --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to zebra --> + <propval name='batch' type='boolean' value='false' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -111,7 +151,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -129,39 +169,40 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on Work-In-Progress, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv4-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv4-routing' /> + <service_fmri value='svc:/network/ipv4-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> - </dependency> - - <dependency name='config_data' + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' grouping='require_all' - restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ripd.conf' /> + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' + restart_on='restart' + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> + </dependency> + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ripd %{routing/daemon-args}' + exec='/lib/svc/method/quagga ripd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -179,16 +220,52 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ripd' /> + <propval name='legacy-daemon' type='astring' + value='/usr/sfw/sbin/ripdstart' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv4' /> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to ripd --> + <propval name='retain' type='boolean' value='false' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -205,7 +282,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -223,39 +300,40 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv6-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv6-routing' /> + <service_fmri value='svc:/network/ipv6-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ripngd.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ripngd %{routing/daemon-args}' + exec='/lib/svc/method/quagga ripngd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -273,16 +351,50 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ripngd' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv6'/> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to ripngd --> + <propval name='retain' type='boolean' value='false' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -299,7 +411,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -317,47 +429,51 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv4-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv4-routing' /> + <service_fmri value='svc:/network/ipv4-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ospfd.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ospfd %{routing/daemon-args}' + exec='/lib/svc/method/quagga ospfd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess,sys_net_config'/> + user='root' group='root'/> </method_context> </exec_method> + <!-- ospfd can take a long time to shutdown, due to graceful + shutdown + --> <exec_method type='method' name='stop' exec=':kill' - timeout_seconds='60'> + timeout_seconds='600'> </exec_method> <property_group name='startd' @@ -367,16 +483,49 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ospfd' /> + <propval name='legacy-daemon' type='astring' + value='/usr/sfw/sbin/ospfdstart' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv4'/> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -393,7 +542,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -411,39 +560,40 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv6-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv6-routing' /> + <service_fmri value='svc:/network/ipv6-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ospf6d.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ospf6d %{routing/daemon-args}' + exec='/lib/svc/method/quagga ospf6d' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -461,22 +611,53 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ospf6d' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv6'/> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> <common_name> <loctext xml:lang='C'> - Quagga: ospf6d, OSPFv3 IPv6 routing protocol daemon. + Quagga: ospf6d, OSPFv3 IPv6 routing protocol daemon. </loctext> </common_name> <documentation> @@ -487,7 +668,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> @@ -506,40 +687,48 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_any' - restart_on='none' + <dependency + name='ipv6-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv6-routing' /> - <service_fmri value='svc:/network/routing/ipv4-routing' /> + <service_fmri value='svc:/network/ipv6-forwarding' /> + </dependency> + + <dependency + name='ipv4-forwarding' + grouping='optional_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/ipv4-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='optional_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/bgpd.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga bgpd %{routing/daemon-args}' + exec='/lib/svc/method/quagga bgpd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -557,16 +746,65 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/bgpd' /> + <propval name='legacy-daemon' type='astring' + value='/usr/sfw/sbin/bgpdstart' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <property name='protocol' type='astring'> + <astring_list> + <value_node value='ipv4'/> + <value_node value='ipv6'/> + </astring_list> + </property> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons. --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to bgpd --> + <propval name='retain' type='boolean' value='false' /> + <propval name='no_kernel' type='boolean' value='false' /> + <propval name='bgp_port' type='astring' value='' /> + + <!-- + If enable_zebra is false, it will not be switched + on by the start method. + --> + <propval name='enable_zebra' type='boolean' value='true' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -583,6 +821,6 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> </service_bundle> diff --git a/vtysh/ChangeLog b/vtysh/ChangeLog index de62763c..af55c6f2 100644 --- a/vtysh/ChangeLog +++ b/vtysh/ChangeLog @@ -1,3 +1,13 @@ +2008-07-03 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * extract.pl.in: Fix as-range to match CPP output. + * vtysh.c: Add missing router_bgp_view_cmd alias. + +2008-07-02 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * CMD_AS_RANGE was being used inside command strings, and thus + not being expanded, fix by dequoting. + 2007-06-20 Nicolas Deffayet <nicolas@deffayet.com> * vtysh.c: (vtysh_write_terminal) Write 'end' when done, diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 789819c6..0b9ee516 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -37,8 +37,8 @@ $ignore{'"router ripng"'} = "ignore"; $ignore{'"router ospf"'} = "ignore"; $ignore{'"router ospf <0-65535>"'} = "ignore"; $ignore{'"router ospf6"'} = "ignore"; -$ignore{'"router bgp CMD_AS_RANGE"'} = "ignore"; -$ignore{'"router bgp CMD_AS_RANGE view WORD"'} = "ignore"; +$ignore{'"router bgp " "<1-4294967295>"'} = "ignore"; +$ignore{'"router bgp " "<1-4294967295>" " view WORD"'} = "ignore"; $ignore{'"router isis WORD"'} = "ignore"; $ignore{'"router zebra"'} = "ignore"; $ignore{'"address-family ipv4"'} = "ignore"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 9f47515d..bad05d98 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -34,6 +34,7 @@ #include "memory.h" #include "vtysh/vtysh.h" #include "log.h" +#include "bgpd/bgp_vty.h" /* Struct VTY. */ struct vty *vty; @@ -838,7 +839,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_BGPD, router_bgp, router_bgp_cmd, - "router bgp CMD_AS_RANGE", + "router bgp " CMD_AS_RANGE, ROUTER_STR BGP_STR AS_STR) @@ -847,6 +848,16 @@ DEFUNSH (VTYSH_BGPD, return CMD_SUCCESS; } +ALIAS_SH (VTYSH_BGPD, + router_bgp, + router_bgp_view_cmd, + "router bgp " CMD_AS_RANGE " view WORD", + ROUTER_STR + BGP_STR + AS_STR + "BGP view\n" + "view name\n") + DEFUNSH (VTYSH_BGPD, address_family_vpnv4, address_family_vpnv4_cmd, @@ -2341,6 +2352,7 @@ vtysh_init_vty (void) #endif install_element (CONFIG_NODE, &router_isis_cmd); install_element (CONFIG_NODE, &router_bgp_cmd); + install_element (CONFIG_NODE, &router_bgp_view_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_ipv4_unicast_cmd); diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 6483f2c7..341c42a4 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,12 @@ +2008-07-01 Paul Jakma <paul.jakma@sun.com> + + * ioctl.c: (if_get_flags) Deal more gracefully with failure + of the BSD link-state SIOCGIFMEDIA ioctl, as some interfaces + apparently don't implement it (e.g. tun). + Also, make BSD link-state checking be conditional on the + 'link-detect' interface configuration flag, as it should be. + Fixes bug #465. + 2008-06-02 Denis Ovsienko * connected.c: (connected_up_ipv4, connected_down_ipv4, diff --git a/zebra/ioctl.c b/zebra/ioctl.c index d536771a..5cf9e7b0 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -362,22 +362,29 @@ if_get_flags (struct interface *ifp) return; } #ifdef HAVE_BSD_LINK_DETECT /* Detect BSD link-state at start-up */ - (void) memset(&ifmr, 0, sizeof(ifmr)); - strncpy (&ifmr.ifm_name, ifp->name, IFNAMSIZ); - if (if_ioctl(SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) - { - zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s", safe_strerror(errno)); - return; - } - if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */ + + /* Per-default, IFF_RUNNING is held high, unless link-detect says + * otherwise - we abuse IFF_RUNNING inside zebra as a link-state flag, + * following practice on Linux and Solaris kernels + */ + SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + + if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) { - if (ifmr.ifm_status & IFM_ACTIVE) - SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - else - UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - } - else /* Force always up */ - SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + (void) memset(&ifmr, 0, sizeof(ifmr)); + strncpy (&ifmr.ifm_name, ifp->name, IFNAMSIZ); + + /* Seems not all interfaces implement this ioctl */ + if (if_ioctl(SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) + zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s", safe_strerror(errno)); + else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */ + { + if (ifmr.ifm_status & IFM_ACTIVE) + SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + else + UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + } + } #endif /* HAVE_BSD_LINK_DETECT */ if_flags_update (ifp, (ifreq.ifr_flags & 0x0000ffff)); |