MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sysctl_mld_ifinfo

Function sysctl_mld_ifinfo

freebsd/netinet6/mld6.c:363–422  ·  view source on GitHub ↗

* Expose struct mld_ifsoftc to userland, keyed by ifindex. * For use by ifmcstat(8). * * SMPng: NOTE: Does an unlocked ifindex space read. * VIMAGE: Assume curvnet set by caller. The node handler itself * is not directly virtualized. */

Source from the content-addressed store, hash-verified

361 * is not directly virtualized.
362 */
363static int
364sysctl_mld_ifinfo(SYSCTL_HANDLER_ARGS)
365{
366 int *name;
367 int error;
368 u_int namelen;
369 struct ifnet *ifp;
370 struct mld_ifsoftc *mli;
371
372 name = (int *)arg1;
373 namelen = arg2;
374
375 if (req->newptr != NULL)
376 return (EPERM);
377
378 if (namelen != 1)
379 return (EINVAL);
380
381 error = sysctl_wire_old_buffer(req, sizeof(struct mld_ifinfo));
382 if (error)
383 return (error);
384
385 IN6_MULTI_LOCK();
386 IN6_MULTI_LIST_LOCK();
387 MLD_LOCK();
388
389 if (name[0] <= 0 || name[0] > V_if_index) {
390 error = ENOENT;
391 goto out_locked;
392 }
393
394 error = ENOENT;
395
396 ifp = ifnet_byindex(name[0]);
397 if (ifp == NULL)
398 goto out_locked;
399
400 LIST_FOREACH(mli, &V_mli_head, mli_link) {
401 if (ifp == mli->mli_ifp) {
402 struct mld_ifinfo info;
403
404 info.mli_version = mli->mli_version;
405 info.mli_v1_timer = mli->mli_v1_timer;
406 info.mli_v2_timer = mli->mli_v2_timer;
407 info.mli_flags = mli->mli_flags;
408 info.mli_rv = mli->mli_rv;
409 info.mli_qi = mli->mli_qi;
410 info.mli_qri = mli->mli_qri;
411 info.mli_uri = mli->mli_uri;
412 error = SYSCTL_OUT(req, &info, sizeof(info));
413 break;
414 }
415 }
416
417out_locked:
418 MLD_UNLOCK();
419 IN6_MULTI_LIST_UNLOCK();
420 IN6_MULTI_UNLOCK();

Callers

nothing calls this directly

Calls 2

sysctl_wire_old_bufferFunction · 0.85
ifnet_byindexFunction · 0.85

Tested by

no test coverage detected