Networking Forums

Networking Forums > Computer Networking > Linux Networking > How build ip packet with my own ethernet header

Reply
Thread Tools Display Modes

How build ip packet with my own ethernet header

 
 
step
Guest
Posts: n/a

 
      12-04-2007, 05:47 AM
hi
i can get the ip package buffer through libpacp or SOCK_RAW , now i
want to build a package with my own ethernet header.
i try this$B!$(Bbut it seems don't work

int scok=scoket(PF_INET,SCOK_RAW,IPPROTO_TCP);
char buf[4096];

strcut ethhdr *ethh=(struct ethhdr *)buf;
struct iphdr *iph=(struct iphdr *)(buf+sizeof(struct ethhdr);
struct tcphdr *tcph=(struct tcphdr *)(buf+ sizeof(struct ethhdr)
+sizeof(struct iphdr));

then set the data for above three struct.

use sendto function to send the buf.

but it seems don't work. how can i do so i can build a package with
my own ethernet header.

or if i recv a package, i change the ethernet header , how can i send
this package.
thanks very much!!!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hardware Gurus: How-to build passive Ethernet Hub? bobb Windows Networking 1 02-11-2006 07:20 PM
linux cooked header to ethernet header conversion makwak Linux Networking 0 05-10-2005 12:36 PM
how many packet types can travel on Ethernet network? linux.lover Linux Networking 2 01-23-2005 10:33 PM
Can I send out an ethernet packet with over 1500 bytes in linux ? Hans Yin Linux Networking 4 12-21-2004 07:19 AM
packet loss ratio of ethernet ronghuazhang@gmail.com Windows Networking 1 11-23-2004 05:01 AM



1 2 3 4 5 6 7 8 9 10 11