parent
20dc2c4d11
commit
da4047d3ba
@ -677,7 +677,7 @@ snl_add_msg_attr(struct snl_writer *nw, int attr_type, int attr_len, const void
|
||||
return (false);
|
||||
}
|
||||
|
||||
struct nlattr *nla = (struct nlattr *)(&nw->base[nw->offset]);
|
||||
struct nlattr *nla = (struct nlattr *)(void *)(&nw->base[nw->offset]);
|
||||
|
||||
nla->nla_len = attr_len + sizeof(struct nlattr);
|
||||
nla->nla_type = attr_type;
|
||||
@ -838,7 +838,7 @@ snl_finalize_msg(struct snl_writer *nw)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static bool
|
||||
static inline bool
|
||||
snl_send_msgs(struct snl_writer *nw)
|
||||
{
|
||||
int offset = nw->offset;
|
||||
|
@ -134,10 +134,10 @@ snl_add_msg_attr_ip(struct snl_writer *nw, int attrtype, const struct sockaddr *
|
||||
|
||||
switch (sa->sa_family) {
|
||||
case AF_INET:
|
||||
addr = &((const struct sockaddr_in *)sa)->sin_addr;
|
||||
addr = &((const struct sockaddr_in *)(const void *)sa)->sin_addr;
|
||||
return (snl_add_msg_attr(nw, attrtype, 4, addr));
|
||||
case AF_INET6:
|
||||
addr = &((const struct sockaddr_in6 *)sa)->sin6_addr;
|
||||
addr = &((const struct sockaddr_in6 *)(const void *)sa)->sin6_addr;
|
||||
return (snl_add_msg_attr(nw, attrtype, 16, addr));
|
||||
}
|
||||
|
||||
@ -153,10 +153,10 @@ snl_add_msg_attr_ipvia(struct snl_writer *nw, int attrtype, const struct sockadd
|
||||
|
||||
switch (sa->sa_family) {
|
||||
case AF_INET:
|
||||
memcpy(&buf[1], &((const struct sockaddr_in *)sa)->sin_addr, 4);
|
||||
memcpy(&buf[1], &((const struct sockaddr_in *)(const void *)sa)->sin_addr, 4);
|
||||
return (snl_add_msg_attr(nw, attrtype, 5, buf));
|
||||
case AF_INET6:
|
||||
memcpy(&buf[1], &((const struct sockaddr_in6 *)sa)->sin6_addr, 16);
|
||||
memcpy(&buf[1], &((const struct sockaddr_in6 *)(const void *)sa)->sin6_addr, 16);
|
||||
return (snl_add_msg_attr(nw, attrtype, 17, buf));
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,9 @@
|
||||
#ifndef _NETLINK_NETLINK_SNL_ROUTE_COMPAT_H_
|
||||
#define _NETLINK_NETLINK_SNL_ROUTE_COMPAT_H_
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* This file contains netlink-compatible definitions from the
|
||||
* net/route.h header.
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define _NETLINK_NETLINK_SNL_ROUTE_PARSERS_H_
|
||||
|
||||
#include <netlink/netlink_snl.h>
|
||||
#include <netlink/netlink_route.h>
|
||||
#include <netlink/netlink_snl_route.h>
|
||||
|
||||
/* TODO: this file should be generated automatically */
|
||||
|
||||
@ -72,7 +72,8 @@ struct rta_mpath {
|
||||
};
|
||||
|
||||
static bool
|
||||
nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg, void *target)
|
||||
nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg __unused,
|
||||
void *target)
|
||||
{
|
||||
int data_len = nla->nla_len - sizeof(struct nlattr);
|
||||
struct rtnexthop *rtnh;
|
||||
@ -83,7 +84,7 @@ nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg,
|
||||
struct rta_mpath *mp = snl_allocz(ss, sz);
|
||||
mp->num_nhops = 0;
|
||||
|
||||
for (rtnh = (struct rtnexthop *)(nla + 1); data_len > 0; ) {
|
||||
for (rtnh = (struct rtnexthop *)(void *)(nla + 1); data_len > 0; ) {
|
||||
struct rta_mpath_nh *mpnh = &mp->nhops[mp->num_nhops++];
|
||||
|
||||
if (!snl_parse_header(ss, rtnh, rtnh->rtnh_len, &_mpath_nh_parser, mpnh))
|
||||
@ -91,7 +92,7 @@ nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg,
|
||||
|
||||
int len = NL_ITEM_ALIGN(rtnh->rtnh_len);
|
||||
data_len -= len;
|
||||
rtnh = (struct rtnexthop *)((char *)rtnh + len);
|
||||
rtnh = (struct rtnexthop *)(void *)((char *)rtnh + len);
|
||||
}
|
||||
if (data_len != 0 || mp->num_nhops == 0) {
|
||||
return (false);
|
||||
|
Loading…
Reference in New Issue
Block a user