Commit ad959036 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

net/sock: add an explicit sk argument for ip_cmsg_recv_offset()

So that we can use it even after orphaining the skbuff.
Suggested-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd2c0f45
...@@ -579,7 +579,8 @@ int ip_options_rcv_srr(struct sk_buff *skb); ...@@ -579,7 +579,8 @@ int ip_options_rcv_srr(struct sk_buff *skb);
*/ */
void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb); void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
void ip_cmsg_recv_offset(struct msghdr *msg, struct sk_buff *skb, int tlen, int offset); void ip_cmsg_recv_offset(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb, int tlen, int offset);
int ip_cmsg_send(struct sock *sk, struct msghdr *msg, int ip_cmsg_send(struct sock *sk, struct msghdr *msg,
struct ipcm_cookie *ipc, bool allow_ipv6); struct ipcm_cookie *ipc, bool allow_ipv6);
int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
...@@ -601,7 +602,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, ...@@ -601,7 +602,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
static inline void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb) static inline void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb)
{ {
ip_cmsg_recv_offset(msg, skb, 0, 0); ip_cmsg_recv_offset(msg, skb->sk, skb, 0, 0);
} }
bool icmp_global_allow(void); bool icmp_global_allow(void);
......
...@@ -164,10 +164,10 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) ...@@ -164,10 +164,10 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb)
put_cmsg(msg, SOL_IP, IP_ORIGDSTADDR, sizeof(sin), &sin); put_cmsg(msg, SOL_IP, IP_ORIGDSTADDR, sizeof(sin), &sin);
} }
void ip_cmsg_recv_offset(struct msghdr *msg, struct sk_buff *skb, void ip_cmsg_recv_offset(struct msghdr *msg, struct sock *sk,
int tlen, int offset) struct sk_buff *skb, int tlen, int offset)
{ {
struct inet_sock *inet = inet_sk(skb->sk); struct inet_sock *inet = inet_sk(sk);
unsigned int flags = inet->cmsg_flags; unsigned int flags = inet->cmsg_flags;
/* Ordered by supposed usage frequency */ /* Ordered by supposed usage frequency */
......
...@@ -1421,7 +1421,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, ...@@ -1421,7 +1421,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
*addr_len = sizeof(*sin); *addr_len = sizeof(*sin);
} }
if (inet->cmsg_flags) if (inet->cmsg_flags)
ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr), off); ip_cmsg_recv_offset(msg, sk, skb, sizeof(struct udphdr), off);
err = copied; err = copied;
if (flags & MSG_TRUNC) if (flags & MSG_TRUNC)
......
...@@ -425,7 +425,7 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -425,7 +425,7 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
if (is_udp4) { if (is_udp4) {
if (inet->cmsg_flags) if (inet->cmsg_flags)
ip_cmsg_recv_offset(msg, skb, ip_cmsg_recv_offset(msg, sk, skb,
sizeof(struct udphdr), off); sizeof(struct udphdr), off);
} else { } else {
if (np->rxopt.all) if (np->rxopt.all)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment