mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 20:34:33 +00:00
Merge pull request #2636 from ppmathis/cleanup/bgpd
bgpd: Cleanup of bgp daemon code
This commit is contained in:
commit
6b479dff80
@ -131,7 +131,6 @@ bgpd.h
|
|||||||
struct peer_group
|
struct peer_group
|
||||||
struct bgp_notify: (in-core representation of wire format?)
|
struct bgp_notify: (in-core representation of wire format?)
|
||||||
struct bgp_nexthop: (v4 and v6 addresses, *ifp)
|
struct bgp_nexthop: (v4 and v6 addresses, *ifp)
|
||||||
struct bgp_rd: router distinguisher: 8 octects
|
|
||||||
struct bgp_filter: distribute, prefix, aslist, route_maps
|
struct bgp_filter: distribute, prefix, aslist, route_maps
|
||||||
struct peer: neighbor structure (very rich/complex)
|
struct peer: neighbor structure (very rich/complex)
|
||||||
struct bgp_nlri: reference to wire format
|
struct bgp_nlri: reference to wire format
|
||||||
|
@ -274,8 +274,7 @@ static void community_list_entry_add(struct community_list *list,
|
|||||||
|
|
||||||
/* Delete community-list entry from the list. */
|
/* Delete community-list entry from the list. */
|
||||||
static void community_list_entry_delete(struct community_list *list,
|
static void community_list_entry_delete(struct community_list *list,
|
||||||
struct community_entry *entry,
|
struct community_entry *entry)
|
||||||
int style)
|
|
||||||
{
|
{
|
||||||
if (entry->next)
|
if (entry->next)
|
||||||
entry->next->prev = entry->prev;
|
entry->next->prev = entry->prev;
|
||||||
@ -882,7 +881,7 @@ int community_list_unset(struct community_list_handler *ch, const char *name,
|
|||||||
if (!entry)
|
if (!entry)
|
||||||
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
||||||
|
|
||||||
community_list_entry_delete(list, entry, style);
|
community_list_entry_delete(list, entry);
|
||||||
route_map_notify_dependencies(name, RMAP_EVENT_CLIST_DELETED);
|
route_map_notify_dependencies(name, RMAP_EVENT_CLIST_DELETED);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1040,7 +1039,7 @@ int lcommunity_list_unset(struct community_list_handler *ch, const char *name,
|
|||||||
if (!entry)
|
if (!entry)
|
||||||
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
||||||
|
|
||||||
community_list_entry_delete(list, entry, style);
|
community_list_entry_delete(list, entry);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1057,8 +1056,6 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name,
|
|||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
|
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
|
||||||
|
|
||||||
entry = NULL;
|
|
||||||
|
|
||||||
/* Get community list. */
|
/* Get community list. */
|
||||||
list = community_list_get(ch, name, EXTCOMMUNITY_LIST_MASTER);
|
list = community_list_get(ch, name, EXTCOMMUNITY_LIST_MASTER);
|
||||||
|
|
||||||
@ -1149,7 +1146,7 @@ int extcommunity_list_unset(struct community_list_handler *ch, const char *name,
|
|||||||
if (!entry)
|
if (!entry)
|
||||||
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
||||||
|
|
||||||
community_list_entry_delete(list, entry, style);
|
community_list_entry_delete(list, entry);
|
||||||
route_map_notify_dependencies(name, RMAP_EVENT_ECLIST_DELETED);
|
route_map_notify_dependencies(name, RMAP_EVENT_ECLIST_DELETED);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -65,7 +65,6 @@ void ecommunity_free(struct ecommunity **ecom)
|
|||||||
if ((*ecom)->str)
|
if ((*ecom)->str)
|
||||||
XFREE(MTYPE_ECOMMUNITY_STR, (*ecom)->str);
|
XFREE(MTYPE_ECOMMUNITY_STR, (*ecom)->str);
|
||||||
XFREE(MTYPE_ECOMMUNITY, *ecom);
|
XFREE(MTYPE_ECOMMUNITY, *ecom);
|
||||||
ecom = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ecommunity_hash_free(struct ecommunity *ecom)
|
static void ecommunity_hash_free(struct ecommunity *ecom)
|
||||||
|
@ -4639,7 +4639,6 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
|
|||||||
int addpath_encoded;
|
int addpath_encoded;
|
||||||
int psize = 0;
|
int psize = 0;
|
||||||
uint8_t rtype;
|
uint8_t rtype;
|
||||||
uint8_t rlen;
|
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
|
|
||||||
/* Start processing the NLRI - there may be multiple in the MP_REACH */
|
/* Start processing the NLRI - there may be multiple in the MP_REACH */
|
||||||
@ -4673,7 +4672,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
rtype = *pnt++;
|
rtype = *pnt++;
|
||||||
psize = rlen = *pnt++;
|
psize = *pnt++;
|
||||||
|
|
||||||
/* When packet overflow occur return immediately. */
|
/* When packet overflow occur return immediately. */
|
||||||
if (pnt + psize > lim)
|
if (pnt + psize > lim)
|
||||||
|
@ -91,7 +91,6 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
|
|||||||
afi_t afi;
|
afi_t afi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
int psize = 0;
|
int psize = 0;
|
||||||
uint8_t rlen;
|
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
int ret;
|
int ret;
|
||||||
void *temp;
|
void *temp;
|
||||||
@ -121,7 +120,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
|
|||||||
if (pnt + 1 > lim)
|
if (pnt + 1 > lim)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
psize = rlen = *pnt++;
|
psize = *pnt++;
|
||||||
|
|
||||||
/* When packet overflow occur return immediately. */
|
/* When packet overflow occur return immediately. */
|
||||||
if (pnt + psize > lim) {
|
if (pnt + psize > lim) {
|
||||||
|
@ -50,7 +50,6 @@ void lcommunity_free(struct lcommunity **lcom)
|
|||||||
if ((*lcom)->str)
|
if ((*lcom)->str)
|
||||||
XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);
|
XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);
|
||||||
XFREE(MTYPE_LCOMMUNITY, *lcom);
|
XFREE(MTYPE_LCOMMUNITY, *lcom);
|
||||||
lcom = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcommunity_hash_free(struct lcommunity *lcom)
|
static void lcommunity_hash_free(struct lcommunity *lcom)
|
||||||
|
@ -447,8 +447,6 @@ int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
|
|||||||
p.family = AF_INET;
|
p.family = AF_INET;
|
||||||
p.prefixlen = IPV4_MAX_BITLEN;
|
p.prefixlen = IPV4_MAX_BITLEN;
|
||||||
|
|
||||||
rn2 = NULL;
|
|
||||||
|
|
||||||
bgp = SUBGRP_INST(subgrp);
|
bgp = SUBGRP_INST(subgrp);
|
||||||
rn1 = bgp_node_match(bgp->connected_table[AFI_IP], &np);
|
rn1 = bgp_node_match(bgp->connected_table[AFI_IP], &np);
|
||||||
if (!rn1)
|
if (!rn1)
|
||||||
|
@ -34,21 +34,12 @@ struct capability_mp_data {
|
|||||||
uint8_t safi; /* iana_safi_t */
|
uint8_t safi; /* iana_safi_t */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct capability_as4 {
|
|
||||||
uint32_t as4;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct graceful_restart_af {
|
struct graceful_restart_af {
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
uint8_t flag;
|
uint8_t flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct capability_gr {
|
|
||||||
uint16_t restart_flag_time;
|
|
||||||
struct graceful_restart_af gr[];
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Capability Code */
|
/* Capability Code */
|
||||||
#define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
|
#define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
|
||||||
#define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
|
#define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
|
||||||
|
@ -348,7 +348,7 @@ static bool bgp_pbr_extract_enumerate(struct bgp_pbr_match_val list[],
|
|||||||
void *valmask, uint8_t type_entry)
|
void *valmask, uint8_t type_entry)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
uint8_t unary_operator_val = unary_operator;
|
uint8_t unary_operator_val;
|
||||||
bool double_check = false;
|
bool double_check = false;
|
||||||
|
|
||||||
if ((unary_operator & OPERATOR_UNARY_OR) &&
|
if ((unary_operator & OPERATOR_UNARY_OR) &&
|
||||||
|
@ -57,17 +57,13 @@ struct bgp_pbr_match_val {
|
|||||||
uint16_t value;
|
uint16_t value;
|
||||||
uint8_t compare_operator;
|
uint8_t compare_operator;
|
||||||
uint8_t unary_operator;
|
uint8_t unary_operator;
|
||||||
} bgp_pbr_value_t;
|
};
|
||||||
|
|
||||||
#define FRAGMENT_DONT 1
|
#define FRAGMENT_DONT 1
|
||||||
#define FRAGMENT_IS 2
|
#define FRAGMENT_IS 2
|
||||||
#define FRAGMENT_FIRST 4
|
#define FRAGMENT_FIRST 4
|
||||||
#define FRAGMENT_LAST 8
|
#define FRAGMENT_LAST 8
|
||||||
|
|
||||||
struct bgp_pbr_fragment_val {
|
|
||||||
uint8_t bitmask;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bgp_pbr_entry_action {
|
struct bgp_pbr_entry_action {
|
||||||
/* used to store enum bgp_pbr_action_enum enumerate */
|
/* used to store enum bgp_pbr_action_enum enumerate */
|
||||||
uint8_t action;
|
uint8_t action;
|
||||||
|
@ -2673,14 +2673,12 @@ static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_info *ri,
|
|||||||
struct peer *peer, afi_t afi, safi_t safi,
|
struct peer *peer, afi_t afi, safi_t safi,
|
||||||
struct prefix_rd *prd)
|
struct prefix_rd *prd)
|
||||||
{
|
{
|
||||||
int status = BGP_DAMP_NONE;
|
|
||||||
|
|
||||||
/* apply dampening, if result is suppressed, we'll be retaining
|
/* apply dampening, if result is suppressed, we'll be retaining
|
||||||
* the bgp_info in the RIB for historical reference.
|
* the bgp_info in the RIB for historical reference.
|
||||||
*/
|
*/
|
||||||
if (CHECK_FLAG(peer->bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
|
if (CHECK_FLAG(peer->bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
|
||||||
&& peer->sort == BGP_PEER_EBGP)
|
&& peer->sort == BGP_PEER_EBGP)
|
||||||
if ((status = bgp_damp_withdraw(ri, rn, afi, safi, 0))
|
if ((bgp_damp_withdraw(ri, rn, afi, safi, 0))
|
||||||
== BGP_DAMP_SUPPRESSED) {
|
== BGP_DAMP_SUPPRESSED) {
|
||||||
bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi,
|
bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi,
|
||||||
safi);
|
safi);
|
||||||
|
@ -864,7 +864,7 @@ DEFPY (rpki_cache,
|
|||||||
"Preference of the cache server\n"
|
"Preference of the cache server\n"
|
||||||
"Preference value\n")
|
"Preference value\n")
|
||||||
{
|
{
|
||||||
int return_value = SUCCESS;
|
int return_value;
|
||||||
|
|
||||||
// use ssh connection
|
// use ssh connection
|
||||||
if (ssh_uname) {
|
if (ssh_uname) {
|
||||||
@ -873,6 +873,7 @@ DEFPY (rpki_cache,
|
|||||||
add_ssh_cache(cache, sshport, ssh_uname, ssh_privkey,
|
add_ssh_cache(cache, sshport, ssh_uname, ssh_privkey,
|
||||||
ssh_pubkey, server_pubkey, preference);
|
ssh_pubkey, server_pubkey, preference);
|
||||||
#else
|
#else
|
||||||
|
return_value = SUCCESS;
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"ssh sockets are not supported. "
|
"ssh sockets are not supported. "
|
||||||
"Please recompile rtrlib and frr with ssh support. "
|
"Please recompile rtrlib and frr with ssh support. "
|
||||||
|
@ -25,16 +25,5 @@ typedef enum {
|
|||||||
BGP_VNC_SUBTLV_TYPE_RFPOPTION = 2, /* deprecated */
|
BGP_VNC_SUBTLV_TYPE_RFPOPTION = 2, /* deprecated */
|
||||||
} bgp_vnc_subtlv_types;
|
} bgp_vnc_subtlv_types;
|
||||||
|
|
||||||
/*
|
|
||||||
* VNC Attribute subtlvs
|
|
||||||
*/
|
|
||||||
struct bgp_vnc_subtlv_lifetime {
|
|
||||||
uint32_t lifetime;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bgp_vnc_subtlv_unaddr {
|
|
||||||
struct prefix un_address; /* IPv4 or IPv6; pfx length ignored */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ENABLE_BGP_VNC */
|
#endif /* ENABLE_BGP_VNC */
|
||||||
#endif /* _QUAGGA_BGP_VNC_TYPES_H */
|
#endif /* _QUAGGA_BGP_VNC_TYPES_H */
|
||||||
|
@ -3372,8 +3372,6 @@ DEFUN (neighbor_set_peer_group,
|
|||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
|
||||||
peer = NULL;
|
|
||||||
|
|
||||||
ret = str2sockunion(argv[idx_peer]->arg, &su);
|
ret = str2sockunion(argv[idx_peer]->arg, &su);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
peer = peer_lookup_by_conf_if(bgp, argv[idx_peer]->arg);
|
peer = peer_lookup_by_conf_if(bgp, argv[idx_peer]->arg);
|
||||||
|
@ -1190,7 +1190,7 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
|
|||||||
mpls_label_t label;
|
mpls_label_t label;
|
||||||
int nh_othervrf = 0;
|
int nh_othervrf = 0;
|
||||||
char buf_prefix[PREFIX_STRLEN]; /* filled in if we are debugging */
|
char buf_prefix[PREFIX_STRLEN]; /* filled in if we are debugging */
|
||||||
bool is_evpn = false;
|
bool is_evpn;
|
||||||
int nh_updated;
|
int nh_updated;
|
||||||
|
|
||||||
/* Don't try to install if we're not connected to Zebra or Zebra doesn't
|
/* Don't try to install if we're not connected to Zebra or Zebra doesn't
|
||||||
|
183
bgpd/bgpd.c
183
bgpd/bgpd.c
@ -888,129 +888,6 @@ static bool peergroup_filter_check(struct peer *peer, afi_t afi, safi_t safi,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset all address family specific configuration. */
|
|
||||||
static void peer_af_flag_reset(struct peer *peer, afi_t afi, safi_t safi)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct bgp_filter *filter;
|
|
||||||
char orf_name[BUFSIZ];
|
|
||||||
|
|
||||||
filter = &peer->filter[afi][safi];
|
|
||||||
|
|
||||||
/* Clear neighbor filter and route-map */
|
|
||||||
for (i = FILTER_IN; i < FILTER_MAX; i++) {
|
|
||||||
if (filter->dlist[i].name) {
|
|
||||||
XFREE(MTYPE_BGP_FILTER_NAME, filter->dlist[i].name);
|
|
||||||
filter->dlist[i].name = NULL;
|
|
||||||
}
|
|
||||||
if (filter->plist[i].name) {
|
|
||||||
XFREE(MTYPE_BGP_FILTER_NAME, filter->plist[i].name);
|
|
||||||
filter->plist[i].name = NULL;
|
|
||||||
}
|
|
||||||
if (filter->aslist[i].name) {
|
|
||||||
XFREE(MTYPE_BGP_FILTER_NAME, filter->aslist[i].name);
|
|
||||||
filter->aslist[i].name = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i = RMAP_IN; i < RMAP_MAX; i++) {
|
|
||||||
if (filter->map[i].name) {
|
|
||||||
XFREE(MTYPE_BGP_FILTER_NAME, filter->map[i].name);
|
|
||||||
filter->map[i].name = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear unsuppress map. */
|
|
||||||
if (filter->usmap.name)
|
|
||||||
XFREE(MTYPE_BGP_FILTER_NAME, filter->usmap.name);
|
|
||||||
filter->usmap.name = NULL;
|
|
||||||
filter->usmap.map = NULL;
|
|
||||||
|
|
||||||
/* Clear neighbor's all address family flags. */
|
|
||||||
peer->af_flags[afi][safi] = 0;
|
|
||||||
|
|
||||||
/* Clear neighbor's all address family sflags. */
|
|
||||||
peer->af_sflags[afi][safi] = 0;
|
|
||||||
|
|
||||||
/* Clear neighbor's all address family capabilities. */
|
|
||||||
peer->af_cap[afi][safi] = 0;
|
|
||||||
|
|
||||||
/* Clear ORF info */
|
|
||||||
peer->orf_plist[afi][safi] = NULL;
|
|
||||||
sprintf(orf_name, "%s.%d.%d", peer->host, afi, safi);
|
|
||||||
prefix_bgp_orf_remove_all(afi, orf_name);
|
|
||||||
|
|
||||||
/* Set default neighbor send-community. */
|
|
||||||
if (!bgp_option_check(BGP_OPT_CONFIG_CISCO)) {
|
|
||||||
SET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY);
|
|
||||||
SET_FLAG(peer->af_flags[afi][safi],
|
|
||||||
PEER_FLAG_SEND_EXT_COMMUNITY);
|
|
||||||
SET_FLAG(peer->af_flags[afi][safi],
|
|
||||||
PEER_FLAG_SEND_LARGE_COMMUNITY);
|
|
||||||
|
|
||||||
SET_FLAG(peer->af_flags_invert[afi][safi],
|
|
||||||
PEER_FLAG_SEND_COMMUNITY);
|
|
||||||
SET_FLAG(peer->af_flags_invert[afi][safi],
|
|
||||||
PEER_FLAG_SEND_EXT_COMMUNITY);
|
|
||||||
SET_FLAG(peer->af_flags_invert[afi][safi],
|
|
||||||
PEER_FLAG_SEND_LARGE_COMMUNITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear neighbor default_originate_rmap */
|
|
||||||
if (peer->default_rmap[afi][safi].name)
|
|
||||||
XFREE(MTYPE_ROUTE_MAP_NAME, peer->default_rmap[afi][safi].name);
|
|
||||||
peer->default_rmap[afi][safi].name = NULL;
|
|
||||||
peer->default_rmap[afi][safi].map = NULL;
|
|
||||||
|
|
||||||
/* Clear neighbor maximum-prefix */
|
|
||||||
peer->pmax[afi][safi] = 0;
|
|
||||||
peer->pmax_threshold[afi][safi] = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* peer global config reset */
|
|
||||||
static void peer_global_config_reset(struct peer *peer)
|
|
||||||
{
|
|
||||||
int saved_flags = 0;
|
|
||||||
|
|
||||||
peer->change_local_as = 0;
|
|
||||||
peer->ttl = (peer_sort(peer) == BGP_PEER_IBGP ? MAXTTL : 1);
|
|
||||||
if (peer->update_source) {
|
|
||||||
sockunion_free(peer->update_source);
|
|
||||||
peer->update_source = NULL;
|
|
||||||
}
|
|
||||||
if (peer->update_if) {
|
|
||||||
XFREE(MTYPE_PEER_UPDATE_SOURCE, peer->update_if);
|
|
||||||
peer->update_if = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (peer_sort(peer) == BGP_PEER_IBGP)
|
|
||||||
peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV;
|
|
||||||
else
|
|
||||||
peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
|
|
||||||
|
|
||||||
/* These are per-peer specific flags and so we must preserve them */
|
|
||||||
saved_flags |= CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
|
|
||||||
saved_flags |= CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN);
|
|
||||||
peer->flags = 0;
|
|
||||||
SET_FLAG(peer->flags, saved_flags);
|
|
||||||
|
|
||||||
peer->holdtime = 0;
|
|
||||||
peer->keepalive = 0;
|
|
||||||
peer->connect = 0;
|
|
||||||
peer->v_connect = BGP_DEFAULT_CONNECT_RETRY;
|
|
||||||
|
|
||||||
/* Reset some other configs back to defaults. */
|
|
||||||
peer->v_start = BGP_INIT_START_TIMER;
|
|
||||||
peer->password = NULL;
|
|
||||||
peer->local_id = peer->bgp->router_id;
|
|
||||||
peer->v_holdtime = peer->bgp->default_holdtime;
|
|
||||||
peer->v_keepalive = peer->bgp->default_keepalive;
|
|
||||||
|
|
||||||
bfd_info_free(&(peer->bfd_info));
|
|
||||||
|
|
||||||
/* Set back the CONFIG_NODE flag. */
|
|
||||||
SET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check peer's AS number and determines if this peer is IBGP or EBGP */
|
/* Check peer's AS number and determines if this peer is IBGP or EBGP */
|
||||||
static inline bgp_peer_sort_t peer_calc_sort(struct peer *peer)
|
static inline bgp_peer_sort_t peer_calc_sort(struct peer *peer)
|
||||||
{
|
{
|
||||||
@ -2821,61 +2698,6 @@ int peer_group_bind(struct bgp *bgp, union sockunion *su, struct peer *peer,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int peer_group_unbind(struct bgp *bgp, struct peer *peer,
|
|
||||||
struct peer_group *group)
|
|
||||||
{
|
|
||||||
struct peer *other;
|
|
||||||
afi_t afi;
|
|
||||||
safi_t safi;
|
|
||||||
|
|
||||||
if (group != peer->group)
|
|
||||||
return BGP_ERR_PEER_GROUP_MISMATCH;
|
|
||||||
|
|
||||||
FOREACH_AFI_SAFI (afi, safi) {
|
|
||||||
if (peer->afc[afi][safi]) {
|
|
||||||
peer->afc[afi][safi] = 0;
|
|
||||||
peer_af_flag_reset(peer, afi, safi);
|
|
||||||
|
|
||||||
if (peer_af_delete(peer, afi, safi) != 0) {
|
|
||||||
zlog_err(
|
|
||||||
"couldn't delete af structure for peer %s",
|
|
||||||
peer->host);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(listnode_lookup(group->peer, peer));
|
|
||||||
peer_unlock(peer); /* peer group list reference */
|
|
||||||
listnode_delete(group->peer, peer);
|
|
||||||
peer->group = NULL;
|
|
||||||
other = peer->doppelganger;
|
|
||||||
|
|
||||||
if (group->conf->as) {
|
|
||||||
peer_delete(peer);
|
|
||||||
if (other && other->status != Deleted) {
|
|
||||||
if (other->group) {
|
|
||||||
peer_unlock(other);
|
|
||||||
listnode_delete(group->peer, other);
|
|
||||||
}
|
|
||||||
other->group = NULL;
|
|
||||||
peer_delete(other);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bgp_bfd_deregister_peer(peer);
|
|
||||||
peer_global_config_reset(peer);
|
|
||||||
|
|
||||||
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) {
|
|
||||||
peer->last_reset = PEER_DOWN_RMAP_UNBIND;
|
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
|
||||||
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
|
|
||||||
} else
|
|
||||||
bgp_session_reset(peer);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int bgp_startup_timer_expire(struct thread *thread)
|
static int bgp_startup_timer_expire(struct thread *thread)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
@ -3825,9 +3647,6 @@ struct peer_flag_action {
|
|||||||
|
|
||||||
/* Action when the flag is changed. */
|
/* Action when the flag is changed. */
|
||||||
enum peer_change_type type;
|
enum peer_change_type type;
|
||||||
|
|
||||||
/* Peer down cause */
|
|
||||||
uint8_t peer_down;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct peer_flag_action peer_flag_action_list[] = {
|
static const struct peer_flag_action peer_flag_action_list[] = {
|
||||||
@ -7920,8 +7739,6 @@ static void bgp_if_finish(struct bgp *bgp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void bgp_snmp_init(void);
|
|
||||||
|
|
||||||
static void bgp_viewvrf_autocomplete(vector comps, struct cmd_token *token)
|
static void bgp_viewvrf_autocomplete(vector comps, struct cmd_token *token)
|
||||||
{
|
{
|
||||||
struct vrf *vrf = NULL;
|
struct vrf *vrf = NULL;
|
||||||
|
@ -590,13 +590,7 @@ struct bgp_nexthop {
|
|||||||
|
|
||||||
#define BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE 1
|
#define BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE 1
|
||||||
|
|
||||||
/* BGP router distinguisher value. */
|
/* Route map direction */
|
||||||
#define BGP_RD_SIZE 8
|
|
||||||
|
|
||||||
struct bgp_rd {
|
|
||||||
uint8_t val[BGP_RD_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define RMAP_IN 0
|
#define RMAP_IN 0
|
||||||
#define RMAP_OUT 1
|
#define RMAP_OUT 1
|
||||||
#define RMAP_MAX 2
|
#define RMAP_MAX 2
|
||||||
@ -1590,7 +1584,6 @@ extern int peer_afc_set(struct peer *, afi_t, safi_t, int);
|
|||||||
|
|
||||||
extern int peer_group_bind(struct bgp *, union sockunion *, struct peer *,
|
extern int peer_group_bind(struct bgp *, union sockunion *, struct peer *,
|
||||||
struct peer_group *, as_t *);
|
struct peer_group *, as_t *);
|
||||||
extern int peer_group_unbind(struct bgp *, struct peer *, struct peer_group *);
|
|
||||||
|
|
||||||
extern int peer_flag_set(struct peer *, uint32_t);
|
extern int peer_flag_set(struct peer *, uint32_t);
|
||||||
extern int peer_flag_unset(struct peer *, uint32_t);
|
extern int peer_flag_unset(struct peer *, uint32_t);
|
||||||
|
@ -3197,8 +3197,8 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
|
|||||||
memset(optary, 0, sizeof(optary));
|
memset(optary, 0, sizeof(optary));
|
||||||
optary[opt_next].v.l2addr.logical_net_id =
|
optary[opt_next].v.l2addr.logical_net_id =
|
||||||
strtoul(argv[14]->arg, NULL, 10);
|
strtoul(argv[14]->arg, NULL, 10);
|
||||||
if ((rc = rfapiStr2EthAddr(argv[12]->arg,
|
if (rfapiStr2EthAddr(argv[12]->arg,
|
||||||
&optary[opt_next].v.l2addr.macaddr))) {
|
&optary[opt_next].v.l2addr.macaddr)) {
|
||||||
vty_out(vty, "Bad mac address \"%s\"\n", argv[12]->arg);
|
vty_out(vty, "Bad mac address \"%s\"\n", argv[12]->arg);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2099,6 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
|
|||||||
nhp->vn_options = NULL;
|
nhp->vn_options = NULL;
|
||||||
|
|
||||||
XFREE(MTYPE_RFAPI_NEXTHOP, nhp);
|
XFREE(MTYPE_RFAPI_NEXTHOP, nhp);
|
||||||
nhp = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,6 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct route_node *rn,
|
|||||||
|
|
||||||
static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
|
static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
|
||||||
{
|
{
|
||||||
struct rfapi_cfg *hc;
|
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct bgp_info *ri;
|
struct bgp_info *ri;
|
||||||
|
|
||||||
@ -411,7 +410,7 @@ static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
|
|||||||
if (!bgp)
|
if (!bgp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(hc = bgp->rfapi_cfg))
|
if (!(bgp->rfapi_cfg))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!VNC_EXPORT_BGP_CE_ENABLED(bgp->rfapi_cfg)) {
|
if (!VNC_EXPORT_BGP_CE_ENABLED(bgp->rfapi_cfg)) {
|
||||||
|
@ -557,7 +557,6 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
|
|||||||
struct bgp_info *info) /* unicast info */
|
struct bgp_info *info) /* unicast info */
|
||||||
{
|
{
|
||||||
afi_t afi = family2afi(prefix->family);
|
afi_t afi = family2afi(prefix->family);
|
||||||
struct rfapi_cfg *hc = NULL;
|
|
||||||
|
|
||||||
struct prefix pfx_unicast_nexthop = {0}; /* happy valgrind */
|
struct prefix pfx_unicast_nexthop = {0}; /* happy valgrind */
|
||||||
|
|
||||||
@ -607,7 +606,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(hc = bgp->rfapi_cfg)) {
|
if (!(bgp->rfapi_cfg)) {
|
||||||
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
|
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
|
||||||
__func__);
|
__func__);
|
||||||
return;
|
return;
|
||||||
@ -698,7 +697,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
|
|||||||
struct peer *peer = info->peer;
|
struct peer *peer = info->peer;
|
||||||
struct attr *attr = info->attr;
|
struct attr *attr = info->attr;
|
||||||
struct attr hattr;
|
struct attr hattr;
|
||||||
struct rfapi_cfg *hc = NULL;
|
struct rfapi_cfg *hc = bgp->rfapi_cfg;
|
||||||
struct attr *iattr = NULL;
|
struct attr *iattr = NULL;
|
||||||
|
|
||||||
struct rfapi_ip_addr vnaddr;
|
struct rfapi_ip_addr vnaddr;
|
||||||
@ -723,7 +722,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(hc = bgp->rfapi_cfg)) {
|
if (!hc) {
|
||||||
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
|
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
|
||||||
__func__);
|
__func__);
|
||||||
return;
|
return;
|
||||||
@ -886,7 +885,6 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
|
|||||||
struct peer *peer = info->peer;
|
struct peer *peer = info->peer;
|
||||||
struct attr *attr = info->attr;
|
struct attr *attr = info->attr;
|
||||||
struct attr hattr;
|
struct attr hattr;
|
||||||
struct rfapi_cfg *hc = NULL;
|
|
||||||
struct attr *iattr = NULL;
|
struct attr *iattr = NULL;
|
||||||
|
|
||||||
struct rfapi_ip_addr vnaddr;
|
struct rfapi_ip_addr vnaddr;
|
||||||
@ -911,7 +909,7 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(hc = bgp->rfapi_cfg)) {
|
if (!(bgp->rfapi_cfg)) {
|
||||||
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
|
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
|
||||||
__func__);
|
__func__);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user