Re: Accessing a udp header in device driver

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

 



On Thursday 10 February 2005 02:54 am, durgam@xxxxxxxxxxxxx wrote:
>
> spin_lock(&udp_lock)
>  uh=skb->h.uh;
>  sport=uh->source;
>  dport=uh->dest;
> spin_lock(&udp_lock)
>

Hi,

In order to access the transport layer data correctly in all scenarios you 
need to take this path:

struct iphdr *ih=(*skb)->nh.iph;
struct udphdr *uh=(struct udphdr*)((char*)ih+sizeof(struct iphdr));

Of course, if you inserted something after the ip header you should compensate 
appropriately.

tavi

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