Subject: kern/30285: can't join multicast groups on gif(4) and gre(4) interfaces
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <carton@Ivy.NET>
List: netbsd-bugs
Date: 05/19/2005 21:28:00
>Number:         30285
>Category:       kern
>Synopsis:       can't join multicast groups on gif(4) and gre(4) interfaces
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 19 21:28:00 +0000 2005
>Originator:     Miles Nordin
>Release:        NetBSD 2.0.2_STABLE
>Organization:
Ivy Ministries
>Environment:
System: NetBSD castrovalva 2.0.2_STABLE NetBSD 2.0.2_STABLE (CASTROVALVA-$Revision: 1.10 $) #0: Wed Apr 27 23:41:50 EDT 2005 carton@castrovalva:/scratch/src/sys/arch/alpha/compile/CASTROVALVA alpha
Architecture: alpha
Machine: alpha
>Description:
The permission checks on  SIOC{ADD,DEL}MULTI for gif(4) and gre(4) are 
too strict.
>How-To-Repeat:
Quagga is able to form OSPF adjacencies over Ethernet interfaces like 
tlp, but can't form them over gif or gre tunnels.  The following message 
appears in syslog:

May 15 02:35:43 ezln ospf6d[748]: Network: Join AllSPFRouters on ifindex 16 fai\
led: Operation not permitted

and ifmcstat shows that the gre interface hasn't been added to the ff02::5 
group which receives OSPFv3 HELLO packets.  pinging ff02::5%gre0 returns 
nothing.  Analagous things happen with OSPFv2 and 224.0.0.5 except that 
ifmcstat isn't available for IPv4.

On an Ethernet interface like tlp, all those things above do 
work---adjacencies, ifmcstat, and pinging the multicast address.

>Fix:
With this patch, Quagga forms OSPFv2 (IPv4) and OSPFv3 (IPv6) adjacencies 
over gre tunnels.
Index: if_gif.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/net/if_gif.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 if_gif.c
--- if_gif.c	12 Dec 2003 11:38:19 -0000	1.1.1.4
+++ if_gif.c	18 May 2005 23:45:57 -0000
@@ -557,8 +557,6 @@
 
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
-			break;
 		switch (ifr->ifr_addr.sa_family) {
 #ifdef INET
 		case AF_INET:	/* IP supports Multicast */
Index: if_gre.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/net/if_gre.c,v
retrieving revision 1.2
diff -u -r1.2 if_gre.c
--- if_gre.c	28 Apr 2005 02:33:22 -0000	1.2
+++ if_gre.c	18 May 2005 23:45:39 -0000
@@ -400,8 +400,6 @@
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
-			break;
 		if (ifr == 0) {
 			error = EAFNOSUPPORT;
 			break;