svn commit: r270868 - head/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Sun Aug 31 06:23:55 UTC 2014


Author: glebius
Date: Sun Aug 31 06:23:54 2014
New Revision: 270868
URL: http://svnweb.freebsd.org/changeset/base/270868

Log:
  Remove ability to write to struct if_data residing in struct ifnet
  via net.link.generic.IFMIB_IFDATA.*.IFDATA_GENERAL sysctl. Reasons
  for removal are:
  - No code in tree uses this possibility.
  - The documentation ifmib(4) doesn't say that such possibility
    exist. The example provided in manual page only reads data.
  - On many interfaces the feature simply doesn't work, since they
    do accounting in hardware, and overwrite if_data on tick.
  
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/net/if_mib.c

Modified: head/sys/net/if_mib.c
==============================================================================
--- head/sys/net/if_mib.c	Sun Aug 31 04:56:34 2014	(r270867)
+++ head/sys/net/if_mib.c	Sun Aug 31 06:23:54 2014	(r270868)
@@ -109,27 +109,8 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XX
 		ifmd.ifmd_snd_drops = ifp->if_snd.ifq_drops;
 
 		error = SYSCTL_OUT(req, &ifmd, sizeof ifmd);
-		if (error || !req->newptr)
-			goto out;
-
-		error = SYSCTL_IN(req, &ifmd, sizeof ifmd);
 		if (error)
 			goto out;
-
-#define DONTCOPY(fld) ifmd.ifmd_data.ifi_##fld = ifp->if_data.ifi_##fld
-		DONTCOPY(type);
-		DONTCOPY(physical);
-		DONTCOPY(addrlen);
-		DONTCOPY(hdrlen);
-		DONTCOPY(mtu);
-		DONTCOPY(metric);
-		DONTCOPY(baudrate);
-#undef DONTCOPY
-#define COPY(fld) ifp->if_##fld = ifmd.ifmd_##fld
-		COPY(data);
-		ifp->if_snd.ifq_maxlen = ifmd.ifmd_snd_maxlen;
-		ifp->if_snd.ifq_drops = ifmd.ifmd_snd_drops;
-#undef COPY
 		break;
 
 	case IFDATA_LINKSPECIFIC:


More information about the svn-src-all mailing list