Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8908
b: refs/heads/master
c: e7fa1bd
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 13, 2005
1 parent 97aa428 commit 7429a60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5cb30640ce01d76d256533bb2824c9cc14eb4070
refs/heads/master: e7fa1bd93f977c03050bd6b3d13846aa43310fef
19 changes: 7 additions & 12 deletions trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
#include <linux/inetdevice.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <net/route.h>

#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv4/ip_conntrack.h>
#include <linux/netfilter_ipv4/ip_conntrack_helper.h>

#define NMBD_PORT 137

MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
MODULE_DESCRIPTION("NetBIOS name service broadcast connection tracking helper");
MODULE_LICENSE("GPL");
Expand All @@ -44,7 +45,6 @@ static int help(struct sk_buff **pskb,
{
struct ip_conntrack_expect *exp;
struct iphdr *iph = (*pskb)->nh.iph;
struct udphdr _uh, *uh;
struct rtable *rt = (struct rtable *)(*pskb)->dst;
struct in_device *in_dev;
u_int32_t mask = 0;
Expand Down Expand Up @@ -72,20 +72,15 @@ static int help(struct sk_buff **pskb,
if (mask == 0)
goto out;

uh = skb_header_pointer(*pskb, iph->ihl * 4, sizeof(_uh), &_uh);
BUG_ON(uh == NULL);

exp = ip_conntrack_expect_alloc(ct);
if (exp == NULL)
goto out;
memset(&exp->tuple, 0, sizeof(exp->tuple));
exp->tuple.src.ip = iph->daddr & mask;
exp->tuple.dst.ip = iph->saddr;
exp->tuple.dst.u.udp.port = uh->source;
exp->tuple.dst.protonum = IPPROTO_UDP;

memset(&exp->mask, 0, sizeof(exp->mask));
exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple;
exp->tuple.src.u.udp.port = ntohs(NMBD_PORT);

exp->mask.src.ip = mask;
exp->mask.src.u.udp.port = 0xFFFF;
exp->mask.dst.ip = 0xFFFFFFFF;
exp->mask.dst.u.udp.port = 0xFFFF;
exp->mask.dst.protonum = 0xFF;
Expand All @@ -107,7 +102,7 @@ static struct ip_conntrack_helper helper = {
.src = {
.u = {
.udp = {
.port = __constant_htons(137),
.port = __constant_htons(NMBD_PORT),
}
}
},
Expand Down

0 comments on commit 7429a60

Please sign in to comment.