FreeBSD/sys/netinet6/mld6.c
/*
 * 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.
 */
Expose struct mld_ifsoftc to userland, keyed by ifindex.

Does an unlocked ifindex space read.
VIMAGE: Assume curvnet set by caller. The node handler itself
is not directly virtualized.
Expose struct mld_ifsoftc to userland keyed by ifindex . Does an unlocked ifindex space read . VIMAGE : Assume curvnet set by caller . The node handler itself is not directly virtualized .
static int
sysctl_mld_ifinfo(SYSCTL_HANDLER_ARGS)
{
	int			*name;
	int			 error;
	u_int			 namelen;
	struct ifnet		*ifp;
	struct mld_ifsoftc	*mli;
	name = (int *)arg1;
	namelen = arg2;
	if (req->newptr != NULL)
		return (EPERM);
	if (namelen != 1)
		return (EINVAL);
	error = sysctl_wire_old_buffer(req, sizeof(struct mld_ifinfo));
	if (error)
		return (error);
	IN6_MULTI_LOCK();
	MLD_LOCK();
	if (name[0] <= 0 || name[0] > V_if_index) {
		error = ENOENT;
		goto out_locked;
	}
	error = ENOENT;
	ifp = ifnet_byindex(name[0]);
	if (ifp == NULL)
		goto out_locked;
	LIST_FOREACH(mli, &V_mli_head, mli_link) {
		if (ifp == mli->mli_ifp) {
			struct mld_ifinfo info;
			info.mli_version = mli->mli_version;
			info.mli_v1_timer = mli->mli_v1_timer;
			info.mli_v2_timer = mli->mli_v2_timer;
			info.mli_flags = mli->mli_flags;
			info.mli_rv = mli->mli_rv;
			info.mli_qi = mli->mli_qi;
			info.mli_qri = mli->mli_qri;
			info.mli_uri = mli->mli_uri;
			error = SYSCTL_OUT(req, &info, sizeof(info));
			break;
		}
	}
out_locked:
	MLD_UNLOCK();
	IN6_MULTI_UNLOCK();
	return (error);
}
static int sysctl_mld_ifinfo ( SYSCTL_HANDLER_ARGS ) { int * name ; int error ; u_int namelen ; struct ifnet * ifp ; struct mld_ifsoftc * mli ; name = ( int * ) arg1 ; namelen = arg2 ; if ( req -> newptr != NULL ) return ( EPERM ) ; if ( namelen != 1 ) return ( EINVAL ) ; error = sysctl_wire_old_buffer ( req , sizeof ( struct mld_ifinfo ) ) ; if ( error ) return ( error ) ; IN6_MULTI_LOCK ( ) ; MLD_LOCK ( ) ; if ( name [ 0 ] <= 0 || name [ 0 ] > V_if_index ) { error = ENOENT ; goto out_locked ; } error = ENOENT ; ifp = ifnet_byindex ( name [ 0 ] ) ; if ( ifp == NULL ) goto out_locked ; LIST_FOREACH ( mli , & V_mli_head , mli_link ) { if ( ifp == mli -> mli_ifp ) { struct mld_ifinfo info ; info . mli_version = mli -> mli_version ; info . mli_v1_timer = mli -> mli_v1_timer ; info . mli_v2_timer = mli -> mli_v2_timer ; info . mli_flags = mli -> mli_flags ; info . mli_rv = mli -> mli_rv ; info . mli_qi = mli -> mli_qi ; info . mli_qri = mli -> mli_qri ; info . mli_uri = mli -> mli_uri ; error = SYSCTL_OUT ( req , & info , sizeof ( info ) ) ; break ; } } out_locked : MLD_UNLOCK ( ) ; IN6_MULTI_UNLOCK ( ) ; return ( error ) ; }
Expose struct mld_ifsoftc to userland, keyed by ifindex.
Expose struct mld_ifsoftc to userland keyed by ifindex .