Subject: Re: IP_RECVIF addition
To: Bill Fenner <fenner@parc.xerox.com>
From: Dennis Ferguson <dennis@jnx.com>
List: tech-net
Date: 10/20/1996 14:16:34
I think this is a good idea, and done just about right. The only bit of
implementation that bugs me a little is:
> + if (inp->inp_flags & INP_RECVIF) {
> + struct sockaddr_dl sdl;
> +
> + sdl.sdl_len = sizeof(sdl);
> + sdl.sdl_family = AF_LINK;
> + sdl.sdl_index = m->m_pkthdr.rcvif ?
> + m->m_pkthdr.rcvif->if_index : 0;
> + sdl.sdl_nlen = sdl.sdl_alen = sdl.sdl_slen = 0;
> + *mp = sbcreatecontrol((caddr_t) &sdl, sdl.sdl_len,
> + IP_RECVIF, IPPROTO_IP);
> + if (*mp)
> + mp = &(*mp)->m_next;
> + }
It seems unhappy to be copying in 20 bytes of a mostly-stack-grot-filled
sockaddr_dl to carry a two byte interface index. Maybe the sockaddr
could be pruned at four or eight bytes?
Dennis Ferguson