Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:00 -0000
From:      Eric Joyner <erj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345658 - head/sys/net
Message-ID:  <201903282046.x2SKkjQZ085450@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: erj
Date: Thu Mar 28 20:46:45 2019
New Revision: 345658
URL: https://svnweb.freebsd.org/changeset/base/345658

Log:
  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

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Mar 28 20:43:47 2019	(r345657)
+++ head/sys/net/iflib.c	Thu Mar 28 20:46:45 2019	(r345658)
@@ -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);





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903282046.x2SKkjQZ085450>