[mpls-linux-general] regarding sk_buff structure....
Status: Beta
Brought to you by:
jleu
From: <vvk...@hs...> - 2002-01-09 04:59:35
|
Hi Abhijit ! Thank you very much for ur valuable info ................. Here inside "mpls_sendmsg" , i am not doing anything related to device ........ Just i am maintaining max number of bufs: 5 , in the pool at this module......... when application comes up it will execute read function............... inside by using /proc filesystem , i implemented read function .. based on that it will fetch the contents from buffer and give it to application............. that is the actual story............ Just i ma sending the files .....If you find bandwidth , please look at into that files................. (See attached file: mpls_buff.c)(See attached file: mpls_pcap.c)(See attached file: mpls_pcap_ops.c)(See attached file: mpls_proc.h) these are very smll files........... the " mpls_get_packet_data" function is in the mpls_buff.c file............... With thanx and regards, Ramki kvv. Abhijit Gadgil <gab...@ee...> on 01/09/2002 09:17:34 AM To: Veera R Koduri/HSS@HSS cc: mpl...@li... Subject: Re: [mpls-linux-general] regarding sk_buff structure.... If you want to send the packet to user-space application, mpls_sendmsg is perhaps not the way you shd to it. Well what i think is happening is (its most likely like that, i m not sure) mpls_sendmsg or subsequent calls from it (if any) are refering to skb->dev or skb->dst somewhere. And its likely that these are not set properly. Also you can have a look at the sources of tun-tap device in drivers/net/ to check how to send packets to userspace. (Excellent stuff! I have seen so far). hth -abhijit vvk...@hs... wrote : > > >Hi Experts ! > > I have come across with one problem that , i want to get the packet and >send it to an application , >running in user space .......... My objective is to get the SHIM ,src,dest >address and packet data ........ > > I am following style.......................of code. > >#define MPLS_MAX_BUFF_SIZE 1500 >#define MPLS_MAX_DATA_SIZE 1500 - 4* sizeof ( unsigned long ) -1 > >int mpls_get_packet_data( struct sk_buff *skb, unsigned long shim, > int type ) >{ > char *fname="mpls_get_packet_data"; > mpls_info_t *buff=NULL; > > printk(KERN_ALERT"%s : entering .....\n",fname); > > buff=(mpls_info_t *)kmalloc(sizeof(mpls_info_t), GFP_KERNEL); > if ( buff == NULL ) > { > printk(KERN_ALERT"%s: kmalloc error",fname); > return -ENOMEM; > } > > if ( skb == NULL ) > { > printk(KERN_ALERT"%s: skb NULL argument error",fname); > kfree(buff); > return -EINVAL; > } > > /* Now get the "src", "fec ..i.e dest address", > * "data" from sk_buff structure ......... > * Fill it in the "mpls_info_t" structure... > * and place the msg in the queue ....... > */ > > > buff->type = type; /* Label Type ...IN or OUT Label */ > buff->shim = shim; /* fill the SHIM info .......*/ > buff->src = skb->nh.iph->saddr; /* src address from sk_buff */ > buff->fec = skb->nh.iph->daddr; /* dest address from sk_buff */ > memset(buff->data, 0, MPLS_MAX_DATA_SIZE-1); > > if ( skb->data != NULL ) > { > printk(KERN_ALERT"%s: skb data length [%d]\n",fname,skb->len); > memcpy(buff->data, skb->data, skb->len); > } > > return mpls_sendmsg(buff, MPLS_MAX_BUFF_SIZE); > } > >This function i am calling in the "mpls_output2" function in the file : " >mpls_output.c" file of mpls >src for kinux............ > >here problem is ......... after some time kernel panic msg arriving and >system is hanging up .... >no response ............ Error is : invalid operand : 00000 > >Is the way i am following is correct or not ? >Can you please guide me , how to retrieve the data............from "sk_buff" >structure ...............? > >Please guide me in this .............. > >I am following the Linux Device Drivers book by oerilly .. by alessandro >rubini............ > >Thanks in advance........ >Regards,Ramki kvv. > >Hughes Software Systems _______________________________________________ mpls-linux-general mailing list mpl...@li... https://lists.sourceforge.net/lists/listinfo/mpls-linux-general |