Feature #9779
Add type information to network interfaces
| Status: | Needs Decision | Start date: | 09/28/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | library | |||
| Target version: | - | |||
| Keywords: | network
interface wireless |
Affected Facter version: | 1.6.1 | |
| Branch: | ||||
| Votes: | 0 |
Description
In particular I would like to know whether and interface is a wireless interface or not.
History
Updated by Ken Barber 8 months ago
- Status changed from Unreviewed to Needs Decision
- Affected Facter version set to 1.6.1
So the question is how you would work this out. What would be the canonical way of doing it? I can envision perhaps working it out by the short name of the interface … but this can be overridden in some cases. You can back track through lsmod perhaps on linux …
Also – how detailed should this be? What sort of information would you want from wired ethernet devices for example?
Bridges can be named just about anything and would require digging to work out the type as well … perhaps btctl show would be a good way of working this out.
If you can outline some use cases for what you would do when you get this information that might be helpful.
Updated by Orion Poplawski 8 months ago
At least on Linux, wireless devices appear to have a wireless subdirectory in /sys/class/net/
After thinking further on my use case, I’m not sure it is completely necessary. My goal is to setup a /etc/dhcp/dhclient-
send dhcp-client-identifier “
which allows our dhcp server to assign the same address for the wireless interface as the ethernet interface. After thinking further about it, it actually wouldn’t be a problem to create a dhclient.conf file for each of the interfaces even though it isn’t strictly necessary.
Updated by Ken Barber 8 months ago
So I can see ‘DEVTYPE’ in the uevent – but only really bridges show this (from linux 2.6.39):
# grep 'DEVTYPE' */uevent
virbr0/uevent:DEVTYPE=bridge
virbr1/uevent:DEVTYPE=bridge
We need to get hold of a box with wifi to see what it shows. If you have time I’d love to see what your wifi interfaces show as a guide.
I noticed it doesn’t distinguish interfaces such as ‘vnet’ as virtual interfaces from say physical interfaces (‘ethX’).
Updated by Orion Poplawski 8 months ago
Wired:
# cat em1/uevent
INTERFACE=em1
IFINDEX=3
Wireless:
# cat p1p1/uevent
DEVTYPE=wlan
INTERFACE=p1p1
IFINDEX=4
I also have an irda0 interface for infrared. Looking at some distinguishing characteristics:
# cat {em1,irda0,lo,p1p1}/type
1
783
772
1
No idea where these numbers come from.
uevent is the same:
# cat irda0/uevent
INTERFACE=irda0
IFINDEX=2
The address and addr_len are different too. Not sure how useful that is.
Updated by Krzysztof Wilczynski 6 months ago
Hello,
This is an interesting problem, and I think… I know how to tackle it a little :–)
At least for wireless interfaces vs anything else (eth, ppp, tun, tap, pan, etc), simply because Linux supports quite a few device drivers and each have its way of naming the interface, therefore identifying all of them may take some time :–)
Also, we assume that driver supports Wireless Extensions (a clue here) correctly — we do not have the luxury of calling iw_get_basic_config() and then looking for EOPNOTSUPP in errno when ioctl call will be denied for us to identify anything wireless, therefore we have to use what Kernel is providing for us mortals in mere user-space :–)
KW