}
unsigned int
-aspath_count_hops (struct aspath *aspath)
+aspath_count_hops (const struct aspath *aspath)
{
int count = 0;
struct assegment *seg = aspath->segments;
extern int aspath_confed_check (struct aspath *);
extern int aspath_left_confed_check (struct aspath *);
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_size (struct aspath *);
extern as_t aspath_highest (struct aspath *);
static void *
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;
cluster = XMALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list));
static void *
bgp_attr_hash_alloc (void *p)
{
- struct attr * val = (struct attr *) p;
+ const struct attr * val = (const struct attr *) p;
struct attr *attr;
attr = XMALLOC (MTYPE_ATTR, sizeof (struct attr));
u_int8_t mask = BGP_ATTR_FLAG_EXTLEN;
const u_int8_t flags = args->flags;
const u_int8_t attr_code = args->type;
- struct peer *const peer = args->peer;
/* there may be attributes we don't know about */
if (attr_code > attr_flags_values_max)
static int
bgp_attr_atomic (struct bgp_attr_parser_args *args)
{
- struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
const bgp_size_t length = args->length;
case SAFI_UNICAST:
case SAFI_MULTICAST:
{
- unsigned long sizep;
struct attr_extra *attre = attr->extra;
assert (attr->extra);
struct aspath *aspath;
int send_as4_path = 0;
int send_as4_aggregator = 0;
- int i = 0;
int use32bit = (CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV)) ? 1 : 0;
size_t mpattrlen_pos = 0;
return 0;
}
+#if 0
/* Delete community attribute using regular expression match. Return
modified communites attribute. */
static struct community *
}
return com;
}
+#endif
/* When given community attribute matches to the community-list return
1 else return 0. */
}
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;
}
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 listnode *node, *nnode;
}
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 listnode *node, *nnode;
"BGP IPv6 neighbor 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)
bgp_debug_neighbor_events_peers = list_new ();
"BGP neighbor on interface to debug\n")
{
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))
{
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
- char *host = argv[0];
+ const char *host = argv[0];
if (!bgp_debug_keepalive_peers)
bgp_debug_keepalive_peers = list_new ();
"BGP neighbor on interface to debug\n")
{
int found_peer = 0;
- char *host = argv[0];
+ const char *host = argv[0];
if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers))
{
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
- char *host = argv[1];
+ const char *host = argv[1];
int inbound;
if (!bgp_debug_update_in_peers)
{
int inbound;
int found_peer = 0;
- char *host = argv[1];
+ const char *host = argv[1];
if (strncmp ("i", argv[0], 1) == 0)
inbound = 1;
ecommunity_str2com (const char *str, int type, int keyword_included)
{
struct ecommunity *ecom = NULL;
- enum ecommunity_token token;
+ enum ecommunity_token token = ecommunity_token_unknown;
struct ecommunity_val eval;
int keyword = 0;
void (*add_hook) (char *);
/* Hook function which is executed when access_list is deleted. */
- void (*delete_hook) (char *);
+ void (*delete_hook) (const char *);
};
/* Element of AS path filter. */
/* Delete hook function. */
void
-as_list_delete_hook (void (*func) (char *))
+as_list_delete_hook (void (*func) (const char *))
{
as_list_master.delete_hook = func;
}
extern struct as_list *as_list_lookup (const 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 */
#include "bgpd/bgp_snmp.h"
#endif /* HAVE_SNMP */
#include "bgpd/bgp_updgrp.h"
+#include "bgpd/bgp_nht.h"
/* Definition of display strings corresponding to FSM events. This should be
* kept consistent with the events defined in bgpd.h
static int
bgp_connect_success (struct peer *peer)
{
- int ret = 0;
-
if (peer->fd < 0)
{
zlog_err ("bgp_connect_success peer's fd is negative value %d",
bgp_establish (struct peer *peer)
{
struct bgp_notify *notify;
- struct peer_af *paf;
afi_t afi;
safi_t safi;
int nsf_af_count = 0;
void
bgp_fsm_nht_update(struct peer *peer, int valid)
{
- int ret = 0;
-
if (!peer)
return;
{
struct bgp *bgp;
struct listnode *node, *nnode;
- int *socket;
struct interface *ifp;
extern struct zclient *zclient;
struct prefix p;
int psize;
int prefixlen;
- u_int32_t label;
u_int16_t type;
struct rd_as rd_as;
struct rd_ip rd_ip;
return -1;
}
- label = decode_label (pnt);
+ (void)decode_label (pnt);
/* Copyr label to prefix. */
tagpnt = pnt;;
*/
if (peer1->status == Clearing || peer1->status == Deleted)
{
- struct bgp *bgp = peer1->bgp;
-
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);
close (bgp_sock);
return -1;
}
struct bgp_nexthop_cache *
-bnc_new ()
+bnc_new (void)
{
struct bgp_nexthop_cache *bnc;
static void *
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;
addr = XMALLOC (MTYPE_BGP_ADDR, sizeof (struct bgp_addr));
char buf[INET6_ADDRSTRLEN];
struct nexthop *nexthop;
time_t tbuf;
- u_char i;
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))
}
void
-bgp_scan_vty_init()
+bgp_scan_vty_init (void)
{
install_element (ENABLE_NODE, &show_ip_bgp_nexthop_cmd);
install_element (VIEW_NODE, &show_ip_bgp_nexthop_cmd);
extern int bgp_nexthop_onlink (afi_t, struct attr *);
extern int bgp_nexthop_self (struct attr *);
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_nexthop_free(struct bgp_nexthop_cache *bnc);
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 */
#include "bgpd/bgp_nexthop.h"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_nht.h"
+#include "bgpd/bgp_fsm.h"
extern struct zclient *zclient;
extern struct bgp_table *bgp_nexthop_cache_table[AFI_MAX];
bgp_parse_nexthop_update (int command)
{
struct stream *s;
- struct bgp_node *rn;
+ struct bgp_node *rn = NULL;
struct bgp_nexthop_cache *bnc;
struct nexthop *nexthop;
struct nexthop *oldnh;
LIST_FOREACH(path, &(bnc->paths), nh_thread)
{
if (!(path->type == ZEBRA_ROUTE_BGP &&
- (path->sub_type == BGP_ROUTE_NORMAL) ||
- (path->sub_type == BGP_ROUTE_STATIC)))
+ ((path->sub_type == BGP_ROUTE_NORMAL) ||
+ (path->sub_type == BGP_ROUTE_STATIC))))
continue;
rn = path->net;
s = bpacket_reformat_for_peer (next_pkt, paf);
bpacket_queue_advance_peer (paf);
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,
peer->host, (stream_get_endp(s) - stream_get_getp(s)));
return s;
struct stream *s;
int num;
unsigned int count = 0;
- int oc = 0;
+ unsigned int oc = 0;
/* Yes first of all get peer pointer. */
peer = THREAD_ARG (thread);
bgp_keepalive_send (struct peer *peer)
{
struct stream *s;
- int length;
s = stream_new (BGP_MAX_PACKET_SIZE);
bgp_packet_set_marker (s, BGP_MSG_KEEPALIVE);
/* Set packet size. */
- length = bgp_packet_set_size (s);
+ (void)bgp_packet_set_size (s);
/* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */
bgp_open_send (struct peer *peer)
{
struct stream *s;
- int length;
u_int16_t send_holdtime;
as_t local_as;
bgp_open_capability (s, peer);
/* Set BGP packet length. */
- length = bgp_packet_set_size (s);
+ (void)bgp_packet_set_size (s);
if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending OPEN, version %d, my as %u, holdtime %d, id %s",
{
struct stream *s;
struct stream *packet;
- int length;
struct bgp_filter *filter;
int orf_refresh = 0;
}
/* Set packet size. */
- length = bgp_packet_set_size (s);
+ (void)bgp_packet_set_size (s);
if (bgp_debug_neighbor_events(peer))
{
{
struct stream *s;
struct stream *packet;
- int length;
/* Adjust safi code. */
if (safi == SAFI_MPLS_VPN)
}
/* Set packet size. */
- length = bgp_packet_set_size (s);
+ (void)bgp_packet_set_size (s);
/* Make real packet. */
packet = stream_dup (s);
u_int16_t send_holdtime;
as_t remote_as;
as_t as4 = 0;
- struct peer *active_peer = NULL;
struct in_addr remote_id;
int mp_capability;
u_int8_t notify_data_remote_as[2];
version = stream_getc (peer->ibuf);
memcpy (notify_data_remote_as, stream_pnt (peer->ibuf), 2);
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);
memcpy (notify_data_remote_id, stream_pnt (peer->ibuf), 4);
remote_id.s_addr = stream_get_ipv4 (peer->ibuf);
bgp_notify_send_with_data (peer,
BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNACEP_HOLDTIME,
- holdtime_ptr, 2);
+ (u_char *)holdtime_ptr, 2);
return -1;
}
bgp_check_update_delay(struct bgp *bgp)
{
struct listnode *node, *nnode;
- struct peer *peer;
+ struct peer *peer = NULL;
if (bgp_debug_neighbor_events(peer))
zlog_debug ("Checking update delay, T: %d R: %d I:%d E: %d", bgp->established,
{
afi_t afi;
safi_t safi;
- u_char reserved;
struct stream *s;
struct peer_af *paf;
/* Parse packet. */
afi = stream_getw (s);
- reserved = stream_getc (s);
+ (void)stream_getc (s);
safi = stream_getc (s);
if (bgp_debug_update(peer, NULL, NULL, 0))
u_int32_t seq;
int psize;
char name[BUFSIZ];
- int ret;
+ int ret = CMD_SUCCESS;
if (bgp_debug_neighbor_events(peer))
{
prefix_bgp_orf_remove_all (name);
break;
}
- ok = ((p_end - p_pnt) >= sizeof(u_int32_t)) ;
+ ok = ((u_int32_t)(p_end - p_pnt) >= sizeof(u_int32_t)) ;
if (ok)
{
memcpy (&seq, p_pnt, sizeof (u_int32_t));
struct capability_mp_data mpc;
struct capability_header *hdr;
u_char action;
- struct bgp *bgp;
afi_t afi;
safi_t safi;
- bgp = peer->bgp;
end = pnt + length;
while (pnt < end)
static int
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_info info;
static int
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_info info;
/* 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,
struct peer *peer, struct attr *attr)
{
}
}
-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
subgroup_announce_reset_nhop (u_char family, struct attr *attr)
{
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
subgroup_announce_check_rsclient (struct bgp_info *ri,
struct update_subgroup *subgrp,
struct bgp_info *nextri = NULL;
int paths_eq, do_mpath, debug;
struct list mp_list;
- char buf[INET6_BUFSIZ];
char pfx_buf[INET6_ADDRSTRLEN];
bgp_mp_list_init (&mp_list);
struct bgp_node *rn)
{
struct prefix *p;
- struct peer_af *paf;
struct peer *onlypeer;
struct attr attr;
struct attr_extra extra;
struct bgp_info *new_select;
struct bgp_info *old_select;
struct bgp_info_pair old_and_new;
- struct listnode *node, *nnode;
- struct peer *peer;
/* Is it end of initial update? (after startup) */
if (!rn)
{
if (ri && ri->addpath_rx_id)
sprintf(buf, " with addpath ID %d", ri->addpath_rx_id);
- else
- sprintf(buf, "");
}
static void
void
bgp_announce_route_all (struct peer *peer)
{
- struct peer_af *paf;
- int af;
afi_t afi;
safi_t safi;
struct bgp_info *ri;
struct bgp_adj_in *ain;
struct bgp_adj_in *ain_next;
- struct bgp_adj_out *aout;
/* XXX:TODO: This is suboptimal, every non-empty route_node is
* queued for every clearing peer, regardless of whether it is
afi_t afi;
safi_t safi;
struct bgp_node *rn;
- struct bgp_node *rm;
- struct bgp_table *table;
struct bgp_static *bgp_static;
/* Use this flag to force reprocessing of the route */
struct aspath *asmerge = NULL;
struct community *community = NULL;
struct community *commerge = NULL;
+#if defined(AGGREGATE_NEXTHOP_CHECK)
struct in_addr nexthop;
u_int32_t med = 0;
+#endif
struct bgp_info *ri;
struct bgp_info *new;
int first = 1;
u_char atomic_aggregate = 0;
/* Record adding route's nexthop and med. */
- if (rinew)
- {
- nexthop = rinew->attr->nexthop;
- med = rinew->attr->med;
- }
+ if (rinew)
+ {
+#if defined(AGGREGATE_NEXTHOP_CHECK)
+ nexthop = rinew->attr->nexthop;
+ med = rinew->attr->med;
+#endif
+ }
/* ORIGIN attribute: If at least one route among routes that are
aggregated has ORIGIN with the value INCOMPLETE, then the
if (! rinew && first)
{
+#if defined(AGGREGATE_NEXTHOP_CHECK)
nexthop = ri->attr->nexthop;
med = ri->attr->med;
+#endif
first = 0;
}
route_vty_short_status_out (struct vty *vty, struct bgp_info *binfo,
json_object *json_path)
{
- json_object *json_boolean_false;
json_object *json_boolean_true;
if (json_path)
{
- json_boolean_false = json_object_new_boolean(0);
json_boolean_true = json_object_new_boolean(1);
/* Route status display. */
#endif
json_object *json_int;
json_object *json_string;
- json_object *json_path;
+ json_object *json_path = NULL;
json_object *json_boolean_false;
- json_object *json_boolean_true;
- json_object *json_cluster_list;
+ json_object *json_boolean_true = NULL;
+ json_object *json_cluster_list = NULL;
if (json_paths)
{
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_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
if (type == bgp_show_type_dampend_paths
int first = 0;
json_object *json_string;
json_object *json_int;
- json_object *json_adv_to;
+ json_object *json_adv_to = NULL;
p = &rn->p;
static void
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_adj_in *ain;
if (! in && CHECK_FLAG (peer->af_sflags[afi][safi],
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_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
{
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,
inet_ntoa (bgp->router_id), VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
static int
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])
{
{
struct peer *peer;
- char *rmap_name = NULL;
+ const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[0]);
"Display the routes advertised to a BGP neighbor\n")
{
struct peer *peer;
- char *rmap_name = NULL;
+ const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[1]);
if (! peer)
{
struct peer *peer;
- char *rmap_name = NULL;
+ const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[0]);
{
struct peer *peer;
- char *rmap_name = NULL;
+ const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[0]);
"Display the received routes from neighbor\n")
{
struct peer *peer;
- char *rmap_name = NULL;
+ const char *rmap_name = NULL;
peer = peer_lookup_in_view (vty, NULL, argv[1]);
if (! peer)
{
int ret;
struct prefix_ipv4 p;
- u_char distance;
struct bgp_node *rn;
struct bgp_distance *bdistance;
return CMD_WARNING;
}
- distance = atoi (distance_str);
-
rn = bgp_node_lookup (bgp_distance_table, (struct prefix *)&p);
if (! rn)
{
route_map_object_t type, void *object)
{
struct interface *ifp;
- struct nexthop *nexthop;
struct bgp_info *info;
if (type == RMAP_BGP)
static void *
route_set_metric_compile (const char *arg)
{
- u_int32_t metric;
unsigned long larg;
char *endptr = NULL;
larg = strtoul (arg, &endptr, 10);
if (*endptr != '\0' || errno || larg > UINT32_MAX)
return NULL;
- metric = larg;
}
else
{
larg = strtoul (arg+1, &endptr, 10);
if (*endptr != '\0' || errno || larg > UINT32_MAX)
return NULL;
- metric = larg;
}
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
route_match_ipv6_next_hop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct in6_addr *addr;
struct bgp_info *bgp_info;
if (type == RMAP_BGP)
{
- addr = rule;
bgp_info = object;
if (!bgp_info->attr->extra)
route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- int *use_peer_address;
struct in6_addr peer_address;
struct bgp_info *bgp_info;
struct peer *peer;
if (type == RMAP_BGP)
{
/* Fetch routemap's rule information. */
- use_peer_address = rule;
bgp_info = object;
peer = bgp_info->peer;
route_map_event_t type)
{
int ret;
- char *dep_name = (char *)arg;
+ char *dep_name = NULL;
const char *tmpstr;
char *rmap_name = NULL;
if ((tmpstr = route_map_get_match_arg(index, command)) != NULL)
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);
}
vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
break;
}
- if (arg == NULL && dep_name)
+ if (dep_name)
XFREE(MTYPE_ROUTE_MAP_RULE, dep_name);
if (rmap_name)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
if (type != RMAP_EVENT_MATCH_DELETED && dep_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);
if (rmap_name)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
* modifications.
*/
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)
{
}
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 listnode *node, *nnode;
}
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;
afi_t afi;
}
static void
-bgp_route_map_mark_update (char *rmap_name)
+bgp_route_map_mark_update (const char *rmap_name)
{
struct listnode *node, *nnode;
struct bgp *bgp;
"IP address of aggregator\n")
{
int ret;
- as_t as;
struct in_addr address;
char *argstr;
-
- VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
ret = inet_aton (argv[1], &address);
if (ret == 0)
"AS number of aggregator\n")
{
int ret;
- as_t as;
struct in_addr address;
char *argstr;
if (argv == 0)
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);
if (ret == 0)
{
updgrp_hash_alloc (void *p)
{
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));
memcpy (updgrp, in, sizeof (struct update_group));
updgrp->conf = XCALLOC (MTYPE_BGP_PEER, sizeof (struct peer));
int match = 0;
if (!ctx)
- return;
+ return CMD_SUCCESS;
if (ctx->subgrp_id)
{
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));
filter = &updgrp->conf->filter[updgrp->afi][updgrp->safi];
if (filter->map[RMAP_OUT].name)
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue;
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));
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);
- 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->peer_refreshes_combined, VTY_NEWLINE);
vty_out (vty, " Merge checks triggered: %u%s",
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",
bpacket_queue_length (SUBGRP_PKTQ (subgrp)), VTY_NEWLINE);
vty_out (vty, " Total packets enqueued: %u%s",
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
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);
bpacket_queue_show_vty (SUBGRP_PKTQ (subgrp), vty);
}
update_group_checkin (updgrp);
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;
update_group_delete (struct update_group *updgrp)
{
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;
bpacket_queue_add (SUBGRP_PKTQ (subgrp), NULL, NULL);
TAILQ_INIT (&(subgrp->adjq));
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);
update_group_add_subgroup (updgrp, subgrp);
sync_delete (subgrp);
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);
update_group_remove_subgroup (subgrp->update_group, subgrp);
paf->subgroup = subgrp;
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);
}
{
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);
}
SUBGRP_INCR_STAT (target, merge_events);
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,
target->update_group->id, target->id, reason ? reason : "unknown");
}
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 bgp_filter *filter;
}
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 bgp_filter *filter;
}
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 bgp_filter *filter;
}
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)
{
struct peer *peer;
if (changed)
{
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);
subgroup_announce_route (subgrp);
}
if (def_changed)
{
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);
subgroup_default_originate (subgrp, 0);
}
*/
void
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;
subgrp = old_subgrp;
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);
}
update_group_remove_subgroup (old_subgrp->update_group, old_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);
}
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);
/*
update_subgroup_copy_packets (subgrp, paf->next_pkt_to_send);
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->peer->host, updgrp->id, subgrp->id);
update_subgroup_add_peer (subgrp, paf, 1);
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);
return;
{
struct update_subgroup *subgrp;
struct peer *peer;
- struct peer_af *paf;
afi_t afi;
safi_t safi;
return UPDWALK_CONTINUE;
}
-void
+int
update_group_refresh_default_originate_route_map (struct thread *thread)
{
struct bgp *bgp;
reason);
THREAD_TIMER_OFF (bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp);
+
+ return(0);
}
/*
if (combine)
{
- struct peer_af *temp_paf;
-
/*
* If there are other peers in the old subgroup that also need
* routes to be announced, pull them into the peer's new
return;
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);
subgroup_announce_route (paf->subgroup);
}
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,
paf->peer->host, subgrp->peer_count);
u_int64_t updgrp_id;
u_int64_t subgrp_id;
bgp_policy_type_e policy_type;
- char *policy_name;
+ const char *policy_name;
int policy_event_start_flag;
int policy_route_update;
updgrp_walkcb cb;
update_subgroup_trigger_merge_check (struct update_subgroup *,
int force);
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);
extern void update_group_af_walk (struct bgp *bgp, afi_t afi, safi_t safi,
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_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_subgroup_inherit_info (struct update_subgroup *to,
if (header1)
{
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),
VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
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_show_adjq_vty (subgrp, vty, ctx->flags);
}
subgrp = THREAD_ARG (thread);
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->t_coalesce = NULL;
subgrp->v_coalesce = 0;
if (!subgrp->v_coalesce)
{
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);
subgroup_announce_route (subgrp);
return;
int space_remaining = 0;
int space_needed = 0;
char send_attr_str[BUFSIZ];
- int send_attr_printed;
+ int send_attr_printed = 0;
int num_pfx = 0;
* return */
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);
/* Flush the FIFO update queue */
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);
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,
inet_ntop (rn->p.family, &(rn->p.u.prefix), buf,
INET6_BUFSIZ), rn->p.prefixlen);
packet = stream_dup (s);
bgp_packet_set_size (packet);
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,
(stream_get_endp(packet) - stream_get_getp(packet)), num_pfx);
pkt = bpacket_queue_add (SUBGRP_PKTQ (subgrp), packet, &vecarr);
struct stream *s;
struct bgp_adj_out *adj;
struct bgp_advertise *adv;
- struct peer *peer;
struct bgp_node *rn;
bgp_size_t unfeasible_len;
bgp_size_t total_attr_len;
if (bpacket_queue_is_full (SUBGRP_INST (subgrp), SUBGRP_PKTQ (subgrp)))
return NULL;
-
- peer = SUBGRP_PEER (subgrp);
afi = SUBGRP_AFI (subgrp);
safi = SUBGRP_SAFI (subgrp);
s = subgrp->work;
{
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,
inet_ntop (rn->p.family, &(rn->p.u.prefix), buf,
INET6_BUFSIZ), rn->p.prefixlen);
}
bgp_packet_set_size (s);
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,
(stream_get_endp(s) - stream_get_getp(s)), num_pfx);
pkt = bpacket_queue_add (SUBGRP_PKTQ (subgrp), stream_dup (s), NULL);
attrstr[0] = '\0';
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,
inet_ntop (p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
p.prefixlen, attrstr);
void
subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
{
- struct peer *peer;
struct stream *s;
struct stream *packet;
struct prefix p;
if (DISABLE_BGP_ANNOUNCE)
return;
- peer = SUBGRP_PEER (subgrp);
afi = SUBGRP_AFI (subgrp);
safi = SUBGRP_SAFI (subgrp);
{
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,
&(p.u.
prefix),
"AS number\n")
{
struct bgp *bgp;
- as_t as;
bgp = vty->index;
- if (argc == 1)
- VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
-
bgp_confederation_id_unset (bgp);
return CMD_SUCCESS;
* @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
* @set: 1 for setting values, 0 for removing the max-paths config.
*/
-int
-bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths,
+static int
+bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
u_int16_t options, int set)
{
struct bgp *bgp;
- u_int16_t maxpaths;
+ u_int16_t maxpaths = 0;
int ret;
afi_t afi;
safi_t safi;
"Wait for peers to be established\n"
"Seconds\n")
-int
-bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set)
+static int
+bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set)
{
struct bgp *bgp;
- u_int16_t update_delay;
bgp = vty->index;
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)
{
struct bgp *bgp;
"on ibgp neighbors\n")
{
struct bgp *bgp;
- u_int32_t local_pref;
- int ret;
bgp = vty->index;
"on ibgp neighbors\n")
{
struct bgp *bgp;
- u_int32_t local_pref;
bgp = vty->index;
peer_weight_set_vty (struct vty *vty, const char *ip_str,
const char *weight_str)
{
- int ret;
struct peer *peer;
unsigned long weight;
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;
}
else
- CMD_WARNING;
+ return CMD_WARNING;
}
DEFUN (no_bgp_set_route_map_delay_timer,
"Default BGP route-map delay timer\n"
"Reset to default time to wait for processing route-map changes")
{
- u_int32_t rmap_delay_timer;
struct bgp *bgp;
bgp = vty->index;
static int
peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
{
- int ret;
struct peer *peer;
peer = peer_lookup_vty (vty, ip_str);
return CMD_WARNING;
if (str)
- ret = peer_interface_set (peer, str);
+ peer_interface_set (peer, str);
else
- ret = peer_interface_unset (peer);
+ peer_interface_unset (peer);
return CMD_SUCCESS;
}
struct prefix match;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_info *ri;
- struct bgp_info *ri_temp;
struct bgp *bgp;
struct bgp_table *table;
struct bgp_table *rib;
{
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_adj_out *adj;
int count = 0;
if (!peer) return(0);
unsigned int count = 0, dn_count = 0;
char timebuf[BGP_UPTIME_LEN], dn_flag[2];
int len;
- struct peer_group *group;
- json_object *json;
- json_object *json_int;
- json_object *json_string;
- json_object *json_peer;
- json_object *json_peers;
- json_object *json_boolean_true;
+ json_object *json = NULL;
+ json_object *json_int = NULL;
+ json_object *json_string = NULL;
+ json_object *json_peer = NULL;
+ json_object *json_peers = NULL;
+ json_object *json_boolean_true = NULL;
/* Header string for each address family. */
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 (bgp->v_maxmed_admin)
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);
ents = bgp_table_count (bgp->rib[afi][safi]);
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->open_in + peer->update_in + peer->keepalive_in
+ peer->notify_in + peer->refresh_in
+ peer->dynamic_cap_out,
peer->version[afi][safi],
0,
- (unsigned long) peer->obuf->count);
+ peer->obuf->count);
vty_out (vty, "%8s",
peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
paf = peer_af_find(p, afi, safi);
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);
vty_out (vty, " Packet Queue length %d%s",
bpacket_queue_virtual_length(paf), VTY_NEWLINE);
vty_out (vty, " %s: TX ", afi_safi_print (afi, safi));
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))
vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" );
vty_out (vty, " %s: RX ", afi_safi_print (afi, safi));
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))
vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" );
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++)
{
- vty_out(vty, "%02X", *msg++);
+ vty_out(vty, "%02X", *msg++);
- if (i != p->last_reset_cause_size)
- if (i % 16 == 0)
- vty_out(vty, "%s ", VTY_NEWLINE);
- else if (i % 4 == 0)
- vty_out(vty, " ");
+ if (i != p->last_reset_cause_size)
+ {
+ if (i % 16 == 0)
+ {
+ vty_out(vty, "%s ", VTY_NEWLINE);
+ }
+ else if (i % 4 == 0)
+ {
+ vty_out(vty, " ");
+ }
+ }
}
vty_out(vty, "%s", VTY_NEWLINE);
}
char buf[128];
afi_t afi;
safi_t safi;
- char *peer_status, *af_str;
+ const char *peer_status;
+ const char *af_str;
int lr_count;
int dynamic;
int af_cfgd;
#ifndef _QUAGGA_BGP_VTY_H
#define _QUAGGA_BGP_VTY_H
+#include "bgpd/bgpd.h"
+
#define CMD_AS_RANGE "<1-4294967295>"
#define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_mpath.h"
#include "bgpd/bgp_nexthop.h"
+#include "bgpd/bgp_nht.h"
/* All information about zebra. */
struct zclient *zclient = NULL;
api.ifindex_num = stream_getc (s);
ifindex = stream_getl (s); /* ifindex, unused */
}
+ else
+ {
+ ifindex = 0;
+ }
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
api.distance = stream_getc (s);
if (command == ZEBRA_IPV4_ROUTE_ADD)
{
- if (bgp_debug_zebra(&p))
+ if (bgp_debug_zebra((struct prefix *)&p))
{
char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv4 route add %s[%d] %s/%d nexthop %s metric %u tag %d",
}
else
{
- if (bgp_debug_zebra(&p))
+ if (bgp_debug_zebra((struct prefix *)&p))
{
char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv4 route delete %s[%d] %s/%d "
api.ifindex_num = stream_getc (s);
ifindex = stream_getl (s); /* ifindex, unused */
}
+ else
+ {
+ ifindex = 0;
+ }
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
api.distance = stream_getc (s);
if (command == ZEBRA_IPV6_ROUTE_ADD)
{
- if (bgp_debug_zebra(&p))
+ if (bgp_debug_zebra((struct prefix *)&p))
{
char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv6 route add %s[%d] %s/%d nexthop %s metric %u tag %d",
}
else
{
- if (bgp_debug_zebra(&p))
+ if (bgp_debug_zebra((struct prefix *)&p))
{
char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv6 route delete %s[%d] %s/%d "
#ifdef HAVE_IPV6
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 *cnode;
if (cp->family == AF_INET6)
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)
return ifp;
}
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 *cnode;
ifindex = info->peer->nexthop.ifp->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);
- else if (info->peer->nexthop.ifp)
- ifindex = info->peer->nexthop.ifp->ifindex;
-
+ {
+ if (info->peer->conf_if || info->peer->ifname)
+ ifindex = if_nametoindex (info->peer->conf_if ? info->peer->conf_if : info->peer->ifname);
+ 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_ifindices_buf, &ifindex, sizeof (unsigned int));
valid_nh_count++;
ifindex = mpinfo->peer->nexthop.ifp->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);
- else if (mpinfo->peer->nexthop.ifp)
- ifindex = mpinfo->peer->nexthop.ifp->ifindex;
-
+ {
+ if (mpinfo->peer->conf_if || mpinfo->peer->ifname)
+ ifindex = if_nametoindex (mpinfo->peer->conf_if ? mpinfo->peer->conf_if : mpinfo->peer->ifname);
+ else if (mpinfo->peer->nexthop.ifp)
+ ifindex = mpinfo->peer->nexthop.ifp->ifindex;
+ }
if (ifindex == 0)
continue;
extern struct interface *if_lookup_by_ipv4 (struct in_addr *);
extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *);
#ifdef HAVE_IPV6
-extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, int ifindex);
-extern struct interface *if_lookup_by_ipv6_exact (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 *, unsigned int ifindex);
#endif /* HAVE_IPV6 */
#endif /* _QUAGGA_BGP_ZEBRA_H */
if (PAF_SUBGRP(af))
{
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);
}
conf = peer->group->conf;
if (conf && CHECK_FLAG (conf->config, PEER_CONFIG_ROUTEADV))
+ {
peer->v_routeadv = conf->routeadv;
-
+ }
/* Only go back to the default advertisement-interval if the user had not
* already configured it */
else if (!CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV))
- if (peer_sort (peer) == BGP_PEER_IBGP)
- peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV;
- else
- peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
-
+ {
+ if (peer_sort (peer) == BGP_PEER_IBGP)
+ peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV;
+ else
+ peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
+ }
/* TTL reset */
if (peer_sort (peer) == BGP_PEER_IBGP)
peer->ttl = 255;
{
/* Advertisement-interval reset */
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;
- else
- group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
+ {
+ if (peer_sort (group->conf) == BGP_PEER_IBGP)
+ group->conf->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV;
+ else
+ group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
+ }
/* ebgp-multihop reset */
if (peer_sort (group->conf) == BGP_PEER_IBGP)
struct peer *peer;
afi_t afi;
safi_t safi;
- as_t as;
/* 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);
}
/* neighbor weight. */
-int
+void
peer_weight_set (struct peer *peer, u_int16_t weight)
{
struct peer_group *group;
peer->weight = weight;
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
- return 0;
+ return;
/* peer-group member updates. */
group = peer->group;
{
peer->weight = group->conf->weight;
}
- return 0;
}
-int
+void
peer_weight_unset (struct peer *peer)
{
struct peer_group *group;
UNSET_FLAG (peer->config, PEER_CONFIG_WEIGHT);
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
- return 0;
+ return;
/* peer-group member updates. */
group = peer->group;
{
peer->weight = 0;
}
- return 0;
+ return;
}
int
}
/* neighbor interface */
-int
+void
peer_interface_set (struct peer *peer, const char *str)
{
if (peer->ifname)
free (peer->ifname);
peer->ifname = strdup (str);
-
- return 0;
}
-int
+void
peer_interface_unset (struct peer *peer)
{
if (peer->ifname)
free (peer->ifname);
peer->ifname = NULL;
-
- return 0;
}
/* Allow-as in. */
}
static void
-peer_aslist_update (char *aslist_name)
+peer_aslist_update (const char *aslist_name)
{
afi_t afi;
safi_t safi;
}
static void
-peer_aslist_del (char *aslist_name)
+peer_aslist_del (const char *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);
}
#include "queue.h"
#include "sockunion.h"
#include "routemap.h"
+#include "linklist.h"
struct update_subgroup;
struct bpacket;
extern struct peer *peer_conf_interface_get(struct bgp *, const char *, afi_t,
safi_t);
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_get (struct bgp *, const char *);
extern struct peer *peer_create_bind_dynamic_neighbor (struct bgp *,
extern int peer_port_set (struct peer *, u_int16_t);
extern int peer_port_unset (struct peer *);
-extern int peer_weight_set (struct peer *, u_int16_t);
-extern int peer_weight_unset (struct peer *);
+extern void peer_weight_set (struct peer *, u_int16_t);
+extern void peer_weight_unset (struct peer *);
extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t);
extern int peer_timers_unset (struct peer *);
extern int peer_advertise_interval_set (struct peer *, u_int32_t);
extern int peer_advertise_interval_unset (struct peer *);
-extern int peer_interface_set (struct peer *, const char *);
-extern int peer_interface_unset (struct peer *);
+extern void peer_interface_set (struct peer *, const char *);
+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_unset (struct peer *, afi_t, safi_t, int);
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 void bgp_scan_finish(void);
+extern void bgp_close(void);
+
static inline int
afindex (afi_t afi, safi_t safi)
{
int sock, done = 0;
char rcvbuf[ZEBRA_PTM_MAX_SOCKBUF];
int nbytes, msglen;
- char *rcvptr, *eofptr;
+ char *rcvptr;
char msgbuf[ZEBRA_PTM_MAX_SOCKBUF];
sock = THREAD_FD (thread);