Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: zenczykowski@gmail.com
Cc: maze@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net-ipv6: add support for sockopt(SOL_IPV6, IPV6_FREEBIND)
Date: Sat, 30 Sep 2017 05:31:10 +0100 (WEST)	[thread overview]
Message-ID: <20170930.053110.46183655550876992.davem@davemloft.net> (raw)
In-Reply-To: <20170927043242.151591-1-zenczykowski@gmail.com>

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Tue, 26 Sep 2017 21:32:42 -0700

> From: Maciej Żenczykowski <maze@google.com>
> 
> So far we've been relying on sockopt(SOL_IP, IP_FREEBIND) being usable
> even on IPv6 sockets.
> 
> However, it turns out it is perfectly reasonable to want to set freebind
> on an AF_INET6 SOCK_RAW socket - but there is no way to set any SOL_IP
> socket option on such a socket (they're all blindly errored out).
> 
> One use case for this is to allow spoofing src ip on a raw socket
> via sendmsg cmsg.
> 
> Tested:
>   built, and booted
>   # python
>   >>> import socket
>   >>> SOL_IP = socket.SOL_IP
>   >>> SOL_IPV6 = socket.IPPROTO_IPV6
>   >>> IP_FREEBIND = 15
>   >>> IPV6_FREEBIND = 78
>   >>> s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, 0)
>   >>> s.getsockopt(SOL_IP, IP_FREEBIND)
>   0
>   >>> s.getsockopt(SOL_IPV6, IPV6_FREEBIND)
>   0
>   >>> s.setsockopt(SOL_IPV6, IPV6_FREEBIND, 1)
>   >>> s.getsockopt(SOL_IP, IP_FREEBIND)
>   1
>   >>> s.getsockopt(SOL_IPV6, IPV6_FREEBIND)
>   1
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Applied to net-next, thanks.

      reply	other threads:[~2017-09-30  4:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27  4:32 [PATCH] net-ipv6: add support for sockopt(SOL_IPV6, IPV6_FREEBIND) Maciej Żenczykowski
2017-09-30  4:31 ` David Miller [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=20170930.053110.46183655550876992.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=zenczykowski@gmail.com \
    /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