Re: accessing skbuffs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello Michael,
       So i can access source ip address of packet in
kernel stack code after eth header is removed and
processed in function eth_type_trans in eth.c as 
u32 someaddr = ((struct iphdr *) (skb->data +
sizeof(struct ethhdr))->saddr; 

        Is that right?

regards,
linux_lover.


--- "Michael R. Hines" <mhines@xxxxxxxxxx> wrote:
> 
> Indeed they are readable.
> 
> They are located within the region pointed to by
> skb->data
> 
> more specifically:
> 
> u32 someaddr = ((struct iphdr *) (skb->data +
> sizeof(struct 
> ethhdr))->saddr; //if I remember correctly
> 
> ......Assuming you're reading the packet directly
> from the network card.
> 
> Otherwise, skb->data may be moved up by a header or
> two.
> For example, if you're inside the IP receive
> functions, the pointer will be 
> moved up by sizeof(struct ethhdr) bytes.
> 
> At 07:50 AM 4/10/2005, linux lover wrote:
> >hello,
> >      Does skbuffs provide facility to access other
> >layers headers at any layer? What i want, if packet
> is
> >processed at LINK layer then can IP addresses(SRC &
> >DST) of packets is readable at Link layer?
> >
> >regards,
> >linux_lover.
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Small Business - Try our new resources site!
> >http://smallbusiness.yahoo.com/resources/
> >
> >--
> >Kernelnewbies: Help each other learn about the
> Linux kernel.
> >Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> >FAQ:           http://kernelnewbies.org/faq/
> 
> /*********************************/
> Michael R. Hines
> Grad Student, Florida State
> Dept. Computer Science
> http://www.cs.fsu.edu/~mhines/
> Jusqu'à ce que le futur vienne...
> /*********************************/
> 
> 


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux