LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-02-2006, 10:58 AM   #1
shrishailnk
Member
 
Registered: Mar 2006
Posts: 47

Rep: Reputation: 15
eternet header....


hello all,

I need to add the ethernet header to the newly allocated sk_buff ,insted of copying whole ethernet
header , i need to copy the individual fields to sk_buff ( ie dst mac ,src mac ,proto)...

can anyone please tell me is the code below ,can realise the above idea....

unsigned char dmac[6]; all these have the respectiv
unsigned char smac[6]; values...
unsigned int type;

new_skb = alloc_skb(size+16 , GFP_ATOMIC);

should i allocate 16 or 14 for eth hdr...

skb_reserve(new_skb , 16);
memcpy(new_skb->data-16 , dmac , 6);
memcpy(new_skb->data-10 , smac , 6);
memcpy(new_skb->data-4 , type ,2);
skb_push(new_skb , 16);

will the above lines work?
one more doubt...
Is it necessary to use only ptrs in the memcpy arguments ... (say i have "int a" ,can i just copy it or do i have to convert it to a ptr...)

waiting for response..
thanks in advance...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
2.6.15 Header? b0rgri0t Slackware 23 01-22-2006 12:25 PM
eternet digdug4life Linux - Hardware 3 10-11-2005 01:39 AM
c header files in linux in place of header files in windows? harun_acs Programming 1 03-17-2004 02:24 AM
Qt header not found xprometeus Linux - Software 5 07-19-2003 01:51 PM
qt header problems... PLEASE HELP ciphercam Linux - Software 7 06-30-2003 06:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration