diff options
author | Patrick McHardy <kaber@trash.net> | 2005-09-13 16:48:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-13 16:48:34 -0400 |
commit | e7fa1bd93f977c03050bd6b3d13846aa43310fef (patch) | |
tree | 04028c2b8df3f278c792a212bfab99d0101eee09 /net | |
parent | 5cb30640ce01d76d256533bb2824c9cc14eb4070 (diff) |
[NETFILTER]: Simplify netbios helper
Don't parse the packet, the data is already available in the conntrack
structure.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_netbios_ns.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index bb7246683b74..71ef19d126d0 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/inetdevice.h> | 23 | #include <linux/inetdevice.h> |
24 | #include <linux/in.h> | 24 | #include <linux/in.h> |
25 | #include <linux/ip.h> | 25 | #include <linux/ip.h> |
26 | #include <linux/udp.h> | ||
27 | #include <net/route.h> | 26 | #include <net/route.h> |
28 | 27 | ||
29 | #include <linux/netfilter.h> | 28 | #include <linux/netfilter.h> |
@@ -31,6 +30,8 @@ | |||
31 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 30 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
32 | #include <linux/netfilter_ipv4/ip_conntrack_helper.h> | 31 | #include <linux/netfilter_ipv4/ip_conntrack_helper.h> |
33 | 32 | ||
33 | #define NMBD_PORT 137 | ||
34 | |||
34 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); | 35 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); |
35 | MODULE_DESCRIPTION("NetBIOS name service broadcast connection tracking helper"); | 36 | MODULE_DESCRIPTION("NetBIOS name service broadcast connection tracking helper"); |
36 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
@@ -44,7 +45,6 @@ static int help(struct sk_buff **pskb, | |||
44 | { | 45 | { |
45 | struct ip_conntrack_expect *exp; | 46 | struct ip_conntrack_expect *exp; |
46 | struct iphdr *iph = (*pskb)->nh.iph; | 47 | struct iphdr *iph = (*pskb)->nh.iph; |
47 | struct udphdr _uh, *uh; | ||
48 | struct rtable *rt = (struct rtable *)(*pskb)->dst; | 48 | struct rtable *rt = (struct rtable *)(*pskb)->dst; |
49 | struct in_device *in_dev; | 49 | struct in_device *in_dev; |
50 | u_int32_t mask = 0; | 50 | u_int32_t mask = 0; |
@@ -72,20 +72,15 @@ static int help(struct sk_buff **pskb, | |||
72 | if (mask == 0) | 72 | if (mask == 0) |
73 | goto out; | 73 | goto out; |
74 | 74 | ||
75 | uh = skb_header_pointer(*pskb, iph->ihl * 4, sizeof(_uh), &_uh); | ||
76 | BUG_ON(uh == NULL); | ||
77 | |||
78 | exp = ip_conntrack_expect_alloc(ct); | 75 | exp = ip_conntrack_expect_alloc(ct); |
79 | if (exp == NULL) | 76 | if (exp == NULL) |
80 | goto out; | 77 | goto out; |
81 | memset(&exp->tuple, 0, sizeof(exp->tuple)); | ||
82 | exp->tuple.src.ip = iph->daddr & mask; | ||
83 | exp->tuple.dst.ip = iph->saddr; | ||
84 | exp->tuple.dst.u.udp.port = uh->source; | ||
85 | exp->tuple.dst.protonum = IPPROTO_UDP; | ||
86 | 78 | ||
87 | memset(&exp->mask, 0, sizeof(exp->mask)); | 79 | exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; |
80 | exp->tuple.src.u.udp.port = ntohs(NMBD_PORT); | ||
81 | |||
88 | exp->mask.src.ip = mask; | 82 | exp->mask.src.ip = mask; |
83 | exp->mask.src.u.udp.port = 0xFFFF; | ||
89 | exp->mask.dst.ip = 0xFFFFFFFF; | 84 | exp->mask.dst.ip = 0xFFFFFFFF; |
90 | exp->mask.dst.u.udp.port = 0xFFFF; | 85 | exp->mask.dst.u.udp.port = 0xFFFF; |
91 | exp->mask.dst.protonum = 0xFF; | 86 | exp->mask.dst.protonum = 0xFF; |
@@ -107,7 +102,7 @@ static struct ip_conntrack_helper helper = { | |||
107 | .src = { | 102 | .src = { |
108 | .u = { | 103 | .u = { |
109 | .udp = { | 104 | .udp = { |
110 | .port = __constant_htons(137), | 105 | .port = __constant_htons(NMBD_PORT), |
111 | } | 106 | } |
112 | } | 107 | } |
113 | }, | 108 | }, |