sysctl_rdstruct() does all the checking for read only sysctls.
Simplify the code a bit.
--
:wq Claudio
Index: netinet/ip_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.244
diff -u -p -r1.244 ip_input.c
--- netinet/ip_input.c 12 Jan 2015 13:51:45 -0000 1.244
+++ netinet/ip_input.c 12 Jan 2015 21:53:37 -0000
@@ -1620,15 +1620,11 @@ ip_sysctl(int *name, u_int namelen, void
return (sysctl_ifq(name + 1, namelen - 1,
oldp, oldlenp, newp, newlen, &ipintrq));
case IPCTL_STATS:
- if (newp != NULL)
- return (EPERM);
- return (sysctl_struct(oldp, oldlenp, newp, newlen,
+ return (sysctl_rdstruct(oldp, oldlenp, newp,
&ipstat, sizeof(ipstat)));
case IPCTL_MRTSTATS:
#ifdef MROUTING
- if (newp != NULL)
- return (EPERM);
- return (sysctl_struct(oldp, oldlenp, newp, newlen,
+ return (sysctl_rdstruct(oldp, oldlenp, newp,
&mrtstat, sizeof(mrtstat)));
#else
return (EOPNOTSUPP);