Ethereal-users: [Ethereal-users] writing packets help!

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "vinaya muralidharan" <vinnie_m1@xxxxxxxxxxxxxx>
Date: 3 Mar 2002 11:09:53 -0000
Hi,
I am currently working on the software implementation of a LAN switch. What we have here is a multihomed PC with the NICs connected to different logical segments. When a workstation on one logical segment wishes to communicate with a workstation on another segment, it sends a packet to the corresponding machine. The NICs on the switch are in promisc mode so they intercept all packets. They do so by using sock_raw and recvfrom (in linux). Now we need to put these packets on the right interface and forward them to the destination machine. The problems are these: I have a sniffer program on 1 machine(uses sock_raw), using sendto I try to send some packets to this machine. The output says that the packet was transferred, but the sniffer code does not show the packet! Could someone please tell me how to write packets at the data link layer with the original source address intact(we send the packets using our switch, but source address should not change)?

Also if you could mail me some sample code, it'll be splendid!
Thanx for the help,
Vinaya Muralidharan.