Commit fee9dee7 authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller

[UDP]: Make use of inet_iif() when doing socket lookups.

UDP currently uses skb->dev->ifindex which may provide the wrong
information when the socket bound to a specific interface.
This patch makes inet_iif() accessible to UDP and makes UDP use it.

The scenario we are trying to fix is when a client is running on
the same system and the server and both client and server bind to
a non-loopback device.
Signed-off-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
Acked-by: default avatarDavid L Stevens <dlstevens@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 41fb2854
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <net/inet_connection_sock.h> #include <net/inet_connection_sock.h>
#include <net/inet_sock.h> #include <net/inet_sock.h>
#include <net/route.h>
#include <net/sock.h> #include <net/sock.h>
#include <net/tcp_states.h> #include <net/tcp_states.h>
...@@ -266,11 +265,6 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) ...@@ -266,11 +265,6 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
wake_up(&hashinfo->lhash_wait); wake_up(&hashinfo->lhash_wait);
} }
static inline int inet_iif(const struct sk_buff *skb)
{
return ((struct rtable *)skb->dst)->rt_iif;
}
extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
const __be32 daddr, const __be32 daddr,
const unsigned short hnum, const unsigned short hnum,
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <net/flow.h> #include <net/flow.h>
#include <net/sock.h> #include <net/sock.h>
#include <net/request_sock.h> #include <net/request_sock.h>
#include <net/route.h>
/** struct ip_options - IP Options /** struct ip_options - IP Options
* *
...@@ -190,4 +191,10 @@ static inline int inet_sk_ehashfn(const struct sock *sk) ...@@ -190,4 +191,10 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
return inet_ehashfn(laddr, lport, faddr, fport); return inet_ehashfn(laddr, lport, faddr, fport);
} }
static inline int inet_iif(const struct sk_buff *skb)
{
return ((struct rtable *)skb->dst)->rt_iif;
}
#endif /* _INET_SOCK_H */ #endif /* _INET_SOCK_H */
...@@ -1152,7 +1152,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], ...@@ -1152,7 +1152,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest,
skb->dev->ifindex, udptable ); inet_iif(skb), udptable);
if (sk != NULL) { if (sk != NULL) {
int ret = udp_queue_rcv_skb(sk, skb); int ret = udp_queue_rcv_skb(sk, skb);
......
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