Re: Problem Modifing the NDIS packet
From: Maxim S. Shatskih (maxim_at_storagecraft.com)
Date: 07/20/04
- Next message: shahar: "Detaching a device"
- Previous message: Hannes: "Re: How prevent DHCP while upgrading intermediate driver?"
- In reply to: Rajesh Gupta: "Problem Modifing the NDIS packet"
- Next in thread: Rajesh Gupta: "Re: Problem Modifing the NDIS packet"
- Reply: Rajesh Gupta: "Re: Problem Modifing the NDIS packet"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Jul 2004 19:38:01 +0400
You cannot modify NDIS_PACKET in place.
You will need to allocate another NDIS_PACKET and another NDIS_BUFFER+the
data area for the update data, and re-link the buffer chain to the new
NDIS_PACKET.
-- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation maxim@storagecraft.com http://www.storagecraft.com "Rajesh Gupta" <guptar@gmail.com> wrote in message news:%23gmxgymbEHA.252@TK2MSFTNGP10.phx.gbl... > Hi All, > > I am trying to modify the NDIS packet. I want to redirect the packet from > destined for 172.10.10.10 to 172.10.10.10. > steps taken to modify the packets. > > 1. Modify the Destination IP address. > 2. Calculate the Checksum. > 3. Modify the Destination MAC address. > 4. Send the packet. > > I have used both Network stacking and own NDIS packets. > > When i tested my code, it worked on One Ethernet Adapter and it did not work > on another adapters. I do not know why. > When i captured the packet with Etherreal, it shows that the Checksum is 0 > at the destination. Everything else is fine. I checked the IP address, MAC > address, then are updated. > I am calculating the right checksum and i made sure i am updating the > checksum after i modified the packet. > I am not sure, when Checksum became 0. > > I do not know, if Miniport driver made it 0. Is that the posibility? if yes > then why? Is my checksum wrong? I am attaching the code to calculate > checksum here. Thanks in advance for your help. > > Regards > Rajesh > > > /* > > ************************************************************************** > > Function: FltIPSumCalculation > > Description: Calculate the 16 bit IP sum. > > *************************************************************************** > > */ > > USHORT FltIPSumCalculation(USHORT len, PUSHORT pbuf) > > { > > ULONG sum=0; > > > while(len > 1){ > > sum += *pbuf++; > > len -= sizeof(USHORT); > > } > > if(len) > > sum += *(UCHAR*)pbuf; > > sum = (sum >> 16) + (sum & 0xffff); > > sum += (sum >> 16); > > // one's complement the result > > sum = ~sum; > > return ((USHORT) sum); > > } > >
- Next message: shahar: "Detaching a device"
- Previous message: Hannes: "Re: How prevent DHCP while upgrading intermediate driver?"
- In reply to: Rajesh Gupta: "Problem Modifing the NDIS packet"
- Next in thread: Rajesh Gupta: "Re: Problem Modifing the NDIS packet"
- Reply: Rajesh Gupta: "Re: Problem Modifing the NDIS packet"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|