tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: in_pcbsetport(), in6_pcbsetport()



On Wed, Apr 29, 2009 at 09:09:11PM +0300, Elad Efrat wrote:
> On Wed, Apr 29, 2009 at 8:54 PM, Manuel Bouyer 
> <bouyer%antioche.eu.org@localhost> wrote:
> 
> > It looks like in udp6_output.c you're going to change in6_any.sin6_addr,
> > I can't see how this can be right (if pr_domain is const there's probably
> > a reason :). You should copy the content to a local sockaddr_in6 instead.
> >
> > BTW, you did a similar change to the netinet/ code, with a UNCONST here too.
> > While it may be safe here (it seems you're not writing to the pointer),
> > it would be better to not use UNCONST() here and make the pointer's
> > copy const instead.
> 
> Good catch! :)
> 
> Would something like the following be okay?
> 
>     struct sockaddr_in6 lsin6 =
>         *((struct sockaddr_in6
> *)__UNCONST(in6p->in6p_socket->so_proto->pr_domain->dom_sa_any));
>     lsin6.sin6_addr = *laddr;

Why do you still need the __UNCONST here ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index