mirror of https://github.com/xqemu/xqemu.git
linux-user: check if NETLINK_ROUTE is available
Some IFLA_* symbols can be missing in the host linux/if_link.h, but as they are enums and not "#defines", check in "configure" if last known (IFLA_PROTO_DOWN) is available and if not, disable management of NETLINK_ROUTE protocol. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
parent
5ce9bb5937
commit
575b22b1b7
|
@ -4526,6 +4526,17 @@ if compile_prog "" "" ; then
|
||||||
have_fsxattr=yes
|
have_fsxattr=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
have_rtnetlink=no
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include <linux/rtnetlink.h>
|
||||||
|
int main(void) {
|
||||||
|
return IFLA_PROTO_DOWN;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
if compile_prog "" "" ; then
|
||||||
|
have_rtnetlink=yes
|
||||||
|
fi
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# End of CC checks
|
# End of CC checks
|
||||||
# After here, no more $cc or $ld runs
|
# After here, no more $cc or $ld runs
|
||||||
|
@ -5461,6 +5472,10 @@ if test "$rdma" = "yes" ; then
|
||||||
echo "CONFIG_RDMA=y" >> $config_host_mak
|
echo "CONFIG_RDMA=y" >> $config_host_mak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$have_rtnetlink" = "yes" ; then
|
||||||
|
echo "CONFIG_RTNETLINK=y" >> $config_host_mak
|
||||||
|
fi
|
||||||
|
|
||||||
# Hold two types of flag:
|
# Hold two types of flag:
|
||||||
# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
|
# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
|
||||||
# a thread we have a handle to
|
# a thread we have a handle to
|
||||||
|
|
|
@ -102,7 +102,9 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
|
||||||
#include <linux/filter.h>
|
#include <linux/filter.h>
|
||||||
#include <linux/blkpg.h>
|
#include <linux/blkpg.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
|
#ifdef CONFIG_RTNETLINK
|
||||||
#include <linux/rtnetlink.h>
|
#include <linux/rtnetlink.h>
|
||||||
|
#endif
|
||||||
#include <linux/audit.h>
|
#include <linux/audit.h>
|
||||||
#include "linux_loop.h"
|
#include "linux_loop.h"
|
||||||
#include "uname.h"
|
#include "uname.h"
|
||||||
|
@ -1627,6 +1629,7 @@ static abi_long target_to_host_for_each_nlmsg(struct nlmsghdr *nlh,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_RTNETLINK
|
||||||
static abi_long host_to_target_for_each_rtattr(struct rtattr *rtattr,
|
static abi_long host_to_target_for_each_rtattr(struct rtattr *rtattr,
|
||||||
size_t len,
|
size_t len,
|
||||||
abi_long (*host_to_target_rtattr)
|
abi_long (*host_to_target_rtattr)
|
||||||
|
@ -2041,6 +2044,7 @@ static abi_long target_to_host_nlmsg_route(struct nlmsghdr *nlh, size_t len)
|
||||||
{
|
{
|
||||||
return target_to_host_for_each_nlmsg(nlh, len, target_to_host_data_route);
|
return target_to_host_for_each_nlmsg(nlh, len, target_to_host_data_route);
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTNETLINK */
|
||||||
|
|
||||||
static abi_long host_to_target_data_audit(struct nlmsghdr *nlh)
|
static abi_long host_to_target_data_audit(struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
|
@ -2730,6 +2734,7 @@ static TargetFdTrans target_packet_trans = {
|
||||||
.target_to_host_addr = packet_target_to_host_sockaddr,
|
.target_to_host_addr = packet_target_to_host_sockaddr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_RTNETLINK
|
||||||
static abi_long netlink_route_target_to_host(void *buf, size_t len)
|
static abi_long netlink_route_target_to_host(void *buf, size_t len)
|
||||||
{
|
{
|
||||||
return target_to_host_nlmsg_route(buf, len);
|
return target_to_host_nlmsg_route(buf, len);
|
||||||
|
@ -2744,6 +2749,7 @@ static TargetFdTrans target_netlink_route_trans = {
|
||||||
.target_to_host_data = netlink_route_target_to_host,
|
.target_to_host_data = netlink_route_target_to_host,
|
||||||
.host_to_target_data = netlink_route_host_to_target,
|
.host_to_target_data = netlink_route_host_to_target,
|
||||||
};
|
};
|
||||||
|
#endif /* CONFIG_RTNETLINK */
|
||||||
|
|
||||||
static abi_long netlink_audit_target_to_host(void *buf, size_t len)
|
static abi_long netlink_audit_target_to_host(void *buf, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -2771,10 +2777,12 @@ static abi_long do_socket(int domain, int type, int protocol)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domain == PF_NETLINK &&
|
if (domain == PF_NETLINK && !(
|
||||||
!(protocol == NETLINK_ROUTE ||
|
#ifdef CONFIG_RTNETLINK
|
||||||
protocol == NETLINK_KOBJECT_UEVENT ||
|
protocol == NETLINK_ROUTE ||
|
||||||
protocol == NETLINK_AUDIT)) {
|
#endif
|
||||||
|
protocol == NETLINK_KOBJECT_UEVENT ||
|
||||||
|
protocol == NETLINK_AUDIT)) {
|
||||||
return -EPFNOSUPPORT;
|
return -EPFNOSUPPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2793,9 +2801,11 @@ static abi_long do_socket(int domain, int type, int protocol)
|
||||||
fd_trans_register(ret, &target_packet_trans);
|
fd_trans_register(ret, &target_packet_trans);
|
||||||
} else if (domain == PF_NETLINK) {
|
} else if (domain == PF_NETLINK) {
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
|
#ifdef CONFIG_RTNETLINK
|
||||||
case NETLINK_ROUTE:
|
case NETLINK_ROUTE:
|
||||||
fd_trans_register(ret, &target_netlink_route_trans);
|
fd_trans_register(ret, &target_netlink_route_trans);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case NETLINK_KOBJECT_UEVENT:
|
case NETLINK_KOBJECT_UEVENT:
|
||||||
/* nothing to do: messages are strings */
|
/* nothing to do: messages are strings */
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue