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
This commit is contained in:
parent
aac9c817af
commit
225eae1bb7
@ -3898,7 +3898,7 @@ iflib_if_transmit(if_t ifp, struct mbuf *m)
|
||||
if (__predict_false((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) {
|
||||
DBG_COUNTER_INC(tx_frees);
|
||||
m_freem(m);
|
||||
return (ENOBUFS);
|
||||
return (ENETDOWN);
|
||||
}
|
||||
|
||||
MPASS(m->m_nextpkt == NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user