diff options
-rw-r--r-- | include/net/ip.h | 2 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 5 | ||||
-rw-r--r-- | net/ipv4/raw.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp.c | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 16078f422397..b39ebe5339ac 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -459,7 +459,7 @@ int ip_options_rcv_srr(struct sk_buff *skb); | |||
459 | * Functions provided by ip_sockglue.c | 459 | * Functions provided by ip_sockglue.c |
460 | */ | 460 | */ |
461 | 461 | ||
462 | void ipv4_pktinfo_prepare(struct sk_buff *skb); | 462 | void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb); |
463 | void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); | 463 | void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); |
464 | int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc); | 464 | int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc); |
465 | int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | 465 | int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 56e34457ac07..0626f2cb192e 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1052,11 +1052,12 @@ e_inval: | |||
1052 | * destination in skb->cb[] before dst drop. | 1052 | * destination in skb->cb[] before dst drop. |
1053 | * This way, receiver doesnt make cache line misses to read rtable. | 1053 | * This way, receiver doesnt make cache line misses to read rtable. |
1054 | */ | 1054 | */ |
1055 | void ipv4_pktinfo_prepare(struct sk_buff *skb) | 1055 | void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) |
1056 | { | 1056 | { |
1057 | struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb); | 1057 | struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb); |
1058 | 1058 | ||
1059 | if (skb_rtable(skb)) { | 1059 | if ((inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) && |
1060 | skb_rtable(skb)) { | ||
1060 | pktinfo->ipi_ifindex = inet_iif(skb); | 1061 | pktinfo->ipi_ifindex = inet_iif(skb); |
1061 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); | 1062 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); |
1062 | } else { | 1063 | } else { |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index b2fa14c1a6f1..41e1d2845c8f 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -299,7 +299,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
299 | { | 299 | { |
300 | /* Charge it to the socket. */ | 300 | /* Charge it to the socket. */ |
301 | 301 | ||
302 | ipv4_pktinfo_prepare(skb); | 302 | ipv4_pktinfo_prepare(sk, skb); |
303 | if (sock_queue_rcv_skb(sk, skb) < 0) { | 303 | if (sock_queue_rcv_skb(sk, skb) < 0) { |
304 | kfree_skb(skb); | 304 | kfree_skb(skb); |
305 | return NET_RX_DROP; | 305 | return NET_RX_DROP; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 262ea3929da6..4226c53daaed 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1544,7 +1544,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
1544 | 1544 | ||
1545 | rc = 0; | 1545 | rc = 0; |
1546 | 1546 | ||
1547 | ipv4_pktinfo_prepare(skb); | 1547 | ipv4_pktinfo_prepare(sk, skb); |
1548 | bh_lock_sock(sk); | 1548 | bh_lock_sock(sk); |
1549 | if (!sock_owned_by_user(sk)) | 1549 | if (!sock_owned_by_user(sk)) |
1550 | rc = __udp_queue_rcv_skb(sk, skb); | 1550 | rc = __udp_queue_rcv_skb(sk, skb); |