Ethereal-users: [Ethereal-users] Can't use sendto with raw sockets!

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

From: "Shweta Prafulla Bagade" <spbagade@xxxxxxxxxxxxxx>
Date: 28 Feb 2002 05:09:51 -0000
Sirs,
We are a group of three students working on a project which is the software implementation of a LAN switch. We are working with sockets in Linux(sock_packet). what we basically wish to achieve is to be able to switch between two logical segments using our code. We have a multihomed PC with the NICs connected to different logical segments. What we have achieved so far is capturing packets on the network by putting our card in promisc mode and storing the destination IP addresses in some buffer. We have made a decision about the NIC which should forward the packet to the destination workstation. We are trying to use sendto to send the packet to the destination workstation but the problem is that with sockaddr structure we can't specify destination address. Instead if we use the structure sockaddr_in(the destination address can be specified) the Interface such as eth0 cannot be specified. Please help us out as to why sendto does not work this way. If there is another way to get the sending of packet done please let us know!
Thankx in advance,
Shweta Bagade & group.