On Sun, May 03 2020, Alexandr Nedvedicky <alexandr.nedvedi...@oracle.com> wrote:
> Hello,

Hi Sashan,

> the question has popped up while on recent code review of some Solaris 
> specific
> bug fixes: do we still need a code in diff below or is it OK to proceed
> and commit the diff?
>
> The chunk below uses bytes 2 and 3 to derive a scope of link local address.  
> It
> seems to me those bytes/octets are always zero in IPv6 link scope addresses
> these days, unless I'm missing something.  I was not able to identify its
> counter part in current kernel, which would make octets 2 & 3 non-zero, so it
> makes me thinking it should be OK to remove the whole chunk below.

See in6_embedscope and in6_recoverscope, IN6_IS_SCOPE_EMBED etc.  Dunno
about this specific piece of code in pfctl, but the "kame hack" is still
here and you really want to double check before removing such chunks in
userland.

>
> thanks and
> regards
> sashan
>
> note __KAME__ is defined, the chunk below is getting compiled currently.
>
> --------8<---------------8<---------------8<------------------8<--------
> diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
> index cef0aa2474f..24175de046c 100644
> --- a/sbin/pfctl/pfctl_parser.c
> +++ b/sbin/pfctl/pfctl_parser.c
> @@ -1361,21 +1361,6 @@ ifa_load(void)
>                       err(1, "%s: calloc", __func__);
>               n->af = ifa->ifa_addr->sa_family;
>               n->ifa_flags = ifa->ifa_flags;
> -#ifdef __KAME__
> -             if (n->af == AF_INET6 &&
> -                 IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)
> -                 ifa->ifa_addr)->sin6_addr) &&
> -                 ((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_scope_id ==
> -                 0) {
> -                     struct sockaddr_in6     *sin6;
> -
> -                     sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
> -                     sin6->sin6_scope_id = sin6->sin6_addr.s6_addr[2] << 8 |
> -                         sin6->sin6_addr.s6_addr[3];
> -                     sin6->sin6_addr.s6_addr[2] = 0;
> -                     sin6->sin6_addr.s6_addr[3] = 0;
> -             }
> -#endif
>               n->ifindex = 0;
>               if (n->af == AF_LINK)
>                       n->ifindex = ((struct sockaddr_dl *)
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to