mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 03:27:39 +00:00
Merge pull request #2620 from pacovn/PVS-Studio_null_check_2
bgpd lib ospfd pimd ripngd: null chk (PVS-Studio)
This commit is contained in:
commit
4adc8f6852
@ -274,7 +274,7 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
|
|||||||
else
|
else
|
||||||
json_nlri_path = json_paths;
|
json_nlri_path = json_paths;
|
||||||
}
|
}
|
||||||
if (display == NLRI_STRING_FORMAT_LARGE)
|
if (display == NLRI_STRING_FORMAT_LARGE && binfo)
|
||||||
vty_out(vty, "BGP flowspec entry: (flags 0x%x)\n",
|
vty_out(vty, "BGP flowspec entry: (flags 0x%x)\n",
|
||||||
binfo->flags);
|
binfo->flags);
|
||||||
bgp_fs_nlri_get_string((unsigned char *)
|
bgp_fs_nlri_get_string((unsigned char *)
|
||||||
|
@ -2168,7 +2168,6 @@ struct bgp_process_queue {
|
|||||||
static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
|
static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
|
||||||
afi_t afi, safi_t safi)
|
afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
struct prefix *p = &rn->p;
|
|
||||||
struct bgp_info *new_select;
|
struct bgp_info *new_select;
|
||||||
struct bgp_info *old_select;
|
struct bgp_info *old_select;
|
||||||
struct bgp_info_pair old_and_new;
|
struct bgp_info_pair old_and_new;
|
||||||
@ -2191,6 +2190,8 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct prefix *p = &rn->p;
|
||||||
|
|
||||||
debug = bgp_debug_bestpath(&rn->p);
|
debug = bgp_debug_bestpath(&rn->p);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));
|
prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));
|
||||||
|
@ -1026,9 +1026,11 @@ static inline bgp_peer_sort_t peer_calc_sort(struct peer *peer)
|
|||||||
else if (peer->as_type == AS_EXTERNAL)
|
else if (peer->as_type == AS_EXTERNAL)
|
||||||
return BGP_PEER_EBGP;
|
return BGP_PEER_EBGP;
|
||||||
|
|
||||||
else if (peer->as_type == AS_SPECIFIED && peer->as)
|
else if (peer->as_type == AS_SPECIFIED && peer->as) {
|
||||||
|
assert(bgp);
|
||||||
return (bgp->as == peer->as ? BGP_PEER_IBGP
|
return (bgp->as == peer->as ? BGP_PEER_IBGP
|
||||||
: BGP_PEER_EBGP);
|
: BGP_PEER_EBGP);
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
struct peer *peer1;
|
struct peer *peer1;
|
||||||
|
@ -2336,7 +2336,7 @@ int rfapi_reopen(struct rfapi_descriptor *rfd, struct bgp *bgp)
|
|||||||
|
|
||||||
h = bgp->rfapi;
|
h = bgp->rfapi;
|
||||||
|
|
||||||
assert(!CHECK_FLAG(h->flags, RFAPI_INCALLBACK));
|
assert(h != NULL && !CHECK_FLAG(h->flags, RFAPI_INCALLBACK));
|
||||||
|
|
||||||
if (CHECK_FLAG(rfd->flags,
|
if (CHECK_FLAG(rfd->flags,
|
||||||
RFAPI_HD_FLAG_CLOSING_ADMINISTRATIVELY)
|
RFAPI_HD_FLAG_CLOSING_ADMINISTRATIVELY)
|
||||||
|
@ -2904,6 +2904,8 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
|
|||||||
struct rfapi_descriptor *rfd;
|
struct rfapi_descriptor *rfd;
|
||||||
vncHDBgpDirect.peer = bi->peer;
|
vncHDBgpDirect.peer = bi->peer;
|
||||||
|
|
||||||
|
assert(bi->extra);
|
||||||
|
|
||||||
rfd = bi->extra->vnc.export
|
rfd = bi->extra->vnc.export
|
||||||
.rfapi_handle;
|
.rfapi_handle;
|
||||||
|
|
||||||
|
16
lib/vty.c
16
lib/vty.c
@ -479,6 +479,8 @@ static int vty_command(struct vty *vty, char *buf)
|
|||||||
const char *protocolname;
|
const char *protocolname;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
|
|
||||||
|
assert(vty);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Log non empty command lines
|
* Log non empty command lines
|
||||||
*/
|
*/
|
||||||
@ -496,13 +498,13 @@ static int vty_command(struct vty *vty, char *buf)
|
|||||||
|
|
||||||
/* format the base vty info */
|
/* format the base vty info */
|
||||||
snprintf(vty_str, sizeof(vty_str), "vty[??]@%s", vty->address);
|
snprintf(vty_str, sizeof(vty_str), "vty[??]@%s", vty->address);
|
||||||
if (vty)
|
|
||||||
for (i = 0; i < vector_active(vtyvec); i++)
|
for (i = 0; i < vector_active(vtyvec); i++)
|
||||||
if (vty == vector_slot(vtyvec, i)) {
|
if (vty == vector_slot(vtyvec, i)) {
|
||||||
snprintf(vty_str, sizeof(vty_str),
|
snprintf(vty_str, sizeof(vty_str), "vty[%d]@%s",
|
||||||
"vty[%d]@%s", i, vty->address);
|
i, vty->address);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* format the prompt */
|
/* format the prompt */
|
||||||
snprintf(prompt_str, sizeof(prompt_str), cmd_prompt(vty->node),
|
snprintf(prompt_str, sizeof(prompt_str), cmd_prompt(vty->node),
|
||||||
|
@ -245,10 +245,11 @@ int work_queue_run(struct thread *thread)
|
|||||||
char yielded = 0;
|
char yielded = 0;
|
||||||
|
|
||||||
wq = THREAD_ARG(thread);
|
wq = THREAD_ARG(thread);
|
||||||
wq->thread = NULL;
|
|
||||||
|
|
||||||
assert(wq);
|
assert(wq);
|
||||||
|
|
||||||
|
wq->thread = NULL;
|
||||||
|
|
||||||
/* calculate cycle granularity:
|
/* calculate cycle granularity:
|
||||||
* list iteration == 1 run
|
* list iteration == 1 run
|
||||||
* listnode processing == 1 cycle
|
* listnode processing == 1 cycle
|
||||||
|
@ -1889,7 +1889,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
|
|||||||
zlog_debug(
|
zlog_debug(
|
||||||
"ospf_translated_nssa_refresh(): no Type-7 found for "
|
"ospf_translated_nssa_refresh(): no Type-7 found for "
|
||||||
"Type-5 LSA Id %s",
|
"Type-5 LSA Id %s",
|
||||||
inet_ntoa(type5->data->id));
|
type5 ? inet_ntoa(type5->data->id) : "(null)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,7 +1899,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
|
|||||||
zlog_debug(
|
zlog_debug(
|
||||||
"ospf_translated_nssa_refresh(): No translated Type-5 "
|
"ospf_translated_nssa_refresh(): No translated Type-5 "
|
||||||
"found for Type-7 with Id %s",
|
"found for Type-7 with Id %s",
|
||||||
inet_ntoa(type7->data->id));
|
type7 ? inet_ntoa(type7->data->id) : "(null)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1912,7 +1912,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
|
|||||||
zlog_debug(
|
zlog_debug(
|
||||||
"ospf_translated_nssa_refresh(): Could not translate "
|
"ospf_translated_nssa_refresh(): Could not translate "
|
||||||
"Type-7 for %s to Type-5",
|
"Type-7 for %s to Type-5",
|
||||||
inet_ntoa(type7->data->id));
|
type7 ? inet_ntoa(type7->data->id) : "(null)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1921,7 +1921,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
|
|||||||
zlog_debug(
|
zlog_debug(
|
||||||
"ospf_translated_nssa_refresh(): Could not install "
|
"ospf_translated_nssa_refresh(): Could not install "
|
||||||
"translated LSA, Id %s",
|
"translated LSA, Id %s",
|
||||||
inet_ntoa(type7->data->id));
|
type7 ? inet_ntoa(type7->data->id) : "(null)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4809,16 +4809,19 @@ static void show_ip_ospf_nbr_nbma_detail_sub(struct vty *vty,
|
|||||||
vty_out(vty, " Poll interval %d\n", nbr_nbma->v_poll);
|
vty_out(vty, " Poll interval %d\n", nbr_nbma->v_poll);
|
||||||
|
|
||||||
/* Show poll-interval timer. */
|
/* Show poll-interval timer. */
|
||||||
if (use_json) {
|
if (nbr_nbma->t_poll) {
|
||||||
long time_store;
|
if (use_json) {
|
||||||
time_store = monotime_until(&nbr_nbma->t_poll->u.sands, NULL)
|
long time_store;
|
||||||
/ 1000LL;
|
time_store = monotime_until(&nbr_nbma->t_poll->u.sands,
|
||||||
json_object_int_add(json_sub, "pollIntervalTimerDueMsec",
|
NULL) / 1000LL;
|
||||||
time_store);
|
json_object_int_add(json_sub,
|
||||||
} else
|
"pollIntervalTimerDueMsec",
|
||||||
vty_out(vty, " Poll timer due in %s\n",
|
time_store);
|
||||||
ospf_timer_dump(nbr_nbma->t_poll, timebuf,
|
} else
|
||||||
sizeof(timebuf)));
|
vty_out(vty, " Poll timer due in %s\n",
|
||||||
|
ospf_timer_dump(nbr_nbma->t_poll, timebuf,
|
||||||
|
sizeof(timebuf)));
|
||||||
|
}
|
||||||
|
|
||||||
/* Show poll-interval timer thread. */
|
/* Show poll-interval timer thread. */
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
|
@ -152,7 +152,7 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
|
|||||||
struct pim_rpf *rpg;
|
struct pim_rpf *rpg;
|
||||||
struct prefix_sg sg;
|
struct prefix_sg sg;
|
||||||
|
|
||||||
rpg = RP(pim_ifp->pim, msg->im_dst);
|
rpg = pim_ifp ? RP(pim_ifp->pim, msg->im_dst) : NULL;
|
||||||
/*
|
/*
|
||||||
* If the incoming interface is unknown OR
|
* If the incoming interface is unknown OR
|
||||||
* the Interface type is SSM we don't need to
|
* the Interface type is SSM we don't need to
|
||||||
@ -278,7 +278,7 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
|
|||||||
|
|
||||||
pim_ifp = up->rpf.source_nexthop.interface->info;
|
pim_ifp = up->rpf.source_nexthop.interface->info;
|
||||||
|
|
||||||
rpg = RP(pim_ifp->pim, sg.grp);
|
rpg = pim_ifp ? RP(pim_ifp->pim, sg.grp) : NULL;
|
||||||
|
|
||||||
if ((pim_rpf_addr_is_inaddr_none(rpg)) || (!pim_ifp)
|
if ((pim_rpf_addr_is_inaddr_none(rpg)) || (!pim_ifp)
|
||||||
|| (!(PIM_I_am_DR(pim_ifp)))) {
|
|| (!(PIM_I_am_DR(pim_ifp)))) {
|
||||||
|
@ -1516,9 +1516,10 @@ int ripng_write_rte(int num, struct stream *s, struct prefix_ipv6 *p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write routing table entry. */
|
/* Write routing table entry. */
|
||||||
if (!nexthop)
|
if (!nexthop) {
|
||||||
|
assert(p);
|
||||||
stream_write(s, (uint8_t *)&p->prefix, sizeof(struct in6_addr));
|
stream_write(s, (uint8_t *)&p->prefix, sizeof(struct in6_addr));
|
||||||
else
|
} else
|
||||||
stream_write(s, (uint8_t *)nexthop, sizeof(struct in6_addr));
|
stream_write(s, (uint8_t *)nexthop, sizeof(struct in6_addr));
|
||||||
stream_putw(s, tag);
|
stream_putw(s, tag);
|
||||||
if (p)
|
if (p)
|
||||||
|
Loading…
Reference in New Issue
Block a user