NetBSD-Bugs archive

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

Re: kern/52469: ipf fails to return-rst (or panics) on a IPv6 link-local-address



The following reply was made to PR kern/52469; it has been noted by GNATS.

From: Edgar =?iso-8859-1?B?RnXf?= <ef%math.uni-bonn.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/52469: ipf fails to return-rst (or panics) on a IPv6
 link-local-address
Date: Mon, 7 Aug 2017 16:26:08 +0200

 On tech-net@, JINMEI, Tatuya suggested the following improvement:
 
 I suggest using utility functions defined in scope6.c instead of
 manually tweaking sin6_addr:
 
 > +    /* KAME */
 > +    if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
 > +        u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
 
 These two lines could (should) be:
 
     if ((error = in6_setscope(&u.dst6.sin6_addr, ifp,
         &u.dst6.sin6_scope_id)) != 0)
         goto bad;
     if ((error = sa6_embedscope(&u.dst6, 0)) != 0)
         goto bad;
 
 It tries to hide as many implementation details as possible, and also
 covers other types of IPv6 scoped addresses (in practice unicast
 link-local may be the only type you're interested in, but in principle
 you'd need to expect it could be, e.g., a scoped multicast address).
 


Home | Main Index | Thread Index | Old Index