September 10, 2004 at 9:30 am #4876
In the NAT application, I only relay ICMP( ping ) packets
The NAT has 2 interface, one is ethernet connecting local network
, the other is PPP for internet.
It can get the packets from the client,
adn when the NAT replace the dest ip address, re-calc the checksum, and
send to MSTCP stack. We never get the response, NO data received
from the PPP adapter. Is there any problem with my code?
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.
Below is my code.
// set MODE to MSTCP_FLAG_SENT_TUNNEL|MSTCP_FLAG_RECV_TUNNEL to all adapters
dwRe=WaitForMultipleObjects(nCount, arrEvents, FALSE , 1000);
if( ( dwRe < WAIT_OBJECT_0 )|| ( dwRe > WAIT_OBJECT_0+nCount-1) )
/// find associated Adapter
if ( !mapAdapter.Lookup( hEvent, adp ))
ZeroMemory ( &Request, sizeof(ETH_REQUEST) );
ZeroMemory ( &PacketBuffer, sizeof(INTERMEDIATE_BUFFER) );
Request.EthPacket.Buffer = &PacketBuffer;
Request.hAdapterHandle = (HANDLE)adp.hAdpHandle;
/// read data
if (PacketBuffer.m_dwDeviceFlags == PACKET_FLAG_ON_SEND)
pEthHeader = (ether_header*)PacketBuffer.m_IBuffer;
if(ntohs(pEthHeader->h_proto) == ETH_P_IP)
pIpHeader=(iphdr*)(PacketBuffer.m_IBuffer +14 );
//// substitute the source ip with nat address
/// calac the checksum
pIpHeader->ip_sum=ip_checksum((unsigned char*)pIpHeader, 20 );
// send packet to MSTCP
}September 10, 2004 at 11:51 am #5627Vadim SmirnovModerator
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 10, 2004 at 2:07 pm #5628
It’s XP. For the PPP, I use RasPPPoE.
Enable IP routing? Do you mean set
IPEnableRouter to 1.
Oh, I did it.
And test again, still no response!!
Do you need to see the whole code?September 13, 2004 at 5:28 am #5629
I run a sniffer to monitor the packets
and find that MSTCP doest not send out my nat packets.
What’s reason cause it to drop the packets?
Can someone send a NAT sample, so I can whether it computer
configuration problem or my nat problem.September 16, 2004 at 6:59 am #5630
Can anyone help me to solve this problem?If I solve this problem in my evaluation, I would purchase one.
- You must be logged in to reply to this topic.