inject GRE packet to raw ip socket input, to support userland GRE decapsulator.

discussed on openbsd developers list.
This commit is contained in:
itojun 2002-08-10 05:40:54 +00:00
parent 3bb8b93140
commit 6446feb7a7
1 changed files with 11 additions and 10 deletions

View File

@ -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 @@ gre_input(m, va_alist)
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 @@ gre_input(m, va_alist)
*/
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;