Preliminary NetBIOS datagram NAT filter
http://suif.stanford.edu/~csapuntz/ip_nat_netbios.c
Using this, I was able to join a Windows NT domain and login into the domain from behind a NAT.
I had a hard time understanding all the parameters to the various methods, so I probably got it wrong for anything except for source NAT (which I tested). I'd appreciate any help from more experienced developers.
Here's the problem with NetBIOS. NetBIOS datagrams contain the source IP address and
source port as bytes 4-9 of the UDP payload. These need to be rewritten while traversing a NAT.
Here are some questions:
- the HOWTO seems to indicate you want to override hlpr->tuple.dst.u.udp.port but all the examples override hlpr->tuple.src.u.udp.port to filter all traffic to a port. Which is right?
- will this NAT helper work with two computers with different IP addresses behind a NAT? i.e. if both computers send packets with source port 138 and destination port 138, will it correctly move the source port number of one of the packets. Or do I have to call some extra functions.
- will this code work for other things that rewrite the source address? What do I need to do to make it work?
Thanks,
-Costa
Quoted 10 lines · Constantine Sapuntzakis
http://suif.stanford.edu/~csapuntz/ip_nat_netbios.c
Using this, I was able to join a Windows NT domain and login into the domain from behind a NAT.
I had a hard time understanding all the parameters to the various methods, so I probably got it wrong for anything except for source NAT (which I tested). I'd appreciate any help from more experienced developers.
Quoted 4 lines
Here's the problem with NetBIOS. NetBIOS datagrams contain the source IP address and
source port as bytes 4-9 of the UDP payload. These need to be rewritten while traversing a NAT.
so how do you determine that what you are modyfying is really a netbios packet? just using the port number is too little. maybe you can do some plausibility checks on the whole packet, and also verify that bytes 4-9 are the same as the ip (source?) address in the packet.
Quoted 4 lines
- the HOWTO seems to indicate you want to override
hlpr->tuple.dst.u.udp.portbut all the examples overridehlpr->tuple.src.u.udp.portto filter all traffic to a port. Which is right?
src.
Quoted 5 lines
- will this NAT helper work with two computers with different IP addresses behind a NAT? i.e. if both computers send packets with source port 138 and destination port 138, will it correctly move the source port number of one of the packets. Or do I have to call some extra functions.
i'm not really sure how the netbios protocol works. therefore I cannot really comment on what you're doing and whether it's the right thing to do. normally, you implement a conntrack helper before writing a nat helper.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie