nff-go icon indicating copy to clipboard operation
nff-go copied to clipboard

How to send packet to raw socket device?

Open mkfsn opened this issue 5 years ago • 4 comments

Hi, thanks for introducing the raw socket, it's a very cool feature! :)

I'm now trying to use the raw socket but having a problem that I couldn't find a way to send packets to that device.

Before I was using SetReceiver and SetSender for dpdk devices, and then I'm able to send a new packet to that port, for example:

pkt, _ := packet.NewPacket()
packet.GeneratePacketFromByte(pkt, []byte(data))
pkt.SendPacket(port)

But I suppose if I use raw socket I don't have the port, so how can I send a new generate packet to the device?

mkfsn avatar Apr 26 '19 07:04 mkfsn

SetReceiverOS, SetSenderOS. Example is here https://github.com/intel-go/nff-go/blob/master/examples/OSforwarding.go

aregm avatar Apr 26 '19 15:04 aregm

Now we don't have a functionality for sending packet directly without flow graph to Raw socket.

You can use SetGenerator->SetSenderOS for lots of packets, however if you would like to send individual packets directly from Flow Functions we will need to add this functionality.

Do you want us to add this functionality?

ifilippov avatar Apr 26 '19 19:04 ifilippov

@ifilippov that sounds good to us, we'll try to use the SetGenerator

guesslin avatar May 02 '19 06:05 guesslin

Hi, I would like to see an equivalent of SendPacket() but directed at non-Ports, ie OS, XDP etc. Did that project get kicked off at all? Currently, without it, it isn't possible to 'seamlessly' swap between DPDK ports, OS and other types of interfaces as, for example, whilst the ARP and ICMP functions can send one-off packets to a port it's not possible to do so to an AF_PACKET interface as it currently stands.
Thanks

vulcanfan avatar Mar 23 '21 14:03 vulcanfan