From c9502438e822199370fe87100c725e1092e943c1 Mon Sep 17 00:00:00 2001 From: hasso Date: Tue, 1 Feb 2005 22:01:48 +0000 Subject: * bgp_open.c, bgp_packet.c, bgp_vty.c, bgpd.[ch]: Remove "no neighbor capability route-refresh" commands. Route refresh capability is sent anyway now. Preserve dummy deprecated commands. [merge from GNU Zebra] --- bgpd/ChangeLog | 6 ++++++ bgpd/bgp_open.c | 38 +++++++++----------------------------- bgpd/bgp_packet.c | 52 ---------------------------------------------------- bgpd/bgp_vty.c | 38 +++++++++++++++++++------------------- bgpd/bgpd.c | 42 ++++++++---------------------------------- bgpd/bgpd.h | 7 +++---- 6 files changed, 45 insertions(+), 138 deletions(-) diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 10ccdf4e..67da8ff8 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,9 @@ +2005-02-01 Akihiro Mizutani + + * bgp_open.c, bgp_packet.c, bgp_vty.c, bgpd.[ch]: Remove "no neighbor + capability route-refresh" commands. Route refresh capability is sent + anyway now. Preserve dummy deprecated commands. + 2005-02-01 Akihiro Mizutani * bgp_attr.c, bgp_snmp.c, bgp_vty.c, bgpd.[ch]: Remove support for old diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 86f48c44..8321bcfa 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -745,23 +745,6 @@ bgp_open_capability (struct stream *s, struct peer *peer) || CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY)) return; - /* When the peer is IPv4 unicast only, do not send capability. */ - if (! peer->afc[AFI_IP][SAFI_MULTICAST] - && ! peer->afc[AFI_IP][SAFI_MPLS_VPN] - && ! peer->afc[AFI_IP6][SAFI_UNICAST] - && ! peer->afc[AFI_IP6][SAFI_MULTICAST] - && CHECK_FLAG (peer->flags, PEER_FLAG_NO_ROUTE_REFRESH_CAP) - && ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_UNICAST], - PEER_FLAG_ORF_PREFIX_SM) - && ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_UNICAST], - PEER_FLAG_ORF_PREFIX_RM) - && ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_MULTICAST], - PEER_FLAG_ORF_PREFIX_SM) - && ! CHECK_FLAG (peer->af_flags[AFI_IP][SAFI_MULTICAST], - PEER_FLAG_ORF_PREFIX_RM) - && ! CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY)) - return; - /* IPv4 unicast. */ if (peer->afc[AFI_IP][SAFI_UNICAST]) { @@ -826,18 +809,15 @@ bgp_open_capability (struct stream *s, struct peer *peer) #endif /* HAVE_IPV6 */ /* Route refresh. */ - if (! CHECK_FLAG (peer->flags, PEER_FLAG_NO_ROUTE_REFRESH_CAP)) - { - SET_FLAG (peer->cap, PEER_CAP_REFRESH_ADV); - stream_putc (s, BGP_OPEN_OPT_CAP); - stream_putc (s, CAPABILITY_CODE_REFRESH_LEN + 2); - stream_putc (s, CAPABILITY_CODE_REFRESH_OLD); - stream_putc (s, CAPABILITY_CODE_REFRESH_LEN); - stream_putc (s, BGP_OPEN_OPT_CAP); - stream_putc (s, CAPABILITY_CODE_REFRESH_LEN + 2); - stream_putc (s, CAPABILITY_CODE_REFRESH); - stream_putc (s, CAPABILITY_CODE_REFRESH_LEN); - } + SET_FLAG (peer->cap, PEER_CAP_REFRESH_ADV); + stream_putc (s, BGP_OPEN_OPT_CAP); + stream_putc (s, CAPABILITY_CODE_REFRESH_LEN + 2); + stream_putc (s, CAPABILITY_CODE_REFRESH_OLD); + stream_putc (s, CAPABILITY_CODE_REFRESH_LEN); + stream_putc (s, BGP_OPEN_OPT_CAP); + stream_putc (s, CAPABILITY_CODE_REFRESH_LEN + 2); + stream_putc (s, CAPABILITY_CODE_REFRESH); + stream_putc (s, CAPABILITY_CODE_REFRESH_LEN); /* ORF capability. */ for (afi = AFI_IP ; afi < AFI_MAX ; afi++) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 04e5bd30..854b32cd 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1037,22 +1037,6 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi, "Advertising" : "Removing", afi, safi); } - /* Encode Route Refresh capability. */ - if (capability_code == CAPABILITY_CODE_REFRESH) - { - stream_putc (s, action); - stream_putc (s, CAPABILITY_CODE_REFRESH); - stream_putc (s, CAPABILITY_CODE_REFRESH_LEN); - stream_putc (s, action); - stream_putc (s, CAPABILITY_CODE_REFRESH_OLD); - stream_putc (s, CAPABILITY_CODE_REFRESH_LEN); - - if (BGP_DEBUG (normal, NORMAL)) - zlog_debug ("%s sending CAPABILITY has %s ROUTE-REFRESH capability", - peer->host, action == CAPABILITY_ACTION_SET ? - "Advertising" : "Removing"); - } - /* Set packet size. */ length = bgp_packet_set_size (s); @@ -2025,42 +2009,6 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length) } } } - else if (cap.code == CAPABILITY_CODE_REFRESH - || cap.code == CAPABILITY_CODE_REFRESH_OLD) - { - /* Check length. */ - if (cap.length != 0) - { - zlog_info ("%s Route Refresh Capability length error %d", - peer->host, cap.length); - bgp_notify_send (peer, BGP_NOTIFY_CEASE, 0); - return -1; - } - - if (BGP_DEBUG (normal, NORMAL)) - zlog_debug ("%s CAPABILITY has %s ROUTE-REFRESH capability(%s) for all address-families", - peer->host, - action == CAPABILITY_ACTION_SET - ? "Advertising" : "Removing", - cap.code == CAPABILITY_CODE_REFRESH_OLD - ? "old" : "new"); - - /* BGP refresh capability */ - if (action == CAPABILITY_ACTION_SET) - { - if (cap.code == CAPABILITY_CODE_REFRESH_OLD) - SET_FLAG (peer->cap, PEER_CAP_REFRESH_OLD_RCV); - else - SET_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV); - } - else - { - if (cap.code == CAPABILITY_CODE_REFRESH_OLD) - UNSET_FLAG (peer->cap, PEER_CAP_REFRESH_OLD_RCV); - else - UNSET_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV); - } - } else { zlog_warn ("%s unrecognized capability code: %d - ignored", diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index dcca1a39..be57c126 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1594,28 +1594,28 @@ DEFUN (no_neighbor_shutdown, return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); } -/* neighbor capability route-refresh. */ -DEFUN (neighbor_capability_route_refresh, - neighbor_capability_route_refresh_cmd, - NEIGHBOR_CMD2 "capability route-refresh", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise route-refresh capability to this neighbor\n") +/* Deprecated neighbor capability route-refresh. */ +DEFUN_DEPRECATED (neighbor_capability_route_refresh, + neighbor_capability_route_refresh_cmd, + NEIGHBOR_CMD2 "capability route-refresh", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Advertise capability to the peer\n" + "Advertise route-refresh capability to this neighbor\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP); + return CMD_SUCCESS; } -DEFUN (no_neighbor_capability_route_refresh, - no_neighbor_capability_route_refresh_cmd, - NO_NEIGHBOR_CMD2 "capability route-refresh", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise route-refresh capability to this neighbor\n") +DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, + no_neighbor_capability_route_refresh_cmd, + NO_NEIGHBOR_CMD2 "capability route-refresh", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Advertise capability to the peer\n" + "Advertise route-refresh capability to this neighbor\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP); + return CMD_SUCCESS; } /* neighbor capability dynamic. */ @@ -8783,7 +8783,7 @@ bgp_vty_init () install_element (BGP_NODE, &neighbor_shutdown_cmd); install_element (BGP_NODE, &no_neighbor_shutdown_cmd); - /* "neighbor capability route-refresh" commands.*/ + /* Deprecated "neighbor capability route-refresh" commands.*/ install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 1cce8c5e..1a504767 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2067,7 +2067,6 @@ struct peer_flag_action peer_flag_action_list[] = { PEER_FLAG_DONT_CAPABILITY, 0, peer_change_none }, { PEER_FLAG_OVERRIDE_CAPABILITY, 0, peer_change_none }, { PEER_FLAG_STRICT_CAP_MATCH, 0, peer_change_none }, - { PEER_FLAG_NO_ROUTE_REFRESH_CAP, 0, peer_change_reset }, { PEER_FLAG_DYNAMIC_CAPABILITY, 0, peer_change_reset }, { PEER_FLAG_ENFORCE_MULTIHOP, 0, peer_change_reset }, { 0, 0, 0 } @@ -2172,33 +2171,15 @@ peer_flag_modify_action (struct peer *peer, u_int32_t flag) } else if (peer->status == Established) { - if (flag == PEER_FLAG_NO_ROUTE_REFRESH_CAP - && CHECK_FLAG (peer->cap, PEER_CAP_DYNAMIC_RCV)) - { - if (CHECK_FLAG (peer->flags, flag)) - UNSET_FLAG (peer->cap, PEER_CAP_REFRESH_ADV); - else - SET_FLAG (peer->cap, PEER_CAP_REFRESH_ADV); - - bgp_capability_send (peer, AFI_IP, SAFI_UNICAST, - CAPABILITY_CODE_REFRESH, - CHECK_FLAG (peer->flags, flag) ? - CAPABILITY_ACTION_UNSET : CAPABILITY_ACTION_SET); - } - else - { - if (flag == PEER_FLAG_NO_ROUTE_REFRESH_CAP) - peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; - else if (flag == PEER_FLAG_DYNAMIC_CAPABILITY) - peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; - else if (flag == PEER_FLAG_PASSIVE) - peer->last_reset = PEER_DOWN_PASSIVE_CHANGE; - else if (flag == PEER_FLAG_ENFORCE_MULTIHOP) - peer->last_reset = PEER_DOWN_MULTIHOP_CHANGE; + if (flag == PEER_FLAG_DYNAMIC_CAPABILITY) + peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; + else if (flag == PEER_FLAG_PASSIVE) + peer->last_reset = PEER_DOWN_PASSIVE_CHANGE; + else if (flag == PEER_FLAG_ENFORCE_MULTIHOP) + peer->last_reset = PEER_DOWN_MULTIHOP_CHANGE; - bgp_notify_send (peer, BGP_NOTIFY_CEASE, - BGP_NOTIFY_CEASE_CONFIG_CHANGE); - } + bgp_notify_send (peer, BGP_NOTIFY_CEASE, + BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); @@ -4353,13 +4334,6 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp, vty_out (vty, " neighbor %s weight %d%s", addr, peer->weight, VTY_NEWLINE); - /* Route refresh. */ - if (CHECK_FLAG (peer->flags, PEER_FLAG_NO_ROUTE_REFRESH_CAP)) - if (! peer_group_active (peer) || - ! CHECK_FLAG (g_peer->flags, PEER_FLAG_NO_ROUTE_REFRESH_CAP)) - vty_out (vty, " no neighbor %s capability route-refresh%s", addr, - VTY_NEWLINE); - /* Dynamic capability. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY)) if (! peer_group_active (peer) || diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 6fb66d3f..e14a8ad3 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -330,10 +330,9 @@ struct peer #define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */ #define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */ #define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */ -#define PEER_FLAG_NO_ROUTE_REFRESH_CAP (1 << 5) /* route-refresh */ -#define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 6) /* dynamic capability */ -#define PEER_FLAG_ENFORCE_MULTIHOP (1 << 7) /* enforce-multihop */ -#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 8) /* local-as no-prepend */ +#define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 5) /* dynamic capability */ +#define PEER_FLAG_ENFORCE_MULTIHOP (1 << 6) /* enforce-multihop */ +#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */ /* Per AF configuration flags. */ u_int32_t af_flags[AFI_MAX][SAFI_MAX]; -- cgit v1.2.1