mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-26 04:54:44 +00:00
Merge pull request #6229 from donaldsharp/netlink_request_fixup
zebra: Modify netlink_request to statisfy coverity
This commit is contained in:
commit
7c6bcbe652
@ -764,7 +764,7 @@ static int netlink_request_intf_addr(struct nlsock *netlink_cmd, int family,
|
|||||||
if (filter_mask)
|
if (filter_mask)
|
||||||
addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filter_mask);
|
addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filter_mask);
|
||||||
|
|
||||||
return netlink_request(netlink_cmd, &req.n);
|
return netlink_request(netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interface lookup by netlink socket. */
|
/* Interface lookup by netlink socket. */
|
||||||
|
@ -1061,10 +1061,11 @@ int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
|
|||||||
/* Issue request message to kernel via netlink socket. GET messages
|
/* Issue request message to kernel via netlink socket. GET messages
|
||||||
* are issued through this interface.
|
* are issued through this interface.
|
||||||
*/
|
*/
|
||||||
int netlink_request(struct nlsock *nl, struct nlmsghdr *n)
|
int netlink_request(struct nlsock *nl, void *req)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_nl snl;
|
struct sockaddr_nl snl;
|
||||||
|
struct nlmsghdr *n = (struct nlmsghdr *)req;
|
||||||
|
|
||||||
/* Check netlink socket. */
|
/* Check netlink socket. */
|
||||||
if (nl->sock < 0) {
|
if (nl->sock < 0) {
|
||||||
@ -1082,7 +1083,7 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n)
|
|||||||
|
|
||||||
/* Raise capabilities and send message, then lower capabilities. */
|
/* Raise capabilities and send message, then lower capabilities. */
|
||||||
frr_with_privs(&zserv_privs) {
|
frr_with_privs(&zserv_privs) {
|
||||||
ret = sendto(nl->sock, (void *)n, n->nlmsg_len, 0,
|
ret = sendto(nl->sock, req, n->nlmsg_len, 0,
|
||||||
(struct sockaddr *)&snl, sizeof(snl));
|
(struct sockaddr *)&snl, sizeof(snl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ int netlink_talk_info(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
|
|||||||
struct nlmsghdr *n,
|
struct nlmsghdr *n,
|
||||||
const struct zebra_dplane_info *dp_info, int startup);
|
const struct zebra_dplane_info *dp_info, int startup);
|
||||||
|
|
||||||
extern int netlink_request(struct nlsock *nl, struct nlmsghdr *n);
|
extern int netlink_request(struct nlsock *nl, void *req);
|
||||||
|
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
|
|
||||||
|
@ -983,7 +983,7 @@ static int netlink_request_route(struct zebra_ns *zns, int family, int type)
|
|||||||
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
|
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
|
||||||
req.rtm.rtm_family = family;
|
req.rtm.rtm_family = family;
|
||||||
|
|
||||||
return netlink_request(&zns->netlink_cmd, &req.n);
|
return netlink_request(&zns->netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Routing table read function using netlink interface. Only called
|
/* Routing table read function using netlink interface. Only called
|
||||||
@ -2492,7 +2492,7 @@ static int netlink_request_nexthop(struct zebra_ns *zns, int family, int type)
|
|||||||
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nhmsg));
|
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nhmsg));
|
||||||
req.nhm.nh_family = family;
|
req.nhm.nh_family = family;
|
||||||
|
|
||||||
return netlink_request(&zns->netlink_cmd, &req.n);
|
return netlink_request(&zns->netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2822,7 +2822,7 @@ static int netlink_request_macs(struct nlsock *netlink_cmd, int family,
|
|||||||
if (master_ifindex)
|
if (master_ifindex)
|
||||||
addattr32(&req.n, sizeof(req), IFLA_MASTER, master_ifindex);
|
addattr32(&req.n, sizeof(req), IFLA_MASTER, master_ifindex);
|
||||||
|
|
||||||
return netlink_request(netlink_cmd, &req.n);
|
return netlink_request(netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2925,7 +2925,7 @@ static int netlink_request_specific_mac_in_bridge(struct zebra_ns *zns,
|
|||||||
vrf_id_to_name(br_if->vrf_id), br_if->vrf_id,
|
vrf_id_to_name(br_if->vrf_id), br_if->vrf_id,
|
||||||
prefix_mac2str(mac, buf, sizeof(buf)), vid);
|
prefix_mac2str(mac, buf, sizeof(buf)), vid);
|
||||||
|
|
||||||
return netlink_request(&zns->netlink_cmd, &req.n);
|
return netlink_request(&zns->netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
|
int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
|
||||||
@ -3225,7 +3225,7 @@ static int netlink_request_neigh(struct nlsock *netlink_cmd, int family,
|
|||||||
if (ifindex)
|
if (ifindex)
|
||||||
addattr32(&req.n, sizeof(req), NDA_IFINDEX, ifindex);
|
addattr32(&req.n, sizeof(req), NDA_IFINDEX, ifindex);
|
||||||
|
|
||||||
return netlink_request(netlink_cmd, &req.n);
|
return netlink_request(netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3313,7 +3313,7 @@ static int netlink_request_specific_neigh_in_vlan(struct zebra_ns *zns,
|
|||||||
ipaddr2str(ip, buf, sizeof(buf)), req.n.nlmsg_flags);
|
ipaddr2str(ip, buf, sizeof(buf)), req.n.nlmsg_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return netlink_request(&zns->netlink_cmd, &req.n);
|
return netlink_request(&zns->netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
int netlink_neigh_read_specific_ip(struct ipaddr *ip,
|
int netlink_neigh_read_specific_ip(struct ipaddr *ip,
|
||||||
|
@ -355,7 +355,7 @@ static int netlink_request_rules(struct zebra_ns *zns, int family, int type)
|
|||||||
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct fib_rule_hdr));
|
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct fib_rule_hdr));
|
||||||
req.frh.family = family;
|
req.frh.family = family;
|
||||||
|
|
||||||
return netlink_request(&zns->netlink_cmd, &req.n);
|
return netlink_request(&zns->netlink_cmd, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user