Re: nd6_ioctl: Use local variable for consistency

2022-11-10 Thread Alexander Bluhm
On Thu, Nov 10, 2022 at 02:56:00PM +, Klemens Nanni wrote:
> No point in using the variable for half of the check.
> 
> OK?

OK bluhm@

> diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
> index e65eeb0c2ac..d88969be617 100644
> --- a/sys/netinet6/nd6.c
> +++ b/sys/netinet6/nd6.c
> @@ -1025,24 +1025,24 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
>   case SIOCGNBRINFO_IN6:
>   {
>   struct llinfo_nd6 *ln;
>   struct in6_addr nb_addr = nbi->addr; /* make local for safety */
>   time_t expire;
>  
>   NET_LOCK_SHARED();
>   /*
>* XXX: KAME specific hack for scoped addresses
>*  : for other scopes than link-local?
>*/
> - if (IN6_IS_ADDR_LINKLOCAL(&nbi->addr) ||
> - IN6_IS_ADDR_MC_LINKLOCAL(&nbi->addr)) {
> + if (IN6_IS_ADDR_LINKLOCAL(&nb_addr) ||
> + IN6_IS_ADDR_MC_LINKLOCAL(&nb_addr)) {
>   u_int16_t *idp = (u_int16_t *)&nb_addr.s6_addr[2];
>  
>   if (*idp == 0)
>   *idp = htons(ifp->if_index);
>   }
>  
>   rt = nd6_lookup(&nb_addr, 0, ifp, ifp->if_rdomain);
>   if (rt == NULL ||
>   (ln = (struct llinfo_nd6 *)rt->rt_llinfo) == NULL) {
>   rtfree(rt);
>   NET_UNLOCK_SHARED();



nd6_ioctl: Use local variable for consistency

2022-11-10 Thread Klemens Nanni
No point in using the variable for half of the check.

OK?

diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index e65eeb0c2ac..d88969be617 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1025,24 +1025,24 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
case SIOCGNBRINFO_IN6:
{
struct llinfo_nd6 *ln;
struct in6_addr nb_addr = nbi->addr; /* make local for safety */
time_t expire;
 
NET_LOCK_SHARED();
/*
 * XXX: KAME specific hack for scoped addresses
 *  : for other scopes than link-local?
 */
-   if (IN6_IS_ADDR_LINKLOCAL(&nbi->addr) ||
-   IN6_IS_ADDR_MC_LINKLOCAL(&nbi->addr)) {
+   if (IN6_IS_ADDR_LINKLOCAL(&nb_addr) ||
+   IN6_IS_ADDR_MC_LINKLOCAL(&nb_addr)) {
u_int16_t *idp = (u_int16_t *)&nb_addr.s6_addr[2];
 
if (*idp == 0)
*idp = htons(ifp->if_index);
}
 
rt = nd6_lookup(&nb_addr, 0, ifp, ifp->if_rdomain);
if (rt == NULL ||
(ln = (struct llinfo_nd6 *)rt->rt_llinfo) == NULL) {
rtfree(rt);
NET_UNLOCK_SHARED();