Subject: Re: drvspec ioctl question
To: Andrew Brown <atatat@atatdot.net>
From: Kyunghwan Kim <redjade@ada.snu.ac.kr>
List: tech-net
Date: 10/22/2001 23:17:44
On Mon, Oct 22, 2001 at 09:14:45AM -0400, Andrew Brown wrote:
> SIOCSDRVSPEC is handled by the default case which calls
>
> error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
> (struct mbuf *)cmd, (struct mbuf *)data,
> (struct mbuf *)ifp, p));
>
> where pr_usrreq(), in a call to manipulate a bridge device, will be a
> udp socket, that means udp_usrreq() in netinet/udp_usrreq.c, which
> does this:
>
> if (req == PRU_CONTROL)
> return (in_control(so, (long)m, (caddr_t)nam,
> (struct ifnet *)control, p));
Oh, I see. That's why ioctl is associated with socket file
descriptor which is SOCK_DGRAM type.
> in_control() in netinet/in.c has a default case near the bottom of a
> long switch that does this:
>
> error = (*ifp->if_ioctl)(ifp, cmd, data);
>
> and that's how bridge_ioctl() gets called.
Thank you for clarification.
Regards,
Kyunghwan Kim
redjade@ada.snu.ac.kr