Subject: kern/29790: POINTTOPOINT IPv6 prefixlen inconsistency
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Chris Ross <cross+netbsd@distal.com>
List: netbsd-bugs
Date: 03/25/2005 06:58:00
>Number:         29790
>Category:       kern
>Synopsis:       P2P interfaces act differently w.r.t. mask (IPv4 vs. IPv6)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 25 06:58:00 +0000 2005
>Originator:     Chris Ross
>Release:        NetBSD 2.0.2
>Organization:
>Environment:
System: NetBSD borderguard.distal.com 2.0.2 NetBSD 2.0.2 (ROUTER.MP) #0: Fri Mar 25 00:35:52 EST 2005 cross@skaro.distal.com:/data/obj/NetBSD-2.0.2.i386/data/NetBSD-2.0/src-2.0.2/sys/arch/i386/compile/ROUTER.MP i386
Architecture: i386
Machine: i386
>Description:
	The kernel acts differently w.r.t. mask length of addresses applied
to P2P interfaces, depending on the IP version of the address.  It appears
to require a "prefixlen 128" for IPv6 addresses, but is content to allow
other things (e.g. /30) for IPv4 addresses.
>How-To-Repeat:
	Create a gre interface, set the tunnel endpoints, then:
# ifconfig gre0 inet A.B.C.D/30 A.B.C.(D+1)
	...this will work.  But, if you create a gif interface,
set its tunnel endpoints, and try:
# ifconfig gif0 inet6 2001:23:2354::2:1/112 2001:23:2354::2:2
ifconfig: SIOCAIFADDR: Invalid argument
#

	It will do the same thing if I move the 112 into a "prefixlen"
argument.  Any prefixlen smaller than 128 causes this.
	Despite the error message, this is actually from the handling
of SIOCAIFADDR_IN6 in sys/netinet6/in6.c.  ifconfig is confusing about
this because it always reports SIOCAIFADDR, regardless of which family
it's using.
>Fix:
	Figure out why IPv4 p2p interfaces allow the netmask to be set
to something other than /32.  Assuming this is a sensible reason,
adjust the code in netinet6/in6.c to allow the same for IPv6.