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.
This commit is contained in:
Gleb Smirnoff 2014-08-31 06:23:54 +00:00
parent 1ec2d237e0
commit 178b14d674
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270868

View File

@ -109,27 +109,8 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
ifmd.ifmd_snd_drops = ifp->if_snd.ifq_drops; ifmd.ifmd_snd_drops = ifp->if_snd.ifq_drops;
error = SYSCTL_OUT(req, &ifmd, sizeof ifmd); error = SYSCTL_OUT(req, &ifmd, sizeof ifmd);
if (error || !req->newptr)
goto out;
error = SYSCTL_IN(req, &ifmd, sizeof ifmd);
if (error) if (error)
goto out; 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; break;
case IFDATA_LINKSPECIFIC: case IFDATA_LINKSPECIFIC: