From nobody@FreeBSD.org  Mon Apr 25 19:56:17 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 54EBE16A4FE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Apr 2005 19:56:17 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2711943D5F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Apr 2005 19:56:17 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j3PJuGwA037676
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Apr 2005 19:56:16 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j3PJuG1j037675;
	Mon, 25 Apr 2005 19:56:16 GMT
	(envelope-from nobody)
Message-Id: <200504251956.j3PJuG1j037675@www.freebsd.org>
Date: Mon, 25 Apr 2005 19:56:16 GMT
From: Andrew Alston <aalston@its.uct.ac.za>
To: freebsd-gnats-submit@FreeBSD.org
Subject: V6 was not supported through GRE tunnels
X-Send-Pr-Version: www-2.3

>Number:         80340
>Category:       kern
>Synopsis:       [patch] [if_gre] V6 support through GRE tunnels
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 25 20:00:38 GMT 2005
>Closed-Date:    Wed Aug 10 19:15:38 GMT 2005
>Last-Modified:  Wed Aug 10 19:15:38 GMT 2005
>Originator:     Andrew Alston
>Release:        5.4-RC3
>Organization:
University of Cape Town
>Environment:
FreeBSD vpn.its.uct.ac.za 5.4-RC3 FreeBSD 5.4-RC3 #7: Sat Apr 23 19:35:02 SAST 2005     root@vpn.its.uct.ac.za:/usr/obj/usr/src/sys/VPN  i386

>Description:
V6 was not supported on the if_gre interface under FreeBSD, the patch submitted is a modified version of the patch used in NetBSD with some minor changes to generate ip_id's when transmitting v6 over GRE.
>How-To-Repeat:
Not a problem - an update
>Fix:
      
>Release-Note:
>Audit-Trail:

From: Giorgos Keramidas <keramida@freebsd.org>
To: Andrew Alston <aalston@its.uct.ac.za>
Cc: bug-followup@freebsd.org
Subject: Re: kern/80340: V6 was not supported through GRE tunnels
Date: Tue, 26 Apr 2005 03:30:56 +0300

 On 2005-04-25 19:56, Andrew Alston <aalston@its.uct.ac.za> wrote:
 > V6 was not supported on the if_gre interface under FreeBSD, the patch
 > submitted is a modified version of the patch used in NetBSD with some
 > minor changes to generate ip_id's when transmitting v6 over GRE.
 
 There was no patch attached.  Can you post a followup with the patch
 included inline or a URI where the patch can be downloaded from, please?
 
 Thanks,
 Giorgos

From: Andrew Alston <aalston@its.uct.ac.za>
To: bug-followup@FreeBSD.org, aalston@its.uct.ac.za
Cc:  
Subject: Re: kern/80340: [patch] [if_gre] V6 support through GRE tunnels
Date: Tue, 26 Apr 2005 07:05:08 +0200

 Hey, sorry about this! Dunno what happened there, I've incldued the 
 patch inline below:
 
 --- Patch follows ---
 
 diff -ruN sys/net.bak/if_gre.c sys/net/if_gre.c
 --- sys/net.bak/if_gre.c	Mon Apr 25 21:29:50 2005
 +++ sys/net/if_gre.c	Mon Apr 25 21:30:24 2005
 @@ -39,7 +39,6 @@
  
  /*
   * Encapsulate L3 protocols into IP
 - * See RFC 1701 and 1702 for more details.
   * If_gre is compatible with Cisco GRE tunnels, so you can
   * have a NetBSD box as the other end of a tunnel interface of a Cisco
   * router. See gre(4) for more details.
 @@ -230,6 +229,8 @@
  	struct gre_softc *sc = ifp->if_softc;
  	struct greip *gh;
  	struct ip *ip;
 + 	u_short ip_id = 0;	
 +	u_int8_t ip_tos = 0;
  	u_int16_t etype = 0;
  	struct mobile_h mob_h;
  
 @@ -338,6 +339,8 @@
  		switch (dst->sa_family) {
  		case AF_INET:
  			ip = mtod(m, struct ip *);
 +			ip_tos = ip->ip_tos;
 +			ip_id = ip->ip_id;
  			etype = ETHERTYPE_IP;
  			break;
  #ifdef NETATALK
 @@ -345,6 +348,12 @@
  			etype = ETHERTYPE_ATALK;
  			break;
  #endif
 +#ifdef INET6
 +		case AF_INET6:
 +			ip_id = ip_newid();
 +			etype = ETHERTYPE_IPV6;
 +			break;
 +#endif
  		default:
  			_IF_DROP(&ifp->if_snd);
  			m_freem(m);
 @@ -379,8 +388,8 @@
  		((struct ip*)gh)->ip_v = IPPROTO_IPV4;
  		((struct ip*)gh)->ip_hl = (sizeof(struct ip)) >> 2;
  		((struct ip*)gh)->ip_ttl = GRE_TTL;
 -		((struct ip*)gh)->ip_tos = ip->ip_tos;
 -		((struct ip*)gh)->ip_id = ip->ip_id;
 +		((struct ip*)gh)->ip_tos = ip_tos; 
 +		((struct ip*)gh)->ip_id = ip_id; 
  		gh->gi_len = m->m_pkthdr.len;
  	}
  
 @@ -457,6 +466,9 @@
  		switch (ifr->ifr_addr.sa_family) {
  #ifdef INET
  		case AF_INET:
 +			break;
 +#endif
 +#ifdef INET6	case AF_INET6:
  			break;
  #endif
  		default:
 diff -ruN sys/netinet.bak/ip_gre.c sys/netinet/ip_gre.c
 --- sys/netinet.bak/ip_gre.c	Mon Apr 25 21:29:54 2005
 +++ sys/netinet/ip_gre.c	Mon Apr 25 21:30:35 2005
 @@ -45,6 +45,7 @@
  
  #include "opt_inet.h"
  #include "opt_atalk.h"
 +#include "opt_inet6.h"
  
  #include <sys/param.h>
  #include <sys/systm.h>
 @@ -81,6 +82,10 @@
  #include <netatalk/at_extern.h>
  #endif
  
 +#ifdef INET6
 +#include <netinet/ip6.h>
 +#endif
 +
  /* Needs IP headers. */
  #include <net/if_gre.h>
  
 @@ -189,8 +194,11 @@
  			isr = NETISR_ATALK1;
  			break;
  #endif
 +#ifdef INET6
  		case ETHERTYPE_IPV6:
 -			/* FALLTHROUGH */
 +			isr = NETISR_IPV6;
 +			break;
 +#endif		
  		default:	   /* others not yet supported */
  			return (0);
  		}
 
 
Responsible-Changed-From-To: freebsd-bugs->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Wed Jun 22 15:31:58 GMT 2005 
Responsible-Changed-Why:  
Will handle that. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80340 
State-Changed-From-To: open->patched 
State-Changed-By: bz 
State-Changed-When: Mon Aug 1 08:17:29 GMT 2005 
State-Changed-Why:  
Patched in HEAD anlong with another needed bugfix. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80340 
State-Changed-From-To: patched->closed 
State-Changed-By: bz 
State-Changed-When: Wed Aug 10 19:14:32 GMT 2005 
State-Changed-Why:  
Patch MFCed to RELENG_6. Thanks for submitting. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80340 
>Unformatted:
