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
/* 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;
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;
if (!entry)
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
- community_list_entry_delete(list, entry, style);
+ community_list_entry_delete(list, entry);
return 0;
}
if (str == NULL)
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
- entry = NULL;
-
/* Get community list. */
list = community_list_get(ch, name, EXTCOMMUNITY_LIST_MASTER);
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;
if ((*ecom)->str)
XFREE(MTYPE_ECOMMUNITY_STR, (*ecom)->str);
XFREE(MTYPE_ECOMMUNITY, *ecom);
- ecom = NULL;
}
static void ecommunity_hash_free(struct ecommunity *ecom)
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 */
return -1;
rtype = *pnt++;
- psize = rlen = *pnt++;
+ psize = *pnt++;
/* When packet overflow occur return immediately. */
if (pnt + psize > lim)
afi_t afi;
safi_t safi;
int psize = 0;
- uint8_t rlen;
struct prefix p;
int ret;
void *temp;
if (pnt + 1 > lim)
return -1;
- psize = rlen = *pnt++;
+ psize = *pnt++;
/* When packet overflow occur return immediately. */
if (pnt + psize > lim) {
if ((*lcom)->str)
XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);
XFREE(MTYPE_LCOMMUNITY, *lcom);
- lcom = NULL;
}
static void lcommunity_hash_free(struct lcommunity *lcom)
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)
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 */
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) &&
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;
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);
"Preference of the cache server\n"
"Preference value\n")
{
- int return_value = SUCCESS;
+ int return_value;
// use ssh connection
if (ssh_uname) {
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. "
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 */
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);
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
}
}
-/* 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 */
static inline bgp_peer_sort_t peer_calc_sort(struct peer *peer)
{
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)
{
struct bgp *bgp;
/* Action when the flag is changed. */
enum peer_change_type type;
-
- /* Peer down cause */
- uint8_t peer_down;
};
static const struct peer_flag_action peer_flag_action_list[] = {
}
}
-extern void bgp_snmp_init(void);
-
static void bgp_viewvrf_autocomplete(vector comps, struct cmd_token *token)
{
struct vrf *vrf = NULL;
#define BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE 1
-/* BGP router distinguisher value. */
-#define BGP_RD_SIZE 8
-
-struct bgp_rd {
- uint8_t val[BGP_RD_SIZE];
-};
-
+/* Route map direction */
#define RMAP_IN 0
#define RMAP_OUT 1
#define RMAP_MAX 2
extern int peer_group_bind(struct bgp *, union sockunion *, struct peer *,
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_unset(struct peer *, uint32_t);
memset(optary, 0, sizeof(optary));
optary[opt_next].v.l2addr.logical_net_id =
strtoul(argv[14]->arg, NULL, 10);
- if ((rc = rfapiStr2EthAddr(argv[12]->arg,
- &optary[opt_next].v.l2addr.macaddr))) {
+ if (rfapiStr2EthAddr(argv[12]->arg,
+ &optary[opt_next].v.l2addr.macaddr)) {
vty_out(vty, "Bad mac address \"%s\"\n", argv[12]->arg);
return CMD_WARNING_CONFIG_FAILED;
}
nhp->vn_options = NULL;
XFREE(MTYPE_RFAPI_NEXTHOP, nhp);
- nhp = NULL;
}
}
static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
{
- struct rfapi_cfg *hc;
struct route_node *rn;
struct bgp_info *ri;
if (!bgp)
return;
- if (!(hc = bgp->rfapi_cfg))
+ if (!(bgp->rfapi_cfg))
return;
if (!VNC_EXPORT_BGP_CE_ENABLED(bgp->rfapi_cfg)) {
struct bgp_info *info) /* unicast info */
{
afi_t afi = family2afi(prefix->family);
- struct rfapi_cfg *hc = NULL;
struct prefix pfx_unicast_nexthop = {0}; /* happy valgrind */
return;
}
- if (!(hc = bgp->rfapi_cfg)) {
+ if (!(bgp->rfapi_cfg)) {
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
__func__);
return;
struct peer *peer = info->peer;
struct attr *attr = info->attr;
struct attr hattr;
- struct rfapi_cfg *hc = NULL;
+ struct rfapi_cfg *hc = bgp->rfapi_cfg;
struct attr *iattr = NULL;
struct rfapi_ip_addr vnaddr;
return;
}
- if (!(hc = bgp->rfapi_cfg)) {
+ if (!hc) {
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
__func__);
return;
struct peer *peer = info->peer;
struct attr *attr = info->attr;
struct attr hattr;
- struct rfapi_cfg *hc = NULL;
struct attr *iattr = NULL;
struct rfapi_ip_addr vnaddr;
return;
}
- if (!(hc = bgp->rfapi_cfg)) {
+ if (!(bgp->rfapi_cfg)) {
vnc_zlog_debug_verbose("%s: bgp->rfapi_cfg is NULL, skipping",
__func__);
return;
if (!pim_br) {
pim_br = XCALLOC(MTYPE_PIM_BR, sizeof(*pim_br));
- if (!pim_br) {
- zlog_err("PIM XCALLOC(%zu) failure", sizeof(*pim_br));
- return;
- }
pim_br->sg = *sg;
void pim_br_init(void)
{
pim_br_list = list_new();
- if (!pim_br_list) {
- zlog_err("%s: Failure to create pim_br_list",
- __PRETTY_FUNCTION__);
- return;
- }
}
return;
}
-static void *if_list_clean(struct pim_interface *pim_ifp)
-{
- struct pim_ifchannel *ch;
-
- if (pim_ifp->igmp_join_list)
- list_delete_and_null(&pim_ifp->igmp_join_list);
-
- if (pim_ifp->igmp_socket_list)
- list_delete_and_null(&pim_ifp->igmp_socket_list);
-
- if (pim_ifp->pim_neighbor_list)
- list_delete_and_null(&pim_ifp->pim_neighbor_list);
-
- if (pim_ifp->upstream_switch_list)
- list_delete_and_null(&pim_ifp->upstream_switch_list);
-
- if (pim_ifp->sec_addr_list)
- list_delete_and_null(&pim_ifp->sec_addr_list);
-
- while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
- ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
-
- pim_ifchannel_delete(ch);
- }
-
- XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
-
- return 0;
-}
-
static void pim_sec_addr_free(struct pim_secondary_addr *sec_addr)
{
XFREE(MTYPE_PIM_SEC_ADDR, sec_addr);
zassert(!ifp->info);
pim_ifp = XCALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
- if (!pim_ifp) {
- zlog_err("PIM XCALLOC(%zu) failure", sizeof(*pim_ifp));
- return 0;
- }
pim_ifp->options = 0;
pim_ifp->pim = pim_get_pim_instance(ifp->vrf_id);
/* list of struct igmp_sock */
pim_ifp->igmp_socket_list = list_new();
- if (!pim_ifp->igmp_socket_list) {
- zlog_err("%s: failure: igmp_socket_list=list_new()",
- __PRETTY_FUNCTION__);
- return if_list_clean(pim_ifp);
- }
pim_ifp->igmp_socket_list->del = (void (*)(void *))igmp_sock_free;
/* list of struct pim_neighbor */
pim_ifp->pim_neighbor_list = list_new();
- if (!pim_ifp->pim_neighbor_list) {
- zlog_err("%s: failure: pim_neighbor_list=list_new()",
- __PRETTY_FUNCTION__);
- return if_list_clean(pim_ifp);
- }
pim_ifp->pim_neighbor_list->del = (void (*)(void *))pim_neighbor_free;
pim_ifp->upstream_switch_list = list_new();
- if (!pim_ifp->upstream_switch_list) {
- zlog_err("%s: failure: upstream_switch_list=list_new()",
- __PRETTY_FUNCTION__);
- return if_list_clean(pim_ifp);
- }
pim_ifp->upstream_switch_list->del =
(void (*)(void *))pim_jp_agg_group_list_free;
pim_ifp->upstream_switch_list->cmp = pim_jp_agg_group_list_cmp;
pim_ifp->sec_addr_list = list_new();
- if (!pim_ifp->sec_addr_list) {
- zlog_err("%s: failure: secondary addresslist",
- __PRETTY_FUNCTION__);
- return if_list_clean(pim_ifp);
- }
pim_ifp->sec_addr_list->del = (void (*)(void *))pim_sec_addr_free;
pim_ifp->sec_addr_list->cmp =
(int (*)(void *, void *))pim_sec_addr_comp;
}
sec_addr = XCALLOC(MTYPE_PIM_SEC_ADDR, sizeof(*sec_addr));
- if (!sec_addr)
- return changed;
changed = 1;
sec_addr->addr = *addr;
}
ij = XCALLOC(MTYPE_PIM_IGMP_JOIN, sizeof(*ij));
- if (!ij) {
- char group_str[INET_ADDRSTRLEN];
- char source_str[INET_ADDRSTRLEN];
- pim_inet4_dump("<grp?>", group_addr, group_str,
- sizeof(group_str));
- pim_inet4_dump("<src?>", source_addr, source_str,
- sizeof(source_str));
- zlog_err(
- "%s: XCALLOC(%zu) failure for IGMP group %s source %s on interface %s",
- __PRETTY_FUNCTION__, sizeof(*ij), group_str, source_str,
- ifp->name);
- close(join_fd);
- return 0;
- }
ij->sock_fd = join_fd;
ij->group_addr = group_addr;
if (!pim_ifp->igmp_join_list) {
pim_ifp->igmp_join_list = list_new();
- if (!pim_ifp->igmp_join_list) {
- return ferr_cfg_invalid("Insufficient memory");
- }
pim_ifp->igmp_join_list->del = (void (*)(void *))igmp_join_free;
}
pim_ifp = ifp->info;
ch = XCALLOC(MTYPE_PIM_IFCHANNEL, sizeof(*ch));
- if (!ch) {
- zlog_warn(
- "%s: pim_ifchannel_new() failure for (S,G)=%s on interface %s",
- __PRETTY_FUNCTION__, pim_str_sg_dump(sg), ifp->name);
- return NULL;
- }
ch->flags = 0;
if ((source_flags & PIM_ENCODE_RPT_BIT)
}
igmp = XCALLOC(MTYPE_PIM_IGMP_SOCKET, sizeof(*igmp));
- if (!igmp) {
- zlog_warn("%s %s: XCALLOC() failure", __FILE__,
- __PRETTY_FUNCTION__);
- return 0;
- }
igmp->igmp_group_list = list_new();
- if (!igmp->igmp_group_list) {
- zlog_err("%s %s: failure: igmp_group_list = list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- return 0;
- }
igmp->igmp_group_list->del = (void (*)(void *))igmp_group_free;
snprintf(hash_name, 64, "IGMP %s hash", ifp->name);
*/
group = XCALLOC(MTYPE_PIM_IGMP_GROUP, sizeof(*group));
- if (!group) {
- zlog_warn("%s %s: XCALLOC() failure", __FILE__,
- __PRETTY_FUNCTION__);
- return NULL; /* error, not found, could not create */
- }
group->group_source_list = list_new();
- if (!group->group_source_list) {
- zlog_warn("%s %s: list_new() failure", __FILE__,
- __PRETTY_FUNCTION__);
- XFREE(MTYPE_PIM_IGMP_GROUP, group); /* discard group */
- return NULL; /* error, not found, could not initialize */
- }
group->group_source_list->del = (void (*)(void *))igmp_source_free;
group->t_group_timer = NULL;
}
src = XCALLOC(MTYPE_PIM_IGMP_GROUP_SOURCE, sizeof(*src));
- if (!src) {
- zlog_warn("%s %s: XCALLOC() failure", __FILE__,
- __PRETTY_FUNCTION__);
- return 0; /* error, not found, could not create */
- }
src->t_source_timer = NULL;
src->source_group = group; /* back pointer */
char hash_name[64];
pim = XCALLOC(MTYPE_PIM_PIM_INSTANCE, sizeof(struct pim_instance));
- if (!pim)
- return NULL;
pim_if_init(pim);
}
pim->static_routes = list_new();
- if (!pim->static_routes) {
- zlog_err("%s %s: failure: static_routes=list_new()", __FILE__,
- __PRETTY_FUNCTION__);
- pim_instance_terminate(pim);
- return NULL;
- }
pim->static_routes->del = (void (*)(void *))pim_static_route_free;
pim->send_v6_secondary = 1;
if (first) {
groups = list_new();
-
jag.sources = list_new();
listnode_add(groups, &jag);
struct pim_msdp_sa *sa;
sa = XCALLOC(MTYPE_PIM_MSDP_SA, sizeof(*sa));
- if (!sa) {
- zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
- sizeof(*sa));
- return NULL;
- }
sa->pim = pim;
sa->sg = *sg;
pim_msdp_enable(pim);
mp = XCALLOC(MTYPE_PIM_MSDP_PEER, sizeof(*mp));
- if (!mp) {
- zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
- sizeof(*mp));
- return PIM_MSDP_ERR_OOM;
- }
mp->pim = pim;
mp->peer = peer_addr;
struct pim_msdp_mg *mg;
mg = XCALLOC(MTYPE_PIM_MSDP_MG, sizeof(*mg));
- if (!mg) {
- zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
- sizeof(*mg));
- return NULL;
- }
mg->mesh_group_name = XSTRDUP(MTYPE_PIM_MSDP_MG_NAME, mesh_group_name);
mg->mbr_list = list_new();
}
mbr = XCALLOC(MTYPE_PIM_MSDP_MG_MBR, sizeof(*mbr));
- if (!mbr) {
- zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
- sizeof(*mbr));
- /* if there are no references to the mg free it */
- pim_msdp_mg_free(pim, mg);
- return PIM_MSDP_ERR_OOM;
- }
mbr->mbr_ip = mbr_ip;
listnode_add_sort(mg->mbr_list, mbr);
zassert(pim_ifp);
neigh = XCALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
- if (!neigh) {
- zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
- sizeof(*neigh));
- return 0;
- }
neigh->creation = pim_time_monotonic_sec();
neigh->source_addr = source_addr;
pnc = XCALLOC(MTYPE_PIM_NEXTHOP_CACHE,
sizeof(struct pim_nexthop_cache));
- if (!pnc) {
- zlog_err("%s: NHT PIM XCALLOC failure ", __PRETTY_FUNCTION__);
- return NULL;
- }
pnc->rpf.rpf_addr.family = rpf_addr->rpf_addr.family;
pnc->rpf.rpf_addr.prefixlen = rpf_addr->rpf_addr.prefixlen;
pnc->rpf.rpf_addr.u.prefix4.s_addr =
pnc = pim_nexthop_cache_find(pim, &rpf);
if (!pnc) {
pnc = pim_nexthop_cache_add(pim, &rpf);
- if (!pnc) {
- char rpf_str[PREFIX_STRLEN];
- pim_addr_dump("<nht-pnc?>", addr, rpf_str,
- sizeof(rpf_str));
- zlog_warn("%s: pnc node allocation failed. addr %s ",
- __PRETTY_FUNCTION__, rpf_str);
- return 0;
- }
pim_sendmsg_zebra_rnh(pim, zclient, pnc,
ZEBRA_NEXTHOP_REGISTER);
if (PIM_DEBUG_PIM_NHT) {
if (up != NULL)
hash_get(pnc->upstream_hash, up, hash_alloc_intern);
- if (pnc && CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
+ if (CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
memcpy(out_pnc, pnc, sizeof(struct pim_nexthop_cache));
return 1;
}
pim_oil_equal, hash_name);
pim->channel_oil_list = list_new();
- if (!pim->channel_oil_list) {
- zlog_err("%s %s: failure: channel_oil_list=list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- return;
- }
pim->channel_oil_list->del = (void (*)(void *))pim_channel_oil_free;
pim->channel_oil_list->cmp =
(int (*)(void *, void *))pim_channel_oil_compare;
}
c_oil = XCALLOC(MTYPE_PIM_CHANNEL_OIL, sizeof(*c_oil));
- if (!c_oil) {
- zlog_err("PIM XCALLOC(%zu) failure", sizeof(*c_oil));
- return NULL;
- }
c_oil->oil.mfcc_mcastgrp = sg->grp;
c_oil->oil.mfcc_origin = sg->src;
rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info));
- if (!rp_info) {
- zlog_err("Unable to alloc rp_info");
- route_table_finish(pim->rp_table);
- list_delete_and_null(&pim->rp_list);
- return;
- }
-
if (!str2prefix("224.0.0.0/4", &rp_info->group)) {
zlog_err("Unable to convert 224.0.0.0/4 to prefix");
list_delete_and_null(&pim->rp_list);
struct route_node *rn;
rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info));
- if (!rp_info)
- return PIM_MALLOC_FAIL;
if (group_range == NULL)
result = str2prefix("224.0.0.0/4", &rp_info->group);
listnode_add_sort(pim->rp_list, rp_info);
rn = route_node_get(pim->rp_table, &rp_info->group);
- if (!rn) {
- char buf[PREFIX_STRLEN];
- zlog_err("Failure to get route node for pim->rp_table: %s",
- prefix2str(&rp_info->group, buf, sizeof(buf)));
- return PIM_MALLOC_FAIL;
- }
rn->info = rp_info;
if (PIM_DEBUG_TRACE) {
if (!pim->ssmpingd_list) {
pim->ssmpingd_list = list_new();
- if (!pim->ssmpingd_list) {
- zlog_err(
- "%s %s: failure: qpim_ssmpingd_list=list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- return 0;
- }
pim->ssmpingd_list->del = (void (*)(void *))ssmpingd_free;
}
}
ss = XCALLOC(MTYPE_PIM_SSMPINGD, sizeof(*ss));
- if (!ss) {
- char source_str[INET_ADDRSTRLEN];
- pim_inet4_dump("<src?>", source_addr, source_str,
- sizeof(source_str));
- zlog_err("%s: XCALLOC(%zu) failure for ssmpingd source %s",
- __PRETTY_FUNCTION__, sizeof(*ss), source_str);
- close(sock_fd);
- return 0;
- }
ss->pim = pim;
ss->sock_fd = sock_fd;
static struct static_route *static_route_alloc()
{
- struct static_route *s_route;
-
- s_route = XCALLOC(MTYPE_PIM_STATIC_ROUTE, sizeof(*s_route));
- if (!s_route) {
- zlog_err("PIM XCALLOC(%zu) failure", sizeof(*s_route));
- return 0;
- }
- return s_route;
+ return XCALLOC(MTYPE_PIM_STATIC_ROUTE, sizeof(struct static_route));
}
static struct static_route *static_route_new(unsigned int iif, unsigned int oif,
{
struct static_route *s_route;
s_route = static_route_alloc();
- if (!s_route) {
- return 0;
- }
s_route->group = group;
s_route->source = source;
*/
if (!*hello_option_addr_list) {
*hello_option_addr_list = list_new();
- if (!*hello_option_addr_list) {
- zlog_err(
- "%s %s: failure: hello_option_addr_list=list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- return -2;
- }
(*hello_option_addr_list)->del =
(void (*)(void *))prefix_free;
}
struct pim_upstream *up;
up = XCALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
- if (!up) {
- zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
- sizeof(*up));
- return NULL;
- }
up->sg = *sg;
pim_str_sg_set(sg, up->sg_str);