(racoon2 44) Re: zero scope ID in link-local addresses

Francis Dupont <[email protected]> Thu, 08 Dec 2005 11:32:33 +0100
Newsgroups gmane.network.ipv6.kame.racoon
Message-ID <[email protected]>
 In your previous mail you wrote:

   > In lib/rc_net.c getifaddrlist() the #ifdef __KAME__ is incorrect:
   > this bug was fixed years ago.
   
   s/years/months/?
   It seems that the fix doesn't have merged into *BSD yet.

=> I use not very old snapshots...

   Is the following change ok for you?
   
=> yes, in doubt to protect the scope_id is a good idea.
   
   Index: lib/rc_net.c
   ===================================================================
   RCS file: /cvs/racoon2/racoon2/lib/rc_net.c,v
   retrieving revision 1.41
   diff -u -r1.41 rc_net.c
   --- lib/rc_net.c	29 Sep 2005 09:41:08 -0000	1.41
   +++ lib/rc_net.c	8 Dec 2005 00:36:28 -0000
   @@ -395,10 +395,13 @@
    #ifdef __KAME__
    			if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) ||
    			    IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) {
   -				sin6->sin6_scope_id =
   -				    ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2])
  ;
   -				sin6->sin6_addr.s6_addr[2] = 0;
   -				sin6->sin6_addr.s6_addr[3] = 0;
   +				int scope_id =
   +				    *(u_int16_t *)&sin6->sin6_addr.s6_addr[2];
   +				if (scope_id != 0) {
   +					sin6->sin6_scope_id = ntohs(scope_id);
   +					sin6->sin6_addr.s6_addr[2] = 0;
   +					sin6->sin6_addr.s6_addr[3] = 0;
   +				}
    			}
    #endif
    #ifdef HAVE_GETIFADDRS_LL_SIN6_SCOPE_ID_BUG
   
Can you warn me when the fix will be commited?

Thanks

[email protected]