[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/44] linux-user: check if NETLINK_ROUTE is availabl
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 05/44] linux-user: check if NETLINK_ROUTE is available |
Date: |
Wed, 8 Jun 2016 16:29:46 +0300 |
From: Laurent Vivier <address@hidden>
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 <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
configure | 15 +++++++++++++++
linux-user/syscall.c | 18 ++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 6d01d96..d1dbc4b 100755
--- a/configure
+++ b/configure
@@ -4526,6 +4526,17 @@ if compile_prog "" "" ; then
have_fsxattr=yes
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
# After here, no more $cc or $ld runs
@@ -5461,6 +5472,10 @@ if test "$rdma" = "yes" ; then
echo "CONFIG_RDMA=y" >> $config_host_mak
fi
+if test "$have_rtnetlink" = "yes" ; then
+ echo "CONFIG_RTNETLINK=y" >> $config_host_mak
+fi
+
# Hold two types of flag:
# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
# a thread we have a handle to
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 933c2cd..9cc9a35 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -102,7 +102,9 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#include <linux/filter.h>
#include <linux/blkpg.h>
#include <linux/netlink.h>
+#ifdef CONFIG_RTNETLINK
#include <linux/rtnetlink.h>
+#endif
#include <linux/audit.h>
#include "linux_loop.h"
#include "uname.h"
@@ -1627,6 +1629,7 @@ static abi_long target_to_host_for_each_nlmsg(struct
nlmsghdr *nlh,
return 0;
}
+#ifdef CONFIG_RTNETLINK
static abi_long host_to_target_for_each_rtattr(struct rtattr *rtattr,
size_t len,
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);
}
+#endif /* CONFIG_RTNETLINK */
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,
};
+#ifdef CONFIG_RTNETLINK
static abi_long netlink_route_target_to_host(void *buf, size_t 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,
.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)
{
@@ -2771,10 +2777,12 @@ static abi_long do_socket(int domain, int type, int
protocol)
return ret;
}
- if (domain == PF_NETLINK &&
- !(protocol == NETLINK_ROUTE ||
- protocol == NETLINK_KOBJECT_UEVENT ||
- protocol == NETLINK_AUDIT)) {
+ if (domain == PF_NETLINK && !(
+#ifdef CONFIG_RTNETLINK
+ protocol == NETLINK_ROUTE ||
+#endif
+ protocol == NETLINK_KOBJECT_UEVENT ||
+ protocol == NETLINK_AUDIT)) {
return -EPFNOSUPPORT;
}
@@ -2793,9 +2801,11 @@ static abi_long do_socket(int domain, int type, int
protocol)
fd_trans_register(ret, &target_packet_trans);
} else if (domain == PF_NETLINK) {
switch (protocol) {
+#ifdef CONFIG_RTNETLINK
case NETLINK_ROUTE:
fd_trans_register(ret, &target_netlink_route_trans);
break;
+#endif
case NETLINK_KOBJECT_UEVENT:
/* nothing to do: messages are strings */
break;
--
2.1.4
- [Qemu-devel] [PULL 00/44] linux-user update, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 01/44] linux-user: Fix qemu-binfmt-conf.sh to store config across reboot, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 04/44] linux-user: add netlink audit, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 03/44] linux-user: support netlink protocol NETLINK_KOBJECT_UEVENT, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 02/44] linux-user: add rtnetlink(7) support, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 06/44] linux-user: Factor out handle_signal code from process_pending_signals(), riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 07/44] linux-user: Move handle_pending_signal() to avoid need for declaration, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 05/44] linux-user: check if NETLINK_ROUTE is available,
riku . voipio <=
- [Qemu-devel] [PULL 10/44] linux-user: Define macro for size of host kernel sigset_t, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 08/44] linux-user: Fix stray tab-indent, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 09/44] linux-user: Factor out uses of do_sigprocmask() from sigreturn code, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 11/44] linux-user: Use safe_syscall for sigsuspend syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 13/44] linux-user: Remove redundant default action check in queue_signal(), riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 18/44] linux-user: pause() should not pause if signal pending, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 14/44] linux-user: Remove redundant gdb_queuesig(), riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 12/44] linux-user: Fix race between multiple signals, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 16/44] linux-user: Queue synchronous signals separately, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 17/44] linux-user: Block signals during sigaction() handling, riku . voipio, 2016/06/08