bgpd: bgpd-warnings.patch

Remove compile warnings for the bgpd directory
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
This commit is contained in:
Donald Sharp 2015-05-19 18:12:17 -07:00
parent 4e3afb1472
commit ffd0c03744
29 changed files with 235 additions and 769 deletions

View File

@ -420,7 +420,7 @@ aspath_count_confeds (struct aspath *aspath)
} }
unsigned int unsigned int
aspath_count_hops (struct aspath *aspath) aspath_count_hops (const struct aspath *aspath)
{ {
int count = 0; int count = 0;
struct assegment *seg = aspath->segments; struct assegment *seg = aspath->segments;

View File

@ -105,7 +105,7 @@ extern int aspath_firstas_check (struct aspath *, as_t);
extern int aspath_confed_check (struct aspath *); extern int aspath_confed_check (struct aspath *);
extern int aspath_left_confed_check (struct aspath *); extern int aspath_left_confed_check (struct aspath *);
extern unsigned long aspath_count (void); extern unsigned long aspath_count (void);
extern unsigned int aspath_count_hops (struct aspath *); extern unsigned int aspath_count_hops (const struct aspath *);
extern unsigned int aspath_count_confeds (struct aspath *); extern unsigned int aspath_count_confeds (struct aspath *);
extern unsigned int aspath_size (struct aspath *); extern unsigned int aspath_size (struct aspath *);
extern as_t aspath_highest (struct aspath *); extern as_t aspath_highest (struct aspath *);

View File

@ -81,7 +81,7 @@ static struct hash *cluster_hash;
static void * static void *
cluster_hash_alloc (void *p) cluster_hash_alloc (void *p)
{ {
struct cluster_list * val = (struct cluster_list *) p; const struct cluster_list *val = (const struct cluster_list *) p;
struct cluster_list *cluster; struct cluster_list *cluster;
cluster = XMALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list)); cluster = XMALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list));
@ -541,7 +541,7 @@ attr_show_all (struct vty *vty)
static void * static void *
bgp_attr_hash_alloc (void *p) bgp_attr_hash_alloc (void *p)
{ {
struct attr * val = (struct attr *) p; const struct attr * val = (const struct attr *) p;
struct attr *attr; struct attr *attr;
attr = XMALLOC (MTYPE_ATTR, sizeof (struct attr)); attr = XMALLOC (MTYPE_ATTR, sizeof (struct attr));
@ -961,7 +961,6 @@ bgp_attr_flag_invalid (struct bgp_attr_parser_args *args)
u_int8_t mask = BGP_ATTR_FLAG_EXTLEN; u_int8_t mask = BGP_ATTR_FLAG_EXTLEN;
const u_int8_t flags = args->flags; const u_int8_t flags = args->flags;
const u_int8_t attr_code = args->type; const u_int8_t attr_code = args->type;
struct peer *const peer = args->peer;
/* there may be attributes we don't know about */ /* there may be attributes we don't know about */
if (attr_code > attr_flags_values_max) if (attr_code > attr_flags_values_max)
@ -1271,7 +1270,6 @@ bgp_attr_local_pref (struct bgp_attr_parser_args *args)
static int static int
bgp_attr_atomic (struct bgp_attr_parser_args *args) bgp_attr_atomic (struct bgp_attr_parser_args *args)
{ {
struct peer *const peer = args->peer;
struct attr *const attr = args->attr; struct attr *const attr = args->attr;
const bgp_size_t length = args->length; const bgp_size_t length = args->length;
@ -2183,7 +2181,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi,
case SAFI_UNICAST: case SAFI_UNICAST:
case SAFI_MULTICAST: case SAFI_MULTICAST:
{ {
unsigned long sizep;
struct attr_extra *attre = attr->extra; struct attr_extra *attre = attr->extra;
assert (attr->extra); assert (attr->extra);
@ -2249,7 +2246,6 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
struct aspath *aspath; struct aspath *aspath;
int send_as4_path = 0; int send_as4_path = 0;
int send_as4_aggregator = 0; int send_as4_aggregator = 0;
int i = 0;
int use32bit = (CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV)) ? 1 : 0; int use32bit = (CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV)) ? 1 : 0;
size_t mpattrlen_pos = 0; size_t mpattrlen_pos = 0;

View File

@ -461,6 +461,7 @@ ecommunity_regexp_match (struct ecommunity *ecom, regex_t * reg)
return 0; return 0;
} }
#if 0
/* Delete community attribute using regular expression match. Return /* Delete community attribute using regular expression match. Return
modified communites attribute. */ modified communites attribute. */
static struct community * static struct community *
@ -508,6 +509,7 @@ community_regexp_delete (struct community *com, regex_t * reg)
} }
return com; return com;
} }
#endif
/* When given community attribute matches to the community-list return /* When given community attribute matches to the community-list return
1 else return 0. */ 1 else return 0. */

View File

@ -286,7 +286,7 @@ bgp_debug_list_conf_print (struct vty *vty, const char *desc, struct list *list)
} }
static void static void
bgp_debug_list_add_entry(struct list *list, char *host, struct prefix *p) bgp_debug_list_add_entry(struct list *list, const char *host, struct prefix *p)
{ {
struct bgp_debug_filter *filter; struct bgp_debug_filter *filter;
@ -307,7 +307,7 @@ bgp_debug_list_add_entry(struct list *list, char *host, struct prefix *p)
} }
static int static int
bgp_debug_list_remove_entry(struct list *list, char *host, struct prefix *p) bgp_debug_list_remove_entry(struct list *list, const char *host, struct prefix *p)
{ {
struct bgp_debug_filter *filter; struct bgp_debug_filter *filter;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -334,7 +334,7 @@ bgp_debug_list_remove_entry(struct list *list, char *host, struct prefix *p)
} }
static int static int
bgp_debug_list_has_entry(struct list *list, char *host, struct prefix *p) bgp_debug_list_has_entry(struct list *list, const char *host, struct prefix *p)
{ {
struct bgp_debug_filter *filter; struct bgp_debug_filter *filter;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -611,7 +611,7 @@ DEFUN (debug_bgp_neighbor_events_peer,
"BGP IPv6 neighbor to debug\n" "BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n") "BGP neighbor on interface to debug\n")
{ {
char *host = argv[0]; const char *host = argv[0];
if (!bgp_debug_neighbor_events_peers) if (!bgp_debug_neighbor_events_peers)
bgp_debug_neighbor_events_peers = list_new (); bgp_debug_neighbor_events_peers = list_new ();
@ -666,7 +666,7 @@ DEFUN (no_debug_bgp_neighbor_events_peer,
"BGP neighbor on interface to debug\n") "BGP neighbor on interface to debug\n")
{ {
int found_peer = 0; int found_peer = 0;
char *host = argv[0]; const char *host = argv[0];
if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers)) if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers))
{ {
@ -755,7 +755,7 @@ DEFUN (debug_bgp_keepalive_peer,
"BGP IPv6 neighbor to debug\n" "BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n") "BGP neighbor on interface to debug\n")
{ {
char *host = argv[0]; const char *host = argv[0];
if (!bgp_debug_keepalive_peers) if (!bgp_debug_keepalive_peers)
bgp_debug_keepalive_peers = list_new (); bgp_debug_keepalive_peers = list_new ();
@ -810,7 +810,7 @@ DEFUN (no_debug_bgp_keepalive_peer,
"BGP neighbor on interface to debug\n") "BGP neighbor on interface to debug\n")
{ {
int found_peer = 0; int found_peer = 0;
char *host = argv[0]; const char *host = argv[0];
if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers)) if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers))
{ {
@ -1027,7 +1027,7 @@ DEFUN (debug_bgp_update_direct_peer,
"BGP IPv6 neighbor to debug\n" "BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n") "BGP neighbor on interface to debug\n")
{ {
char *host = argv[1]; const char *host = argv[1];
int inbound; int inbound;
if (!bgp_debug_update_in_peers) if (!bgp_debug_update_in_peers)
@ -1162,7 +1162,7 @@ DEFUN (no_debug_bgp_update_direct_peer,
{ {
int inbound; int inbound;
int found_peer = 0; int found_peer = 0;
char *host = argv[1]; const char *host = argv[1];
if (strncmp ("i", argv[0], 1) == 0) if (strncmp ("i", argv[0], 1) == 0)
inbound = 1; inbound = 1;

View File

@ -512,7 +512,7 @@ struct ecommunity *
ecommunity_str2com (const char *str, int type, int keyword_included) ecommunity_str2com (const char *str, int type, int keyword_included)
{ {
struct ecommunity *ecom = NULL; struct ecommunity *ecom = NULL;
enum ecommunity_token token; enum ecommunity_token token = ecommunity_token_unknown;
struct ecommunity_val eval; struct ecommunity_val eval;
int keyword = 0; int keyword = 0;

View File

@ -51,7 +51,7 @@ struct as_list_master
void (*add_hook) (char *); void (*add_hook) (char *);
/* Hook function which is executed when access_list is deleted. */ /* Hook function which is executed when access_list is deleted. */
void (*delete_hook) (char *); void (*delete_hook) (const char *);
}; };
/* Element of AS path filter. */ /* Element of AS path filter. */
@ -412,7 +412,7 @@ as_list_add_hook (void (*func) (char *))
/* Delete hook function. */ /* Delete hook function. */
void void
as_list_delete_hook (void (*func) (char *)) as_list_delete_hook (void (*func) (const char *))
{ {
as_list_master.delete_hook = func; as_list_master.delete_hook = func;
} }

View File

@ -34,6 +34,6 @@ extern enum as_filter_type as_list_apply (struct as_list *, void *);
extern struct as_list *as_list_lookup (const char *); extern struct as_list *as_list_lookup (const char *);
extern void as_list_add_hook (void (*func) (char *)); extern void as_list_add_hook (void (*func) (char *));
extern void as_list_delete_hook (void (*func) (char *)); extern void as_list_delete_hook (void (*func) (const char *));
#endif /* _QUAGGA_BGP_FILTER_H */ #endif /* _QUAGGA_BGP_FILTER_H */

View File

@ -47,6 +47,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_snmp.h" #include "bgpd/bgp_snmp.h"
#endif /* HAVE_SNMP */ #endif /* HAVE_SNMP */
#include "bgpd/bgp_updgrp.h" #include "bgpd/bgp_updgrp.h"
#include "bgpd/bgp_nht.h"
/* Definition of display strings corresponding to FSM events. This should be /* Definition of display strings corresponding to FSM events. This should be
* kept consistent with the events defined in bgpd.h * kept consistent with the events defined in bgpd.h
@ -1199,8 +1200,6 @@ bgp_stop_with_notify (struct peer *peer, u_char code, u_char sub_code)
static int static int
bgp_connect_success (struct peer *peer) bgp_connect_success (struct peer *peer)
{ {
int ret = 0;
if (peer->fd < 0) if (peer->fd < 0)
{ {
zlog_err ("bgp_connect_success peer's fd is negative value %d", zlog_err ("bgp_connect_success peer's fd is negative value %d",
@ -1408,7 +1407,6 @@ static int
bgp_establish (struct peer *peer) bgp_establish (struct peer *peer)
{ {
struct bgp_notify *notify; struct bgp_notify *notify;
struct peer_af *paf;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
int nsf_af_count = 0; int nsf_af_count = 0;
@ -1597,8 +1595,6 @@ bgp_fsm_exeption (struct peer *peer)
void void
bgp_fsm_nht_update(struct peer *peer, int valid) bgp_fsm_nht_update(struct peer *peer, int valid)
{ {
int ret = 0;
if (!peer) if (!peer)
return; return;

View File

@ -225,7 +225,6 @@ bgp_exit (int status)
{ {
struct bgp *bgp; struct bgp *bgp;
struct listnode *node, *nnode; struct listnode *node, *nnode;
int *socket;
struct interface *ifp; struct interface *ifp;
extern struct zclient *zclient; extern struct zclient *zclient;

View File

@ -85,7 +85,6 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr,
struct prefix p; struct prefix p;
int psize; int psize;
int prefixlen; int prefixlen;
u_int32_t label;
u_int16_t type; u_int16_t type;
struct rd_as rd_as; struct rd_as rd_as;
struct rd_ip rd_ip; struct rd_ip rd_ip;
@ -140,7 +139,7 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr,
return -1; return -1;
} }
label = decode_label (pnt); (void)decode_label (pnt);
/* Copyr label to prefix. */ /* Copyr label to prefix. */
tagpnt = pnt;; tagpnt = pnt;;

View File

@ -273,10 +273,8 @@ bgp_accept (struct thread *thread)
*/ */
if (peer1->status == Clearing || peer1->status == Deleted) if (peer1->status == Clearing || peer1->status == Deleted)
{ {
struct bgp *bgp = peer1->bgp;
if (bgp_debug_neighbor_events(peer1)) if (bgp_debug_neighbor_events(peer1))
zlog_debug("[Event] Closing incoming conn for %s (0x%x) state %d", zlog_debug("[Event] Closing incoming conn for %s (%p) state %d",
peer1->host, peer1, peer1->status); peer1->host, peer1, peer1->status);
close (bgp_sock); close (bgp_sock);
return -1; return -1;

View File

@ -76,7 +76,7 @@ bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
} }
struct bgp_nexthop_cache * struct bgp_nexthop_cache *
bnc_new () bnc_new (void)
{ {
struct bgp_nexthop_cache *bnc; struct bgp_nexthop_cache *bnc;
@ -159,7 +159,7 @@ static struct hash *bgp_address_hash;
static void * static void *
bgp_address_hash_alloc (void *p) bgp_address_hash_alloc (void *p)
{ {
struct in_addr *val = p; const struct in_addr *val = (const struct in_addr *)p;
struct bgp_addr *addr; struct bgp_addr *addr;
addr = XMALLOC (MTYPE_BGP_ADDR, sizeof (struct bgp_addr)); addr = XMALLOC (MTYPE_BGP_ADDR, sizeof (struct bgp_addr));
@ -433,7 +433,6 @@ show_ip_bgp_nexthop_table (struct vty *vty, int detail)
char buf[INET6_ADDRSTRLEN]; char buf[INET6_ADDRSTRLEN];
struct nexthop *nexthop; struct nexthop *nexthop;
time_t tbuf; time_t tbuf;
u_char i;
vty_out (vty, "Current BGP nexthop cache:%s", VTY_NEWLINE); vty_out (vty, "Current BGP nexthop cache:%s", VTY_NEWLINE);
for (rn = bgp_table_top (bgp_nexthop_cache_table[AFI_IP]); rn; rn = bgp_route_next (rn)) for (rn = bgp_table_top (bgp_nexthop_cache_table[AFI_IP]); rn; rn = bgp_route_next (rn))
@ -585,7 +584,7 @@ bgp_scan_init (void)
} }
void void
bgp_scan_vty_init() bgp_scan_vty_init (void)
{ {
install_element (ENABLE_NODE, &show_ip_bgp_nexthop_cmd); install_element (ENABLE_NODE, &show_ip_bgp_nexthop_cmd);
install_element (VIEW_NODE, &show_ip_bgp_nexthop_cmd); install_element (VIEW_NODE, &show_ip_bgp_nexthop_cmd);

View File

@ -66,9 +66,11 @@ extern int bgp_config_write_scan_time (struct vty *);
extern int bgp_nexthop_onlink (afi_t, struct attr *); extern int bgp_nexthop_onlink (afi_t, struct attr *);
extern int bgp_nexthop_self (struct attr *); extern int bgp_nexthop_self (struct attr *);
extern void bgp_address_init (void); extern void bgp_address_init (void);
extern struct bgp_nexthop_cache *bnc_new(); extern struct bgp_nexthop_cache *bnc_new(void);
extern void bnc_free(struct bgp_nexthop_cache *bnc); extern void bnc_free(struct bgp_nexthop_cache *bnc);
extern void bnc_nexthop_free(struct bgp_nexthop_cache *bnc); extern void bnc_nexthop_free(struct bgp_nexthop_cache *bnc);
extern char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size); extern char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size);
extern void bgp_scan_init(void);
extern void bgp_scan_vty_init(void);
#endif /* _QUAGGA_BGP_NEXTHOP_H */ #endif /* _QUAGGA_BGP_NEXTHOP_H */

View File

@ -38,6 +38,7 @@
#include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_nexthop.h"
#include "bgpd/bgp_debug.h" #include "bgpd/bgp_debug.h"
#include "bgpd/bgp_nht.h" #include "bgpd/bgp_nht.h"
#include "bgpd/bgp_fsm.h"
extern struct zclient *zclient; extern struct zclient *zclient;
extern struct bgp_table *bgp_nexthop_cache_table[AFI_MAX]; extern struct bgp_table *bgp_nexthop_cache_table[AFI_MAX];
@ -282,7 +283,7 @@ void
bgp_parse_nexthop_update (int command) bgp_parse_nexthop_update (int command)
{ {
struct stream *s; struct stream *s;
struct bgp_node *rn; struct bgp_node *rn = NULL;
struct bgp_nexthop_cache *bnc; struct bgp_nexthop_cache *bnc;
struct nexthop *nexthop; struct nexthop *nexthop;
struct nexthop *oldnh; struct nexthop *oldnh;
@ -618,8 +619,8 @@ evaluate_paths (struct bgp_nexthop_cache *bnc)
LIST_FOREACH(path, &(bnc->paths), nh_thread) LIST_FOREACH(path, &(bnc->paths), nh_thread)
{ {
if (!(path->type == ZEBRA_ROUTE_BGP && if (!(path->type == ZEBRA_ROUTE_BGP &&
(path->sub_type == BGP_ROUTE_NORMAL) || ((path->sub_type == BGP_ROUTE_NORMAL) ||
(path->sub_type == BGP_ROUTE_STATIC))) (path->sub_type == BGP_ROUTE_STATIC))))
continue; continue;
rn = path->net; rn = path->net;

View File

@ -263,7 +263,7 @@ bgp_write_packet (struct peer *peer)
s = bpacket_reformat_for_peer (next_pkt, paf); s = bpacket_reformat_for_peer (next_pkt, paf);
bpacket_queue_advance_peer (paf); bpacket_queue_advance_peer (paf);
if (bgp_debug_update(peer, NULL, NULL, 0)) if (bgp_debug_update(peer, NULL, NULL, 0))
zlog_debug ("u%llu:s%llu %s send UPDATE len %d ", zlog_debug ("u%" PRIu64 ":s%" PRIu64 "%s send UPDATE len %zu ",
PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id,
peer->host, (stream_get_endp(s) - stream_get_getp(s))); peer->host, (stream_get_endp(s) - stream_get_getp(s)));
return s; return s;
@ -349,7 +349,7 @@ bgp_write (struct thread *thread)
struct stream *s; struct stream *s;
int num; int num;
unsigned int count = 0; unsigned int count = 0;
int oc = 0; unsigned int oc = 0;
/* Yes first of all get peer pointer. */ /* Yes first of all get peer pointer. */
peer = THREAD_ARG (thread); peer = THREAD_ARG (thread);
@ -516,7 +516,6 @@ void
bgp_keepalive_send (struct peer *peer) bgp_keepalive_send (struct peer *peer)
{ {
struct stream *s; struct stream *s;
int length;
s = stream_new (BGP_MAX_PACKET_SIZE); s = stream_new (BGP_MAX_PACKET_SIZE);
@ -524,7 +523,7 @@ bgp_keepalive_send (struct peer *peer)
bgp_packet_set_marker (s, BGP_MSG_KEEPALIVE); bgp_packet_set_marker (s, BGP_MSG_KEEPALIVE);
/* Set packet size. */ /* Set packet size. */
length = bgp_packet_set_size (s); (void)bgp_packet_set_size (s);
/* Dump packet if debug option is set. */ /* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */ /* bgp_packet_dump (s); */
@ -543,7 +542,6 @@ void
bgp_open_send (struct peer *peer) bgp_open_send (struct peer *peer)
{ {
struct stream *s; struct stream *s;
int length;
u_int16_t send_holdtime; u_int16_t send_holdtime;
as_t local_as; as_t local_as;
@ -574,7 +572,7 @@ bgp_open_send (struct peer *peer)
bgp_open_capability (s, peer); bgp_open_capability (s, peer);
/* Set BGP packet length. */ /* Set BGP packet length. */
length = bgp_packet_set_size (s); (void)bgp_packet_set_size (s);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending OPEN, version %d, my as %u, holdtime %d, id %s", zlog_debug ("%s sending OPEN, version %d, my as %u, holdtime %d, id %s",
@ -683,7 +681,6 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
{ {
struct stream *s; struct stream *s;
struct stream *packet; struct stream *packet;
int length;
struct bgp_filter *filter; struct bgp_filter *filter;
int orf_refresh = 0; int orf_refresh = 0;
@ -751,7 +748,7 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
} }
/* Set packet size. */ /* Set packet size. */
length = bgp_packet_set_size (s); (void)bgp_packet_set_size (s);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
{ {
@ -777,7 +774,6 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi,
{ {
struct stream *s; struct stream *s;
struct stream *packet; struct stream *packet;
int length;
/* Adjust safi code. */ /* Adjust safi code. */
if (safi == SAFI_MPLS_VPN) if (safi == SAFI_MPLS_VPN)
@ -805,7 +801,7 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi,
} }
/* Set packet size. */ /* Set packet size. */
length = bgp_packet_set_size (s); (void)bgp_packet_set_size (s);
/* Make real packet. */ /* Make real packet. */
packet = stream_dup (s); packet = stream_dup (s);
@ -903,7 +899,6 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
u_int16_t send_holdtime; u_int16_t send_holdtime;
as_t remote_as; as_t remote_as;
as_t as4 = 0; as_t as4 = 0;
struct peer *active_peer = NULL;
struct in_addr remote_id; struct in_addr remote_id;
int mp_capability; int mp_capability;
u_int8_t notify_data_remote_as[2]; u_int8_t notify_data_remote_as[2];
@ -915,7 +910,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
version = stream_getc (peer->ibuf); version = stream_getc (peer->ibuf);
memcpy (notify_data_remote_as, stream_pnt (peer->ibuf), 2); memcpy (notify_data_remote_as, stream_pnt (peer->ibuf), 2);
remote_as = stream_getw (peer->ibuf); remote_as = stream_getw (peer->ibuf);
holdtime_ptr = stream_pnt (peer->ibuf); holdtime_ptr = (u_int16_t *)stream_pnt (peer->ibuf);
holdtime = stream_getw (peer->ibuf); holdtime = stream_getw (peer->ibuf);
memcpy (notify_data_remote_id, stream_pnt (peer->ibuf), 4); memcpy (notify_data_remote_id, stream_pnt (peer->ibuf), 4);
remote_id.s_addr = stream_get_ipv4 (peer->ibuf); remote_id.s_addr = stream_get_ipv4 (peer->ibuf);
@ -1086,7 +1081,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
bgp_notify_send_with_data (peer, bgp_notify_send_with_data (peer,
BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNACEP_HOLDTIME, BGP_NOTIFY_OPEN_UNACEP_HOLDTIME,
holdtime_ptr, 2); (u_char *)holdtime_ptr, 2);
return -1; return -1;
} }
@ -1175,7 +1170,7 @@ void
bgp_check_update_delay(struct bgp *bgp) bgp_check_update_delay(struct bgp *bgp)
{ {
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct peer *peer; struct peer *peer = NULL;
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug ("Checking update delay, T: %d R: %d I:%d E: %d", bgp->established, zlog_debug ("Checking update delay, T: %d R: %d I:%d E: %d", bgp->established,
@ -1752,7 +1747,6 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
{ {
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_char reserved;
struct stream *s; struct stream *s;
struct peer_af *paf; struct peer_af *paf;
@ -1780,7 +1774,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
/* Parse packet. */ /* Parse packet. */
afi = stream_getw (s); afi = stream_getw (s);
reserved = stream_getc (s); (void)stream_getc (s);
safi = stream_getc (s); safi = stream_getc (s);
if (bgp_debug_update(peer, NULL, NULL, 0)) if (bgp_debug_update(peer, NULL, NULL, 0))
@ -1836,7 +1830,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
u_int32_t seq; u_int32_t seq;
int psize; int psize;
char name[BUFSIZ]; char name[BUFSIZ];
int ret; int ret = CMD_SUCCESS;
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
{ {
@ -1870,7 +1864,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
prefix_bgp_orf_remove_all (name); prefix_bgp_orf_remove_all (name);
break; break;
} }
ok = ((p_end - p_pnt) >= sizeof(u_int32_t)) ; ok = ((u_int32_t)(p_end - p_pnt) >= sizeof(u_int32_t)) ;
if (ok) if (ok)
{ {
memcpy (&seq, p_pnt, sizeof (u_int32_t)); memcpy (&seq, p_pnt, sizeof (u_int32_t));
@ -1967,11 +1961,9 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
struct capability_mp_data mpc; struct capability_mp_data mpc;
struct capability_header *hdr; struct capability_header *hdr;
u_char action; u_char action;
struct bgp *bgp;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
bgp = peer->bgp;
end = pnt + length; end = pnt + length;
while (pnt < end) while (pnt < end)

View File

@ -927,7 +927,7 @@ bgp_cluster_filter (struct peer *peer, struct attr *attr)
static int static int
bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr, bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
afi_t afi, safi_t safi, char *rmap_name) afi_t afi, safi_t safi, const char *rmap_name)
{ {
struct bgp_filter *filter; struct bgp_filter *filter;
struct bgp_info info; struct bgp_info info;
@ -984,7 +984,7 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
static int static int
bgp_output_modifier (struct peer *peer, struct prefix *p, struct attr *attr, bgp_output_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
afi_t afi, safi_t safi, char *rmap_name) afi_t afi, safi_t safi, const char *rmap_name)
{ {
struct bgp_filter *filter; struct bgp_filter *filter;
struct bgp_info info; struct bgp_info info;
@ -1110,7 +1110,7 @@ bgp_import_modifier (struct peer *rsclient, struct peer *peer,
/* If this is an EBGP peer with remove-private-AS */ /* If this is an EBGP peer with remove-private-AS */
void static void
bgp_peer_remove_private_as(struct bgp *bgp, afi_t afi, safi_t safi, bgp_peer_remove_private_as(struct bgp *bgp, afi_t afi, safi_t safi,
struct peer *peer, struct attr *attr) struct peer *peer, struct attr *attr)
{ {
@ -1157,310 +1157,6 @@ bgp_peer_as_override(struct bgp *bgp, afi_t afi, safi_t safi,
} }
} }
static int
bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p,
struct attr *attr, afi_t afi, safi_t safi)
{
int ret;
char buf[SU_ADDRSTRLEN];
struct bgp_filter *filter;
struct peer *from;
struct bgp *bgp;
int transparent;
int reflect;
struct attr *riattr;
from = ri->peer;
filter = &peer->filter[afi][safi];
bgp = peer->bgp;
riattr = bgp_info_mpath_count (ri) ? bgp_info_mpath_attr (ri) : ri->attr;
if (DISABLE_BGP_ANNOUNCE)
return 0;
/* Do not send announces to RS-clients from the 'normal' bgp_table. */
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
return 0;
/* Do not send back route to sender. */
if (from == peer)
return 0;
/* Aggregate-address suppress check. */
if (ri->extra && ri->extra->suppress)
if (! UNSUPPRESS_MAP_NAME (filter))
return 0;
/* Default route check. */
if (CHECK_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
{
if (p->family == AF_INET && p->u.prefix4.s_addr == INADDR_ANY)
return 0;
#ifdef HAVE_IPV6
else if (p->family == AF_INET6 && p->prefixlen == 0)
return 0;
#endif /* HAVE_IPV6 */
}
/* Transparency check. */
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)
&& CHECK_FLAG (from->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
transparent = 1;
else
transparent = 0;
/* If community is not disabled check the no-export and local. */
if (! transparent && bgp_community_filter (peer, riattr))
return 0;
/* If the attribute has originator-id and it is same as remote
peer's id. */
if (riattr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID))
{
if (IPV4_ADDR_SAME (&peer->remote_id, &riattr->extra->originator_id))
{
if (bgp_debug_update(peer, p, NULL, 0))
zlog_debug("%s [Update:SEND] %s/%d originator-id is same as remote router-id",
peer->host,
inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen);
return 0;
}
}
/* ORF prefix-list filter check */
if (CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
&& (CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
|| CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)))
if (peer->orf_plist[afi][safi])
{
if (prefix_list_apply (peer->orf_plist[afi][safi], p) == PREFIX_DENY)
return 0;
}
/* Output filter check. */
if (bgp_output_filter (peer, p, riattr, afi, safi) == FILTER_DENY)
{
if (bgp_debug_update(peer, p, NULL, 0))
zlog_debug("%s [Update:SEND] %s/%d is filtered",
peer->host,
inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen);
return 0;
}
#ifdef BGP_SEND_ASPATH_CHECK
/* AS path loop check. */
if (aspath_loop_check (riattr->aspath, peer->as))
{
if (bgp_debug_update(peer, p, NULL, 0))
zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
peer->host, peer->as);
return 0;
}
#endif /* BGP_SEND_ASPATH_CHECK */
/* If we're a CONFED we need to loop check the CONFED ID too */
if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
{
if (aspath_loop_check(riattr->aspath, bgp->confed_id))
{
if (bgp_debug_update(peer, p, NULL, 0))
zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
peer->host,
bgp->confed_id);
return 0;
}
}
/* Route-Reflect check. */
if (from->sort == BGP_PEER_IBGP && peer->sort == BGP_PEER_IBGP)
reflect = 1;
else
reflect = 0;
/* IBGP reflection check. */
if (reflect)
{
/* A route from a Client peer. */
if (CHECK_FLAG (from->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
{
/* Reflect to all the Non-Client peers and also to the
Client peers other than the originator. Originator check
is already done. So there is noting to do. */
/* no bgp client-to-client reflection check. */
if (bgp_flag_check (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
return 0;
}
else
{
/* A route from a Non-client peer. Reflect to all other
clients. */
if (! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
return 0;
}
}
/* For modify attribute, copy it to temporary structure. */
bgp_attr_dup (attr, riattr);
/* If local-preference is not set. */
if ((peer->sort == BGP_PEER_IBGP
|| peer->sort == BGP_PEER_CONFED)
&& (! (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))))
{
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF);
attr->local_pref = bgp->default_local_pref;
}
/* If originator-id is not set and the route is to be reflected,
set the originator id */
if (peer && from && peer->sort == BGP_PEER_IBGP &&
from->sort == BGP_PEER_IBGP &&
(! (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))))
{
attr->extra = bgp_attr_extra_get(attr);
IPV4_ADDR_COPY(&(attr->extra->originator_id), &(from->remote_id));
SET_FLAG(attr->flag, BGP_ATTR_ORIGINATOR_ID);
}
/* Remove MED if its an EBGP peer - will get overwritten by route-maps */
if (peer->sort == BGP_PEER_EBGP
&& attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
{
if (ri->peer != bgp->peer_self && ! transparent
&& ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
attr->flag &= ~(ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC));
}
/* next-hop-set */
if (transparent
|| (reflect && ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF_ALL))
|| (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)
&& ((p->family == AF_INET && attr->nexthop.s_addr)
#ifdef HAVE_IPV6
|| (p->family == AF_INET6 &&
! IN6_IS_ADDR_UNSPECIFIED(&attr->extra->mp_nexthop_global))
#endif /* HAVE_IPV6 */
)))
{
/* NEXT-HOP Unchanged. */
}
else if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)
|| (p->family == AF_INET && attr->nexthop.s_addr == 0)
#ifdef HAVE_IPV6
|| (p->family == AF_INET6 &&
IN6_IS_ADDR_UNSPECIFIED(&attr->extra->mp_nexthop_global))
#endif /* HAVE_IPV6 */
|| (peer->sort == BGP_PEER_EBGP
&& (bgp_multiaccess_check_v4 (attr->nexthop, peer) == 0)))
{
/* Set IPv4 nexthop. */
if (p->family == AF_INET)
{
if (safi == SAFI_MPLS_VPN)
memcpy (&attr->extra->mp_nexthop_global_in, &peer->nexthop.v4,
IPV4_MAX_BYTELEN);
else
memcpy (&attr->nexthop, &peer->nexthop.v4, IPV4_MAX_BYTELEN);
}
#ifdef HAVE_IPV6
/* Set IPv6 nexthop. */
if (p->family == AF_INET6)
{
/* IPv6 global nexthop must be included. */
memcpy (&attr->extra->mp_nexthop_global, &peer->nexthop.v6_global,
IPV6_MAX_BYTELEN);
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
#endif /* HAVE_IPV6 */
}
#ifdef HAVE_IPV6
if (p->family == AF_INET6)
{
/* Left nexthop_local unchanged if so configured. */
if ( CHECK_FLAG (peer->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) )
{
if ( IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_local) )
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
else
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
/* Default nexthop_local treatment for non-RS-Clients */
else
{
/* Link-local address should not be transit to different peer. */
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
/* Set link-local address for shared network peer. */
if (peer->shared_network
&& ! IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_local))
{
memcpy (&attr->extra->mp_nexthop_local, &peer->nexthop.v6_local,
IPV6_MAX_BYTELEN);
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
}
/* If bgpd act as BGP-4+ route-reflector, do not send link-local
address.*/
if (reflect)
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
/* If BGP-4+ link-local nexthop is not link-local nexthop. */
if (! IN6_IS_ADDR_LINKLOCAL (&peer->nexthop.v6_local))
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
}
#endif /* HAVE_IPV6 */
bgp_peer_remove_private_as(bgp, afi, safi, peer, attr);
bgp_peer_as_override(bgp, afi, safi, peer, attr);
/* Route map & unsuppress-map apply. */
if (ROUTE_MAP_OUT_NAME (filter)
|| (ri->extra && ri->extra->suppress) )
{
struct bgp_info info;
struct attr dummy_attr;
struct attr_extra dummy_extra;
dummy_attr.extra = &dummy_extra;
info.peer = peer;
info.attr = attr;
/* The route reflector is not allowed to modify the attributes
of the reflected IBGP routes. */
if ((from->sort == BGP_PEER_IBGP && peer->sort == BGP_PEER_IBGP) &&
!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
{
bgp_attr_dup (&dummy_attr, attr);
info.attr = &dummy_attr;
}
SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT);
if (ri->extra && ri->extra->suppress)
ret = route_map_apply (UNSUPPRESS_MAP (filter), p, RMAP_BGP, &info);
else
ret = route_map_apply (ROUTE_MAP_OUT (filter), p, RMAP_BGP, &info);
peer->rmap_type = 0;
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (attr);
return 0;
}
}
return 1;
}
static void static void
subgroup_announce_reset_nhop (u_char family, struct attr *attr) subgroup_announce_reset_nhop (u_char family, struct attr *attr)
{ {
@ -1790,201 +1486,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp,
return 1; return 1;
} }
static int
bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient,
struct prefix *p, struct attr *attr, afi_t afi, safi_t safi)
{
int ret;
char buf[SU_ADDRSTRLEN];
struct bgp_filter *filter;
struct bgp_info info;
struct peer *from;
struct attr *riattr;
from = ri->peer;
filter = &rsclient->filter[afi][safi];
riattr = bgp_info_mpath_count (ri) ? bgp_info_mpath_attr (ri) : ri->attr;
if (DISABLE_BGP_ANNOUNCE)
return 0;
/* Do not send back route to sender. */
if (from == rsclient)
return 0;
/* Aggregate-address suppress check. */
if (ri->extra && ri->extra->suppress)
if (! UNSUPPRESS_MAP_NAME (filter))
return 0;
/* Default route check. */
if (CHECK_FLAG (rsclient->af_sflags[afi][safi],
PEER_STATUS_DEFAULT_ORIGINATE))
{
if (p->family == AF_INET && p->u.prefix4.s_addr == INADDR_ANY)
return 0;
#ifdef HAVE_IPV6
else if (p->family == AF_INET6 && p->prefixlen == 0)
return 0;
#endif /* HAVE_IPV6 */
}
/* If the attribute has originator-id and it is same as remote
peer's id. */
if (riattr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID))
{
if (IPV4_ADDR_SAME (&rsclient->remote_id,
&riattr->extra->originator_id))
{
if (bgp_debug_update(rsclient, p, NULL, 0))
zlog_debug ("%s [Update:SEND] %s/%d originator-id is same as remote router-id",
rsclient->host,
inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen);
return 0;
}
}
/* ORF prefix-list filter check */
if (CHECK_FLAG (rsclient->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
&& (CHECK_FLAG (rsclient->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
|| CHECK_FLAG (rsclient->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)))
if (rsclient->orf_plist[afi][safi])
{
if (prefix_list_apply (rsclient->orf_plist[afi][safi], p) == PREFIX_DENY)
return 0;
}
/* Output filter check. */
if (bgp_output_filter (rsclient, p, riattr, afi, safi) == FILTER_DENY)
{
if (bgp_debug_update(rsclient, p, NULL, 0))
zlog_debug ("%s [Update:SEND] %s/%d is filtered",
rsclient->host,
inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen);
return 0;
}
#ifdef BGP_SEND_ASPATH_CHECK
/* AS path loop check. */
if (aspath_loop_check (riattr->aspath, rsclient->as))
{
if (bgp_debug_update(rsclient, p, NULL, 0))
zlog_debug ("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
rsclient->host, rsclient->as);
return 0;
}
#endif /* BGP_SEND_ASPATH_CHECK */
/* For modify attribute, copy it to temporary structure. */
bgp_attr_dup (attr, riattr);
/* next-hop-set */
if ((p->family == AF_INET && attr->nexthop.s_addr == 0)
#ifdef HAVE_IPV6
|| (p->family == AF_INET6 &&
IN6_IS_ADDR_UNSPECIFIED(&attr->extra->mp_nexthop_global))
#endif /* HAVE_IPV6 */
)
{
/* Set IPv4 nexthop. */
if (p->family == AF_INET)
{
if (safi == SAFI_MPLS_VPN)
memcpy (&attr->extra->mp_nexthop_global_in, &rsclient->nexthop.v4,
IPV4_MAX_BYTELEN);
else
memcpy (&attr->nexthop, &rsclient->nexthop.v4, IPV4_MAX_BYTELEN);
}
#ifdef HAVE_IPV6
/* Set IPv6 nexthop. */
if (p->family == AF_INET6)
{
/* IPv6 global nexthop must be included. */
memcpy (&attr->extra->mp_nexthop_global, &rsclient->nexthop.v6_global,
IPV6_MAX_BYTELEN);
attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
#endif /* HAVE_IPV6 */
}
#ifdef HAVE_IPV6
if (p->family == AF_INET6)
{
struct attr_extra *attre = attr->extra;
/* Left nexthop_local unchanged if so configured. */
if ( CHECK_FLAG (rsclient->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) )
{
if ( IN6_IS_ADDR_LINKLOCAL (&attre->mp_nexthop_local) )
attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
else
attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
/* Default nexthop_local treatment for RS-Clients */
else
{
/* Announcer and RS-Client are both in the same network */
if (rsclient->shared_network && from->shared_network &&
(rsclient->ifindex == from->ifindex))
{
if ( IN6_IS_ADDR_LINKLOCAL (&attre->mp_nexthop_local) )
attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
else
attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
/* Set link-local address for shared network peer. */
else if (rsclient->shared_network
&& IN6_IS_ADDR_LINKLOCAL (&rsclient->nexthop.v6_local))
{
memcpy (&attre->mp_nexthop_local, &rsclient->nexthop.v6_local,
IPV6_MAX_BYTELEN);
attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
}
else
attre->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
}
#endif /* HAVE_IPV6 */
/* If this is EBGP peer and remove-private-AS is set. */
if (rsclient->sort == BGP_PEER_EBGP
&& peer_af_flag_check (rsclient, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS)
&& aspath_private_as_check (attr->aspath))
attr->aspath = aspath_empty_get ();
/* Route map & unsuppress-map apply. */
if (ROUTE_MAP_OUT_NAME (filter) || (ri->extra && ri->extra->suppress) )
{
info.peer = rsclient;
info.attr = attr;
SET_FLAG (rsclient->rmap_type, PEER_RMAP_TYPE_OUT);
if (ri->extra && ri->extra->suppress)
ret = route_map_apply (UNSUPPRESS_MAP (filter), p, RMAP_BGP, &info);
else
ret = route_map_apply (ROUTE_MAP_OUT (filter), p, RMAP_BGP, &info);
rsclient->rmap_type = 0;
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (attr);
return 0;
}
}
return 1;
}
static int static int
subgroup_announce_check_rsclient (struct bgp_info *ri, subgroup_announce_check_rsclient (struct bgp_info *ri,
struct update_subgroup *subgrp, struct update_subgroup *subgrp,
@ -2207,7 +1708,6 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
struct bgp_info *nextri = NULL; struct bgp_info *nextri = NULL;
int paths_eq, do_mpath, debug; int paths_eq, do_mpath, debug;
struct list mp_list; struct list mp_list;
char buf[INET6_BUFSIZ];
char pfx_buf[INET6_ADDRSTRLEN]; char pfx_buf[INET6_ADDRSTRLEN];
bgp_mp_list_init (&mp_list); bgp_mp_list_init (&mp_list);
@ -2375,7 +1875,6 @@ subgroup_process_announce_selected (struct update_subgroup *subgrp,
struct bgp_node *rn) struct bgp_node *rn)
{ {
struct prefix *p; struct prefix *p;
struct peer_af *paf;
struct peer *onlypeer; struct peer *onlypeer;
struct attr attr; struct attr attr;
struct attr_extra extra; struct attr_extra extra;
@ -2526,8 +2025,6 @@ bgp_process_main (struct work_queue *wq, void *data)
struct bgp_info *new_select; struct bgp_info *new_select;
struct bgp_info *old_select; struct bgp_info *old_select;
struct bgp_info_pair old_and_new; struct bgp_info_pair old_and_new;
struct listnode *node, *nnode;
struct peer *peer;
/* Is it end of initial update? (after startup) */ /* Is it end of initial update? (after startup) */
if (!rn) if (!rn)
@ -2889,8 +2386,6 @@ bgp_info_addpath_rx_str(struct bgp_info *ri, char *buf)
{ {
if (ri && ri->addpath_rx_id) if (ri && ri->addpath_rx_id)
sprintf(buf, " with addpath ID %d", ri->addpath_rx_id); sprintf(buf, " with addpath ID %d", ri->addpath_rx_id);
else
sprintf(buf, "");
} }
static void static void
@ -3675,8 +3170,6 @@ bgp_announce_route (struct peer *peer, afi_t afi, safi_t safi)
void void
bgp_announce_route_all (struct peer *peer) bgp_announce_route_all (struct peer *peer)
{ {
struct peer_af *paf;
int af;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -3890,7 +3383,6 @@ bgp_clear_route_table (struct peer *peer, afi_t afi, safi_t safi,
struct bgp_info *ri; struct bgp_info *ri;
struct bgp_adj_in *ain; struct bgp_adj_in *ain;
struct bgp_adj_in *ain_next; struct bgp_adj_in *ain_next;
struct bgp_adj_out *aout;
/* XXX:TODO: This is suboptimal, every non-empty route_node is /* XXX:TODO: This is suboptimal, every non-empty route_node is
* queued for every clearing peer, regardless of whether it is * queued for every clearing peer, regardless of whether it is
@ -5076,8 +4568,6 @@ bgp_static_redo_import_check (struct bgp *bgp)
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_node *rm;
struct bgp_table *table;
struct bgp_static *bgp_static; struct bgp_static *bgp_static;
/* Use this flag to force reprocessing of the route */ /* Use this flag to force reprocessing of the route */
@ -5816,8 +5306,10 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
struct aspath *asmerge = NULL; struct aspath *asmerge = NULL;
struct community *community = NULL; struct community *community = NULL;
struct community *commerge = NULL; struct community *commerge = NULL;
#if defined(AGGREGATE_NEXTHOP_CHECK)
struct in_addr nexthop; struct in_addr nexthop;
u_int32_t med = 0; u_int32_t med = 0;
#endif
struct bgp_info *ri; struct bgp_info *ri;
struct bgp_info *new; struct bgp_info *new;
int first = 1; int first = 1;
@ -5825,11 +5317,13 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
u_char atomic_aggregate = 0; u_char atomic_aggregate = 0;
/* Record adding route's nexthop and med. */ /* Record adding route's nexthop and med. */
if (rinew) if (rinew)
{ {
nexthop = rinew->attr->nexthop; #if defined(AGGREGATE_NEXTHOP_CHECK)
med = rinew->attr->med; nexthop = rinew->attr->nexthop;
} med = rinew->attr->med;
#endif
}
/* ORIGIN attribute: If at least one route among routes that are /* ORIGIN attribute: If at least one route among routes that are
aggregated has ORIGIN with the value INCOMPLETE, then the aggregated has ORIGIN with the value INCOMPLETE, then the
@ -5859,8 +5353,10 @@ bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
if (! rinew && first) if (! rinew && first)
{ {
#if defined(AGGREGATE_NEXTHOP_CHECK)
nexthop = ri->attr->nexthop; nexthop = ri->attr->nexthop;
med = ri->attr->med; med = ri->attr->med;
#endif
first = 0; first = 0;
} }
@ -6932,12 +6428,10 @@ static void
route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo, route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo,
json_object *json_path) json_object *json_path)
{ {
json_object *json_boolean_false;
json_object *json_boolean_true; json_object *json_boolean_true;
if (json_path) if (json_path)
{ {
json_boolean_false = json_object_new_boolean(0);
json_boolean_true = json_object_new_boolean(1); json_boolean_true = json_object_new_boolean(1);
/* Route status display. */ /* Route status display. */
@ -7405,10 +6899,10 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
#endif #endif
json_object *json_int; json_object *json_int;
json_object *json_string; json_object *json_string;
json_object *json_path; json_object *json_path = NULL;
json_object *json_boolean_false; json_object *json_boolean_false;
json_object *json_boolean_true; json_object *json_boolean_true = NULL;
json_object *json_cluster_list; json_object *json_cluster_list = NULL;
if (json_paths) if (json_paths)
{ {
@ -8197,7 +7691,7 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, struct in_addr *router
if (!use_json && header) if (!use_json && header)
{ {
vty_out (vty, "BGP table version is %llu, local router ID is %s%s", table->version, inet_ntoa (*router_id), VTY_NEWLINE); vty_out (vty, "BGP table version is %" PRIu64 ", local router ID is %s%s", table->version, inet_ntoa (*router_id), VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
if (type == bgp_show_type_dampend_paths if (type == bgp_show_type_dampend_paths
@ -8317,7 +7811,7 @@ route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
int first = 0; int first = 0;
json_object *json_string; json_object *json_string;
json_object *json_int; json_object *json_int;
json_object *json_adv_to; json_object *json_adv_to = NULL;
p = &rn->p; p = &rn->p;
@ -12104,7 +11598,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts,
static void static void
show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
int in, char *rmap_name) int in, const char *rmap_name)
{ {
struct bgp_table *table; struct bgp_table *table;
struct bgp_adj_in *ain; struct bgp_adj_in *ain;
@ -12131,7 +11625,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
if (! in && CHECK_FLAG (peer->af_sflags[afi][safi], if (! in && CHECK_FLAG (peer->af_sflags[afi][safi],
PEER_STATUS_DEFAULT_ORIGINATE)) PEER_STATUS_DEFAULT_ORIGINATE))
{ {
vty_out (vty, "BGP table version is %llu, local router ID is %s%s", table->version, inet_ntoa (bgp->router_id), VTY_NEWLINE); vty_out (vty, "BGP table version is %" PRIu64 ", local router ID is %s%s", table->version, inet_ntoa (bgp->router_id), VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
@ -12180,7 +11674,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
{ {
if (header1) if (header1)
{ {
vty_out (vty, "BGP table version is %llu, local router ID " vty_out (vty, "BGP table version is %" PRIu64 ", local router ID "
"is %s%s", table->version, "is %s%s", table->version,
inet_ntoa (bgp->router_id), VTY_NEWLINE); inet_ntoa (bgp->router_id), VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
@ -12223,7 +11717,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
static int static int
peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
int in, char *rmap_name) int in, const char *rmap_name)
{ {
if (! peer || ! peer->afc[afi][safi]) if (! peer || ! peer->afc[afi][safi])
{ {
@ -12293,7 +11787,7 @@ DEFUN (show_ip_bgp_neighbor_advertised_route,
{ {
struct peer *peer; struct peer *peer;
char *rmap_name = NULL; const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[0]); peer = peer_lookup_in_view (vty, NULL, argv[0]);
@ -12334,7 +11828,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
"Display the routes advertised to a BGP neighbor\n") "Display the routes advertised to a BGP neighbor\n")
{ {
struct peer *peer; struct peer *peer;
char *rmap_name = NULL; const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[1]); peer = peer_lookup_in_view (vty, NULL, argv[1]);
if (! peer) if (! peer)
@ -12419,7 +11913,7 @@ DEFUN (show_bgp_neighbor_advertised_route,
{ {
struct peer *peer; struct peer *peer;
char *rmap_name = NULL; const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[0]); peer = peer_lookup_in_view (vty, NULL, argv[0]);
@ -12585,7 +12079,7 @@ DEFUN (show_ip_bgp_neighbor_received_routes,
{ {
struct peer *peer; struct peer *peer;
char *rmap_name = NULL; const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[0]); peer = peer_lookup_in_view (vty, NULL, argv[0]);
@ -12626,7 +12120,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
"Display the received routes from neighbor\n") "Display the received routes from neighbor\n")
{ {
struct peer *peer; struct peer *peer;
char *rmap_name = NULL; const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[1]); peer = peer_lookup_in_view (vty, NULL, argv[1]);
if (! peer) if (! peer)
@ -14278,7 +13772,6 @@ bgp_distance_unset (struct vty *vty, const char *distance_str,
{ {
int ret; int ret;
struct prefix_ipv4 p; struct prefix_ipv4 p;
u_char distance;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_distance *bdistance; struct bgp_distance *bdistance;
@ -14289,8 +13782,6 @@ bgp_distance_unset (struct vty *vty, const char *distance_str,
return CMD_WARNING; return CMD_WARNING;
} }
distance = atoi (distance_str);
rn = bgp_node_lookup (bgp_distance_table, (struct prefix *)&p); rn = bgp_node_lookup (bgp_distance_table, (struct prefix *)&p);
if (! rn) if (! rn)
{ {

View File

@ -960,7 +960,6 @@ route_match_interface (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
struct interface *ifp; struct interface *ifp;
struct nexthop *nexthop;
struct bgp_info *info; struct bgp_info *info;
if (type == RMAP_BGP) if (type == RMAP_BGP)
@ -1382,7 +1381,6 @@ route_set_metric (void *rule, struct prefix *prefix,
static void * static void *
route_set_metric_compile (const char *arg) route_set_metric_compile (const char *arg)
{ {
u_int32_t metric;
unsigned long larg; unsigned long larg;
char *endptr = NULL; char *endptr = NULL;
@ -1393,7 +1391,6 @@ route_set_metric_compile (const char *arg)
larg = strtoul (arg, &endptr, 10); larg = strtoul (arg, &endptr, 10);
if (*endptr != '\0' || errno || larg > UINT32_MAX) if (*endptr != '\0' || errno || larg > UINT32_MAX)
return NULL; return NULL;
metric = larg;
} }
else else
{ {
@ -1407,7 +1404,6 @@ route_set_metric_compile (const char *arg)
larg = strtoul (arg+1, &endptr, 10); larg = strtoul (arg+1, &endptr, 10);
if (*endptr != '\0' || errno || larg > UINT32_MAX) if (*endptr != '\0' || errno || larg > UINT32_MAX)
return NULL; return NULL;
metric = larg;
} }
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
@ -2077,12 +2073,10 @@ static route_map_result_t
route_match_ipv6_next_hop (void *rule, struct prefix *prefix, route_match_ipv6_next_hop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
struct in6_addr *addr;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
if (type == RMAP_BGP) if (type == RMAP_BGP)
{ {
addr = rule;
bgp_info = object; bgp_info = object;
if (!bgp_info->attr->extra) if (!bgp_info->attr->extra)
@ -2314,7 +2308,6 @@ static route_map_result_t
route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix, route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
int *use_peer_address;
struct in6_addr peer_address; struct in6_addr peer_address;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
struct peer *peer; struct peer *peer;
@ -2323,7 +2316,6 @@ route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
if (type == RMAP_BGP) if (type == RMAP_BGP)
{ {
/* Fetch routemap's rule information. */ /* Fetch routemap's rule information. */
use_peer_address = rule;
bgp_info = object; bgp_info = object;
peer = bgp_info->peer; peer = bgp_info->peer;
@ -2550,7 +2542,7 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
route_map_event_t type) route_map_event_t type)
{ {
int ret; int ret;
char *dep_name = (char *)arg; char *dep_name = NULL;
const char *tmpstr; const char *tmpstr;
char *rmap_name = NULL; char *rmap_name = NULL;
@ -2562,6 +2554,10 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
if ((tmpstr = route_map_get_match_arg(index, command)) != NULL) if ((tmpstr = route_map_get_match_arg(index, command)) != NULL)
dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, tmpstr); dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, tmpstr);
} }
else
{
dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, arg);
}
rmap_name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, index->map->name); rmap_name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, index->map->name);
} }
@ -2577,7 +2573,7 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE); vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
break; break;
} }
if (arg == NULL && dep_name) if (dep_name)
XFREE(MTYPE_ROUTE_MAP_RULE, dep_name); XFREE(MTYPE_ROUTE_MAP_RULE, dep_name);
if (rmap_name) if (rmap_name)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name); XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
@ -2587,7 +2583,7 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
if (type != RMAP_EVENT_MATCH_DELETED && dep_name) if (type != RMAP_EVENT_MATCH_DELETED && dep_name)
route_map_upd8_dependency(type, dep_name, rmap_name); route_map_upd8_dependency(type, dep_name, rmap_name);
if (arg == NULL && dep_name) if (dep_name)
XFREE(MTYPE_ROUTE_MAP_RULE, dep_name); XFREE(MTYPE_ROUTE_MAP_RULE, dep_name);
if (rmap_name) if (rmap_name)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name); XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
@ -2646,7 +2642,7 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
* modifications. * modifications.
*/ */
static void static void
bgp_route_map_process_peer (char *rmap_name, struct peer *peer, bgp_route_map_process_peer (const char *rmap_name, struct peer *peer,
int afi, int safi, int route_update) int afi, int safi, int route_update)
{ {
@ -2763,7 +2759,7 @@ bgp_route_map_process_peer (char *rmap_name, struct peer *peer,
} }
static void static void
bgp_route_map_update_peer_group(char *rmap_name, struct bgp *bgp) bgp_route_map_update_peer_group(const char *rmap_name, struct bgp *bgp)
{ {
struct peer_group *group; struct peer_group *group;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -2798,7 +2794,7 @@ bgp_route_map_update_peer_group(char *rmap_name, struct bgp *bgp)
} }
static int static int
bgp_route_map_process_update (void *arg, char *rmap_name, int route_update) bgp_route_map_process_update (void *arg, const char *rmap_name, int route_update)
{ {
int i; int i;
afi_t afi; afi_t afi;
@ -2935,7 +2931,7 @@ bgp_route_map_update_timer(struct thread *thread)
} }
static void static void
bgp_route_map_mark_update (char *rmap_name) bgp_route_map_mark_update (const char *rmap_name)
{ {
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct bgp *bgp; struct bgp *bgp;
@ -4209,11 +4205,8 @@ DEFUN (set_aggregator_as,
"IP address of aggregator\n") "IP address of aggregator\n")
{ {
int ret; int ret;
as_t as;
struct in_addr address; struct in_addr address;
char *argstr; char *argstr;
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
ret = inet_aton (argv[1], &address); ret = inet_aton (argv[1], &address);
if (ret == 0) if (ret == 0)
@ -4243,15 +4236,12 @@ DEFUN (no_set_aggregator_as,
"AS number of aggregator\n") "AS number of aggregator\n")
{ {
int ret; int ret;
as_t as;
struct in_addr address; struct in_addr address;
char *argstr; char *argstr;
if (argv == 0) if (argv == 0)
return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL); return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL);
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
ret = inet_aton (argv[1], &address); ret = inet_aton (argv[1], &address);
if (ret == 0) if (ret == 0)
{ {

View File

@ -254,9 +254,9 @@ static void *
updgrp_hash_alloc (void *p) updgrp_hash_alloc (void *p)
{ {
struct update_group *updgrp; struct update_group *updgrp;
struct update_group *in; const struct update_group *in;
in = p; in = (const struct update_group *)p;
updgrp = XCALLOC (MTYPE_BGP_UPDGRP, sizeof (struct update_group)); updgrp = XCALLOC (MTYPE_BGP_UPDGRP, sizeof (struct update_group));
memcpy (updgrp, in, sizeof (struct update_group)); memcpy (updgrp, in, sizeof (struct update_group));
updgrp->conf = XCALLOC (MTYPE_BGP_PEER, sizeof (struct peer)); updgrp->conf = XCALLOC (MTYPE_BGP_PEER, sizeof (struct peer));
@ -529,7 +529,7 @@ update_group_show_walkcb (struct update_group *updgrp, void *arg)
int match = 0; int match = 0;
if (!ctx) if (!ctx)
return; return CMD_SUCCESS;
if (ctx->subgrp_id) if (ctx->subgrp_id)
{ {
@ -558,7 +558,7 @@ update_group_show_walkcb (struct update_group *updgrp, void *arg)
vty = ctx->vty; vty = ctx->vty;
vty_out (vty, "Update-group %llu:%s", updgrp->id, VTY_NEWLINE); vty_out (vty, "Update-group %" PRIu64 ":%s", updgrp->id, VTY_NEWLINE);
vty_out (vty, " Created: %s", timestamp_string (updgrp->uptime)); vty_out (vty, " Created: %s", timestamp_string (updgrp->uptime));
filter = &updgrp->conf->filter[updgrp->afi][updgrp->safi]; filter = &updgrp->conf->filter[updgrp->afi][updgrp->safi];
if (filter->map[RMAP_OUT].name) if (filter->map[RMAP_OUT].name)
@ -581,14 +581,14 @@ update_group_show_walkcb (struct update_group *updgrp, void *arg)
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, " Update-subgroup %llu:%s", subgrp->id, VTY_NEWLINE); vty_out (vty, " Update-subgroup %" PRIu64 ":%s", subgrp->id, VTY_NEWLINE);
vty_out (vty, " Created: %s", timestamp_string (subgrp->uptime)); vty_out (vty, " Created: %s", timestamp_string (subgrp->uptime));
if (subgrp->split_from.update_group_id || subgrp->split_from.subgroup_id) if (subgrp->split_from.update_group_id || subgrp->split_from.subgroup_id)
{ {
vty_out (vty, " Split from group id: %llu%s", vty_out (vty, " Split from group id: %" PRIu64 "%s",
subgrp->split_from.update_group_id, VTY_NEWLINE); subgrp->split_from.update_group_id, VTY_NEWLINE);
vty_out (vty, " Split from subgroup id: %llu%s", vty_out (vty, " Split from subgroup id: %" PRIu64 "%s",
subgrp->split_from.subgroup_id, VTY_NEWLINE); subgrp->split_from.subgroup_id, VTY_NEWLINE);
} }
@ -605,7 +605,7 @@ update_group_show_walkcb (struct update_group *updgrp, void *arg)
subgrp->peer_refreshes_combined, VTY_NEWLINE); subgrp->peer_refreshes_combined, VTY_NEWLINE);
vty_out (vty, " Merge checks triggered: %u%s", vty_out (vty, " Merge checks triggered: %u%s",
subgrp->merge_checks_triggered, VTY_NEWLINE); subgrp->merge_checks_triggered, VTY_NEWLINE);
vty_out (vty, " Version: %llu%s", subgrp->version, VTY_NEWLINE); vty_out (vty, " Version: %" PRIu64 "%s", subgrp->version, VTY_NEWLINE);
vty_out (vty, " Packet queue length: %d%s", vty_out (vty, " Packet queue length: %d%s",
bpacket_queue_length (SUBGRP_PKTQ (subgrp)), VTY_NEWLINE); bpacket_queue_length (SUBGRP_PKTQ (subgrp)), VTY_NEWLINE);
vty_out (vty, " Total packets enqueued: %u%s", vty_out (vty, " Total packets enqueued: %u%s",
@ -646,7 +646,7 @@ updgrp_show_packet_queue_walkcb (struct update_group *updgrp, void *arg)
{ {
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
vty_out (vty, "update group %llu, subgroup %llu%s", updgrp->id, vty_out (vty, "update group %" PRIu64 ", subgroup %" PRIu64 "%s", updgrp->id,
subgrp->id, VTY_NEWLINE); subgrp->id, VTY_NEWLINE);
bpacket_queue_show_vty (SUBGRP_PKTQ (subgrp), vty); bpacket_queue_show_vty (SUBGRP_PKTQ (subgrp), vty);
} }
@ -710,7 +710,7 @@ update_group_create (struct peer_af *paf)
update_group_checkin (updgrp); update_group_checkin (updgrp);
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("create update group %llu", updgrp->id); zlog_debug ("create update group %" PRIu64, updgrp->id);
UPDGRP_GLOBAL_STAT (updgrp, updgrps_created) += 1; UPDGRP_GLOBAL_STAT (updgrp, updgrps_created) += 1;
@ -721,7 +721,7 @@ static void
update_group_delete (struct update_group *updgrp) update_group_delete (struct update_group *updgrp)
{ {
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("delete update group %llu", updgrp->id); zlog_debug ("delete update group %" PRIu64, updgrp->id);
UPDGRP_GLOBAL_STAT (updgrp, updgrps_deleted) += 1; UPDGRP_GLOBAL_STAT (updgrp, updgrps_deleted) += 1;
@ -768,7 +768,7 @@ update_subgroup_create (struct update_group *updgrp)
bpacket_queue_add (SUBGRP_PKTQ (subgrp), NULL, NULL); bpacket_queue_add (SUBGRP_PKTQ (subgrp), NULL, NULL);
TAILQ_INIT (&(subgrp->adjq)); TAILQ_INIT (&(subgrp->adjq));
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("create subgroup u%llu:s%llu", zlog_debug ("create subgroup u%" PRIu64 ":s%" PRIu64,
updgrp->id, subgrp->id); updgrp->id, subgrp->id);
update_group_add_subgroup (updgrp, subgrp); update_group_add_subgroup (updgrp, subgrp);
@ -801,7 +801,7 @@ update_subgroup_delete (struct update_subgroup *subgrp)
sync_delete (subgrp); sync_delete (subgrp);
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("delete subgroup u%llu:s%llu", zlog_debug ("delete subgroup u%" PRIu64 ":s%" PRIu64,
subgrp->update_group->id, subgrp->id); subgrp->update_group->id, subgrp->id);
update_group_remove_subgroup (subgrp->update_group, subgrp); update_group_remove_subgroup (subgrp->update_group, subgrp);
@ -859,7 +859,7 @@ update_subgroup_add_peer (struct update_subgroup *subgrp, struct peer_af *paf,
paf->subgroup = subgrp; paf->subgroup = subgrp;
subgrp->peer_count++; subgrp->peer_count++;
if (bgp_debug_peer_updout_enabled(paf->peer)) if (bgp_debug_peer_updout_enabled(paf->peer->host))
{ {
UPDGRP_PEER_DBG_EN(subgrp->update_group); UPDGRP_PEER_DBG_EN(subgrp->update_group);
} }
@ -902,7 +902,7 @@ update_subgroup_remove_peer_internal (struct update_subgroup *subgrp,
{ {
assert (subgrp && paf); assert (subgrp && paf);
if (bgp_debug_peer_updout_enabled(paf->peer)) if (bgp_debug_peer_updout_enabled(paf->peer->host))
{ {
UPDGRP_PEER_DBG_DIS(subgrp->update_group); UPDGRP_PEER_DBG_DIS(subgrp->update_group);
} }
@ -1083,7 +1083,7 @@ update_subgroup_merge (struct update_subgroup *subgrp,
SUBGRP_INCR_STAT (target, merge_events); SUBGRP_INCR_STAT (target, merge_events);
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("u%llu:s%llu (%d peers) merged into u%llu:s%llu, " zlog_debug ("u%" PRIu64 ":s%" PRIu64 " (%d peers) merged into u%" PRIu64 ":s%" PRIu64 ", "
"trigger: %s", subgrp->update_group->id, subgrp->id, peer_count, "trigger: %s", subgrp->update_group->id, subgrp->id, peer_count,
target->update_group->id, target->id, reason ? reason : "unknown"); target->update_group->id, target->id, reason ? reason : "unknown");
@ -1222,7 +1222,7 @@ update_subgroup_copy_packets (struct update_subgroup *dest,
} }
static int static int
updgrp_prefix_list_update (struct update_group *updgrp, char *name) updgrp_prefix_list_update (struct update_group *updgrp, const char *name)
{ {
struct peer *peer; struct peer *peer;
struct bgp_filter *filter; struct bgp_filter *filter;
@ -1241,7 +1241,7 @@ updgrp_prefix_list_update (struct update_group *updgrp, char *name)
} }
static int static int
updgrp_filter_list_update (struct update_group *updgrp, char *name) updgrp_filter_list_update (struct update_group *updgrp, const char *name)
{ {
struct peer *peer; struct peer *peer;
struct bgp_filter *filter; struct bgp_filter *filter;
@ -1259,7 +1259,7 @@ updgrp_filter_list_update (struct update_group *updgrp, char *name)
} }
static int static int
updgrp_distribute_list_update (struct update_group *updgrp, char *name) updgrp_distribute_list_update (struct update_group *updgrp, const char *name)
{ {
struct peer *peer; struct peer *peer;
struct bgp_filter *filter; struct bgp_filter *filter;
@ -1278,7 +1278,7 @@ updgrp_distribute_list_update (struct update_group *updgrp, char *name)
} }
static int static int
updgrp_route_map_update (struct update_group *updgrp, char *name, updgrp_route_map_update (struct update_group *updgrp, const char *name,
int *def_rmap_changed) int *def_rmap_changed)
{ {
struct peer *peer; struct peer *peer;
@ -1381,14 +1381,14 @@ updgrp_policy_update_walkcb (struct update_group *updgrp, void *arg)
if (changed) if (changed)
{ {
if (bgp_debug_update(NULL, NULL, updgrp, 0)) if (bgp_debug_update(NULL, NULL, updgrp, 0))
zlog_debug ("u%llu:s%llu announcing routes upon policy %s (type %d) change", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " announcing routes upon policy %s (type %d) change",
updgrp->id, subgrp->id, ctx->policy_name, ctx->policy_type); updgrp->id, subgrp->id, ctx->policy_name, ctx->policy_type);
subgroup_announce_route (subgrp); subgroup_announce_route (subgrp);
} }
if (def_changed) if (def_changed)
{ {
if (bgp_debug_update(NULL, NULL, updgrp, 0)) if (bgp_debug_update(NULL, NULL, updgrp, 0))
zlog_debug ("u%llu:s%llu announcing default upon default routemap %s change", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " announcing default upon default routemap %s change",
updgrp->id, subgrp->id, ctx->policy_name); updgrp->id, subgrp->id, ctx->policy_name);
subgroup_default_originate (subgrp, 0); subgroup_default_originate (subgrp, 0);
} }
@ -1439,7 +1439,7 @@ update_group_periodic_merge_walkcb (struct update_group *updgrp, void *arg)
*/ */
void void
update_group_policy_update (struct bgp *bgp, bgp_policy_type_e ptype, update_group_policy_update (struct bgp *bgp, bgp_policy_type_e ptype,
char *pname, int route_update, int start_event) const char *pname, int route_update, int start_event)
{ {
struct updwalk_context ctx; struct updwalk_context ctx;
@ -1483,7 +1483,7 @@ update_subgroup_split_peer (struct peer_af *paf, struct update_group *updgrp)
subgrp = old_subgrp; subgrp = old_subgrp;
old_id = old_subgrp->update_group->id; old_id = old_subgrp->update_group->id;
if (bgp_debug_peer_updout_enabled(paf->peer)) if (bgp_debug_peer_updout_enabled(paf->peer->host))
{ {
UPDGRP_PEER_DBG_DIS(old_subgrp->update_group); UPDGRP_PEER_DBG_DIS(old_subgrp->update_group);
} }
@ -1491,12 +1491,12 @@ update_subgroup_split_peer (struct peer_af *paf, struct update_group *updgrp)
update_group_remove_subgroup (old_subgrp->update_group, old_subgrp); update_group_remove_subgroup (old_subgrp->update_group, old_subgrp);
update_group_add_subgroup (updgrp, subgrp); update_group_add_subgroup (updgrp, subgrp);
if (bgp_debug_peer_updout_enabled(paf->peer)) if (bgp_debug_peer_updout_enabled(paf->peer->host))
{ {
UPDGRP_PEER_DBG_EN(updgrp); UPDGRP_PEER_DBG_EN(updgrp);
} }
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("u%llu:s%llu peer %s moved to u%llu:s%llu", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " peer %s moved to u%" PRIu64 ":s%" PRIu64,
old_id, subgrp->id, paf->peer->host, updgrp->id, subgrp->id); old_id, subgrp->id, paf->peer->host, updgrp->id, subgrp->id);
/* /*
@ -1529,7 +1529,7 @@ update_subgroup_split_peer (struct peer_af *paf, struct update_group *updgrp)
update_subgroup_copy_packets (subgrp, paf->next_pkt_to_send); update_subgroup_copy_packets (subgrp, paf->next_pkt_to_send);
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("u%llu:s%llu peer %s split and moved into u%llu:s%llu", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " peer %s split and moved into u%" PRIu64 ":s%" PRIu64,
paf->subgroup->update_group->id, paf->subgroup->id, paf->subgroup->update_group->id, paf->subgroup->id,
paf->peer->host, updgrp->id, subgrp->id); paf->peer->host, updgrp->id, subgrp->id);
@ -1674,7 +1674,7 @@ update_group_adjust_peer (struct peer_af *paf)
update_subgroup_add_peer (subgrp, paf, 1); update_subgroup_add_peer (subgrp, paf, 1);
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("u%llu:s%llu add peer %s", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " add peer %s",
updgrp->id, subgrp->id, paf->peer->host); updgrp->id, subgrp->id, paf->peer->host);
return; return;
@ -1771,7 +1771,6 @@ update_group_default_originate_route_map_walkcb(struct update_group *updgrp,
{ {
struct update_subgroup *subgrp; struct update_subgroup *subgrp;
struct peer *peer; struct peer *peer;
struct peer_af *paf;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -1790,7 +1789,7 @@ update_group_default_originate_route_map_walkcb(struct update_group *updgrp,
return UPDWALK_CONTINUE; return UPDWALK_CONTINUE;
} }
void int
update_group_refresh_default_originate_route_map (struct thread *thread) update_group_refresh_default_originate_route_map (struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
@ -1801,6 +1800,8 @@ update_group_refresh_default_originate_route_map (struct thread *thread)
reason); reason);
THREAD_TIMER_OFF (bgp->t_rmap_def_originate_eval); THREAD_TIMER_OFF (bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp); bgp_unlock(bgp);
return(0);
} }
/* /*
@ -1827,8 +1828,6 @@ peer_af_announce_route (struct peer_af *paf, int combine)
if (combine) if (combine)
{ {
struct peer_af *temp_paf;
/* /*
* If there are other peers in the old subgroup that also need * If there are other peers in the old subgroup that also need
* routes to be announced, pull them into the peer's new * routes to be announced, pull them into the peer's new
@ -1863,7 +1862,7 @@ peer_af_announce_route (struct peer_af *paf, int combine)
return; return;
if (bgp_debug_update(paf->peer, NULL, subgrp->update_group, 0)) if (bgp_debug_update(paf->peer, NULL, subgrp->update_group, 0))
zlog_debug ("u%llu:s%llu %s announcing routes", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s announcing routes",
subgrp->update_group->id, subgrp->id, paf->peer->host); subgrp->update_group->id, subgrp->id, paf->peer->host);
subgroup_announce_route (paf->subgroup); subgroup_announce_route (paf->subgroup);
@ -1884,7 +1883,7 @@ peer_af_announce_route (struct peer_af *paf, int combine)
} }
if (bgp_debug_update(paf->peer, NULL, subgrp->update_group, 0)) if (bgp_debug_update(paf->peer, NULL, subgrp->update_group, 0))
zlog_debug ("u%llu:s%llu announcing routes to %s, combined into %d peers", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " announcing routes to %s, combined into %d peers",
subgrp->update_group->id, subgrp->id, subgrp->update_group->id, subgrp->id,
paf->peer->host, subgrp->peer_count); paf->peer->host, subgrp->peer_count);

View File

@ -290,7 +290,7 @@ struct updwalk_context
u_int64_t updgrp_id; u_int64_t updgrp_id;
u_int64_t subgrp_id; u_int64_t subgrp_id;
bgp_policy_type_e policy_type; bgp_policy_type_e policy_type;
char *policy_name; const char *policy_name;
int policy_event_start_flag; int policy_event_start_flag;
int policy_route_update; int policy_route_update;
updgrp_walkcb cb; updgrp_walkcb cb;
@ -371,13 +371,13 @@ extern int
update_subgroup_trigger_merge_check (struct update_subgroup *, update_subgroup_trigger_merge_check (struct update_subgroup *,
int force); int force);
extern void update_group_policy_update (struct bgp *bgp, extern void update_group_policy_update (struct bgp *bgp,
bgp_policy_type_e ptype, char *pname, bgp_policy_type_e ptype, const char *pname,
int route_update, int start_event); int route_update, int start_event);
extern void update_group_af_walk (struct bgp *bgp, afi_t afi, safi_t safi, extern void update_group_af_walk (struct bgp *bgp, afi_t afi, safi_t safi,
updgrp_walkcb cb, void *ctx); updgrp_walkcb cb, void *ctx);
extern void update_group_walk (struct bgp *bgp, updgrp_walkcb cb, void *ctx); extern void update_group_walk (struct bgp *bgp, updgrp_walkcb cb, void *ctx);
extern void update_group_periodic_merge (struct bgp *bgp); extern void update_group_periodic_merge (struct bgp *bgp);
extern void update_group_refresh_default_originate_route_map (struct thread *thread); extern int update_group_refresh_default_originate_route_map (struct thread *thread);
extern void update_group_start_advtimer (struct bgp *bgp); extern void update_group_start_advtimer (struct bgp *bgp);
extern void update_subgroup_inherit_info (struct update_subgroup *to, extern void update_subgroup_inherit_info (struct update_subgroup *to,

View File

@ -124,7 +124,7 @@ subgrp_show_adjq_vty (struct update_subgroup *subgrp, struct vty *vty,
if (header1) if (header1)
{ {
vty_out (vty, vty_out (vty,
"BGP table version is %llu, local router ID is %s%s", "BGP table version is %" PRIu64 ", local router ID is %s%s",
table->version, inet_ntoa (bgp->router_id), table->version, inet_ntoa (bgp->router_id),
VTY_NEWLINE); VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
@ -165,7 +165,7 @@ updgrp_show_adj_walkcb (struct update_group *updgrp, void *arg)
{ {
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;
vty_out (vty, "update group %llu, subgroup %llu%s", updgrp->id, vty_out (vty, "update group %" PRIu64 ", subgroup %" PRIu64 "%s", updgrp->id,
subgrp->id, VTY_NEWLINE); subgrp->id, VTY_NEWLINE);
subgrp_show_adjq_vty (subgrp, vty, ctx->flags); subgrp_show_adjq_vty (subgrp, vty, ctx->flags);
} }
@ -192,7 +192,7 @@ subgroup_coalesce_timer (struct thread *thread)
subgrp = THREAD_ARG (thread); subgrp = THREAD_ARG (thread);
if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0)) if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0))
zlog_debug ("u%llu:s%llu announcing routes upon coalesce timer expiry", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " announcing routes upon coalesce timer expiry",
(SUBGRP_UPDGRP (subgrp))->id, subgrp->id); (SUBGRP_UPDGRP (subgrp))->id, subgrp->id);
subgrp->t_coalesce = NULL; subgrp->t_coalesce = NULL;
subgrp->v_coalesce = 0; subgrp->v_coalesce = 0;
@ -707,7 +707,7 @@ subgroup_announce_all (struct update_subgroup *subgrp)
if (!subgrp->v_coalesce) if (!subgrp->v_coalesce)
{ {
if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0)) if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0))
zlog_debug ("u%llu:s%llu announcing all routes", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " announcing all routes",
subgrp->update_group->id, subgrp->id); subgrp->update_group->id, subgrp->id);
subgroup_announce_route (subgrp); subgroup_announce_route (subgrp);
return; return;

View File

@ -602,7 +602,7 @@ subgroup_update_packet (struct update_subgroup *subgrp)
int space_remaining = 0; int space_remaining = 0;
int space_needed = 0; int space_needed = 0;
char send_attr_str[BUFSIZ]; char send_attr_str[BUFSIZ];
int send_attr_printed; int send_attr_printed = 0;
int num_pfx = 0; int num_pfx = 0;
@ -680,7 +680,7 @@ subgroup_update_packet (struct update_subgroup *subgrp)
* return */ * return */
if (space_remaining < space_needed) if (space_remaining < space_needed)
{ {
zlog_err ("u%llu:s%llu attributes too long, cannot send UPDATE", zlog_err ("u%" PRIu64 ":s%" PRIu64 " attributes too long, cannot send UPDATE",
subgrp->update_group->id, subgrp->id); subgrp->update_group->id, subgrp->id);
/* Flush the FIFO update queue */ /* Flush the FIFO update queue */
@ -725,12 +725,12 @@ subgroup_update_packet (struct update_subgroup *subgrp)
if (!send_attr_printed) if (!send_attr_printed)
{ {
zlog_debug ("u%llu:s%llu send UPDATE w/ attr: %s", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " send UPDATE w/ attr: %s",
subgrp->update_group->id, subgrp->id, send_attr_str); subgrp->update_group->id, subgrp->id, send_attr_str);
send_attr_printed = 1; send_attr_printed = 1;
} }
zlog_debug ("u%llu:s%llu send UPDATE %s/%d", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s/%d",
subgrp->update_group->id, subgrp->id, subgrp->update_group->id, subgrp->id,
inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, inet_ntop (rn->p.family, &(rn->p.u.prefix), buf,
INET6_BUFSIZ), rn->p.prefixlen); INET6_BUFSIZ), rn->p.prefixlen);
@ -767,7 +767,7 @@ subgroup_update_packet (struct update_subgroup *subgrp)
packet = stream_dup (s); packet = stream_dup (s);
bgp_packet_set_size (packet); bgp_packet_set_size (packet);
if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0)) if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0))
zlog_debug ("u%llu:s%llu UPDATE len %d numpfx %d", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " UPDATE len %zd numpfx %d",
subgrp->update_group->id, subgrp->id, subgrp->update_group->id, subgrp->id,
(stream_get_endp(packet) - stream_get_getp(packet)), num_pfx); (stream_get_endp(packet) - stream_get_getp(packet)), num_pfx);
pkt = bpacket_queue_add (SUBGRP_PKTQ (subgrp), packet, &vecarr); pkt = bpacket_queue_add (SUBGRP_PKTQ (subgrp), packet, &vecarr);
@ -795,7 +795,6 @@ subgroup_withdraw_packet (struct update_subgroup *subgrp)
struct stream *s; struct stream *s;
struct bgp_adj_out *adj; struct bgp_adj_out *adj;
struct bgp_advertise *adv; struct bgp_advertise *adv;
struct peer *peer;
struct bgp_node *rn; struct bgp_node *rn;
bgp_size_t unfeasible_len; bgp_size_t unfeasible_len;
bgp_size_t total_attr_len; bgp_size_t total_attr_len;
@ -815,8 +814,6 @@ subgroup_withdraw_packet (struct update_subgroup *subgrp)
if (bpacket_queue_is_full (SUBGRP_INST (subgrp), SUBGRP_PKTQ (subgrp))) if (bpacket_queue_is_full (SUBGRP_INST (subgrp), SUBGRP_PKTQ (subgrp)))
return NULL; return NULL;
peer = SUBGRP_PEER (subgrp);
afi = SUBGRP_AFI (subgrp); afi = SUBGRP_AFI (subgrp);
safi = SUBGRP_SAFI (subgrp); safi = SUBGRP_SAFI (subgrp);
s = subgrp->work; s = subgrp->work;
@ -872,7 +869,7 @@ subgroup_withdraw_packet (struct update_subgroup *subgrp)
{ {
char buf[INET6_BUFSIZ]; char buf[INET6_BUFSIZ];
zlog_debug ("u%llu:s%llu send UPDATE %s/%d -- unreachable", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s/%d -- unreachable",
subgrp->update_group->id, subgrp->id, subgrp->update_group->id, subgrp->id,
inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, inet_ntop (rn->p.family, &(rn->p.u.prefix), buf,
INET6_BUFSIZ), rn->p.prefixlen); INET6_BUFSIZ), rn->p.prefixlen);
@ -904,7 +901,7 @@ subgroup_withdraw_packet (struct update_subgroup *subgrp)
} }
bgp_packet_set_size (s); bgp_packet_set_size (s);
if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0)) if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0))
zlog_debug ("u%llu:s%llu UPDATE (withdraw) len %d numpfx %d", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " UPDATE (withdraw) len %zd numpfx %d",
subgrp->update_group->id, subgrp->id, subgrp->update_group->id, subgrp->id,
(stream_get_endp(s) - stream_get_getp(s)), num_pfx); (stream_get_endp(s) - stream_get_getp(s)), num_pfx);
pkt = bpacket_queue_add (SUBGRP_PKTQ (subgrp), stream_dup (s), NULL); pkt = bpacket_queue_add (SUBGRP_PKTQ (subgrp), stream_dup (s), NULL);
@ -955,7 +952,7 @@ subgroup_default_update_packet (struct update_subgroup *subgrp,
attrstr[0] = '\0'; attrstr[0] = '\0';
bgp_dump_attr (peer, attr, attrstr, BUFSIZ); bgp_dump_attr (peer, attr, attrstr, BUFSIZ);
zlog_debug ("u%llu:s%llu send UPDATE %s/%d %s", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s/%d %s",
(SUBGRP_UPDGRP (subgrp))->id, subgrp->id, (SUBGRP_UPDGRP (subgrp))->id, subgrp->id,
inet_ntop (p.family, &(p.u.prefix), buf, INET6_BUFSIZ), inet_ntop (p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
p.prefixlen, attrstr); p.prefixlen, attrstr);
@ -994,7 +991,6 @@ subgroup_default_update_packet (struct update_subgroup *subgrp,
void void
subgroup_default_withdraw_packet (struct update_subgroup *subgrp) subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
{ {
struct peer *peer;
struct stream *s; struct stream *s;
struct stream *packet; struct stream *packet;
struct prefix p; struct prefix p;
@ -1010,7 +1006,6 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
if (DISABLE_BGP_ANNOUNCE) if (DISABLE_BGP_ANNOUNCE)
return; return;
peer = SUBGRP_PEER (subgrp);
afi = SUBGRP_AFI (subgrp); afi = SUBGRP_AFI (subgrp);
safi = SUBGRP_SAFI (subgrp); safi = SUBGRP_SAFI (subgrp);
@ -1027,7 +1022,7 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
{ {
char buf[INET6_BUFSIZ]; char buf[INET6_BUFSIZ];
zlog_debug ("u%llu:s%llu send UPDATE %s/%d -- unreachable", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s/%d -- unreachable",
(SUBGRP_UPDGRP (subgrp))->id, subgrp->id, inet_ntop (p.family, (SUBGRP_UPDGRP (subgrp))->id, subgrp->id, inet_ntop (p.family,
&(p.u. &(p.u.
prefix), prefix),

View File

@ -890,13 +890,9 @@ DEFUN (no_bgp_confederation_identifier,
"AS number\n") "AS number\n")
{ {
struct bgp *bgp; struct bgp *bgp;
as_t as;
bgp = vty->index; bgp = vty->index;
if (argc == 1)
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
bgp_confederation_id_unset (bgp); bgp_confederation_id_unset (bgp);
return CMD_SUCCESS; return CMD_SUCCESS;
@ -970,12 +966,12 @@ DEFUN (no_bgp_confederation_peers,
* @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
* @set: 1 for setting values, 0 for removing the max-paths config. * @set: 1 for setting values, 0 for removing the max-paths config.
*/ */
int static int
bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths, bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
u_int16_t options, int set) u_int16_t options, int set)
{ {
struct bgp *bgp; struct bgp *bgp;
u_int16_t maxpaths; u_int16_t maxpaths = 0;
int ret; int ret;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -1280,11 +1276,10 @@ ALIAS (no_bgp_update_delay,
"Wait for peers to be established\n" "Wait for peers to be established\n"
"Seconds\n") "Seconds\n")
int static int
bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set) bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set)
{ {
struct bgp *bgp; struct bgp *bgp;
u_int16_t update_delay;
bgp = vty->index; bgp = vty->index;
@ -1328,7 +1323,7 @@ DEFUN (no_bgp_wpkt_quanta,
return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); return bgp_wpkt_quanta_config_vty(vty, argv[0], 0);
} }
int static int
bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) bgp_coalesce_config_vty (struct vty *vty, const char *num, char set)
{ {
struct bgp *bgp; struct bgp *bgp;
@ -2260,8 +2255,6 @@ DEFUN (bgp_rr_allow_outbound_policy,
"on ibgp neighbors\n") "on ibgp neighbors\n")
{ {
struct bgp *bgp; struct bgp *bgp;
u_int32_t local_pref;
int ret;
bgp = vty->index; bgp = vty->index;
@ -2284,7 +2277,6 @@ DEFUN (no_bgp_rr_allow_outbound_policy,
"on ibgp neighbors\n") "on ibgp neighbors\n")
{ {
struct bgp *bgp; struct bgp *bgp;
u_int32_t local_pref;
bgp = vty->index; bgp = vty->index;
@ -4582,7 +4574,6 @@ static int
peer_weight_set_vty (struct vty *vty, const char *ip_str, peer_weight_set_vty (struct vty *vty, const char *ip_str,
const char *weight_str) const char *weight_str)
{ {
int ret;
struct peer *peer; struct peer *peer;
unsigned long weight; unsigned long weight;
@ -4592,7 +4583,7 @@ peer_weight_set_vty (struct vty *vty, const char *ip_str,
VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
ret = peer_weight_set (peer, weight); peer_weight_set (peer, weight);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -4896,7 +4887,7 @@ DEFUN (bgp_set_route_map_delay_timer,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
else else
CMD_WARNING; return CMD_WARNING;
} }
DEFUN (no_bgp_set_route_map_delay_timer, DEFUN (no_bgp_set_route_map_delay_timer,
@ -4906,7 +4897,6 @@ DEFUN (no_bgp_set_route_map_delay_timer,
"Default BGP route-map delay timer\n" "Default BGP route-map delay timer\n"
"Reset to default time to wait for processing route-map changes") "Reset to default time to wait for processing route-map changes")
{ {
u_int32_t rmap_delay_timer;
struct bgp *bgp; struct bgp *bgp;
bgp = vty->index; bgp = vty->index;
@ -4919,7 +4909,6 @@ DEFUN (no_bgp_set_route_map_delay_timer,
static int static int
peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
{ {
int ret;
struct peer *peer; struct peer *peer;
peer = peer_lookup_vty (vty, ip_str); peer = peer_lookup_vty (vty, ip_str);
@ -4927,9 +4916,9 @@ peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
return CMD_WARNING; return CMD_WARNING;
if (str) if (str)
ret = peer_interface_set (peer, str); peer_interface_set (peer, str);
else else
ret = peer_interface_unset (peer); peer_interface_unset (peer);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -5734,8 +5723,6 @@ bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str,
struct prefix match; struct prefix match;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_node *rm; struct bgp_node *rm;
struct bgp_info *ri;
struct bgp_info *ri_temp;
struct bgp *bgp; struct bgp *bgp;
struct bgp_table *table; struct bgp_table *table;
struct bgp_table *rib; struct bgp_table *rib;
@ -8319,7 +8306,6 @@ bgp_adj_out_count (struct peer *peer, int afi, int safi)
{ {
struct bgp_table *table; struct bgp_table *table;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_adj_out *adj;
int count = 0; int count = 0;
if (!peer) return(0); if (!peer) return(0);
@ -8342,17 +8328,15 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
unsigned int count = 0, dn_count = 0; unsigned int count = 0, dn_count = 0;
char timebuf[BGP_UPTIME_LEN], dn_flag[2]; char timebuf[BGP_UPTIME_LEN], dn_flag[2];
int len; int len;
struct peer_group *group; json_object *json = NULL;
json_object *json; json_object *json_int = NULL;
json_object *json_int; json_object *json_string = NULL;
json_object *json_string; json_object *json_peer = NULL;
json_object *json_peer; json_object *json_peers = NULL;
json_object *json_peers; json_object *json_boolean_true = NULL;
json_object *json_boolean_true;
/* Header string for each address family. */ /* Header string for each address family. */
static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv";
if (use_json) if (use_json)
{ {
@ -8505,7 +8489,7 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
if (bgp->v_maxmed_admin) if (bgp->v_maxmed_admin)
vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE);
vty_out(vty, "BGP table version %llu%s", vty_out(vty, "BGP table version %" PRIu64 "%s",
bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE);
ents = bgp_table_count (bgp->rib[afi][safi]); ents = bgp_table_count (bgp->rib[afi][safi]);
@ -8620,7 +8604,7 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out (vty, "4 "); vty_out (vty, "4 ");
vty_out (vty, "%5u %7d %7d %8lu %4d %4u ", vty_out (vty, "%5u %7d %7d %8lu %4d %4ld ",
peer->as, peer->as,
peer->open_in + peer->update_in + peer->keepalive_in peer->open_in + peer->update_in + peer->keepalive_in
+ peer->notify_in + peer->refresh_in + peer->notify_in + peer->refresh_in
@ -8630,7 +8614,7 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
+ peer->dynamic_cap_out, + peer->dynamic_cap_out,
peer->version[afi][safi], peer->version[afi][safi],
0, 0,
(unsigned long) peer->obuf->count); peer->obuf->count);
vty_out (vty, "%8s", vty_out (vty, "%8s",
peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
@ -9037,7 +9021,7 @@ bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
paf = peer_af_find(p, afi, safi); paf = peer_af_find(p, afi, safi);
if (paf && PAF_SUBGRP(paf)) if (paf && PAF_SUBGRP(paf))
{ {
vty_out (vty, " Update group %llu, subgroup %llu%s", vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s",
PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE);
vty_out (vty, " Packet Queue length %d%s", vty_out (vty, " Packet Queue length %d%s",
bpacket_queue_virtual_length(paf), VTY_NEWLINE); bpacket_queue_virtual_length(paf), VTY_NEWLINE);
@ -9403,7 +9387,7 @@ bgp_show_peer (struct vty *vty, struct peer *p)
vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); vty_out (vty, " %s: TX ", afi_safi_print (afi, safi));
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
vty_out (vty, "advertised", afi_safi_print (afi, safi)); vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" );
@ -9417,7 +9401,7 @@ bgp_show_peer (struct vty *vty, struct peer *p)
vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); vty_out (vty, " %s: RX ", afi_safi_print (afi, safi));
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
vty_out (vty, "advertised", afi_safi_print (afi, safi)); vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" );
@ -9616,13 +9600,19 @@ bgp_show_peer (struct vty *vty, struct peer *p)
vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE);
for (i = 1; i <= p->last_reset_cause_size; i++) for (i = 1; i <= p->last_reset_cause_size; i++)
{ {
vty_out(vty, "%02X", *msg++); vty_out(vty, "%02X", *msg++);
if (i != p->last_reset_cause_size) if (i != p->last_reset_cause_size)
if (i % 16 == 0) {
vty_out(vty, "%s ", VTY_NEWLINE); if (i % 16 == 0)
else if (i % 4 == 0) {
vty_out(vty, " "); vty_out(vty, "%s ", VTY_NEWLINE);
}
else if (i % 4 == 0)
{
vty_out(vty, " ");
}
}
} }
vty_out(vty, "%s", VTY_NEWLINE); vty_out(vty, "%s", VTY_NEWLINE);
} }
@ -10675,7 +10665,8 @@ bgp_show_one_peer_group (struct vty *vty, struct peer_group *group)
char buf[128]; char buf[128];
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
char *peer_status, *af_str; const char *peer_status;
const char *af_str;
int lr_count; int lr_count;
int dynamic; int dynamic;
int af_cfgd; int af_cfgd;

View File

@ -21,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_VTY_H #ifndef _QUAGGA_BGP_VTY_H
#define _QUAGGA_BGP_VTY_H #define _QUAGGA_BGP_VTY_H
#include "bgpd/bgpd.h"
#define CMD_AS_RANGE "<1-4294967295>" #define CMD_AS_RANGE "<1-4294967295>"
#define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>" #define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>"

View File

@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */
#include "bgpd/bgp_debug.h" #include "bgpd/bgp_debug.h"
#include "bgpd/bgp_mpath.h" #include "bgpd/bgp_mpath.h"
#include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_nexthop.h"
#include "bgpd/bgp_nht.h"
/* All information about zebra. */ /* All information about zebra. */
struct zclient *zclient = NULL; struct zclient *zclient = NULL;
@ -459,6 +460,10 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
api.ifindex_num = stream_getc (s); api.ifindex_num = stream_getc (s);
ifindex = stream_getl (s); /* ifindex, unused */ ifindex = stream_getl (s); /* ifindex, unused */
} }
else
{
ifindex = 0;
}
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE)) if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
api.distance = stream_getc (s); api.distance = stream_getc (s);
@ -475,7 +480,7 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
if (command == ZEBRA_IPV4_ROUTE_ADD) if (command == ZEBRA_IPV4_ROUTE_ADD)
{ {
if (bgp_debug_zebra(&p)) if (bgp_debug_zebra((struct prefix *)&p))
{ {
char buf[2][INET_ADDRSTRLEN]; char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv4 route add %s[%d] %s/%d nexthop %s metric %u tag %d", zlog_debug("Zebra rcvd: IPv4 route add %s[%d] %s/%d nexthop %s metric %u tag %d",
@ -491,7 +496,7 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
} }
else else
{ {
if (bgp_debug_zebra(&p)) if (bgp_debug_zebra((struct prefix *)&p))
{ {
char buf[2][INET_ADDRSTRLEN]; char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv4 route delete %s[%d] %s/%d " zlog_debug("Zebra rcvd: IPv4 route delete %s[%d] %s/%d "
@ -547,6 +552,10 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
api.ifindex_num = stream_getc (s); api.ifindex_num = stream_getc (s);
ifindex = stream_getl (s); /* ifindex, unused */ ifindex = stream_getl (s); /* ifindex, unused */
} }
else
{
ifindex = 0;
}
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE)) if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
api.distance = stream_getc (s); api.distance = stream_getc (s);
@ -569,7 +578,7 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
if (command == ZEBRA_IPV6_ROUTE_ADD) if (command == ZEBRA_IPV6_ROUTE_ADD)
{ {
if (bgp_debug_zebra(&p)) if (bgp_debug_zebra((struct prefix *)&p))
{ {
char buf[2][INET6_ADDRSTRLEN]; char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv6 route add %s[%d] %s/%d nexthop %s metric %u tag %d", zlog_debug("Zebra rcvd: IPv6 route add %s[%d] %s/%d nexthop %s metric %u tag %d",
@ -585,7 +594,7 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
} }
else else
{ {
if (bgp_debug_zebra(&p)) if (bgp_debug_zebra((struct prefix *)&p))
{ {
char buf[2][INET6_ADDRSTRLEN]; char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv6 route delete %s[%d] %s/%d " zlog_debug("Zebra rcvd: IPv6 route delete %s[%d] %s/%d "
@ -657,7 +666,7 @@ if_lookup_by_ipv4_exact (struct in_addr *addr)
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
struct interface * struct interface *
if_lookup_by_ipv6 (struct in6_addr *addr, int ifindex) if_lookup_by_ipv6 (struct in6_addr *addr, unsigned int ifindex)
{ {
struct listnode *ifnode; struct listnode *ifnode;
struct listnode *cnode; struct listnode *cnode;
@ -679,7 +688,7 @@ if_lookup_by_ipv6 (struct in6_addr *addr, int ifindex)
if (cp->family == AF_INET6) if (cp->family == AF_INET6)
if (prefix_match (cp, (struct prefix *)&p)) if (prefix_match (cp, (struct prefix *)&p))
{ {
if (IN6_IS_ADDR_LINKLOCAL(&cp->u.prefix6)) if (IN6_IS_ADDR_LINKLOCAL(&cp->u.prefix6.s6_addr32[0]))
{ {
if (ifindex == ifp->ifindex) if (ifindex == ifp->ifindex)
return ifp; return ifp;
@ -693,7 +702,7 @@ if_lookup_by_ipv6 (struct in6_addr *addr, int ifindex)
} }
struct interface * struct interface *
if_lookup_by_ipv6_exact (struct in6_addr *addr, int ifindex) if_lookup_by_ipv6_exact (struct in6_addr *addr, unsigned int ifindex)
{ {
struct listnode *ifnode; struct listnode *ifnode;
struct listnode *cnode; struct listnode *cnode;
@ -1217,11 +1226,12 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
ifindex = info->peer->nexthop.ifp->ifindex; ifindex = info->peer->nexthop.ifp->ifindex;
if (!ifindex) if (!ifindex)
if (info->peer->conf_if || info->peer->ifname) {
ifindex = if_nametoindex (info->peer->conf_if ? info->peer->conf_if : info->peer->ifname); if (info->peer->conf_if || info->peer->ifname)
else if (info->peer->nexthop.ifp) ifindex = if_nametoindex (info->peer->conf_if ? info->peer->conf_if : info->peer->ifname);
ifindex = info->peer->nexthop.ifp->ifindex; else if (info->peer->nexthop.ifp)
ifindex = info->peer->nexthop.ifp->ifindex;
}
stream_put (bgp_nexthop_buf, &nexthop, sizeof (struct in6_addr *)); stream_put (bgp_nexthop_buf, &nexthop, sizeof (struct in6_addr *));
stream_put (bgp_ifindices_buf, &ifindex, sizeof (unsigned int)); stream_put (bgp_ifindices_buf, &ifindex, sizeof (unsigned int));
valid_nh_count++; valid_nh_count++;
@ -1255,11 +1265,12 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
ifindex = mpinfo->peer->nexthop.ifp->ifindex; ifindex = mpinfo->peer->nexthop.ifp->ifindex;
if (!ifindex) if (!ifindex)
if (mpinfo->peer->conf_if || mpinfo->peer->ifname) {
ifindex = if_nametoindex (mpinfo->peer->conf_if ? mpinfo->peer->conf_if : mpinfo->peer->ifname); if (mpinfo->peer->conf_if || mpinfo->peer->ifname)
else if (mpinfo->peer->nexthop.ifp) ifindex = if_nametoindex (mpinfo->peer->conf_if ? mpinfo->peer->conf_if : mpinfo->peer->ifname);
ifindex = mpinfo->peer->nexthop.ifp->ifindex; else if (mpinfo->peer->nexthop.ifp)
ifindex = mpinfo->peer->nexthop.ifp->ifindex;
}
if (ifindex == 0) if (ifindex == 0)
continue; continue;

View File

@ -49,8 +49,8 @@ extern int bgp_redistribute_unset (struct bgp *, afi_t, int, u_short);
extern struct interface *if_lookup_by_ipv4 (struct in_addr *); extern struct interface *if_lookup_by_ipv4 (struct in_addr *);
extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *); extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *);
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, int ifindex); extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, unsigned int ifindex);
extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *, int ifindex); extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *, unsigned int ifindex);
#endif /* HAVE_IPV6 */ #endif /* HAVE_IPV6 */
#endif /* _QUAGGA_BGP_ZEBRA_H */ #endif /* _QUAGGA_BGP_ZEBRA_H */

View File

@ -659,7 +659,7 @@ peer_af_delete (struct peer *peer, afi_t afi, safi_t safi)
if (PAF_SUBGRP(af)) if (PAF_SUBGRP(af))
{ {
if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
zlog_debug ("u%llu:s%llu remove peer %s", zlog_debug ("u%" PRIu64 ":s%" PRIu64 " remove peer %s",
af->subgroup->update_group->id, af->subgroup->id, peer->host); af->subgroup->update_group->id, af->subgroup->id, peer->host);
} }
@ -1304,16 +1304,18 @@ peer_as_change (struct peer *peer, as_t as, int as_specified)
conf = peer->group->conf; conf = peer->group->conf;
if (conf && CHECK_FLAG (conf->config, PEER_CONFIG_ROUTEADV)) if (conf && CHECK_FLAG (conf->config, PEER_CONFIG_ROUTEADV))
{
peer->v_routeadv = conf->routeadv; peer->v_routeadv = conf->routeadv;
}
/* Only go back to the default advertisement-interval if the user had not /* Only go back to the default advertisement-interval if the user had not
* already configured it */ * already configured it */
else if (!CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV)) else if (!CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV))
if (peer_sort (peer) == BGP_PEER_IBGP) {
peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; if (peer_sort (peer) == BGP_PEER_IBGP)
else peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV;
peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; else
peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
}
/* TTL reset */ /* TTL reset */
if (peer_sort (peer) == BGP_PEER_IBGP) if (peer_sort (peer) == BGP_PEER_IBGP)
peer->ttl = 255; peer->ttl = 255;
@ -2340,10 +2342,12 @@ peer_group_bind (struct bgp *bgp, union sockunion *su, struct peer *peer,
{ {
/* Advertisement-interval reset */ /* Advertisement-interval reset */
if (! CHECK_FLAG (group->conf->config, PEER_CONFIG_ROUTEADV)) if (! CHECK_FLAG (group->conf->config, PEER_CONFIG_ROUTEADV))
if (peer_sort (group->conf) == BGP_PEER_IBGP) {
group->conf->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; if (peer_sort (group->conf) == BGP_PEER_IBGP)
else group->conf->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV;
group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; else
group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
}
/* ebgp-multihop reset */ /* ebgp-multihop reset */
if (peer_sort (group->conf) == BGP_PEER_IBGP) if (peer_sort (group->conf) == BGP_PEER_IBGP)
@ -2836,7 +2840,6 @@ peer_create_bind_dynamic_neighbor (struct bgp *bgp, union sockunion *su,
struct peer *peer; struct peer *peer;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
as_t as;
/* Create peer first; we've already checked group config is valid. */ /* Create peer first; we've already checked group config is valid. */
peer = peer_create (su, NULL, bgp, bgp->as, group->conf->as, group->conf->as_type, 0, 0); peer = peer_create (su, NULL, bgp, bgp->as, group->conf->as, group->conf->as_type, 0, 0);
@ -3964,7 +3967,7 @@ peer_port_unset (struct peer *peer)
} }
/* neighbor weight. */ /* neighbor weight. */
int void
peer_weight_set (struct peer *peer, u_int16_t weight) peer_weight_set (struct peer *peer, u_int16_t weight)
{ {
struct peer_group *group; struct peer_group *group;
@ -3974,7 +3977,7 @@ peer_weight_set (struct peer *peer, u_int16_t weight)
peer->weight = weight; peer->weight = weight;
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
return 0; return;
/* peer-group member updates. */ /* peer-group member updates. */
group = peer->group; group = peer->group;
@ -3982,10 +3985,9 @@ peer_weight_set (struct peer *peer, u_int16_t weight)
{ {
peer->weight = group->conf->weight; peer->weight = group->conf->weight;
} }
return 0;
} }
int void
peer_weight_unset (struct peer *peer) peer_weight_unset (struct peer *peer)
{ {
struct peer_group *group; struct peer_group *group;
@ -4000,7 +4002,7 @@ peer_weight_unset (struct peer *peer)
UNSET_FLAG (peer->config, PEER_CONFIG_WEIGHT); UNSET_FLAG (peer->config, PEER_CONFIG_WEIGHT);
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
return 0; return;
/* peer-group member updates. */ /* peer-group member updates. */
group = peer->group; group = peer->group;
@ -4008,7 +4010,7 @@ peer_weight_unset (struct peer *peer)
{ {
peer->weight = 0; peer->weight = 0;
} }
return 0; return;
} }
int int
@ -4227,24 +4229,20 @@ peer_advertise_interval_unset (struct peer *peer)
} }
/* neighbor interface */ /* neighbor interface */
int void
peer_interface_set (struct peer *peer, const char *str) peer_interface_set (struct peer *peer, const char *str)
{ {
if (peer->ifname) if (peer->ifname)
free (peer->ifname); free (peer->ifname);
peer->ifname = strdup (str); peer->ifname = strdup (str);
return 0;
} }
int void
peer_interface_unset (struct peer *peer) peer_interface_unset (struct peer *peer)
{ {
if (peer->ifname) if (peer->ifname)
free (peer->ifname); free (peer->ifname);
peer->ifname = NULL; peer->ifname = NULL;
return 0;
} }
/* Allow-as in. */ /* Allow-as in. */
@ -5042,7 +5040,7 @@ peer_aslist_unset (struct peer *peer,afi_t afi, safi_t safi, int direct)
} }
static void static void
peer_aslist_update (char *aslist_name) peer_aslist_update (const char *aslist_name)
{ {
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -5104,10 +5102,10 @@ peer_aslist_add (char *aslist_name)
} }
static void static void
peer_aslist_del (char *aslist_name) peer_aslist_del (const char *aslist_name)
{ {
peer_aslist_update (aslist_name); peer_aslist_update (aslist_name);
route_map_notify_dependencies((char *)aslist_name, RMAP_EVENT_ASLIST_DELETED); route_map_notify_dependencies(aslist_name, RMAP_EVENT_ASLIST_DELETED);
} }

View File

@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "queue.h" #include "queue.h"
#include "sockunion.h" #include "sockunion.h"
#include "routemap.h" #include "routemap.h"
#include "linklist.h"
struct update_subgroup; struct update_subgroup;
struct bpacket; struct bpacket;
@ -1105,6 +1106,7 @@ extern struct peer *peer_lookup_by_conf_if (struct bgp *, const char *);
extern struct peer *peer_conf_interface_get(struct bgp *, const char *, afi_t, extern struct peer *peer_conf_interface_get(struct bgp *, const char *, afi_t,
safi_t); safi_t);
extern void bgp_peer_conf_if_to_su_update (struct peer *); extern void bgp_peer_conf_if_to_su_update (struct peer *);
extern int peer_group_listen_range_del(struct peer_group *, struct prefix *);
extern struct peer_group *peer_group_lookup (struct bgp *, const char *); extern struct peer_group *peer_group_lookup (struct bgp *, const char *);
extern struct peer_group *peer_group_get (struct bgp *, const char *); extern struct peer_group *peer_group_get (struct bgp *, const char *);
extern struct peer *peer_create_bind_dynamic_neighbor (struct bgp *, extern struct peer *peer_create_bind_dynamic_neighbor (struct bgp *,
@ -1215,8 +1217,8 @@ extern int peer_default_originate_unset (struct peer *, afi_t, safi_t);
extern int peer_port_set (struct peer *, u_int16_t); extern int peer_port_set (struct peer *, u_int16_t);
extern int peer_port_unset (struct peer *); extern int peer_port_unset (struct peer *);
extern int peer_weight_set (struct peer *, u_int16_t); extern void peer_weight_set (struct peer *, u_int16_t);
extern int peer_weight_unset (struct peer *); extern void peer_weight_unset (struct peer *);
extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t); extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t);
extern int peer_timers_unset (struct peer *); extern int peer_timers_unset (struct peer *);
@ -1227,8 +1229,8 @@ extern int peer_timers_connect_unset (struct peer *);
extern int peer_advertise_interval_set (struct peer *, u_int32_t); extern int peer_advertise_interval_set (struct peer *, u_int32_t);
extern int peer_advertise_interval_unset (struct peer *); extern int peer_advertise_interval_unset (struct peer *);
extern int peer_interface_set (struct peer *, const char *); extern void peer_interface_set (struct peer *, const char *);
extern int peer_interface_unset (struct peer *); extern void peer_interface_unset (struct peer *);
extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *); extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *);
extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int); extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
@ -1273,6 +1275,9 @@ extern struct peer_af * peer_af_create (struct peer *, afi_t, safi_t);
extern struct peer_af * peer_af_find (struct peer *, afi_t, safi_t); extern struct peer_af * peer_af_find (struct peer *, afi_t, safi_t);
extern int peer_af_delete (struct peer *, afi_t, safi_t); extern int peer_af_delete (struct peer *, afi_t, safi_t);
extern void bgp_scan_finish(void);
extern void bgp_close(void);
static inline int static inline int
afindex (afi_t afi, safi_t safi) afindex (afi_t afi, safi_t safi)
{ {

View File

@ -392,7 +392,7 @@ zebra_ptm_sock_read (struct thread *thread)
int sock, done = 0; int sock, done = 0;
char rcvbuf[ZEBRA_PTM_MAX_SOCKBUF]; char rcvbuf[ZEBRA_PTM_MAX_SOCKBUF];
int nbytes, msglen; int nbytes, msglen;
char *rcvptr, *eofptr; char *rcvptr;
char msgbuf[ZEBRA_PTM_MAX_SOCKBUF]; char msgbuf[ZEBRA_PTM_MAX_SOCKBUF];
sock = THREAD_FD (thread); sock = THREAD_FD (thread);