mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 21:10:28 +00:00
Merge pull request #4366 from qlyoung/vrrp-coverity-fixes
vrrpd: fix coverity warnings
This commit is contained in:
commit
7df5a3c7e2
@ -763,7 +763,7 @@ static void vrrp_send_advertisement(struct vrrp_router *r)
|
|||||||
|
|
||||||
const char *group = r->family == AF_INET ? VRRP_MCASTV4_GROUP_STR
|
const char *group = r->family == AF_INET ? VRRP_MCASTV4_GROUP_STR
|
||||||
: VRRP_MCASTV6_GROUP_STR;
|
: VRRP_MCASTV6_GROUP_STR;
|
||||||
str2sockunion(group, &dest);
|
(void)str2sockunion(group, &dest);
|
||||||
|
|
||||||
ssize_t sent = sendto(r->sock_tx, pkt, (size_t)pktsz, 0, &dest.sa,
|
ssize_t sent = sendto(r->sock_tx, pkt, (size_t)pktsz, 0, &dest.sa,
|
||||||
sockunion_sizeof(&dest));
|
sockunion_sizeof(&dest));
|
||||||
@ -969,7 +969,7 @@ static int vrrp_read(struct thread *thread)
|
|||||||
uint8_t control[64];
|
uint8_t control[64];
|
||||||
struct ipaddr src = {};
|
struct ipaddr src = {};
|
||||||
|
|
||||||
struct msghdr m;
|
struct msghdr m = {};
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
|
|
||||||
iov.iov_base = r->ibuf;
|
iov.iov_base = r->ibuf;
|
||||||
@ -1384,7 +1384,6 @@ static void vrrp_change_state_backup(struct vrrp_router *r)
|
|||||||
*/
|
*/
|
||||||
static void vrrp_change_state_initialize(struct vrrp_router *r)
|
static void vrrp_change_state_initialize(struct vrrp_router *r)
|
||||||
{
|
{
|
||||||
r->vr->advertisement_interval = r->vr->advertisement_interval;
|
|
||||||
r->master_adver_interval = 0;
|
r->master_adver_interval = 0;
|
||||||
vrrp_recalculate_timers(r);
|
vrrp_recalculate_timers(r);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ void vrrp_garp_send(struct vrrp_router *r, struct in_addr *v4)
|
|||||||
if (ifp->flags & IFF_NOARP) {
|
if (ifp->flags & IFF_NOARP) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
|
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
|
||||||
"Unable to send gratuitous ARP on %s; has IFF_NOARP\n",
|
"Unable to send gratuitous ARP on %s; has IFF_NOARP",
|
||||||
r->vr->vrid, family2str(r->family), ifp->name);
|
r->vr->vrid, family2str(r->family), ifp->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -132,6 +132,14 @@ void vrrp_garp_send(struct vrrp_router *r, struct in_addr *v4)
|
|||||||
/* Build garp */
|
/* Build garp */
|
||||||
garpbuf_len = vrrp_build_garp(garpbuf, ifp, v4);
|
garpbuf_len = vrrp_build_garp(garpbuf, ifp, v4);
|
||||||
|
|
||||||
|
if (garpbuf_len < 0) {
|
||||||
|
zlog_warn(
|
||||||
|
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
|
||||||
|
"Unable to send gratuitous ARP on %s; MAC address unknown",
|
||||||
|
r->vr->vrid, family2str(r->family), ifp->name);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
/* Send garp */
|
/* Send garp */
|
||||||
inet_ntop(AF_INET, v4, astr, sizeof(astr));
|
inet_ntop(AF_INET, v4, astr, sizeof(astr));
|
||||||
|
|
||||||
|
@ -139,7 +139,10 @@ static int vrrp_ndisc_una_build(struct interface *ifp, struct ipaddr *ip,
|
|||||||
ph.dst = ip6h->ip6_dst;
|
ph.dst = ip6h->ip6_dst;
|
||||||
ph.ulpl = htonl(len);
|
ph.ulpl = htonl(len);
|
||||||
ph.next_hdr = IPPROTO_ICMPV6;
|
ph.next_hdr = IPPROTO_ICMPV6;
|
||||||
icmp6h->icmp6_cksum = in_cksum_with_ph6(&ph, (void *)icmp6h, len);
|
|
||||||
|
/* Suppress static analysis warnings about accessing icmp6 oob */
|
||||||
|
void *offset = icmp6h;
|
||||||
|
icmp6h->icmp6_cksum = in_cksum_with_ph6(&ph, offset, len);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user