From 178b14d674d5db9f9df9572a80e3f5f5c11221e2 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Sun, 31 Aug 2014 06:23:54 +0000 Subject: [PATCH] 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. --- sys/net/if_mib.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c index aa6e6e5acb74..875c646bbd35 100644 --- a/sys/net/if_mib.c +++ b/sys/net/if_mib.c @@ -109,27 +109,8 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */ 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: