How split one big packet into two parts and send it in my IM Driver?

hello,
i write an IM Driver,and it can work well,but know i want to control
the packet length not to exceed 800,so if the packet between 800 and the
MTU,i will split it,and then i do not know what to do next,how to send this
two packet in my SendPackets Function,who can give me some advice or simple
code?
thanks.


ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com

Splitting a packet is not the right way to do it. From your IM driver, you
should report a lesser MTU i.e. 800 in your case (in reply to
OID_GEN_MAXIMUM_FRAME_SIZE etc), so that TCP/IP above you correctly give you
maximum 800 bytes sized packets. But this will only work on the send path. I
don’t think you can do anything on the receive path.

The splitting won’t work because TCP keeps a sequence number for each packet
and only TCP is able to generate them correctly.


Pankaj Garg
This posting is provided “AS IS” with no warranties and confers no rights.

“shark mouse” wrote in message news:xxxxx@ntdev…
> hello,
> i write an IM Driver,and it can work well,but know i want to control
> the packet length not to exceed 800,so if the packet between 800 and the
> MTU,i will split it,and then i do not know what to do next,how to send
this
> two packet in my SendPackets Function,who can give me some advice or
simple
> code?
> thanks.
>
> _________________________________________________________________
> ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com
>
>

“Pankaj Garg” wrote in message
news:xxxxx@ntdev…
> Splitting a packet is not the right way to do it. From your IM driver, you
> should report a lesser MTU i.e. 800 in your case (in reply to
> OID_GEN_MAXIMUM_FRAME_SIZE etc), so that TCP/IP above you correctly give
> you
> maximum 800 bytes sized packets. But this will only work on the send path.
> I
> don’t think you can do anything on the receive path.
>
> The splitting won’t work because TCP keeps a sequence number for each
> packet
> and only TCP is able to generate them correctly.
>

Actually, you can split (fragment) send packets in a NDIS IM driver. This is
often a necessary step in encapsulation of outgoing packets. The sequence
numbers, etc are taken from the original unfragmented packet - just like a
router along the way would fragment oversize packets.

HOWEVER, I certainly agree with you that the solution to this poster’s
problem is to change the MTU to the size that the link can handle.

Regards,

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com

> –
> Pankaj Garg
> This posting is provided “AS IS” with no warranties and confers no rights.
>
>
> “shark mouse” wrote in message news:xxxxx@ntdev…
>> hello,
>> i write an IM Driver,and it can work well,but know i want to control
>> the packet length not to exceed 800,so if the packet between 800 and the
>> MTU,i will split it,and then i do not know what to do next,how to send
> this
>> two packet in my SendPackets Function,who can give me some advice or
> simple
>> code?
>> thanks.
>>
>> _________________________________________________________________
>> ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com
>>
>>
>
>
>

I’ve seen some strange behavior on WXP where when reducing the MTU (even though it’s Maximum TRANSMISSION Unit) it appears to affect the TCP/IP stack’s ability to receive packets above the size of the reduced MTU.

Normal TCP connections are usually unaffected because the MSS (Maximum Segment Size) is negotiated at the upper layer TCP connection and thus any traffic sent/received has been built into small enough packets. The specific case I saw was with ICMP (Ping) packets where a received packet was coming in from another machine with a payload larger than the MTU that was reported to the stack. The stack appeared to drop this packet (i.e. the ping was not responded to).

Has anyone else encountered this? We were going to combat this problem by 1) NOT reducing the MTU and 2) Performing IP Fragmentation/Reassembly when necessary in our Intermediate Driver.

-Paul

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Thomas F. Divine
Sent: Wednesday, April 05, 2006 1:50 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How split one big packet into two parts and send it in my IM Driver?

“Pankaj Garg” wrote in message
news:xxxxx@ntdev…
> Splitting a packet is not the right way to do it. From your IM driver, you
> should report a lesser MTU i.e. 800 in your case (in reply to
> OID_GEN_MAXIMUM_FRAME_SIZE etc), so that TCP/IP above you correctly give
> you
> maximum 800 bytes sized packets. But this will only work on the send path.
> I
> don’t think you can do anything on the receive path.
>
> The splitting won’t work because TCP keeps a sequence number for each
> packet
> and only TCP is able to generate them correctly.
>

Actually, you can split (fragment) send packets in a NDIS IM driver. This is
often a necessary step in encapsulation of outgoing packets. The sequence
numbers, etc are taken from the original unfragmented packet - just like a
router along the way would fragment oversize packets.

HOWEVER, I certainly agree with you that the solution to this poster’s
problem is to change the MTU to the size that the link can handle.

Regards,

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com

> –
> Pankaj Garg
> This posting is provided “AS IS” with no warranties and confers no rights.
>
>
> “shark mouse” wrote in message news:xxxxx@ntdev…
>> hello,
>> i write an IM Driver,and it can work well,but know i want to control
>> the packet length not to exceed 800,so if the packet between 800 and the
>> MTU,i will split it,and then i do not know what to do next,how to send
> this
>> two packet in my SendPackets Function,who can give me some advice or
> simple
>> code?
>> thanks.
>>
>> _________________________________________________________________
>> ???ĵ???ʼ?ϵͳ?? MSN Hotmail?? http://www.hotmail.com
>>
>>
>
>
>


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

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Paul Benware[SMTP:xxxxx@koolspan.com]
Reply To: Windows System Software Devs Interest List
Sent: Wednesday, April 05, 2006 10:32 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How split one big packet into two parts and send it in my IM Driver?

I’ve seen some strange behavior on WXP where when reducing the MTU (even though it’s Maximum TRANSMISSION Unit) it appears to affect the TCP/IP stack’s ability to receive packets above the size of the reduced MTU.

Normal TCP connections are usually unaffected because the MSS (Maximum Segment Size) is negotiated at the upper layer TCP connection and thus any traffic sent/received has been built into small enough packets. The specific case I saw was with ICMP (Ping) packets where a received packet was coming in from another machine with a payload larger than the MTU that was reported to the stack. The stack appeared to drop this packet (i.e. the ping was not responded to).

Has anyone else encountered this? We were going to combat this problem by 1) NOT reducing the MTU and 2) Performing IP Fragmentation/Reassembly when necessary in our Intermediate Driver.

Interesting. I’m almost sure reducing MTU didn’t cause problems at NT4 and w2k and larger packets could be received. However, it isn’t illogical if protocol driver refuses to receive larger packets than below driver claims to support. I’d solve it by simulating IP fragmentation on receive path. Just indicate one larger IP packet as two IP fragments.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Thomas F. Divine[SMTP:xxxxx@hotmail.com]
Reply To: Windows System Software Devs Interest List
Sent: Wednesday, April 05, 2006 7:50 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How split one big packet into two parts and send it in my IM Driver?

Actually, you can split (fragment) send packets in a NDIS IM driver. This is
often a necessary step in encapsulation of outgoing packets. The sequence
numbers, etc are taken from the original unfragmented packet - just like a
router along the way would fragment oversize packets.

Which problem can’t be solved by reporting smaller MTU? For encapsulation I simply reported real MTU - max size of the envelope and didn’t need to fragment packets.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

thanks for all the advice.now i know i need do ip fragmeng and
ressemble in my IM driver,but how to do it,i have no idea of that?
thanks again.


Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn

No, you may not need it as changing MTU is much easier and it should be the first step (1 hour of development and testing). Later, if you find you really need fragmenting, just read the appropriate RFC (and please don’t ask what is RFC and which one you should read).

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of shark mouse[SMTP:xxxxx@hotmail.com]
Reply To: Windows System Software Devs Interest List
Sent: Thursday, April 06, 2006 6:51 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How split one big packet into two parts and send it in my IM Driver?

thanks for all the advice.now i know i need do ip fragmeng and
ressemble in my IM driver,but how to do it,i have no idea of that?
thanks again.


??? MSN Explorer: http://explorer.msn.com/lccn


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

If you need the algorithm see here
http://www.ietf.org/rfc/rfc0815.txt
http://www.ietf.org/rfc/rfc0791.txt

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shark mouse
Sent: Wednesday, April 05, 2006 9:52 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How split one big packet into two parts and send it in my IM Driver?

thanks for all the advice.now i know i need do ip fragmeng and ressemble in my IM driver,but how to do it,i have no idea of that?
thanks again.


??? MSN Explorer: http://explorer.msn.com/lccn


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

There’s also a good reference in the “TCP/IP Illustrated” books. Volume I by W. Richard Stevens and Volume II by Gary R. Wright and Stevens. Amazon.com has them both. Volume II is the “implementation” book, so if you were only going to buy one of them, this would be it.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Shanbhogue, Vedvyas
Sent: Thursday, April 06, 2006 1:38 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How split one big packet into two parts and send it in my IM Driver?

If you need the algorithm see here
http://www.ietf.org/rfc/rfc0815.txt
http://www.ietf.org/rfc/rfc0791.txt

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shark mouse
Sent: Wednesday, April 05, 2006 9:52 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How split one big packet into two parts and send it in my IM Driver?

thanks for all the advice.now i know i need do ip fragmeng and ressemble in my IM driver,but how to do it,i have no idea of that?
thanks again.


??? MSN Explorer: http://explorer.msn.com/lccn


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


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

someone told me to decrease the mtu,and then deal with the buffer not
to exceed 800 bytes,is that possible?


ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.msn.com/cn

You have to handle the OID_GEN_MAXIMUM_FRAME_SIZE oid in your MiniportQueryInformation handler.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shark mouse
Sent: Thursday, April 06, 2006 10:23 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How split one big packet into two parts and send it in my IM Driver?

someone told me to decrease the mtu,and then deal with the buffer not
to exceed 800 bytes,is that possible?


???ѽ??н???ʹ?? MSN Messenger: http://messenger.msn.com/cn


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