The "gif*" tunnelling interface does everything ipip does.

Move usage example from ipip.4 to gif.4
Excise ipip and stitch up the scars.
This commit is contained in:
sommerfeld 2002-03-04 13:24:06 +00:00
parent 1932d50001
commit 3406f0a3dd
41 changed files with 118 additions and 740 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.448 2002/03/01 11:26:49 ad Exp $
# $NetBSD: mi,v 1.449 2002/03/04 13:24:06 sommerfeld Exp $
./usr/share/info/am-utils.info man-amd-info
./usr/share/info/as.info man-computil-info
./usr/share/info/awk.info man-util-info
@ -704,7 +704,6 @@
./usr/share/man/cat4/ip6.0 man-sys-catman
./usr/share/man/cat4/ipf.0 man-sys-catman
./usr/share/man/cat4/ipfilter.0 man-sys-catman
./usr/share/man/cat4/ipip.0 man-sys-catman
./usr/share/man/cat4/ipkdb.0 man-sys-catman
./usr/share/man/cat4/ipl.0 man-sys-catman
./usr/share/man/cat4/ipnat.0 man-sys-catman
@ -2378,7 +2377,6 @@
./usr/share/man/man4/ip6.4 man-sys-man
./usr/share/man/man4/ipf.4 man-sys-man
./usr/share/man/man4/ipfilter.4 man-sys-man
./usr/share/man/man4/ipip.4 man-sys-man
./usr/share/man/man4/ipkdb.4 man-sys-man
./usr/share/man/man4/ipl.4 man-sys-man
./usr/share/man/man4/ipnat.4 man-sys-man

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.245 2002/02/06 21:06:34 jdolecek Exp $
# $NetBSD: Makefile,v 1.246 2002/03/04 13:24:07 sommerfeld Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= acphy.4 adv.4 adw.4 agp.4 ahb.4 ahc.4 amhphy.4 an.4 aria.4 \
@ -12,7 +12,7 @@ MAN= acphy.4 adv.4 adw.4 agp.4 ahb.4 ahc.4 amhphy.4 an.4 aria.4 \
fd.4 fpa.4 fms.4 fxp.4 gentbi.4 glxtphy.4 gre.4 gphyter.4 gsip.4 hme.4 \
icmp.4 icsphy.4 idp.4 ifmedia.4 iha.4 inet.4 inphy.4 intersil7170.4 \
ioasic.4 ioat.4 \
iop.4 iophy.4 iopsp.4 ip.4 ipip.4 ipkdb.4 iso.4 isp.4 joy.4 \
iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 iso.4 isp.4 joy.4 \
lc.4 ld.4 lkm.4 \
lo.4 lxtphy.4 mainbus.4 makphy.4 mbe.4 mca.4 mcclock.4 \
md.4 mfb.4 mhzc.4 midi.4 mii.4 \

View File

@ -1,4 +1,4 @@
.\" $NetBSD: gif.4,v 1.17 2001/09/19 01:03:43 wiz Exp $
.\" $NetBSD: gif.4,v 1.18 2002/03/04 13:24:07 sommerfeld Exp $
.\" $KAME: gif.4,v 1.24 2001/02/20 12:54:01 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -167,6 +167,50 @@ bit.
.%O draft-ietf-ipsec-ecn-02.txt
.Re
.\"
.Sh EXAMPLES
Configuration example:
.Bd -literal
Host X--NetBSD A ----------------tunnel---------- cisco D------Host E
\\ |
\\ /
+-----Router B--------Router C---------+
.Ed
On NetBSD system A
.Ns ( Nx ) :
.Bd -literal
# route add default B
# ifconfig gifN create
# ifconfig gifN A netmask 0xffffffff tunnel A D up
# route add E 0
# route change E -ifp gif0
.Ed
.Pp
On Host D (Cisco):
.Bd -literal
Interface TunnelX
ip unnumbered D ! e.g. address from Ethernet interface
tunnel source D ! e.g. address from Ethernet interface
tunnel destination A
ip route C <some interface and mask>
ip route A mask C
ip route X mask tunnelX
.Ed
.Pp
or on Host D
.Ns ( Nx ) :
.Bd -literal
# route add default C
# ifconfig ipipN D A
.Ed
.Pp
If all goes well, you should see packets flowing ;-)
.Pp
If you want to reach Host A over the tunnel (from the Cisco D), then
you have to have an alias on Host A for e.g. the Ethernet interface like:
.Ic ifconfig Ar <etherif> alias Y
and on the cisco
.Ic ip Ar route Y mask tunnelX .
.Sh HISTORY
The
.Nm
@ -200,3 +244,16 @@ had a multi-destination behavior, configurable via
.Dv IFF_LINK0
flag.
The behavior was obsoleted and is no longer supported.
.Pp
It should be possible to use the
.Dv add
command of
.Xr route 8
to add an interface route to a
.Nm
interface in one step rather than having to tweak it
later with
.Dv change .

View File

@ -1,145 +0,0 @@
.\" $NetBSD: ipip.4,v 1.9 2002/02/13 08:17:38 ross Exp $
.\"
.\" Copyright 1998 (c) The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Heiko W.Rupp <hwr@pilhuhn.de>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of the The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 28, 1999
.Dt IPIP 4
.Os
.Sh NAME
.Nm ipip
.Nd encapsulating network device
.Sh SYNOPSIS
.Cd pseudo-device ipip Op Ar count
.Sh DESCRIPTION
The
.Nm ipip
network interface is a pseudo device that allows to encapsulate datagrams
into IP. These encapsulated datagrams are routed to a destination host,
where they are decapsulated and further routed to their final destination.
The so called
.Dq tunnel
appears to the inner datagrams like one hop.
Encapsulation is according to RFC 2003. The outer datagram header is of
IP type 4 (IPIP).
.Pp
The network interfaces are named
.Sy ipip Ns Ar 0 ,
.Sy ipip Ns Ar 1
and so on, as many as have given on the
.Sy pseudo-device
line in the system config file.
.Pp
Note that the IP addresses of the tunnel endpoints may be the same as the
ones defined with
.Ic ifconfig
for the interface (as if IP is encapsulated), but need not be.
.Sh EXAMPLES
Configuration example:
.Bd -literal
Host X-- Host A ----------------tunnel---------- cisco D------Host E
\\ |
\\ /
+------Host B----------Host C----------+
.Ed
On host A
.Ns ( Nx ) :
.Bd -literal
# route add default B
# ifconfig ipipN A D netmask 0xffffffff up
# route add E D
.Ed
.Pp
On Host D (Cisco):
.Bd -literal
Interface TunnelX
ip unnumbered D ! e.g. address from Ethernet interface
tunnel source D ! e.g. address from Ethernet interface
tunnel destination A
ip route C \*[Lt]some interface and mask\*[Gt]
ip route A mask C
ip route X mask tunnelX
.Ed
.Pp
or on Host D
.Ns ( Nx ) :
.Bd -literal
# route add default C
# ifconfig ipipN D A
.Ed
.Pp
If all goes well, you should see packets flowing ;-)
.Pp
If you want to reach Host A over the tunnel (from the Cisco D), then
you have to have an alias on Host A for e.g. the Ethernet interface like:
.Ic ifconfig Ar \*[Lt]etherif\*[Gt] alias Y
and on the cisco
.Ic ip Ar route Y mask tunnelX .
.Sh NOTES
For correct operation, the
.Nm
device needs a route to the destination, that is less specific than the
one over the tunnel.
(Basically, there needs to be a route to the decapsulating host that
does not run over the tunnel, as this would be a loop ..)
.Pp
In order to get
.Ic ifconfig
to actually mark the interface as up, the keyword
.Ar up
must be given last on its command line.
.Pp
The kernel must be set to forward datagrams by either option
.Dq GATEWAY
in the kernel config file or by issuing the appropriate option to
.Xr sysctl 8 .
.Sh SEE ALSO
.Xr atalk 4 ,
.Xr gre 4 ,
.Xr inet 4 ,
.Xr ip 4 ,
.Xr netintro 4 ,
.Xr options 4 ,
.Xr protocols 5 ,
.Xr ifconfig 8 ,
.Xr sysctl 8
.Pp
A description of IPIP encapsulation can be found in RFC 2003.
.Sh BUGS
The ipip_compute_route() code in ip_ipip.c toggles the last bit of the
IP-address to provoke the search for a less specific route than the
one directly over the tunnel to prevent loops. This is possibly not
the best solution.
.Pp
Traceroute does not work yet over the tunnel.

View File

@ -1,4 +1,4 @@
# $NetBSD: AMIGA,v 1.46 2002/02/15 21:28:04 is Exp $
# $NetBSD: AMIGA,v 1.47 2002/03/04 13:24:07 sommerfeld Exp $
#
# This file was automatically created. Changes will be
# lost when running make in this directory.
@ -24,7 +24,7 @@
#device.
include "arch/amiga/conf/std.amiga"
#ident "GENERIC-$Revision: 1.46 $"
#ident "GENERIC-$Revision: 1.47 $"
maxusers 8
options RTC_OFFSET=0
@ -404,7 +404,6 @@ pseudo-device ppp 1 # PPP network interfaces
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
pseudo-device tun 1 # network tunnel line discipline
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device bpfilter 16 # Berkeley packet filter
pseudo-device ipfilter # IP Filter package
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)

View File

@ -1,4 +1,4 @@
# $NetBSD: DRACO,v 1.62 2002/02/15 21:28:05 is Exp $
# $NetBSD: DRACO,v 1.63 2002/03/04 13:24:08 sommerfeld Exp $
#
# This file was automatically created. Changes will be
# lost when running make in this directory.
@ -24,7 +24,7 @@
#device.
include "arch/amiga/conf/std.amiga"
#ident "GENERIC-$Revision: 1.62 $"
#ident "GENERIC-$Revision: 1.63 $"
maxusers 8
options RTC_OFFSET=0
@ -265,7 +265,6 @@ pseudo-device ppp 1 # PPP network interfaces
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
pseudo-device tun 1 # network tunnel line discipline
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device bpfilter 16 # Berkeley packet filter
pseudo-device ipfilter # IP Filter package
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.175 2002/02/15 21:28:05 is Exp $
# $NetBSD: GENERIC,v 1.176 2002/03/04 13:24:08 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -34,7 +34,7 @@
include "arch/amiga/conf/std.amiga"
#ident "GENERIC-$Revision: 1.175 $"
#ident "GENERIC-$Revision: 1.176 $"
#ifdef INSTALL_CONFIGURATION
makeoptions COPTS="-Os"
@ -496,7 +496,6 @@ pseudo-device ppp 1 # PPP network interfaces
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
pseudo-device tun 1 # network tunnel line discipline
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device bpfilter 16 # Berkeley packet filter
pseudo-device ipfilter # IP Filter package
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL,v 1.24 2002/02/15 21:28:05 is Exp $
# $NetBSD: INSTALL,v 1.25 2002/03/04 13:24:08 sommerfeld Exp $
#
# This file was automatically created. Changes will be
# lost when running make in this directory.
@ -24,7 +24,7 @@
#device.
include "arch/amiga/conf/std.amiga"
#ident "GENERIC-$Revision: 1.24 $"
#ident "GENERIC-$Revision: 1.25 $"
makeoptions COPTS="-Os"
@ -352,7 +352,6 @@ pseudo-device ppp 1 # PPP network interfaces
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
pseudo-device tun 1 # network tunnel line discipline
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device bpfilter 16 # Berkeley packet filter
pseudo-device ipfilter # IP Filter package
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)

View File

@ -1,4 +1,4 @@
# $NetBSD: NULL,v 1.8 2002/01/27 13:23:11 jdolecek Exp $
# $NetBSD: NULL,v 1.9 2002/03/04 13:24:08 sommerfeld Exp $
#
# This file was automatically created. Changes will be
# lost when running make in this directory.
@ -306,7 +306,6 @@ a34kbbc0 at mainbus0 # A3000/A4000 battery backed clock
#pseudo-device ppp 1 # PPP network interfaces
#pseudo-device tun 1 # network tunnel line discipline
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
#pseudo-device bpfilter 16 # Berkeley packet filter
#pseudo-device ipfilter # IP Filter package

View File

@ -1,4 +1,4 @@
# $NetBSD: ARCTIC,v 1.15 2002/01/27 13:23:11 jdolecek Exp $
# $NetBSD: ARCTIC,v 1.16 2002/03/04 13:24:08 sommerfeld Exp $
# $OpenBSD: ARCTIC,v 1.12 1999/08/29 12:14:03 niklas Exp $
#
# configuration file for DeskStation
@ -245,7 +245,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.62 2002/02/10 17:36:54 wiz Exp $
# $NetBSD: GENERIC,v 1.63 2002/03/04 13:24:08 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -20,7 +20,7 @@
include "arch/arc/conf/std.arc"
#ident "GENERIC-$Revision: 1.62 $"
#ident "GENERIC-$Revision: 1.63 $"
maxusers 32 # estimated number of users
@ -386,7 +386,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: M403,v 1.18 2002/01/27 13:23:11 jdolecek Exp $
# $NetBSD: M403,v 1.19 2002/03/04 13:24:08 sommerfeld Exp $
#
# configuration file for MIPS Magnum 4000 system
#
@ -195,7 +195,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: MIMORI,v 1.12 2002/02/10 17:36:55 wiz Exp $
# $NetBSD: MIMORI,v 1.13 2002/03/04 13:24:08 sommerfeld Exp $
# NetBSD: GENERIC,v 1.31 2000/06/09 05:33:02 soda Exp
#
# MIMORI -- My NEC RISCstation 2250 (ur)
@ -248,7 +248,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: PCCONS,v 1.17 2002/02/10 17:36:55 wiz Exp $
# $NetBSD: PCCONS,v 1.18 2002/03/04 13:24:08 sommerfeld Exp $
# $OpenBSD: GENERIC,v 1.29 1999/08/29 12:14:03 niklas Exp $
#
# PCCONS -- generic but pccons rather than wscons
@ -348,7 +348,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: PICA,v 1.30 2002/01/27 13:23:11 jdolecek Exp $
# $NetBSD: PICA,v 1.31 2002/03/04 13:24:09 sommerfeld Exp $
#
# configuration file for ACER PICA system
#
@ -197,7 +197,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: RAMDISK,v 1.24 2002/02/10 17:36:55 wiz Exp $
# $NetBSD: RAMDISK,v 1.25 2002/03/04 13:24:09 sommerfeld Exp $
# $OpenBSD: RAMDISK,v 1.9 1999/08/29 12:14:03 niklas Exp $
#
# memory disk based configuration file for MIPS R4x00 ARC Systems
@ -359,7 +359,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.19 2002/02/12 09:11:45 skrll Exp $
# $NetBSD: GENERIC,v 1.20 2002/03/04 13:24:09 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -490,7 +490,6 @@ pseudo-device sl 2 # Serial Line IP
pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.27 2002/02/10 17:36:56 wiz Exp $
# $NetBSD: GENERIC,v 1.28 2002/03/04 13:24:09 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -20,7 +20,7 @@
include "arch/cobalt/conf/std.cobalt"
#ident "GENERIC-$Revision: 1.27 $"
#ident "GENERIC-$Revision: 1.28 $"
maxusers 32
@ -260,7 +260,6 @@ pseudo-device loop # network loopback
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # RFC 2003 IP Encapsulation
#pseudo-device gif 4 # RFC1933 tunnel
#pseudo-device faith 1 # IPv[46] tcp relay translation
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: CARDBUS,v 1.52 2002/02/10 17:36:56 wiz Exp $
# $NetBSD: CARDBUS,v 1.53 2002/03/04 13:24:09 sommerfeld Exp $
#
# CARDBUS: GENERIC + CardBus support. Additionally, some
# things typically not found on laptops have been commented out.
@ -8,7 +8,7 @@
include "arch/i386/conf/std.i386"
#ident "CARDBUS-$Revision: 1.52 $"
#ident "CARDBUS-$Revision: 1.53 $"
maxusers 32 # estimated number of users
@ -947,7 +947,6 @@ pseudo-device sl 2 # Serial Line IP
pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: DR-EVIL,v 1.38 2002/02/10 17:36:57 wiz Exp $
# $NetBSD: DR-EVIL,v 1.39 2002/03/04 13:24:09 sommerfeld Exp $
#
# DR-EVIL -- Dell Inspiron 3800 laptop used by thorpej@netbsd.org
#
@ -831,7 +831,6 @@ pseudo-device ppp 2 # Point-to-Point Protocol
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC 1933)
pseudo-device faith 1 # IPv[46] TCP relay translation

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.473 2002/02/27 00:31:12 jmcneill Exp $
# $NetBSD: GENERIC,v 1.474 2002/03/04 13:24:10 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -20,7 +20,7 @@
include "arch/i386/conf/std.i386"
#ident "GENERIC-$Revision: 1.473 $"
#ident "GENERIC-$Revision: 1.474 $"
maxusers 32 # estimated number of users
@ -1048,7 +1048,6 @@ pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device irframetty # IrDA frame line discipline
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC_LAPTOP,v 1.42 2002/02/10 17:36:58 wiz Exp $
# $NetBSD: GENERIC_LAPTOP,v 1.43 2002/03/04 13:24:10 sommerfeld Exp $
# From: NetBSD: GENERIC,v 1.414 2001/07/30 19:59:05 ad Exp
#
# GENERIC_LAPTOP -- GENERIC with cardbus and some USB devices enabled
@ -6,7 +6,7 @@
include "arch/i386/conf/std.i386"
#ident "GENERIC-$Revision: 1.42 $"
#ident "GENERIC-$Revision: 1.43 $"
maxusers 32 # estimated number of users
@ -765,7 +765,6 @@ pseudo-device sl 2 # Serial Line IP
pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL,v 1.184 2002/02/10 17:36:58 wiz Exp $
# $NetBSD: INSTALL,v 1.185 2002/03/04 13:24:10 sommerfeld Exp $
#
# INSTALL - Installation kernel.
#
@ -705,7 +705,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
# miscellaneous pseudo-devices
pseudo-device pty 2 # pseudo-terminals (Sysinst needs two)

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL_LAPTOP,v 1.21 2002/02/10 17:36:58 wiz Exp $
# $NetBSD: INSTALL_LAPTOP,v 1.22 2002/03/04 13:24:10 sommerfeld Exp $
#
# INSTALL - Installation kernel.
#
@ -480,7 +480,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
# miscellaneous pseudo-devices
pseudo-device pty 2 # pseudo-terminals (Sysinst needs two)

View File

@ -1,4 +1,4 @@
# $NetBSD: IOPENER,v 1.23 2002/02/10 17:36:58 wiz Exp $
# $NetBSD: IOPENER,v 1.24 2002/03/04 13:24:10 sommerfeld Exp $
#
# IOPENER -- GENERIC-like kernel for the Netpliance i-opener
# from: GENERIC,v 1.358 2000/07/05 04:07:25 sommerfeld Exp
@ -6,7 +6,7 @@
include "arch/i386/conf/std.i386"
#ident "IOPENER-$Revision: 1.23 $"
#ident "IOPENER-$Revision: 1.24 $"
maxusers 32 # estimated number of users
@ -388,7 +388,6 @@ pseudo-device sl 2 # Serial Line IP
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
#pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,11 +1,11 @@
# $NetBSD: LAMB,v 1.16 2002/01/27 13:23:19 jdolecek Exp $
# $NetBSD: LAMB,v 1.17 2002/03/04 13:24:10 sommerfeld Exp $
#
# GENERIC -- everything that's currently supported
#
include "arch/i386/conf/std.i386"
#ident "GENERIC-$Revision: 1.16 $"
#ident "GENERIC-$Revision: 1.17 $"
maxusers 32 # estimated number of users
@ -355,7 +355,6 @@ pseudo-device sl 2 # Serial Line IP
pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: NET4501,v 1.3 2002/03/01 23:42:20 thorpej Exp $
# $NetBSD: NET4501,v 1.4 2002/03/04 13:24:10 sommerfeld Exp $
#
# NET4501 -- kernel configuration for a Soekris Engineering net4501
# single-board computer.
@ -8,7 +8,7 @@
include "arch/i386/conf/std.i386"
#ident "NET4501-$Revision: 1.3 $"
#ident "NET4501-$Revision: 1.4 $"
maxusers 32 # estimated number of users
@ -241,7 +241,6 @@ pseudo-device loop # network loopback
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
pseudo-device faith 1 # IPv[46] tcp relay translation i/f
pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: SWINGER,v 1.26 2002/02/10 17:36:59 wiz Exp $
# $NetBSD: SWINGER,v 1.27 2002/03/04 13:24:10 sommerfeld Exp $
# from NetBSD: GENERIC,v 1.325 2000/04/14 14:53:32 augustss Exp
#
# SWINGER -- thorpej's Abit BP6+dual Celeron
@ -6,7 +6,7 @@
include "arch/i386/conf/std.i386"
#ident "SWINGER-$Revision: 1.26 $"
#ident "SWINGER-$Revision: 1.27 $"
maxusers 64 # estimated number of users
@ -804,7 +804,6 @@ pseudo-device loop # network loopback
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
pseudo-device faith 1 # IPv[46] tcp relay translation i/f

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.33 2002/02/17 20:59:36 uch Exp $
# $NetBSD: GENERIC,v 1.34 2002/03/04 13:24:10 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -20,7 +20,7 @@
include "arch/mmeye/conf/std.mmeye"
#ident "GENERIC-$Revision: 1.33 $"
#ident "GENERIC-$Revision: 1.34 $"
maxusers 16 # estimated number of users
@ -185,7 +185,6 @@ pseudo-device sl 2 # Serial Line IP
pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.29 2002/01/27 13:23:22 jdolecek Exp $
# $NetBSD: GENERIC,v 1.30 2002/03/04 13:24:11 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -20,7 +20,7 @@
include "arch/news68k/conf/std.news68k"
#ident "GENERIC-$Revision: 1.29 $"
#ident "GENERIC-$Revision: 1.30 $"
maxusers 8
@ -211,7 +211,6 @@ pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device bpfilter 16 # Berkeley Packet Filter
pseudo-device ipfilter # ip filter
pseudo-device strip 1 # Starmode Radio IP (Metricom)
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,10 +1,10 @@
# $NetBSD: GENERIC_TINY,v 1.10 2002/01/27 13:23:22 jdolecek Exp $
# $NetBSD: GENERIC_TINY,v 1.11 2002/03/04 13:24:11 sommerfeld Exp $
# news68k GENERIC config file for low memory machines;
#
include "arch/news68k/conf/std.news68k"
#ident "GENERIC_TINY-$Revision: 1.10 $"
#ident "GENERIC_TINY-$Revision: 1.11 $"
maxusers 4
@ -191,7 +191,6 @@ pseudo-device tun 4 # Network "tunnel" device
pseudo-device bpfilter 16 # Berkeley Packet Filter
#pseudo-device ipfilter # ip filter
#pseudo-device strip 1 # Starmode Radio IP (Metricom)
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: LIBERO,v 1.14 2002/01/27 13:23:22 jdolecek Exp $
# $NetBSD: LIBERO,v 1.15 2002/03/04 13:24:11 sommerfeld Exp $
# NEWS1750 config file;
#
@ -151,7 +151,6 @@ pseudo-device ppp 2 # PPP interfaces
pseudo-device bpfilter 16 # Berkeley Packet Filter
pseudo-device ipfilter # ip filter
#pseudo-device strip 1 # Starmode Radio IP (Metricom)
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
pseudo-device rnd # /dev/random and in-kernle generator

View File

@ -1,4 +1,4 @@
# $NetBSD: NEWS1200,v 1.14 2002/01/27 13:23:22 jdolecek Exp $
# $NetBSD: NEWS1200,v 1.15 2002/03/04 13:24:11 sommerfeld Exp $
# news1200 config file
#
@ -138,7 +138,6 @@ pseudo-device tun 4 # Network "tunnel" device
pseudo-device bpfilter 16 # Berkeley Packet Filter
pseudo-device ipfilter # ip filter
#pseudo-device strip 1 # Starmode Radio IP (Metricom)
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
pseudo-device rnd # /dev/random and in-kernle generator

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.42 2002/02/25 19:09:43 kleink Exp $
# $NetBSD: GENERIC,v 1.43 2002/03/04 13:24:11 sommerfeld Exp $
#
# GENERIC machine description file
#
@ -20,7 +20,7 @@
include "arch/prep/conf/std.prep"
#ident "GENERIC-$Revision: 1.42 $"
#ident "GENERIC-$Revision: 1.43 $"
maxusers 32
@ -442,7 +442,6 @@ pseudo-device sl 2 # Serial Line IP
pseudo-device strip 2 # Starmode Radio IP (Metricom)
pseudo-device tun 2 # network tunneling over tty
pseudo-device gre 2 # generic L3 over IP tunnel
pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 2 # IPv[46] tcp relay translation i/f
#pseudo-device stf 2 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: NATSUMI,v 1.11 2002/01/27 13:23:25 jdolecek Exp $
# $NetBSD: NATSUMI,v 1.12 2002/03/04 13:24:11 sommerfeld Exp $
#
# for development
#
@ -381,7 +381,6 @@ pseudo-device ipfilter # IP filter (firewall) and NAT
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
#pseudo-device tun 2 # network tunneling over tty
#pseudo-device gre 2 # generic L3 over IP tunnel
#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003)
#pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith 2 # IPv[46] tcp relay translation i/f
#pseudo-device stf 2 # 6to4 IPv6 over IPv4 encapsulation

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.498 2002/02/27 05:03:24 jmc Exp $
# $NetBSD: files,v 1.499 2002/03/04 13:24:11 sommerfeld Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -878,7 +878,6 @@ defpseudo bridge: ifnet, ether
defpseudo bpfilter: ifnet, bpf_filter
defpseudo strip: ifnet
defpseudo ipfilter: ifnet
defpseudo ipip: ifnet
defpseudo gre: ifnet
defpseudo gif: ifnet
defpseudo faith: ifnet
@ -1264,7 +1263,6 @@ file netinet/ip_frag.c ipfilter
file netinet/ip_gre.c inet & gre
file netinet/ip_icmp.c inet
file netinet/ip_input.c inet
file netinet/ip_ipip.c ipip needs-count
file netinet/ip_log.c ipfilter & ipfilter_log
file netinet/ip_mroute.c inet & mrouting
file netinet/ip_nat.c ipfilter

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_proto.c,v 1.54 2001/12/21 06:30:43 itojun Exp $ */
/* $NetBSD: in_proto.c,v 1.55 2002/03/04 13:24:12 sommerfeld Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.54 2001/12/21 06:30:43 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.55 2002/03/04 13:24:12 sommerfeld Exp $");
#include "opt_mrouting.h"
#include "opt_eon.h" /* ISO CLNL over IP */
@ -135,11 +135,6 @@ __KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.54 2001/12/21 06:30:43 itojun Exp $")
#include <netiso/eonvar.h>
#endif /* EON */
#include "ipip.h"
#if NIPIP > 0 || defined(MROUTING)
#include <netinet/ip_ipip.h>
#endif /* NIPIP > 0 || MROUTING */
#include "gre.h"
#if NGRE > 0
#include <netinet/ip_gre.h>
@ -259,15 +254,6 @@ struct protosw inetsw[] = {
},
};
#if NIPIP > 0
struct protosw ipip_protosw =
{ SOCK_RAW, &inetdomain, IPPROTO_IPIP, PR_ATOMIC|PR_ADDR,
ipip_input, rip_output, 0, rip_ctloutput,
rip_usrreq, /* XXX */
0, 0, 0, 0,
};
#endif /* NIPIP */
struct domain inetdomain =
{ PF_INET, "internet", 0, 0, 0,
inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,

View File

@ -70,7 +70,7 @@
#define USE_RADIX
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.7 2001/12/21 06:30:43 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.8 2002/03/04 13:24:12 sommerfeld Exp $");
#include "opt_mrouting.h"
#include "opt_inet.h"
@ -107,13 +107,8 @@ __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.7 2001/12/21 06:30:43 itojun Exp $");
#include <machine/stdarg.h>
#include "ipip.h"
#if NIPIP > 0
# include <netinet/ip_ipip.h>
#else
# ifdef MROUTING
# include <netinet/ip_mroute.h>
# endif
#ifdef MROUTING
#include <netinet/ip_mroute.h>
#endif
#include <net/net_osdep.h>

View File

@ -1,415 +0,0 @@
/* $NetBSD: ip_ipip.c,v 1.16 2001/11/13 00:32:38 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center; Heiko W.Rupp <hwr@pilhuhn.de>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Encapsulate for and decapsulate packets received on an IP-in-IP tunnel.
*
* See: RFC 2003.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_ipip.c,v 1.16 2001/11/13 00:32:38 lukem Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_types.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip_ipip.h>
#include <netinet/ip_encap.h>
#else
#error IPIP without INET?
#endif
#if NBPFILTER > 0
#include <net/bpf.h>
#endif
#include <machine/stdarg.h>
struct ipip_softc *ipip_softc;
int ipip_nsoftc;
static int ipip_encapcheck __P((const struct mbuf *, int, int, void *));
void ipipattach __P((int));
int ipip_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *));
int ipip_ioctl __P((struct ifnet *, u_long, caddr_t));
void ipip_compute_route __P((struct ipip_softc *));
extern struct protosw ipip_protosw;
/*
* Note this is a common IP-in-IP input for both ipip `interfaces'
* and the multicast routing code's IP-in-IP needs.
*/
void
#if __STDC__
ipip_input(struct mbuf *m, ...)
#else
ipip_input(m, va_alist)
sruct mbuf *m;
va_dcl
#endif
{
struct ipip_softc *sc;
int hlen, proto;
va_list ap;
va_start(ap, m);
hlen = va_arg(ap, int);
proto = va_arg(ap, int);
va_end(ap);
sc = (struct ipip_softc *)encap_getarg(m);
if (sc != NULL) {
int s;
sc->sc_if.if_ipackets++;
sc->sc_if.if_ibytes += m->m_pkthdr.len;
m_adj(m, hlen);
m->m_pkthdr.rcvif = &sc->sc_if;
s = splnet();
if (IF_QFULL(&ipintrq)) {
IF_DROP(&ipintrq);
m_freem(m);
} else {
IF_ENQUEUE(&ipintrq, m);
/*
* No need to reschedule an IP netisr, since
* ipintr() will simply continue looping and
* see the packet we just enqueued.
*/
}
splx(s);
/* No more processing at this level. */
return;
}
m_freem(m);
}
/*
* Find the ipip interface associated with our src/dst.
*/
static int
ipip_encapcheck(m, off, proto, arg)
const struct mbuf *m;
int off;
int proto;
void *arg;
{
struct ipip_softc *sc;
struct ip ip;
sc = (struct ipip_softc *)arg;
if (sc == NULL)
return 0;
if ((sc->sc_if.if_flags & IFF_UP) == 0)
return 0;
/* LINTED const cast */
m_copydata((struct mbuf *)m, 0, sizeof(ip), (caddr_t)&ip);
if (!in_hosteq(sc->sc_dst, ip.ip_src) ||
!in_hosteq(sc->sc_src, ip.ip_dst))
return 0;
/* both address matched */
return 32 * 2;
}
/*
* Attach the IPIP pseudo-devices.
*/
/* ARGSUSED */
void
ipipattach(count)
int count;
{
struct ipip_softc *sc;
size_t size;
int i;
ipip_nsoftc = count;
size = sizeof(struct ipip_softc) * count;
ipip_softc = malloc(size, M_DEVBUF, M_WAITOK);
memset(ipip_softc, 0, size);
for (i = 0; i < ipip_nsoftc; i++) {
sc = &ipip_softc[i];
sprintf(sc->sc_if.if_xname, "ipip%d", i);
sc->sc_cookie = encap_attach_func(AF_INET, IPPROTO_IPIP,
ipip_encapcheck, &ipip_protosw, sc);
if (sc->sc_cookie == NULL) {
printf("%s: attach failed\n", sc->sc_if.if_xname);
continue;
}
sc->sc_if.if_softc = sc;
sc->sc_if.if_type = IFT_OTHER;
sc->sc_if.if_dlt = DLT_NULL;
sc->sc_if.if_addrlen = sizeof(struct in_addr);
sc->sc_if.if_hdrlen = sizeof(struct ip);
sc->sc_if.if_mtu = 0; /* filled in later */
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_output = ipip_output;
sc->sc_if.if_ioctl = ipip_ioctl;
sc->sc_src.s_addr = INADDR_ANY;
sc->sc_dst.s_addr = INADDR_ANY;
if_attach(&sc->sc_if);
if_alloc_sadl(&sc->sc_if);
#if NBPFILTER > 0
bpfattach(&sc->sc_if, DLT_NULL, sc->sc_if.if_hdrlen);
#endif
}
}
int
ipip_output(ifp, m0, dst, rt)
struct ifnet *ifp;
struct mbuf *m0;
struct sockaddr *dst;
struct rtentry *rt;
{
struct ipip_softc *sc = ifp->if_softc;
struct ip *nip, *ip;
int error;
if (dst->sa_family != AF_INET) {
IF_DROP(&ifp->if_snd);
m_freem(m0);
return (EAFNOSUPPORT);
}
ip = mtod(m0, struct ip *);
/* Add the new IP header. */
M_PREPEND(m0, sizeof(struct ip), M_DONTWAIT);
if (m0 == NULL)
return (ENOBUFS);
nip = mtod(m0, struct ip *);
memset(nip, 0, sizeof(*nip));
nip->ip_hl = sizeof(*nip) >> 2;
nip->ip_tos = ip->ip_tos;
nip->ip_len = m0->m_pkthdr.len;
nip->ip_ttl = ip->ip_ttl;
nip->ip_p = IPPROTO_IPIP;
nip->ip_src = sc->sc_src;
nip->ip_dst = sc->sc_dst;
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m0);
#endif
ifp->if_opackets++;
ifp->if_obytes += m0->m_pkthdr.len;
error = ip_output(m0, NULL, &sc->sc_route, 0, NULL);
if (error)
ifp->if_oerrors++;
return (error);
}
int
ipip_ioctl(ifp, cmd, data)
struct ifnet *ifp;
u_long cmd;
caddr_t data;
{
struct ipip_softc *sc = ifp->if_softc;
struct ifaddr *ifa = (struct ifaddr *)data;
struct in_ifaddr *ia = (struct in_ifaddr *)data;
struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
s = splnet();
switch (cmd) {
case SIOCSIFADDR:
case SIOCSIFDSTADDR:
if (ifa->ifa_addr->sa_family != AF_INET) {
error = EAFNOSUPPORT;
break;
}
sc->sc_src = (satosin(ifa->ifa_addr))->sin_addr;
sc->sc_dst = ia->ia_dstaddr.sin_addr;
ifp->if_mtu = 0;
ifp->if_flags &= ~IFF_UP;
if (!in_nullhost(sc->sc_src) && !in_nullhost(sc->sc_dst)) {
struct rtentry *rt;
ipip_compute_route(sc);
/*
* Now that we know the route to use, fill in the
* MTU.
*/
rt = sc->sc_route.ro_rt;
if (rt != NULL) {
ifp->if_mtu = rt->rt_ifp->if_mtu -
ifp->if_hdrlen;
ifp->if_flags |= IFF_UP;
}
}
break;
case SIOCSIFFLAGS:
if (in_nullhost(sc->sc_src) || in_nullhost(sc->sc_dst))
ifp->if_flags &= ~IFF_UP;
if (ifp->if_flags & IFF_UP) {
if (sc->sc_route.ro_rt == NULL) {
struct rtentry *rt;
ipip_compute_route(sc);
rt = sc->sc_route.ro_rt;
if (rt != NULL)
ifp->if_mtu = rt->rt_ifp->if_mtu -
ifp->if_hdrlen;
else
ifp->if_flags &= ~IFF_UP;
}
}
else {
if (sc->sc_route.ro_rt != NULL) {
RTFREE(sc->sc_route.ro_rt);
sc->sc_route.ro_rt = NULL;
}
ifp->if_mtu = 0;
}
break;
case SIOCSIFMTU:
if (ifr->ifr_mtu < (IP_MSS - ifp->if_hdrlen)) {
error = EINVAL;
break;
}
if (sc->sc_route.ro_rt != NULL &&
ifr->ifr_mtu > (sc->sc_route.ro_rt->rt_ifp->if_mtu -
ifp->if_hdrlen)) {
error = EINVAL;
break;
}
ifp->if_mtu = ifr->ifr_mtu;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
if (ifr == NULL || ifr->ifr_addr.sa_family != AF_INET) {
error = EAFNOSUPPORT;
break;
}
break;
default:
error = EINVAL;
}
splx(s);
return (error);
}
/*
* Compute a less-specific route to the destination such that ip_output()
* will not loop the packet back to ipip_output().
*/
void
ipip_compute_route(sc)
struct ipip_softc *sc;
{
struct route *ro;
ro = &sc->sc_route;
if (ro->ro_rt != NULL)
RTFREE(ro->ro_rt);
ro->ro_rt = NULL;
memset(&ro->ro_dst, 0, sizeof(ro->ro_dst));
ro->ro_dst.sa_family = AF_INET;
ro->ro_dst.sa_len = sizeof(ro->ro_dst);
/*
* Toggle the last bit on the address so our interface won't
* match.
*
* XXX What we want here is a flag to exclude picking routes
* XXX with this interface.
*/
((struct sockaddr_in *)&ro->ro_dst)->sin_addr.s_addr =
htonl(ntohl(sc->sc_dst.s_addr) ^ 1);
rtalloc(ro);
/*
* Now change it back, or else ip_ouput() will just drop
* the route and find the one for the ipip interface.
*/
((struct sockaddr_in *)&ro->ro_dst)->sin_addr = sc->sc_dst;
}

View File

@ -1,57 +0,0 @@
/* $NetBSD: ip_ipip.h,v 1.2 2000/04/19 06:30:55 itojun Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _NETINET_IP_IPIP_H_
#define _NETINET_IP_IPIP_H_
struct encaptab;
struct ipip_softc {
struct ifnet sc_if; /* our ifnet structure */
struct in_addr sc_src; /* tunnel source address */
struct in_addr sc_dst; /* tunnel destination address */
struct route sc_route; /* route to destination */
const struct encaptab *sc_cookie;
};
#ifdef _KERNEL
void ipip_input __P((struct mbuf *, ...));
#endif
#endif /* _NETINET_IP_IPIP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_mroute.c,v 1.58 2001/11/13 00:32:38 lukem Exp $ */
/* $NetBSD: ip_mroute.c,v 1.59 2002/03/04 13:24:12 sommerfeld Exp $ */
/*
* IP multicast forwarding procedures
@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.58 2001/11/13 00:32:38 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.59 2002/03/04 13:24:12 sommerfeld Exp $");
#include "opt_ipsec.h"
@ -175,12 +175,11 @@ struct ip multicast_encap_iphdr = {
* Private variables.
*/
static vifi_t numvifs = 0;
static int have_encap_tunnel = 0;
static struct callout expire_upcalls_ch;
/*
* one-back cache used by mrt_ipip_input to locate a tunnel's vif
* one-back cache used by vif_encapcheck to locate a tunnel's vif
* given a datagram's src ip address.
*/
static struct in_addr last_encap_src;
@ -485,7 +484,6 @@ ip_mrouter_done()
mfchashtbl = 0;
/* Reset de-encapsulation cache. */
have_encap_tunnel = 0;
ip_mrouter = 0;
@ -591,12 +589,6 @@ add_vif(m)
/* Prepare cached route entry. */
bzero(&vifp->v_route, sizeof(vifp->v_route));
/*
* Tell mrt_ipip_input() to start looking at encapsulated
* packets.
*/
have_encap_tunnel = 1;
} else {
/* Use the physical interface associated with the address. */
ifp = ifa->ifa_ifp;