Skip to content
Permalink
Browse files

bgpd: Cleanup of bgp daemon code

This commit removes various parts of the bgpd implementation code which
are unused/useless, e.g. unused functions, unused variable
initializations, unused structs, ...

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
  • Loading branch information...
ppmathis committed Jul 7, 2018
1 parent 76f17a8 commit 3f54c705ecc008a69ce95f0f2e61cf529b520ee4
@@ -131,7 +131,6 @@ bgpd.h
struct peer_group
struct bgp_notify: (in-core representation of wire format?)
struct bgp_nexthop: (v4 and v6 addresses, *ifp)
struct bgp_rd: router distinguisher: 8 octects
struct bgp_filter: distribute, prefix, aslist, route_maps
struct peer: neighbor structure (very rich/complex)
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. */
static void community_list_entry_delete(struct community_list *list,
struct community_entry *entry,
int style)
struct community_entry *entry)
{
if (entry->next)
entry->next->prev = entry->prev;
@@ -882,7 +881,7 @@ int community_list_unset(struct community_list_handler *ch, const char *name,
if (!entry)
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);

return 0;
@@ -1040,7 +1039,7 @@ int lcommunity_list_unset(struct community_list_handler *ch, const char *name,
if (!entry)
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;

community_list_entry_delete(list, entry, style);
community_list_entry_delete(list, entry);

return 0;
}
@@ -1057,8 +1056,6 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name,
if (str == NULL)
return COMMUNITY_LIST_ERR_MALFORMED_VAL;

entry = NULL;

/* Get community list. */
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)
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);

return 0;
@@ -65,7 +65,6 @@ void ecommunity_free(struct ecommunity **ecom)
if ((*ecom)->str)
XFREE(MTYPE_ECOMMUNITY_STR, (*ecom)->str);
XFREE(MTYPE_ECOMMUNITY, *ecom);
ecom = NULL;
}

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 psize = 0;
uint8_t rtype;
uint8_t rlen;
struct prefix p;

/* 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;

rtype = *pnt++;
psize = rlen = *pnt++;
psize = *pnt++;

/* When packet overflow occur return immediately. */
if (pnt + psize > lim)
@@ -91,7 +91,6 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
afi_t afi;
safi_t safi;
int psize = 0;
uint8_t rlen;
struct prefix p;
int ret;
void *temp;
@@ -121,7 +120,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
if (pnt + 1 > lim)
return -1;

psize = rlen = *pnt++;
psize = *pnt++;

/* When packet overflow occur return immediately. */
if (pnt + psize > lim) {
@@ -50,7 +50,6 @@ void lcommunity_free(struct lcommunity **lcom)
if ((*lcom)->str)
XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);
XFREE(MTYPE_LCOMMUNITY, *lcom);
lcom = NULL;
}

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.prefixlen = IPV4_MAX_BITLEN;

rn2 = NULL;

bgp = SUBGRP_INST(subgrp);
rn1 = bgp_node_match(bgp->connected_table[AFI_IP], &np);
if (!rn1)
@@ -34,21 +34,12 @@ struct capability_mp_data {
uint8_t safi; /* iana_safi_t */
};

struct capability_as4 {
uint32_t as4;
};

struct graceful_restart_af {
afi_t afi;
safi_t safi;
uint8_t flag;
};

struct capability_gr {
uint16_t restart_flag_time;
struct graceful_restart_af gr[];
};

/* Capability Code */
#define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
#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)
{
bool ret;
uint8_t unary_operator_val = unary_operator;
uint8_t unary_operator_val;
bool double_check = false;

if ((unary_operator & OPERATOR_UNARY_OR) &&
@@ -57,17 +57,13 @@ struct bgp_pbr_match_val {
uint16_t value;
uint8_t compare_operator;
uint8_t unary_operator;
} bgp_pbr_value_t;
};

#define FRAGMENT_DONT 1
#define FRAGMENT_IS 2
#define FRAGMENT_FIRST 4
#define FRAGMENT_LAST 8

struct bgp_pbr_fragment_val {
uint8_t bitmask;
};

struct bgp_pbr_entry_action {
/* used to store enum bgp_pbr_action_enum enumerate */
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 prefix_rd *prd)
{
int status = BGP_DAMP_NONE;

/* apply dampening, if result is suppressed, we'll be retaining
* the bgp_info in the RIB for historical reference.
*/
if (CHECK_FLAG(peer->bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
&& 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_aggregate_decrement(peer->bgp, &rn->p, ri, afi,
safi);
@@ -864,7 +864,7 @@ DEFPY (rpki_cache,
"Preference of the cache server\n"
"Preference value\n")
{
int return_value = SUCCESS;
int return_value;

// use ssh connection
if (ssh_uname) {
@@ -873,6 +873,7 @@ DEFPY (rpki_cache,
add_ssh_cache(cache, sshport, ssh_uname, ssh_privkey,
ssh_pubkey, server_pubkey, preference);
#else
return_value = SUCCESS;
vty_out(vty,
"ssh sockets are not supported. "
"Please recompile rtrlib and frr with ssh support. "
@@ -25,16 +25,5 @@ typedef enum {
BGP_VNC_SUBTLV_TYPE_RFPOPTION = 2, /* deprecated */
} 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 /* _QUAGGA_BGP_VNC_TYPES_H */
@@ -3372,8 +3372,6 @@ DEFUN (neighbor_set_peer_group,
struct peer *peer;
struct peer_group *group;

peer = NULL;

ret = str2sockunion(argv[idx_peer]->arg, &su);
if (ret < 0) {
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;
int nh_othervrf = 0;
char buf_prefix[PREFIX_STRLEN]; /* filled in if we are debugging */
bool is_evpn = false;
bool is_evpn;
int nh_updated;

/* Don't try to install if we're not connected to Zebra or Zebra doesn't
Oops, something went wrong.

0 comments on commit 3f54c70

Please sign in to comment.
You can’t perform that action at this time.