Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send packet to raw socket device? #599

Open
mkfsn opened this issue Apr 26, 2019 · 4 comments
Open

How to send packet to raw socket device? #599

mkfsn opened this issue Apr 26, 2019 · 4 comments

Comments

@mkfsn
Copy link
Contributor

mkfsn commented Apr 26, 2019

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?

@aregm
Copy link
Owner

aregm commented Apr 26, 2019

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

@ifilippov
Copy link
Contributor

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?

@guesslin
Copy link
Contributor

guesslin commented May 2, 2019

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

@vulcanfan
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants