Re: accessing skbuffs

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

 




That's correct. You'll want to try it of course.

Print out the octets of the number (by converting it to a 4-byte character array
for instance) and verifying that you're using the correct location within the
skb->data array.


It's important that you recognize that you're just accessing bytes within
large array containing various values, starting at the address skb->data.

- Michael

At 01:48 AM 4/11/2005, linux lover wrote:
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/

/*********************************/ Michael R. Hines Grad Student, Florida State Dept. Computer Science http://www.cs.fsu.edu/~mhines/ Jusqu'à ce que le futur vienne... /*********************************/


-- 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