aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
authorKOVACS Krisztian <hidden@sch.bme.hu>2008-10-07 15:38:32 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-07 15:38:32 -0400
commit607c4aaf03041c8bd81555a0218050c0f895088e (patch)
tree130cfcfca74eccb135592a883000a319e94cd7e2 /net/ipv4/udp.c
parent9a1f27c48065ce713eb47f2fd475b717e63ef239 (diff)
inet: Add udplib_lookup_skb() helpers
To be able to use the cached socket reference in the skb during input processing we add a new set of lookup functions that receive the skb on their argument list. Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c83d0ef469c9..c7a90b546b21 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -302,6 +302,17 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
302 return result; 302 return result;
303} 303}
304 304
305static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
306 __be16 sport, __be16 dport,
307 struct hlist_head udptable[])
308{
309 const struct iphdr *iph = ip_hdr(skb);
310
311 return __udp4_lib_lookup(dev_net(skb->dst->dev), iph->saddr, sport,
312 iph->daddr, dport, inet_iif(skb),
313 udptable);
314}
315
305struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 316struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
306 __be32 daddr, __be16 dport, int dif) 317 __be32 daddr, __be16 dport, int dif)
307{ 318{
@@ -1208,8 +1219,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1208 return __udp4_lib_mcast_deliver(net, skb, uh, 1219 return __udp4_lib_mcast_deliver(net, skb, uh,
1209 saddr, daddr, udptable); 1220 saddr, daddr, udptable);
1210 1221
1211 sk = __udp4_lib_lookup(net, saddr, uh->source, daddr, 1222 sk = __udp4_lib_lookup_skb(skb, uh->source, uh->dest, udptable);
1212 uh->dest, inet_iif(skb), udptable);
1213 1223
1214 if (sk != NULL) { 1224 if (sk != NULL) {
1215 int ret = udp_queue_rcv_skb(sk, skb); 1225 int ret = udp_queue_rcv_skb(sk, skb);