NDIS IM question

Hi.

I have to redirect packets from specified port to another one.
So I’m using passthru as a base and I implemented Send and Receive handlers
to change ports.
Everything seems to be ok with incoming packets, but outgoing packets has
invalid checksum. But I’ve made a correct calculation and replace old one
with new checksum and client got packet with old checksum. It strange I
can’t even imagine what could be a reason. Besides new port value is exists
while checksum is old, and this happens only in Send handler.

Can anybody point me where to look for possible reason or maybe I missed
something?

Thanx in advance.

Hello Dmitriy,

I am trying to change the Ip address of packets going from my computer. I
was trying to do in IP Fliter Hook Driver but i after changing the source IP
there was some error in TCP hand shaking.

I tried this through NDIS IM driver but i am unsuccessful. Can u please send
me the code u used for changing the port in Passthru driver.

It would be a grt help for me.

Thanks in advance,
Vibhor Mahajan

On 4/6/06, Dmitriy Gubarkov wrote:
>
> Hi.
>
> I have to redirect packets from specified port to another one.
> So I’m using passthru as a base and I implemented Send and Receive
> handlers
> to change ports.
> Everything seems to be ok with incoming packets, but outgoing packets has
> invalid checksum. But I’ve made a correct calculation and replace old one
> with new checksum and client got packet with old checksum. It strange I
> can’t even imagine what could be a reason. Besides new port value is
> exists
> while checksum is old, and this happens only in Send handler.
>
> Can anybody point me where to look for possible reason or maybe I missed
> something?
>
> Thanx in advance.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

“Dmitriy Gubarkov” wrote in message news:xxxxx@ntdev…
> Hi.
>
> I have to redirect packets from specified port to another one.
> So I’m using passthru as a base and I implemented Send and Receive
> handlers to change ports.
> Everything seems to be ok with incoming packets, but outgoing packets has
> invalid checksum. But I’ve made a correct calculation and replace old one
> with new checksum and client got packet with old checksum. It strange I
> can’t even imagine what could be a reason. Besides new port value is
> exists while checksum is old, and this happens only in Send handler.
>
> Can anybody point me where to look for possible reason or maybe I missed
> something?
>
> Thanx in advance.
Perhaps this is related to NDIS task offload - checksum offload.

In your IM driver you need to monitor the queries and sets related to NDIS
task offload. If the adapter offers hardware checksum offload and the TCP/IP
driver has elected to use it, then send packets will not have the correct
checksum because it is understood that the hardware will compute them. Going
further, if you compute a correct checksum in your IM filter, the outgoing
checksum will be incorrect because the hardware will make an additional
computation.

Read the info on the checksum task offload. There you will find how to
detect when offload is enabled and the expected values to be put into the
packet checksum field, etc . for this scheme to work.

Thomas F. Divine

Thanks i will try one…

On 4/6/06, Thomas F. Divine wrote:
>
>
> “Dmitriy Gubarkov” wrote in message news:xxxxx@ntdev…
> > Hi.
> >
> > I have to redirect packets from specified port to another one.
> > So I’m using passthru as a base and I implemented Send and Receive
> > handlers to change ports.
> > Everything seems to be ok with incoming packets, but outgoing packets
> has
> > invalid checksum. But I’ve made a correct calculation and replace old
> one
> > with new checksum and client got packet with old checksum. It strange I
> > can’t even imagine what could be a reason. Besides new port value is
> > exists while checksum is old, and this happens only in Send handler.
> >
> > Can anybody point me where to look for possible reason or maybe I missed
> > something?
> >
> > Thanx in advance.
> Perhaps this is related to NDIS task offload - checksum offload.
>
> In your IM driver you need to monitor the queries and sets related to NDIS
> task offload. If the adapter offers hardware checksum offload and the
> TCP/IP
> driver has elected to use it, then send packets will not have the correct
> checksum because it is understood that the hardware will compute them.
> Going
> further, if you compute a correct checksum in your IM filter, the outgoing
> checksum will be incorrect because the hardware will make an additional
> computation.
>
> Read the info on the checksum task offload. There you will find how to
> detect when offload is enabled and the expected values to be put into the
> packet checksum field, etc . for this scheme to work.
>
> Thomas F. Divine
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Thomas thanx a lot. You’ve saved my mind from madness!

“Thomas F. Divine” ???/??? ? ???
???: news:xxxxx@ntdev…
>
> “Dmitriy Gubarkov” wrote in message news:xxxxx@ntdev…
>> Hi.
>>
>> I have to redirect packets from specified port to another one.
>> So I’m using passthru as a base and I implemented Send and Receive
>> handlers to change ports.
>> Everything seems to be ok with incoming packets, but outgoing packets has
>> invalid checksum. But I’ve made a correct calculation and replace old one
>> with new checksum and client got packet with old checksum. It strange I
>> can’t even imagine what could be a reason. Besides new port value is
>> exists while checksum is old, and this happens only in Send handler.
>>
>> Can anybody point me where to look for possible reason or maybe I missed
>> something?
>>
>> Thanx in advance.
> Perhaps this is related to NDIS task offload - checksum offload.
>
> In your IM driver you need to monitor the queries and sets related to NDIS
> task offload. If the adapter offers hardware checksum offload and the
> TCP/IP driver has elected to use it, then send packets will not have the
> correct checksum because it is understood that the hardware will compute
> them. Going further, if you compute a correct checksum in your IM filter,
> the outgoing checksum will be incorrect because the hardware will make an
> additional computation.
>
> Read the info on the checksum task offload. There you will find how to
> detect when offload is enabled and the expected values to be put into the
> packet checksum field, etc . for this scheme to work.
>
> Thomas F. Divine
>
>
>

If I’m not mistaking IP Filter is good for Firewall solution not for redirection, it’s ok with incoming packets but outgoing packet in this filter come with header only no data at all.

What peace of code? Payload parser? Take a look at samples of extended Passthru, there a lot of useful code for this. I used them.
“Vibhor Mahajan” ???/??? ? ??? ???: news:xxxxx@ntdev…
Hello Dmitriy,

I am trying to change the Ip address of packets going from my computer. I was trying to do in IP Fliter Hook Driver but i after changing the source IP there was some error in TCP hand shaking.

I tried this through NDIS IM driver but i am unsuccessful. Can u please send me the code u used for changing the port in Passthru driver.

It would be a grt help for me.

Thanks in advance,
Vibhor Mahajan

On 4/6/06, Dmitriy Gubarkov wrote:
Hi.

I have to redirect packets from specified port to another one.
So I’m using passthru as a base and I implemented Send and Receive handlers
to change ports.
Everything seems to be ok with incoming packets, but outgoing packets has
invalid checksum. But I’ve made a correct calculation and replace old one
with new checksum and client got packet with old checksum. It strange I
can’t even imagine what could be a reason. Besides new port value is exists
while checksum is old, and this happens only in Send handler.

Can anybody point me where to look for possible reason or maybe I missed
something?

Thanx in advance.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer