Page MenuHomeFreeBSD

Add SIOCGIFDOWNREASON
ClosedPublic

Authored by kib on Sep 4 2019, 8:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 12:28 AM
Unknown Object (File)
Wed, Nov 6, 3:12 PM
Unknown Object (File)
Sun, Nov 3, 7:48 PM
Unknown Object (File)
Oct 4 2024, 11:01 AM
Unknown Object (File)
Sep 27 2024, 9:26 AM
Unknown Object (File)
Sep 21 2024, 4:59 AM
Unknown Object (File)
Sep 18 2024, 3:18 PM
Unknown Object (File)
Sep 12 2024, 8:59 AM

Details

Summary

The ioctl(2) intended to provide more details about the cause of the down for the link.

Eventually we might define a comprehensive list of codes for the situations. But interface also allows the driver to provide free-form null-terminated ASCII string to provide arbitrary non-formalized information. Sample implementation exists for mlx5(4), where the string is fetched from firmware controlling the port.

Currently, the interface is only utilized by ifconfig(8) to provide the hint to user, if available.

Sample output:

# ifconfig mce0
mce0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=3ed07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6,TXRTLMT,HWRXTSTMP>
        ether e4:1d:2d:e7:10:0a
        media: Ethernet autoselect <full-duplex,rxpause,txpause>
        status: no carrier (Negotiation failure)
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

What about translation of text messages? Should we use an enum for this? Or provide both?

What about translation of text messages? Should we use an enum for this? Or provide both?

Translations are not planned, the string that comes from kernel typically is provided by hardware (firmware). I added some way to extend the interface in more automation-friendly way in the next revision.

Make the IFDOWNREASON interface capable of returning standard numeric reasons, but not define any yet.
Add vendor-specific escape.

sbin/ifconfig/ifmedia.c
193 ↗(On Diff #61829)

Should there be some filter or forced zero at on ifdr_msg ?

ifdr_msg[sizeof(ifdr_msg) - 1] = 0 ??

sbin/ifconfig/ifmedia.c
193 ↗(On Diff #61829)

Kernel must zero-terminate the string. Why would utility not trust the kernel ?

sbin/ifconfig/ifmedia.c
193 ↗(On Diff #61829)

OK, but what about non-printable characters? Is the kernel responsible to filter this? I don't trust hardware/firmware to provide correct strings :-)

sbin/ifconfig/ifmedia.c
193 ↗(On Diff #61829)

I am not sure, and I think it is premature to do anything about it until there is a driver that does emit something non-printable.

Even then, I think this is a problem of the driver, and not kernel/ifconfig.

kib edited the summary of this revision. (Show Details)

Sometimes I suffer from being unable to bring the interface to "administratively shutdown" state as opposed to "operative shutdown". It would be nice if ifconfig(8) "down" was able to update status of the interface with "admindown" string or similar, and "up" was able to auto-remove such note.

Such information can be useful for code responsible for recovering procedures trying to reset a driver or synthetic tunnel-like interface to differentiate faulty or disabled interfaces.

I mean, there may be different sources of such information and not only firmware/driver.

This revision is now accepted and ready to land.Sep 17 2019, 12:59 PM
This revision was automatically updated to reflect the committed changes.