Re: NDIS ntohs/htons

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Just to clarify, the MAC header and payload is already in network byte
order
in the call to MiniportSendPackets/MiniportSend. I am sure over the air it
will be in network byte order just wasn't sure about at the Miniport send
interface.

Yes, the MAC header and PDU that's delivered to your MiniportSendPackets
(for NDIS 5.1) or MiniportSendNetBufferLists (for NDIS 6.0) will be in
network byte order.

Just for my education, is this behavior documented somewhere?

It's most likely in the WDK documentation. But just doing some debugging on
the payload itself would tell you what you need to know.

So would my check look something like

if( ntohs(nEthtypeLength) >= 0x0600 )
{
// DIX

}
else
{
// 802.3

}
I believe you want to check for 0x0800 (for IPV4) and not 0x0600 (for Xerox
NS IDP).


"Peter" wrote:

The data of the MAC header and packet payload in the egress packet is in
network byte order.

"Gammaraman" <Gammaraman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:20EE665F-6471-4894-8251-6C0A64F2C431@xxxxxxxxxxxxxxxx
Hi,

I am trying to inspect the Ethertype/length field in the Ethernet
header
of
an egress NDIS packet handed to the miniport by a protocol driver. What
byte-order does NDIS use for the header and payload? Do I need to put
the
Ethertype/length value through a call to ntohs() or htons() or just use
the
value as is?

I am assuming for an ingress NDIS packet, the byte order is network
byte
order so I would need to use ntohs() to inpect a short. Is this
correct?

Thanks.





.



Relevant Pages

  • Re: NDIS ntohs/htons
    ... the MAC header and payload is already in network byte order ... an egress NDIS packet handed to the miniport by a protocol driver. ...
    (microsoft.public.development.device.drivers)
  • Re: NDIS ntohs/htons
    ... DIX or 802.3 and then look at the EtherType, ... miniport be prepared to handle this case also to be robust ... the MAC header and payload is already in network byte ... I am trying to inspect the Ethertype/length field in the Ethernet ...
    (microsoft.public.development.device.drivers)
  • Strange UDP packets to non-existent network.
    ... some packet captures for everybody's review. ... They all have the same rotating payload but the dst udp ... - Ensure Reliable Performance of Mission Critical Applications ... - Precisely Define and Implement Network Security and Performance Policies ...
    (Incidents)
  • Re: [PATCH v2] tcp: splice as many packets as possible at once
    ... allocator, so that each skb could have its payload in the fragments, we ... I will resurrect to some point my network allocator to check how things ... Great, I'll try to learn a bit btw., ...
    (Linux-Kernel)
  • Re: Hyperthread issue
    ... No spin locks are required at all in a serialized miniport as there can ... it is a good idea to call any NDIS complete handlers ... This restriction is AFAIK a must for serialized drivers. ... Packet scheduler Miniport was connected to the network, ...
    (microsoft.public.development.device.drivers)