qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user: check if NETLINK_ROUTE is available
Date: Tue, 7 Jun 2016 11:48:25 +0300	[thread overview]
Message-ID: <20160607084825.GB19978@beaming.home> (raw)
In-Reply-To: <1464898455-10082-1-git-send-email-laurent@vivier.eu>

On Thu, Jun 02, 2016 at 10:14:15PM +0200, Laurent Vivier wrote:
> 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.

Applied with the rest of series, thanks
Riku

> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> Note:
>    This patch must be applied on top of the series:
>    [PATCH v2 0/3] linux-user: netlink support
> 
>  configure            | 15 +++++++++++++++
>  linux-user/syscall.c | 18 ++++++++++++++----
>  2 files changed, 29 insertions(+), 4 deletions(-)
> 
> diff --git a/configure b/configure
> index b5aab72..294d791 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 da48ba4..7c88d63 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -104,7 +104,9 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
>  #include "linux_loop.h"
>  #include <linux/if_packet.h>
>  #include <linux/netlink.h>
> +#ifdef CONFIG_RTNETLINK
>  #include <linux/rtnetlink.h>
> +#endif
>  #include <linux/audit.h>
>  #include "uname.h"
>  
> @@ -1629,6 +1631,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)
> @@ -2043,6 +2046,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)
>  {
> @@ -2794,6 +2798,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);
> @@ -2808,6 +2813,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)
>  {
> @@ -2835,10 +2841,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;
>      }
>  
> @@ -2857,9 +2865,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.5.5
> 

      parent reply	other threads:[~2016-06-07  8:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 20:14 [Qemu-devel] [PATCH] linux-user: check if NETLINK_ROUTE is available Laurent Vivier
2016-06-03  8:32 ` Riku Voipio
2016-06-03  8:42   ` Laurent Vivier
2016-06-07  8:48 ` Riku Voipio [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160607084825.GB19978@beaming.home \
    --to=riku.voipio@iki.fi \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).