Re: Getting the Received Packet's Sender (IP) Address

Zhu Yi <[email protected]>
Newsgroups gmane.linux.drivers.ipw2100.devel
Organization Intel Corp.
Message-ID <[email protected]>
On Fri, 2007-01-05 at 15:48 +0000, Siva Sivavakeesar wrote:
> However, I have been having
> trouble finding the received packets IP and MAC address together.
> Although conceptually wrong, I am trying to get the sender's IP
> address for every packet a node receives at the MAC (driver) level.
> For this purpose, I have added the follwing code under ipw_rx() of
> ipw2200.c.
> 
>     static void ipw_rx(struct ipw_priv *priv)
>    {   .
>        :
>        struct iphdr *iph;
>        .
>        :
>        iph = (struct iphdr *) rxb->skb->nh.iph;
> 
>        if (iph != NULL) {
> 
>           saddr = iph->saddr;
>       }
> 
>        .
>        :
> }

You cannot reference ip address this way here, since this the lower
layer of IP stack. the skb->nh.iph is assigned value in the IP stack.

> However, since "iph" always returns NULL, I am not able to find the
> sender's IP address of a packet/frame received. Can you please let me
> know whether accessing the IPHdr information is possible at the driver
> (MAC) level. If not, how can I get around with this problem. 

If you would really want to get IP address here you should parse IEEE
802.11, SNAP and IP protocol (if it is a IP packet) yourself. The
beginning address is skb->data.

Thanks,
-yi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.