-1

i want to write a line of code inside a driver module to get support on Mobile broadband . This is the code :

   PUCHAR pCurrData;

   struct eth_hdr *pEthHeader = (struct eth_hdr*)pCurrData;
   NET_BUFFER_LIST_INFO(pNBL, NetBufferListFrameType) = (PVOID)(ULONG_PTR)pEthHeader->type;

    switch( pEthHeader->type ){

        case PP_HTONS(ETHTYPE_IP):

             NdisSetNblFlag(pNBL, 0x00000200 /*NDIS_NBL_FLAGS_IS_IPV4*/);

         break;

            }

so my doubt , what is struct eth_hdr ? which header file i include ? so i should define this structure as my own ?

vinay kp
  • 35
  • 8

1 Answers1

0

Searching a little bit on google returns these precise lines from a repo on GitHub.

Using the GitHub search feature on the repo returns those lines:

/** Ethernet header */
struct eth_hdr {
#if ETH_PAD_SIZE
  PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
#endif
  PACK_STRUCT_FIELD(struct eth_addr dest);
  PACK_STRUCT_FIELD(struct eth_addr src);
  PACK_STRUCT_FIELD(u16_t type);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES
#  include "arch/epstruct.h"
#endif

This seems to describe only a part of an ethernet frame with MAC Dest, MAC source and Ethertype.

You should notice that this code is extracted directly from a bootkit (namely Caberp) which, among other things, inject a network driver in the kernel network driver stack. I don't think this kind of code is a good start for getting an idea on how a NDIS driver should be made.

There are enough good NDIS driver samples on the WDK to start with.

Neitsa
  • 7,693
  • 1
  • 28
  • 45
  • okay . i know that . But i want to add only mobile broadband support for NDIS . So this line of code is to check the Netbuffer list for the mobile broadband type . Anyway Thank u very much . – vinay kp Nov 23 '15 at 05:57