Forum Replies Created
September 16, 2004 at 12:41 pm in reply to: Tcpip routing forward question? #5636
Following to your post Send out modified ip packets, but no reponse ( NAT ) you read the packet from the inner interface, substitute the source IP and send this packet to the stack. What do you think the stack will do with packet received from the inner interface which has it’s own IP address as a source address? Yes, it will drop it, because it never expects such a packet from the network. So you don’t need to alter incoming packets from the inner interface. In this case TCP/IP will route them and try to send from the external interface with inner client source IP.
In order to complete your task you should filter the external (Internet interface) and NAT (substutute the source address with external interface one) outgoing packets. For the packets received on the external interface you should do the reverse operation (change destination IP from the external interface IP to inner system one) if you find the required entry in your NAT table.September 15, 2004 at 10:19 am in reply to: Howto get IP address for a given adapter #5631
The only documented way is IP Helper API.September 10, 2004 at 11:51 am in reply to: Send out modified ip packets, but no reponse ( NAT ) #5627
In order to analyze your code I would also need to analyze the environment it runs in. However, check if you have enable IP routing (forwarding) since it is disabled by the default and TCP/IP will just drop the packets from the interface if they don’t match interface address information.
Another ques: when I call SendPacketToMstcp(), should I also get this packet at PACKET_FLAG_ON_SEND at the other adapter when MSTCP send it to interface? I tried, but not get the packet.
No, this flag has informational purpose only (for you reference if packet was received from the network or from the stack).September 6, 2004 at 10:17 am in reply to: How can i drop packets using Local Host Api #5624
Localhost Monitor API is created as a sniffer tool, not the firewall software and can’t be used fot the dropping packets. However, it’s base driver (TDI filter driver) can be used for the developing the application level firewall like the one you have mentioned.September 4, 2004 at 11:51 am in reply to: tunnel mode not dropping packets? #5618
You have NDISWANIP interface even if you have no modems installed. Please reference the interface list returned by ListAdapters tool.September 2, 2004 at 5:08 pm in reply to: tunnel mode not dropping packets? #5616
I only have one adaptor in the PC. So everything must go through that network card.
If you have single ethernet interface then it does not mean that you have the only adapter seen by WinpkFilter, because you always have the dial-up(NDISWANIP) interface.
If i put the adaptor in to tunnel mode and dont have SendPacketToAdapter or SendPacketToMSTCP then all packets should be dropped and no networking should function.
You are right, if you filter in tunnel mode and don’t reinject packets to stack then any network activity is disabled. I suppose something is wrong with your code, definitions or the network interface you filter.September 2, 2004 at 5:02 pm in reply to: testapp stops working after some time #5619
Please check if you are using retail (not trial) version of the driver.September 2, 2004 at 10:02 am in reply to: tunnel mode not dropping packets? #5614
I have the only idea, probably you filter the adapter different from the one used for the e-mail and network browsing.August 31, 2004 at 10:40 am in reply to: Need to know what application is associated with a packet #5477
There may be 2 application which are accessing same IP/ port/ protocol like Netscape and Internet explorer accessing yahoo.com same time.
Right, destination IP/protocol/port can be the same, but source ports will be different for the case described.August 30, 2004 at 10:44 pm in reply to: NAT question #5607
IMHO, in theory (hardly likely that it will ever happen in real life) it is possible that application running on NAT system access the same IP/port as another application running behind the NAT and the same source port used in NAT table and for local application running on NAT system. In this case it is not possible to distinguish if packet should be NAT’ed or not. But even in this rare case you still can use sequence and aknowledgement fields in TCP header to determine wheather the NAT should be applied (it will work for TCP connection only).August 29, 2004 at 10:46 am in reply to: Need to know what application is associated with a packet #5475
You can use IP/port/protocol information gathered on the TDI level and match it against information extracted from IP packet. If it is the same then the packet is probably originated from the application you intercepted on the TDI level.August 29, 2004 at 10:41 am in reply to: Can winpkfilter work properly with win XP SP2? #5609
The latest WinpkFilter release is fully compatible with Windows XP SP2.August 27, 2004 at 10:24 pm in reply to: NAT question #5605
So what about if some application use this port number at the NAT computer? Is there any conflicts if use same port number ( with some application at NAT computer )?
The conflict is possible, you will just bypass those applications (they may be not working properly with your NAT application, but it won’t make any problems to NAT). However, you can just reserve required port range by your own application.
Another question: how to get binding IP address for each interface adapter, and how to get windows route table?
IP Helper APIAugust 27, 2004 at 12:25 pm in reply to: NAT question #5603
When I replace the Client(IP, PORT) of the inner packet with the NAT External(ip, port), what port number should I used for the NAT external? The same with the Client Port or a new one? Is that must be a free number that no one uses it? How do I generate this port number.
When you substitute inner source IP with external one but don’t substitute inner port this is called static NAT. When you substitute inner source port in addition to IP this is called dynamic NAT. You can use any free port number (an example just take some rarely used port range like 10000-64000 and allocate ports from there).
PS: where can I get the code of Checksum Calculation?
That depends from the progarmming environment you use, an example some C and Delhi code is available on this board.August 19, 2004 at 9:30 am in reply to: NAT question #5601
If you want to realize your own packet forwarding you can do it with API’s you have mentioned. If you filter two adapters and you can read packet from one and send them to another, here is no crime. Just don’t forget that MTU for the interfaces can be different.