Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet inject GRE packet to raw ip socket input, to sup...



details:   https://anonhg.NetBSD.org/src/rev/b3467e0e0997
branches:  trunk
changeset: 535098:b3467e0e0997
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Aug 10 05:40:54 2002 +0000

description:
inject GRE packet to raw ip socket input, to support userland GRE decapsulator.
discussed on openbsd developers list.

diffstat:

 sys/netinet/ip_gre.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r ce795b43b64e -r b3467e0e0997 sys/netinet/ip_gre.c
--- a/sys/netinet/ip_gre.c      Sat Aug 10 05:05:24 2002 +0000
+++ b/sys/netinet/ip_gre.c      Sat Aug 10 05:40:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_gre.c,v 1.19 2002/06/09 19:49:49 itojun Exp $ */
+/*     $NetBSD: ip_gre.c,v 1.20 2002/08/10 05:40:54 itojun Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_gre.c,v 1.19 2002/06/09 19:49:49 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_gre.c,v 1.20 2002/08/10 05:40:54 itojun Exp $");
 
 #include "gre.h"
 #if NGRE > 0
@@ -121,21 +121,22 @@
         va_dcl
 #endif
 {
-       int hlen,ret;
+       int off, ret, proto;
        va_list ap;
 
        va_start(ap, m);
-       hlen = va_arg(ap, int);
+       off = va_arg(ap, int);
+       proto = va_arg(ap, int);
        va_end(ap);
 
-       ret = gre_input2(m,hlen,IPPROTO_GRE);
+       ret = gre_input2(m, off, proto);
        /*
-        * ret == 0 : packet not processed, but input from here
-        * means no matching tunnel that is up is found,
-        * so we can just free the mbuf and return
+        * ret == 0 : packet not processed, meaning that 
+        * no matching tunnel that is up is found.
+        * we inject it to raw ip socket to see if anyone picks it up.
         */
        if (ret == 0)
-               m_freem(m);
+               rip_input(m, off, proto);
 }
 
 /*
@@ -148,7 +149,7 @@
  */
 
 int
-gre_input2(struct mbuf *m ,int hlen,u_char proto)
+gre_input2(struct mbuf *m ,int hlen, u_char proto)
 {
        struct greip *gip = mtod(m, struct greip *);
        int s;



Home | Main Index | Thread Index | Old Index