diff options
| author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2014-01-19 21:43:08 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-01-19 22:53:18 -0500 |
| commit | 4b261c75a99f29c93a0b6babfc180cdf566bd654 (patch) | |
| tree | 2c1fcebd79d2fcb1625f89ef5067605151953010 /include/linux | |
| parent | a6e2fe17eba47681e82cdb9cfed5a67b57802a78 (diff) | |
ipv6: make IPV6_RECVPKTINFO work for ipv4 datagrams
We currently don't report IPV6_RECVPKTINFO in cmsg access ancillary data
for IPv4 datagrams on IPv6 sockets.
This patch splits the ip6_datagram_recv_ctl into two functions, one
which handles both protocol families, AF_INET and AF_INET6, while the
ip6_datagram_recv_specific_ctl only handles IPv6 cmsg data.
ip6_datagram_recv_*_ctl never reported back any errors, so we can make
them return void. Also provide a helper for protocols which don't offer dual
personality to further use ip6_datagram_recv_ctl, which is exported to
modules.
I needed to shuffle the code for ping around a bit to make it easier to
implement dual personality for ping ipv6 sockets in future.
Reported-by: Gert Doering <gert@space.net>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ipv6.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 1084304fd75a..2faef339d8f2 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
| @@ -284,6 +284,8 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
| 284 | 284 | ||
| 285 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) | 285 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) |
| 286 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) | 286 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) |
| 287 | #define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \ | ||
| 288 | inet6_sk(sk)->rxopt.bits.rxinfo) | ||
| 287 | 289 | ||
| 288 | static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk) | 290 | static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk) |
| 289 | { | 291 | { |
| @@ -300,6 +302,7 @@ static inline int inet_v6_ipv6only(const struct sock *sk) | |||
| 300 | #else | 302 | #else |
| 301 | #define __ipv6_only_sock(sk) 0 | 303 | #define __ipv6_only_sock(sk) 0 |
| 302 | #define ipv6_only_sock(sk) 0 | 304 | #define ipv6_only_sock(sk) 0 |
| 305 | #define ipv6_sk_rxinfo(sk) 0 | ||
| 303 | 306 | ||
| 304 | static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) | 307 | static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) |
| 305 | { | 308 | { |
