]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
iflib: return ENETDOWN when the network device is down
authorerj <erj@FreeBSD.org>
Thu, 28 Mar 2019 20:46:45 +0000 (20:46 +0000)
committererj <erj@FreeBSD.org>
Thu, 28 Mar 2019 20:46:45 +0000 (20:46 +0000)
commitf501e29bc974ab7d57ea41245ecb63e365bf9752
treeabf59b810dd2d25044843c20482d3e6f55137c59
parent3290e27ba6e547ca8b644442e049926fcae242ae
iflib: return ENETDOWN when the network device is down

From Jake:
iflib_if_transmit returns ENOBUFS when the device is down, or when the
link isn't active.

This was changed in r308792 from return (0), so that the function
correctly reports an error that it was unable to transmit.

However, using ENOBUFS can cause some network applications to produce
the following or similar errors:

"ping: sendto: No buffer space available"

This is a bit confusing as the real cause of the issue is that the
network device is down.

Replace the ENOBUFS return with ENETDOWN to indicate more clearly that
the reason for the failure to send is due to the network device is
offline.

This will cause the error message to be reported as

"ping: sendto: Network is down"

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@, sbruno@, bz@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19652
sys/net/iflib.c