From 9daf71541cf685e41e90920c5c1c64ab3b5940d1 Mon Sep 17 00:00:00 2001 From: Pawel Biernacki Date: Sun, 21 Jun 2020 18:40:17 +0000 Subject: [PATCH] net.link.generic.ifdata..linkspecific: rework handler This OID was added in r17352 but the write path of IFDATA_LINKSPECIFIC seems unused as there are no in-base writers, and as far as I can tell we had issues with this code before, see PR 219472. Drop the write path to make the handler read-only as described in comments and man-pages. It can be marked as MPSAFE now. Reviewed by: bdragon, kib, melifaro, wollman Approved by: kib (mentor) Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D25348 --- sys/net/if_mib.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c index ff5e61029762..b2646ce4cb1b 100644 --- a/sys/net/if_mib.c +++ b/sys/net/if_mib.c @@ -122,10 +122,6 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */ error = SYSCTL_OUT(req, ifp->if_linkmib, ifp->if_linkmiblen); if (error || !req->newptr) goto out; - - error = SYSCTL_IN(req, ifp->if_linkmib, ifp->if_linkmiblen); - if (error) - goto out; break; case IFDATA_DRIVERNAME: @@ -152,6 +148,6 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */ } static SYSCTL_NODE(_net_link_generic, IFMIB_IFDATA, ifdata, - CTLFLAG_RW | CTLFLAG_NEEDGIANT, sysctl_ifdata, + CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ifdata, "Interface table");