Re: prefixlen of IPv6 over PPP

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: prefixlen of IPv6 over PPP

by Nagae Hidetake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think it's time to move to tech-net.

From: Nagae Hidetake <nagae@...>
Subject: prefixlen of IPv6 over PPP
Date: Fri, 06 Nov 2009 08:08:11 +0900 (JST)

> My ISP provides IPv6 tunneling service over PPTP
> (Point to Point Tunneling Protocol).
> Supported platform of clients is Windows Vista.
> IPv6 address is assigned with Router Advertisement.
>
> I'm trying to use this service with NetBSD/i386 5.0.1.
> PPTP tunnel is successfully opened with pkgsrc/net/pptp as below.
> (ppp1 is a PPTP tunnel)
>
> ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
>         inet aaa.aaa.aaa.aaa -> bbb.bbb.bbb.bbb netmask 0xffffff00
>         inet6 fe80::xxxxx:xxxx:xxxx:xxxx%ppp0 ->  prefixlen 64 scopeid 0x5
> ppp1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
>         inet6 fe80::yyyy:yyyy:yyyy:yyyy%ppp1 -> fe80::zzzz:zzzz:zzzz:zzzz prefixlen 128 scopeid 0x6
>
> Next, I call rtsol command and the router returns rtadv.
> But my NetBSD box ignores it.
> It seems going into the path 'in6_ifadd: wrong prefixlen for %s'
> of src/sys/netinet6/nd6_rtr.c.
>
> I guess that the problem is prefixlen of ppp1.
> All 128 bits of link-local address are prefix.
> On the other hand, prefixlen of IPv6 over PPP looks like set always
> 128 in 'sif6addr' of src/usr.sbin/pppd/pppd/sys-bsd.c.
I attached a patch to src/usr.sbin/pppd/pppd/sys-bsd.c.
It makes pppd not to set destination address and set prefixlen 64.
Setting destination address with prefix 64 is rejected by
in6_update_ifa1 defined in src/sys/netinet6/in6.c.
PPTP connection with this patch accepts prefix advertised through RA.

I think this is the way pppoe handles IPv6 Link-Local address.
Is this a correct solution?

--
Nagae Hidetake nagae@...
                        http://www.eagan.jp/nagae/

*** src/usr.sbin/pppd/pppd/sys-bsd.c_orig 2009-06-20 20:07:55.000000000 +0900
--- src/usr.sbin/pppd/pppd/sys-bsd.c 2009-11-08 11:24:56.000000000 +0900
***************
*** 758,763 ****
--- 758,764 ----
      *(u_int16_t *)&addreq6.ifra_addr.sin6_addr.s6_addr[2] = htons(ifindex);
 
      /* his addr */
+ #if 0
      addreq6.ifra_dstaddr.sin6_family = AF_INET6;
      addreq6.ifra_dstaddr.sin6_len = sizeof(struct sockaddr_in6);
      addreq6.ifra_dstaddr.sin6_addr.s6_addr[0] = 0xfe;
***************
*** 766,777 ****
  sizeof(our_eui64));
      /* KAME ifindex hack */
      *(u_int16_t *)&addreq6.ifra_dstaddr.sin6_addr.s6_addr[2] = htons(ifindex);
 
      /* prefix mask: 128bit */
      addreq6.ifra_prefixmask.sin6_family = AF_INET6;
      addreq6.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6);
      memset(&addreq6.ifra_prefixmask.sin6_addr, 0xff,
! sizeof(addreq6.ifra_prefixmask.sin6_addr));
 
      /* address lifetime (infty) */
      addreq6.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
--- 767,781 ----
  sizeof(our_eui64));
      /* KAME ifindex hack */
      *(u_int16_t *)&addreq6.ifra_dstaddr.sin6_addr.s6_addr[2] = htons(ifindex);
+ #endif
 
      /* prefix mask: 128bit */
      addreq6.ifra_prefixmask.sin6_family = AF_INET6;
      addreq6.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6);
      memset(&addreq6.ifra_prefixmask.sin6_addr, 0xff,
! sizeof(addreq6.ifra_prefixmask.sin6_addr)-sizeof(our_eui64));
!     memset(&addreq6.ifra_prefixmask.sin6_addr+sizeof(our_eui64), 0x00,
! sizeof(our_eui64));
 
      /* address lifetime (infty) */
      addreq6.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;

Parent Message unknown Re: prefixlen of IPv6 over PPP

by Nagae Hidetake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: christos@... (Christos Zoulas)
Subject: Re: prefixlen of IPv6 over PPP
Date: Tue, 10 Nov 2009 22:15:04 +0000 (UTC)
http://mail-index.netbsd.org/current-users/2009/11/10/msg011139.html

> In article <20091108.114051.241895082.nagae@...>,
> Nagae Hidetake  <nagae@...> wrote:

>>I attached a patch to src/usr.sbin/pppd/pppd/sys-bsd.c.
>>It makes pppd not to set destination address and set prefixlen 64.
>>Setting destination address with prefix 64 is rejected by
>>in6_update_ifa1 defined in src/sys/netinet6/in6.c.
>>PPTP connection with this patch accepts prefix advertised through RA.
>>
>>I think this is the way pppoe handles IPv6 Link-Local address.
>>Is this a correct solution?

> Does this patch work for you? Linux uses a 10 bit prefixlen...

Thank you. Your patch also works fine in my environment.
Here is the output of ifconfig.

ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
        inet XXX.XXX.XXX.XXX -> YYY.YYY.YYY.YYY netmask 0xffffff00
        inet6 fe80::216:d3ff:fe38:ba9d%ppp0 ->  prefixlen 64 scopeid 0x5
ppp1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1280
        inet6 fe80::ccfb:86b3:7b75:9470%ppp1 ->  prefixlen 64 scopeid 0x6
        inet6 2001:240:bb8a:d9:ccfb:86b3:7b75:9470 ->  prefixlen 64

> - sizeof(addreq6.ifra_prefixmask.sin6_addr));
> + sizeof(addreq6.ifra_prefixmask.sin6_addr) - sizeof(our_eui64));
> +    memset(&addreq6.ifra_prefixmask.sin6_addr+sizeof(our_eui64), 0x00,
> + sizeof(our_eui64));

More strictly, start address of the second memset shoud be
&addreq6.ifra_prefixmask.sin6_addr+sizeof(struct sockaddr_in6)-sizeof(our_euc64)


# 10 bit prefixlen!?  It's interesting...

--
Nagae Hidetake nagae@...
                        http://www.eagan.jp/nagae/