You are not logged in.
Pages: 1
Hello *,
I would like to know where ethtool gets it's information on the modes (10baseT Full etc) that an interface supports.
I can always use grep in my script but was just wondering if there is maybe something in /sys that could provice that info to me (already searched there though). And human readable seems less error-prone to me.
Thanks in advance!
Offline
ethtool uses system calls to get information from the kernel - it looks like this is done with functions defined in /usr/include/net/if.h.
If you want to do this in a compiled program, that should do it. But it sounds like you just want to do this from a script, so that wouldn't work.
You say you use grep - what exactly do you grep? I suspect the output of `ip` might be most useful.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Currently I grep for something like this:
ethtool $i | egrep -q "10(0(0)?)?baseT/Full"
What I need to know is that the card is not a 10G (or more) and that it is not a virtio interface. Currently that handles the situation but I was wondering if there is something cleaner.
For 10G links I could grep for
Supported ports: [ FIBRE ]
but then, virtio interfaces return nothing at all with ethtool.
I'm not really sure how to do this with ip. By the way, I am more interested in the available link modes than the currently negotiated mode.
Thanks
Offline
I stand corrected, I don't know if ip can provided those details. I thought you were looking for alternatives to ethtool which I'm not familiar with aside from a quick glance at the code.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1