Question

I am creating an ethernet frame sniffing/forwarding program on a Linux machine that I will use to sniff the frames being transmitted from a computer to ethernet and vice-versa.

I am trying to activate pause frames so that I will not lose any packets, since having a two-step transmission to the router may cause some delay.

The only way I have found to do this is by using ethtool to, for example, turn on pause frames from a receiving end:

ethtool -A eth0 rx on

I have doubts about this which I hope an ethtool expert may put at ease, however.

An option that's available using "ethtool -A" is turning autonegotiation on or off. As far as I know, autonegotiation has little to do with pause frames. Also, the lack of options available with ethtool regarding pause frames is a bit disconcerting. For example, managing the pause time requested by the frame sender is not an option with ethtool.

So, is ethtool really the best, or only way to configure pause frames? Ideally, I would like to configure them through C code, but if ethtool is the only way to do so, I'd simply like some confirmation that I am doing the correct thing by configuring pause frames with ethtool.

And if someone could point me in the right direction of a way to configure pause frames in C, I would be even more grateful.

Thank you.

Was it helpful?

Solution

Why do you want to reinvent the wheel? Why not use for example libpcap or netfilter hooks to intercept the packets?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top