Retire EtherIP, we have L2TP instead.

This commit is contained in:
maxv 2018-08-14 14:49:13 +00:00
parent f29cc3a327
commit 735ddbc5b3
17 changed files with 17 additions and 1629 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.2218 2018/08/13 08:26:49 christos Exp $
# $NetBSD: mi,v 1.2219 2018/08/14 14:49:13 maxv Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
./etc/mtree/set.comp comp-sys-root
@ -2299,7 +2299,7 @@
./usr/include/net/if_bridgevar.h comp-c-include
./usr/include/net/if_dl.h comp-c-include
./usr/include/net/if_ether.h comp-c-include
./usr/include/net/if_etherip.h comp-c-include
./usr/include/net/if_etherip.h comp-obsolete obsolete
./usr/include/net/if_fddi.h comp-c-include
./usr/include/net/if_gif.h comp-c-include
./usr/include/net/if_gre.h comp-c-include

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1608 2018/08/12 17:11:55 christos Exp $
# $NetBSD: mi,v 1.1609 2018/08/14 14:49:13 maxv Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -1071,7 +1071,7 @@
./usr/share/man/cat4/esp.0 man-sys-catman .cat
./usr/share/man/cat4/ess.0 man-sys-catman .cat
./usr/share/man/cat4/et.0 man-sys-catman .cat
./usr/share/man/cat4/etherip.0 man-sys-catman .cat
./usr/share/man/cat4/etherip.0 man-obsolete obsolete
./usr/share/man/cat4/etphy.0 man-sys-catman .cat
./usr/share/man/cat4/evbarm/bcmgpio.0 man-sys-catman .cat
./usr/share/man/cat4/evbarm/cpsw.0 man-sys-catman .cat
@ -4221,7 +4221,7 @@
./usr/share/man/html4/esp.html man-sys-htmlman html
./usr/share/man/html4/ess.html man-sys-htmlman html
./usr/share/man/html4/et.html man-sys-htmlman html
./usr/share/man/html4/etherip.html man-sys-htmlman html
./usr/share/man/html4/etherip.html man-obsolete obsolete
./usr/share/man/html4/etphy.html man-sys-htmlman html
./usr/share/man/html4/evbarm/bcmgpio.html man-sys-htmlman html
./usr/share/man/html4/evbarm/cpsw.html man-sys-htmlman html
@ -7143,7 +7143,7 @@
./usr/share/man/man4/esp.4 man-sys-man .man
./usr/share/man/man4/ess.4 man-sys-man .man
./usr/share/man/man4/et.4 man-sys-man .man
./usr/share/man/man4/etherip.4 man-sys-man .man
./usr/share/man/man4/etherip.4 man-obsolete obsolete
./usr/share/man/man4/etphy.4 man-sys-man .man
./usr/share/man/man4/evbarm/bcmgpio.4 man-sys-man .man
./usr/share/man/man4/evbarm/cpsw.4 man-sys-man .man

View File

@ -1,4 +1,4 @@
$NetBSD: TODO.smpnet,v 1.22 2018/08/07 07:19:28 ozaki-r Exp $
$NetBSD: TODO.smpnet,v 1.23 2018/08/14 14:49:13 maxv Exp $
MP-safe components
==================
@ -75,7 +75,6 @@ Unprotected ones
- Interfaces
- agr(4)
- carp(4)
- etherip(4)
- faith(4)
- gre(4)
- ppp(4)

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.663 2018/08/08 21:15:41 maya Exp $
# $NetBSD: Makefile,v 1.664 2018/08/14 14:49:13 maxv Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@ -22,7 +22,7 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
ddb.4 ddc.4 de.4 dge.4 dk.4 dm.4 dmoverio.4 \
dmphy.4 dpt.4 dpti.4 drm.4 drum.4 drvctl.4 dtv.4 dtviic.4 dwctwo.4 \
eap.4 ebus.4 edc.4 elmc.4 emuxki.4 en.4 envsys.4 ep.4 esh.4 \
esa.4 esiop.4 esm.4 eso.4 et.4 etherip.4 etphy.4 exphy.4 \
esa.4 esiop.4 esm.4 eso.4 et.4 etphy.4 exphy.4 \
fd.4 filemon.4 finsio.4 flash.4 fpa.4 fms.4 fss.4 \
fujbp.4 full.4 fxp.4 \
gcscaudio.4 gem.4 genfb.4 gentbi.4 geodeide.4 \

View File

@ -1,171 +0,0 @@
.\" $NetBSD: etherip.4,v 1.8 2017/07/03 21:30:58 wiz Exp $
.\"
.\" Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>.
.\" All rights reserved.
.\"
.\" 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. Neither the name of Hans Rosenfeld nor the names of his contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
.\"
.\"
.\" Copyright (c) 2004, 2005 The NetBSD Foundation.
.\" All rights reserved.
.\"
.\" 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.
.\"
.\" 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.
.\"
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
.\"
.\" 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. Neither the name of the project 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 PROJECT 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 PROJECT 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 November 23, 2006
.Dt ETHERIP 4
.Os
.Sh NAME
.Nm etherip
.Nd EtherIP tunneling device
.Sh SYNOPSIS
.Cd "pseudo-device etherip"
.Sh DESCRIPTION
The
.Nm
interface is a tunneling pseudo device for Ethernet frames.
It can tunnel Ethernet traffic over IPv4 and IPv6 using the EtherIP
protocol specified in RFC 3378.
.Pp
The only difference between an
.Nm
interface and a real Ethernet interface is that there is an IP tunnel
instead of a wire.
Therefore, to use
.Nm
the administrator must first create the interface and then configure
protocol and addresses used for the outer header.
This can be done by using
.Xr ifconfig 8
.Cm create
and
.Cm tunnel
subcommands, or
.Dv SIOCIFCREATE
and
.Dv SIOCSLIFPHYADDR
ioctls.
.Ss Packet format
Ethernet frames are prepended with a EtherIP header as described by
RFC 3378.
The resulting EtherIP packets will be encapsulated in an
outer packet, which may be either an IPv4 or IPv6 packet, with IP
protocol number 97.
.Ss Ethernet address
When a
.Nm
device is created, it is assigned an Ethernet address
of the form f2:0b:a5:xx:xx:xx.
This address can later be changed through a sysctl node.
.Pp
The sysctl node is net.link.etherip.<iface>.
Any string of six colon-separated hexadecimal numbers will be accepted.
Reading that node will provide a string representation of the current
Ethernet address.
.Ss Security
The EtherIP header of incoming packets is not checked for
validity.
This is because there seems to be some confusion about how
such a header has to look like.
For outgoing packets, the header is set up the same way as done in
.Ox ,
.Fx ,
and Linux to be compatible with those systems.
.Ss Converting from previous implementation
A tunnel configured for the previous (undocumented) implementation
will work with just renaming the device from gif to
.Nm .
.Sh SEE ALSO
.Xr bridge 4 ,
.Xr gif 4 ,
.Xr inet 4 ,
.Xr inet6 4 ,
.Xr tap 4 ,
.Xr ifconfig 8
.\"
.Sh HISTORY
The
.Nm
device first appeared in
.Nx 4.0 ,
it is based on
.Xr tap 4 ,
.Xr gif 4 ,
and the former gif-based EtherIP implementation ported from
.Ox .
.\"
.Sh BUGS
Probably many.
There is lots of code duplication between
.Nm ,
.Xr tap 4 ,
.Xr gif 4 ,
and probably other tunnelling drivers which should be cleaned up.

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.1202 2018/07/15 07:07:15 martin Exp $
# $NetBSD: files,v 1.1203 2018/08/14 14:49:13 maxv Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@ -1456,7 +1456,6 @@ defpseudo srt: ifnet
defpseudo stf: ifnet
defpseudodev tap: ifnet, ether, arp
defpseudo carp: ifnet, ether, arp
defpseudodev etherip: ifnet, ether, arp
defpseudodev l2tp: ifnet, ether, arp
defpseudo canloop: ifnet
defpseudo ipsecif: ifnet # avoid to confuse ipsec itself option

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.36 2018/02/16 10:19:04 knakahara Exp $
# $NetBSD: Makefile,v 1.37 2018/08/14 14:49:13 maxv Exp $
INCSDIR= /usr/include/net
INCS= bpf.h bpfjit.h bpfdesc.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \
if_atm.h if_bridgevar.h if_dl.h if_ether.h if_etherip.h if_fddi.h if_gif.h \
if_atm.h if_bridgevar.h if_dl.h if_ether.h if_fddi.h if_gif.h \
if_gre.h if_hippi.h if_ieee1394.h if_ipsec.h if_llc.h if_media.h if_mpls.h \
if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stf.h \
if_tap.h if_token.h if_tun.h if_types.h if_vlanvar.h net_stats.h \

View File

@ -1,4 +1,4 @@
# $NetBSD: files.net,v 1.16 2018/02/27 14:28:01 maxv Exp $
# $NetBSD: files.net,v 1.17 2018/08/14 14:49:13 maxv Exp $
# XXX CLEANUP
define net
@ -12,7 +12,6 @@ file net/if_arcsubr.c arcnet needs-flag
file net/if_atmsubr.c atm
file net/if_bridge.c bridge needs-flag
file net/bridgestp.c bridge
file net/if_etherip.c etherip needs-flag
file net/if_ethersubr.c ether | fddi | netatalk | token |
wlan needs-flag
file net/if_faith.c faith & (inet | inet6) needs-flag
@ -64,9 +63,7 @@ file netinet/in_l2tp.c l2tp & inet
file netinet/ip_carp.c carp & (inet | inet6) needs-flag
file netinet/ip_ecn.c ipsec | gif | stf
file netinet/ip_encap.c inet | inet6
file netinet/ip_etherip.c etherip & inet
file netinet/wqinput.c inet | inet6
file netinet6/ip6_etherip.c etherip & inet6
file netinet6/in6_gif.c gif & inet6
file netinet6/in6_l2tp.c l2tp & inet6

View File

@ -1,708 +0,0 @@
/* $NetBSD: if_etherip.c,v 1.43 2018/06/26 06:48:02 msaitoh Exp $ */
/*
* Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* All rights reserved.
*
* 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. Neither the name of Hans Rosenfeld nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*/
/*
* Copyright (c) 2003, 2004, 2008 The NetBSD Foundation.
* All rights reserved.
*
* 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. 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.
*/
/* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_etherip.c,v 1.43 2018/06/26 06:48:02 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/intr.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_ether.h>
#include <net/if_media.h>
#include <net/route.h>
#include <net/if_etherip.h>
#include <net/bpf.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifdef INET
#include <netinet/in_var.h>
#endif /* INET */
#include <netinet/ip_etherip.h>
#ifdef INET6
#include <netinet6/ip6_etherip.h>
#ifndef INET
#include <netinet/in.h>
#endif
#include <netinet6/in6_var.h>
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_gif.h>
#include <netinet6/ip6protosw.h>
#endif /* INET6 */
#include <compat/sys/sockio.h>
#include "ioconf.h"
struct etherip_softc_list etherip_softc_list;
static int etherip_node;
static int etherip_sysctl_handler(SYSCTLFN_PROTO);
SYSCTL_SETUP_PROTO(sysctl_etherip_setup);
static int etherip_match(device_t, cfdata_t, void *);
static void etherip_attach(device_t, device_t, void *);
static int etherip_detach(device_t, int);
CFATTACH_DECL_NEW(etherip, sizeof(struct etherip_softc),
etherip_match, etherip_attach, etherip_detach, NULL);
extern struct cfdriver etherip_cd;
static void etherip_start(struct ifnet *);
static void etherip_stop(struct ifnet *, int);
static int etherip_init(struct ifnet *);
static int etherip_ioctl(struct ifnet *, u_long, void *);
static int etherip_mediachange(struct ifnet *);
static void etherip_mediastatus(struct ifnet *, struct ifmediareq *);
static int etherip_clone_create(struct if_clone *, int);
static int etherip_clone_destroy(struct ifnet *);
static struct if_clone etherip_cloners = IF_CLONE_INITIALIZER(
"etherip", etherip_clone_create, etherip_clone_destroy);
static int etherip_set_tunnel(struct ifnet *,
struct sockaddr *, struct sockaddr *);
static void etherip_delete_tunnel(struct ifnet *);
static void etheripintr(void *);
void
etheripattach(int count)
{
int error;
error = config_cfattach_attach(etherip_cd.cd_name, &etherip_ca);
if (error) {
aprint_error("%s: unable to register cfattach\n",
etherip_cd.cd_name);
(void)config_cfdriver_detach(&etherip_cd);
return;
}
LIST_INIT(&etherip_softc_list);
if_clone_attach(&etherip_cloners);
}
/* Pretty much useless for a pseudo-device */
static int
etherip_match(device_t self, cfdata_t cfdata, void *arg)
{
return 1;
}
static void
etherip_attach(device_t parent, device_t self, void *aux)
{
struct etherip_softc *sc = device_private(self);
struct ifnet *ifp;
const struct sysctlnode *node;
uint8_t enaddr[ETHER_ADDR_LEN] =
{ 0xf2, 0x0b, 0xa5, 0xff, 0xff, 0xff };
char enaddrstr[3 * ETHER_ADDR_LEN];
struct timeval tv;
uint32_t ui;
int error;
sc->sc_dev = self;
sc->sc_si = NULL;
sc->sc_src = NULL;
sc->sc_dst = NULL;
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
/*
* In order to obtain unique initial Ethernet address on a host,
* do some randomisation using the current uptime. It's not meant
* for anything but avoiding hard-coding an address.
*/
getmicrouptime(&tv);
ui = (tv.tv_sec ^ tv.tv_usec) & 0xffffff;
memcpy(enaddr+3, (uint8_t *)&ui, 3);
aprint_verbose_dev(self, "Ethernet address %s\n",
ether_snprintf(enaddrstr, sizeof(enaddrstr), enaddr));
/*
* Why 1000baseT? Why not? You can add more.
*
* Note that there are 3 steps: init, one or several additions to
* list of supported media, and in the end, the selection of one
* of them.
*/
ifmedia_init(&sc->sc_im, 0, etherip_mediachange, etherip_mediastatus);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_1000_T, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_1000_T|IFM_FDX, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_10_T, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_im, IFM_ETHER|IFM_AUTO);
/*
* One should note that an interface must do multicast in order
* to support IPv6.
*/
ifp = &sc->sc_ec.ec_if;
strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = etherip_ioctl;
ifp->if_start = etherip_start;
ifp->if_stop = etherip_stop;
ifp->if_init = etherip_init;
IFQ_SET_READY(&ifp->if_snd);
sc->sc_ec.ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU;
/*
* Those steps are mandatory for an Ethernet driver, the first call
* being common to all network interface drivers.
*/
error = if_initialize(ifp);
if (error != 0) {
aprint_error_dev(self, "if_initialize failed(%d)\n", error);
ifmedia_delete_instance(&sc->sc_im, IFM_INST_ANY);
pmf_device_deregister(self);
return;
}
ether_ifattach(ifp, enaddr);
if_register(ifp);
/*
* Add a sysctl node for that interface.
*
* The pointer transmitted is not a string, but instead a pointer to
* the softc structure, which we can use to build the string value on
* the fly in the helper function of the node. See the comments for
* etherip_sysctl_handler for details.
*/
error = sysctl_createv(NULL, 0, NULL, &node, CTLFLAG_READWRITE,
CTLTYPE_STRING, device_xname(self), NULL,
etherip_sysctl_handler, 0, (void *)sc, 18,
CTL_NET, AF_LINK, etherip_node,
device_unit(self), CTL_EOL);
if (error)
aprint_error_dev(self,
"sysctl_createv returned %d, ignoring\n", error);
/* insert into etherip_softc_list */
LIST_INSERT_HEAD(&etherip_softc_list, sc, etherip_list);
}
/*
* When detaching, we do the inverse of what is done in the attach
* routine, in reversed order.
*/
static int
etherip_detach(device_t self, int flags)
{
struct etherip_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_ec.ec_if;
int error, s;
s = splnet();
etherip_stop(ifp, 1);
if_down(ifp);
splx(s);
/*
* Destroying a single leaf is a very straightforward operation using
* sysctl_destroyv. One should be sure to always end the path with
* CTL_EOL.
*/
error = sysctl_destroyv(NULL, CTL_NET, AF_LINK, etherip_node,
device_unit(self), CTL_EOL);
if (error)
aprint_error_dev(self,
"sysctl_destroyv returned %d, ignoring\n", error);
LIST_REMOVE(sc, etherip_list);
etherip_delete_tunnel(ifp);
ether_ifdetach(ifp);
if_detach(ifp);
rtcache_free(&sc->sc_ro);
ifmedia_delete_instance(&sc->sc_im, IFM_INST_ANY);
pmf_device_deregister(self);
return 0;
}
/*
* This function is called by the ifmedia layer to notify the driver
* that the user requested a media change. A real driver would
* reconfigure the hardware.
*/
static int
etherip_mediachange(struct ifnet *ifp)
{
return 0;
}
/*
* Here the user asks for the currently used media.
*/
static void
etherip_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
{
struct etherip_softc *sc = ifp->if_softc;
imr->ifm_active = sc->sc_im.ifm_cur->ifm_media;
}
static void
etherip_start(struct ifnet *ifp)
{
struct etherip_softc *sc = ifp->if_softc;
if (sc->sc_si)
softint_schedule(sc->sc_si);
}
static void
etheripintr(void *arg)
{
struct etherip_softc *sc = (struct etherip_softc *)arg;
struct ifnet *ifp = &sc->sc_ec.ec_if;
struct mbuf *m;
int s, error;
mutex_enter(softnet_lock);
for (;;) {
s = splnet();
IFQ_DEQUEUE(&ifp->if_snd, m);
splx(s);
if (m == NULL)
break;
bpf_mtap(ifp, m, BPF_D_OUT);
ifp->if_opackets++;
if (sc->sc_src && sc->sc_dst) {
ifp->if_flags |= IFF_OACTIVE;
switch (sc->sc_src->sa_family) {
#ifdef INET
case AF_INET:
error = ip_etherip_output(ifp, m);
break;
#endif
#ifdef INET6
case AF_INET6:
error = ip6_etherip_output(ifp, m);
break;
#endif
default:
/* impossible */
m_freem(m);
error = ENETDOWN;
}
ifp->if_flags &= ~IFF_OACTIVE;
} else {
m_freem(m);
}
}
mutex_exit(softnet_lock);
__USE(error);
}
static int
etherip_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct etherip_softc *sc = ifp->if_softc;
struct ifreq *ifr = data;
struct sockaddr *src, *dst;
int s, error;
switch (cmd) {
case SIOCSLIFPHYADDR:
src = (struct sockaddr *)
&(((struct if_laddrreq *)data)->addr);
dst = (struct sockaddr *)
&(((struct if_laddrreq *)data)->dstaddr);
/* sa_family must be equal */
if (src->sa_family != dst->sa_family)
return EINVAL;
/* validate sa_len */
switch (src->sa_family) {
#ifdef INET
case AF_INET:
if (src->sa_len != sizeof(struct sockaddr_in) ||
dst->sa_len != sizeof(struct sockaddr_in))
return EINVAL;
break;
#endif
#ifdef INET6
case AF_INET6:
if (src->sa_len != sizeof(struct sockaddr_in6) ||
dst->sa_len != sizeof(struct sockaddr_in6))
return EINVAL;
break;
#endif
default:
return EAFNOSUPPORT;
}
error = etherip_set_tunnel(ifp, src, dst);
break;
case SIOCDIFPHYADDR:
etherip_delete_tunnel(ifp);
error = 0;
break;
case SIOCGLIFPHYADDR:
if (sc->sc_src == NULL || sc->sc_dst == NULL)
return EADDRNOTAVAIL;
/* copy src */
src = sc->sc_src;
dst = (struct sockaddr *)
&(((struct if_laddrreq *)data)->addr);
if (src->sa_len > sizeof(((struct if_laddrreq *)data)->addr))
return EINVAL;
memcpy(dst, src, src->sa_len);
/* copy dst */
src = sc->sc_dst;
dst = (struct sockaddr *)
&(((struct if_laddrreq *)data)->dstaddr);
if (src->sa_len > sizeof(((struct if_laddrreq *)data)->dstaddr))
return EINVAL;
memcpy(dst, src, src->sa_len);
error = 0;
break;
#ifdef OSIOCSIFMEDIA
case OSIOCSIFMEDIA:
#endif
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
s = splnet();
error = ifmedia_ioctl(ifp, ifr, &sc->sc_im, cmd);
splx(s);
break;
default:
s = splnet();
error = ether_ioctl(ifp, cmd, data);
splx(s);
if (error == ENETRESET)
error = 0;
break;
}
return (error);
}
static int
etherip_set_tunnel(struct ifnet *ifp,
struct sockaddr *src,
struct sockaddr *dst)
{
struct etherip_softc *sc = ifp->if_softc;
struct etherip_softc *sc2;
struct sockaddr *osrc, *odst;
int s, error = 0;
s = splsoftnet();
LIST_FOREACH(sc2, &etherip_softc_list, etherip_list) {
if (sc2 == sc)
continue;
if (!sc2->sc_dst || !sc2->sc_src)
continue;
if (sc2->sc_dst->sa_family != dst->sa_family ||
sc2->sc_dst->sa_len != dst->sa_len ||
sc2->sc_src->sa_family != src->sa_family ||
sc2->sc_src->sa_len != src->sa_len)
continue;
/* can't configure same pair of address onto two tunnels */
if (memcmp(sc2->sc_dst, dst, dst->sa_len) == 0 &&
memcmp(sc2->sc_src, src, src->sa_len) == 0) {
error = EADDRNOTAVAIL;
goto out;
}
/* XXX both end must be valid? (I mean, not 0.0.0.0) */
}
if (sc->sc_si) {
softint_disestablish(sc->sc_si);
sc->sc_si = NULL;
}
ifp->if_flags &= ~IFF_RUNNING;
osrc = sc->sc_src; sc->sc_src = NULL;
odst = sc->sc_dst; sc->sc_dst = NULL;
sc->sc_src = sockaddr_dup(src, M_WAITOK);
if (osrc)
sockaddr_free(osrc);
sc->sc_dst = sockaddr_dup(dst, M_WAITOK);
if (odst)
sockaddr_free(odst);
sc->sc_si = softint_establish(SOFTINT_NET, etheripintr, sc);
if (sc->sc_si == NULL)
error = ENOMEM;
ifp->if_flags |= IFF_RUNNING;
out:
splx(s);
return(error);
}
static void
etherip_delete_tunnel(struct ifnet *ifp)
{
struct etherip_softc *sc = ifp->if_softc;
int s;
s = splsoftnet();
ifp->if_flags &= ~IFF_RUNNING;
if (sc->sc_si) {
softint_disestablish(sc->sc_si);
sc->sc_si = NULL;
}
if (sc->sc_src) {
sockaddr_free(sc->sc_src);
sc->sc_src = NULL;
}
if (sc->sc_dst) {
sockaddr_free(sc->sc_dst);
sc->sc_dst = NULL;
}
splx(s);
}
static int
etherip_init(struct ifnet *ifp)
{
struct etherip_softc *sc = ifp->if_softc;
if (sc->sc_si == NULL)
sc->sc_si = softint_establish(SOFTINT_NET, etheripintr, sc);
if (sc->sc_si == NULL)
return(ENOMEM);
ifp->if_flags |= IFF_RUNNING;
etherip_start(ifp);
return 0;
}
static void
etherip_stop(struct ifnet *ifp, int disable)
{
ifp->if_flags &= ~IFF_RUNNING;
}
static int
etherip_clone_create(struct if_clone *ifc, int unit)
{
cfdata_t cf;
cf = malloc(sizeof(struct cfdata), M_DEVBUF, M_WAITOK);
cf->cf_name = etherip_cd.cd_name;
cf->cf_atname = etherip_ca.ca_name;
cf->cf_unit = unit;
cf->cf_fstate = FSTATE_STAR;
if (config_attach_pseudo(cf) == NULL) {
aprint_error("%s%d: unable to attach an instance\n",
etherip_cd.cd_name, unit);
return (ENXIO);
}
return 0;
}
static int
etherip_clone_destroy(struct ifnet *ifp)
{
struct etherip_softc *sc = ifp->if_softc;
cfdata_t cf = device_cfdata(sc->sc_dev);
int error;
if ((error = config_detach(sc->sc_dev, 0)) != 0)
aprint_error_dev(sc->sc_dev, "unable to detach instance\n");
free(cf, M_DEVBUF);
return error;
}
SYSCTL_SETUP(sysctl_etherip_setup, "sysctl net.link.etherip subtree setup")
{
const struct sysctlnode *node;
int error = 0;
error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "link", NULL,
NULL, 0, NULL, 0,
CTL_NET, AF_LINK, CTL_EOL);
if (error)
return;
error = sysctl_createv(clog, 0, NULL, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "etherip", NULL,
NULL, 0, NULL, 0,
CTL_NET, AF_LINK, CTL_CREATE, CTL_EOL);
if (error)
return;
etherip_node = node->sysctl_num;
}
static int
etherip_sysctl_handler(SYSCTLFN_ARGS)
{
struct sysctlnode node;
struct etherip_softc *sc;
struct ifnet *ifp;
int error;
size_t len;
char addr[3 * ETHER_ADDR_LEN];
char enaddr[ETHER_ADDR_LEN];
node = *rnode;
sc = node.sysctl_data;
ifp = &sc->sc_ec.ec_if;
(void)ether_snprintf(addr, sizeof(addr), CLLADDR(ifp->if_sadl));
node.sysctl_data = addr;
error = sysctl_lookup(SYSCTLFN_CALL(&node));
if (error || newp == NULL)
return error;
len = strlen(addr);
if (len < 11 || len > 17)
return EINVAL;
/* Commit change */
if (ether_aton_r(enaddr, sizeof(enaddr), addr) != 0)
return EINVAL;
if_set_sadl(ifp, enaddr, ETHER_ADDR_LEN, false);
return error;
}

View File

@ -1,73 +0,0 @@
/* $NetBSD: if_etherip.h,v 1.12 2016/12/14 11:19:15 knakahara Exp $ */
/*
* Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* All rights reserved.
*
* 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. Neither the name of Hans Rosenfeld nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 _NET_IF_ETHERIP_H_
#define _NET_IF_ETHERIP_H_
#include <sys/queue.h>
#ifdef _KERNEL_OPT
#include "opt_inet.h"
#endif
#include <netinet/in.h>
struct etherip_softc {
struct ifmedia sc_im;
device_t sc_dev;
struct ethercom sc_ec;
struct sockaddr *sc_src; /* tunnel source address */
struct sockaddr *sc_dst; /* tunnel destination address */
struct route sc_ro; /*
* cached inet route
* TODO:
* we must make percpu when MP-ify
*/
void *sc_si; /* softintr handle */
LIST_ENTRY(etherip_softc) etherip_list; /* list of etherip tunnels */
};
LIST_HEAD(etherip_softc_list, etherip_softc);
extern struct etherip_softc_list etherip_softc_list;
struct etherip_header {
uint8_t eip_ver; /* version/reserved */
uint8_t eip_pad; /* required padding byte */
};
#define ETHERIP_VER_VERS_MASK 0x0f
#define ETHERIP_VER_RSVD_MASK 0xf0
#define ETHERIP_VERSION 0x03
#define ETHERIP_TTL 30
#define ETHERIP_ROUTE_TTL 10
#endif /* !_NET_IF_ETHERIP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_proto.c,v 1.128 2018/05/03 07:13:48 maxv Exp $ */
/* $NetBSD: in_proto.c,v 1.129 2018/08/14 14:49:14 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.128 2018/05/03 07:13:48 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.129 2018/08/14 14:49:14 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_mrouting.h"
@ -144,11 +144,6 @@ __KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.128 2018/05/03 07:13:48 maxv Exp $");
#include <net/if_pfsync.h>
#endif
#include "etherip.h"
#if NETHERIP > 0
#include <netinet/ip_etherip.h>
#endif
DOMAIN_DEFINE(inetdomain); /* forward declare and add to link set */
/* Wrappers to acquire kernel_lock. */
@ -195,9 +190,6 @@ PR_WRAP_INPUT(dccp_input)
PR_WRAP_INPUT(sctp_input)
#endif
PR_WRAP_INPUT(rip_input)
#if NETHERIP > 0
PR_WRAP_INPUT(ip_etherip_input)
#endif
#if NPFSYNC > 0
PR_WRAP_INPUT(pfsync_input)
#endif
@ -211,7 +203,6 @@ PR_WRAP_INPUT(pim_input)
#define dccp_input dccp_input_wrapper
#define sctp_input sctp_input_wrapper
#define rip_input rip_input_wrapper
#define ip_etherip_input ip_etherip_input_wrapper
#define pfsync_input pfsync_input_wrapper
#define igmp_input igmp_input_wrapper
#define pim_input pim_input_wrapper
@ -416,17 +407,6 @@ const struct protosw inetsw[] = {
.pr_init = encap_init,
},
#endif /* INET6 */
#if NETHERIP > 0
{ .pr_type = SOCK_RAW,
.pr_domain = &inetdomain,
.pr_protocol = IPPROTO_ETHERIP,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = ip_etherip_input,
.pr_ctlinput = rip_ctlinput,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs,
},
#endif /* NETHERIP > 0 */
#if NCARP > 0
{ .pr_type = SOCK_RAW,
.pr_domain = &inetdomain,

View File

@ -1,267 +0,0 @@
/* $NetBSD: ip_etherip.c,v 1.21 2018/01/26 14:47:41 maxv Exp $ */
/*
* Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* All rights reserved.
*
* 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. Neither the name of Hans Rosenfeld nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*/
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_etherip.c,v 1.21 2018/01/26 14:47:41 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/kernel.h>
#include <net/if.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/in_var.h>
#include <netinet/ip_etherip.h>
#include <net/if_ether.h>
#include <net/if_media.h>
#include <net/if_etherip.h>
#include <net/bpf.h>
int
ip_etherip_output(struct ifnet *ifp, struct mbuf *m)
{
struct rtentry *rt;
struct etherip_softc *sc = (struct etherip_softc*)ifp->if_softc;
struct sockaddr_in *sin_src, *sin_dst;
struct ip iphdr; /* capsule IP header, host byte ordered */
struct etherip_header eiphdr;
int proto, error;
union {
struct sockaddr dst;
struct sockaddr_in dst4;
} u;
sin_src = (struct sockaddr_in *)sc->sc_src;
sin_dst = (struct sockaddr_in *)sc->sc_dst;
if (sin_src == NULL ||
sin_dst == NULL ||
sin_src->sin_family != AF_INET ||
sin_dst->sin_family != AF_INET) {
m_freem(m);
return EAFNOSUPPORT;
}
/* reset broadcast/multicast flags */
m->m_flags &= ~(M_BCAST|M_MCAST);
KASSERT((m->m_flags & M_PKTHDR) != 0);
proto = IPPROTO_ETHERIP;
/* fill and prepend Ethernet-in-IP header */
eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
eiphdr.eip_pad = 0;
M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT);
if (m == NULL)
return ENOBUFS;
if (M_UNWRITABLE(m, sizeof(struct etherip_header))) {
m = m_pullup(m, sizeof(struct etherip_header));
if (m == NULL)
return ENOBUFS;
}
memcpy(mtod(m, struct etherip_header *), &eiphdr,
sizeof(struct etherip_header));
/* fill new IP header */
memset(&iphdr, 0, sizeof(struct ip));
iphdr.ip_src = sin_src->sin_addr;
/* bidirectional configured tunnel mode */
if (sin_dst->sin_addr.s_addr != INADDR_ANY)
iphdr.ip_dst = sin_dst->sin_addr;
else {
m_freem(m);
return ENETUNREACH;
}
iphdr.ip_p = proto;
/* version will be set in ip_output() */
iphdr.ip_ttl = ETHERIP_TTL;
iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip));
/* prepend new IP header */
M_PREPEND(m, sizeof(struct ip), M_DONTWAIT);
if (m == NULL)
return ENOBUFS;
if (M_UNWRITABLE(m, sizeof(struct ip)))
m = m_pullup(m, sizeof(struct ip));
if (m == NULL)
return ENOBUFS;
memcpy(mtod(m, struct ip *), &iphdr, sizeof(struct ip));
sockaddr_in_init(&u.dst4, &sin_dst->sin_addr, 0);
if ((rt = rtcache_lookup(&sc->sc_ro, &u.dst)) == NULL) {
m_freem(m);
return ENETUNREACH;
}
/* if it constitutes infinite encapsulation, punt. */
if (rt->rt_ifp == ifp) {
rtcache_unref(rt, &sc->sc_ro);
rtcache_free(&sc->sc_ro);
m_freem(m);
return ENETUNREACH; /*XXX*/
}
rtcache_unref(rt, &sc->sc_ro);
error = ip_output(m, NULL, &sc->sc_ro, 0, NULL, NULL);
return error;
}
void
ip_etherip_input(struct mbuf *m, ...)
{
struct etherip_softc *sc;
const struct ip *ip;
struct sockaddr_in *src, *dst;
struct ifnet *ifp = NULL;
int off, proto, s;
va_list ap;
va_start(ap, m);
off = va_arg(ap, int);
proto = va_arg(ap, int);
va_end(ap);
if (proto != IPPROTO_ETHERIP) {
m_freem(m);
ip_statinc(IP_STAT_NOPROTO);
return;
}
ip = mtod(m, const struct ip *);
/* find device configured for this packet's src and dst */
LIST_FOREACH(sc, &etherip_softc_list, etherip_list) {
if (!sc->sc_src || !sc->sc_dst)
continue;
if (sc->sc_src->sa_family != AF_INET ||
sc->sc_dst->sa_family != AF_INET)
continue;
src = (struct sockaddr_in *)sc->sc_src;
dst = (struct sockaddr_in *)sc->sc_dst;
if (src->sin_addr.s_addr != ip->ip_dst.s_addr ||
dst->sin_addr.s_addr != ip->ip_src.s_addr)
continue;
ifp = &sc->sc_ec.ec_if;
break;
}
/* no matching device found */
if (!ifp) {
m_freem(m);
ip_statinc(IP_STAT_ODROPPED);
return;
}
m_adj(m, off);
/*
* Section 4 of RFC 3378 requires that the EtherIP header of incoming
* packets is verified to contain the correct values in the version and
* reserved fields, and packets with wrong values be dropped.
*
* There is some discussion about what exactly the header should look
* like, the RFC is not very clear there. To be compatible with broken
* implementations, we don't check the header on incoming packets,
* relying on the ethernet code to filter out garbage.
*
* The header we use for sending is compatible with the original
* implementation in OpenBSD, which was used in former NetBSD versions
* and is used in FreeBSD. One Linux implementation is known to use the
* same value.
*/
m_adj(m, sizeof(struct etherip_header));
m = m_pullup(m, sizeof(struct ether_header));
if (m == NULL) {
ifp->if_ierrors++;
return;
}
m_set_rcvif(m, ifp);
m->m_flags &= ~(M_BCAST|M_MCAST);
s = splnet();
if_input(ifp, m);
splx(s);
return;
}

View File

@ -1,38 +0,0 @@
/* $NetBSD: ip_etherip.h,v 1.1 2006/11/23 04:07:07 rpaulo Exp $ */
/*
* Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* All rights reserved.
*
* 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. Neither the name of Hans Rosenfeld nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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_ETHERIP_H_
#define _NETINET_IP_ETHERIP_H_
int ip_etherip_output(struct ifnet *, struct mbuf *);
void ip_etherip_input(struct mbuf *, ...);
#endif /* !_NETINET_IP_ETHERIP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_proto.c,v 1.125 2018/05/11 09:43:59 roy Exp $ */
/* $NetBSD: in6_proto.c,v 1.126 2018/08/14 14:49:14 maxv Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.125 2018/05/11 09:43:59 roy Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.126 2018/08/14 14:49:14 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@ -130,11 +130,6 @@ __KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.125 2018/05/11 09:43:59 roy Exp $");
#include <netinet/ip_carp.h>
#endif
#include "etherip.h"
#if NETHERIP > 0
#include <netinet6/ip6_etherip.h>
#endif
#include <netinet6/ip6protosw.h>
/*
@ -194,9 +189,6 @@ PR_WRAP_INPUT6(rip6_input)
PR_WRAP_INPUT6(dest6_input)
PR_WRAP_INPUT6(route6_input)
PR_WRAP_INPUT6(frag6_input)
#if NETHERIP > 0
PR_WRAP_INPUT6(ip6_etherip_input)
#endif
#if NPFSYNC > 0
PR_WRAP_INPUT6(pfsync_input)
#endif
@ -210,7 +202,6 @@ PR_WRAP_INPUT6(pim6_input)
#define dest6_input dest6_input_wrapper
#define route6_input route6_input_wrapper
#define frag6_input frag6_input_wrapper
#define ip6_etherip_input ip6_etherip_input_wrapper
#define pim6_input pim6_input_wrapper
#endif
@ -434,17 +425,6 @@ const struct ip6protosw inet6sw[] = {
.pr_usrreqs = &rip6_usrreqs,
.pr_init = encap_init,
},
#if NETHERIP > 0
{ .pr_type = SOCK_RAW,
.pr_domain = &inet6domain,
.pr_protocol = IPPROTO_ETHERIP,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = ip6_etherip_input,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs,
},
#endif
#if NCARP > 0
{ .pr_type = SOCK_RAW,
.pr_domain = &inet6domain,

View File

@ -1,269 +0,0 @@
/* $NetBSD: ip6_etherip.c,v 1.22 2018/01/26 14:47:41 maxv Exp $ */
/*
* Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* All rights reserved.
*
* 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. Neither the name of Hans Rosenfeld nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*/
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_etherip.c,v 1.22 2018/01/26 14:47:41 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/kernel.h>
#include <net/if.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#ifdef INET
#include <netinet/ip.h>
#endif
#ifdef INET6
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/ip6_private.h>
#include <netinet6/in6_var.h>
#include <netinet6/ip6_etherip.h>
#endif
#include <net/if_ether.h>
#include <net/if_media.h>
#include <net/if_etherip.h>
#include <net/bpf.h>
int
ip6_etherip_output(struct ifnet *ifp, struct mbuf *m)
{
struct rtentry *rt;
struct etherip_softc *sc = (struct etherip_softc *)ifp->if_softc;
struct sockaddr_in6 *sin6_src, *sin6_dst;
struct ip6_hdr *ip6; /* capsule IP header, host byte ordered */
struct etherip_header eiphdr;
int proto, error;
union {
struct sockaddr dst;
struct sockaddr_in6 dst6;
} u;
sin6_src = (struct sockaddr_in6 *)sc->sc_src;
sin6_dst = (struct sockaddr_in6 *)sc->sc_dst;
if (sin6_src == NULL ||
sin6_dst == NULL ||
sin6_src->sin6_family != AF_INET6 ||
sin6_dst->sin6_family != AF_INET6) {
m_freem(m);
return EAFNOSUPPORT;
}
/* reset broadcast/multicast flags */
m->m_flags &= ~(M_BCAST|M_MCAST);
KASSERT((m->m_flags & M_PKTHDR) != 0);
proto = IPPROTO_ETHERIP;
/* fill and prepend Ethernet-in-IP header */
eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
eiphdr.eip_pad = 0;
M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT);
if (m == NULL)
return ENOBUFS;
if (M_UNWRITABLE(m, sizeof(struct etherip_header))) {
m = m_pullup(m, sizeof(struct etherip_header));
if (m == NULL)
return ENOBUFS;
}
memcpy(mtod(m, struct etherip_header *), &eiphdr,
sizeof(struct etherip_header));
/* prepend new IP header */
M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT);
if (m && m->m_len < sizeof(struct ip6_hdr))
m = m_pullup(m, sizeof(struct ip6_hdr));
if (m == NULL)
return ENOBUFS;
ip6 = mtod(m, struct ip6_hdr *);
ip6->ip6_flow = 0;
ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
ip6->ip6_vfc |= IPV6_VERSION;
ip6->ip6_nxt = proto;
ip6->ip6_hlim = ETHERIP_TTL;
ip6->ip6_src = sin6_src->sin6_addr;
/* bidirectional configured tunnel mode */
if (!IN6_IS_ADDR_UNSPECIFIED(&sin6_dst->sin6_addr))
ip6->ip6_dst = sin6_dst->sin6_addr;
else {
m_freem(m);
return ENETUNREACH;
}
sockaddr_in6_init(&u.dst6, &sin6_dst->sin6_addr, 0, 0, 0);
if ((rt = rtcache_lookup(&sc->sc_ro, &u.dst)) == NULL) {
m_freem(m);
return ENETUNREACH;
}
/* if it constitutes infinite encapsulation, punt. */
if (rt->rt_ifp == ifp) {
rtcache_unref(rt, &sc->sc_ro);
rtcache_free(&sc->sc_ro);
m_freem(m);
return ENETUNREACH; /* XXX */
}
rtcache_unref(rt, &sc->sc_ro);
/*
* force fragmentation to minimum MTU, to avoid path MTU discovery.
* it is too painful to ask for resend of inner packet, to achieve
* path MTU discovery for encapsulated packets.
*/
error = ip6_output(m, 0, &sc->sc_ro, IPV6_MINMTU, NULL, NULL, NULL);
return error;
}
int
ip6_etherip_input(struct mbuf **mp, int *offp, int proto)
{
struct mbuf *m = *mp;
int off = *offp;
struct etherip_softc *sc;
const struct ip6_hdr *ip6;
struct sockaddr_in6 *src6, *dst6;
struct ifnet *ifp = NULL;
int s;
if (proto != IPPROTO_ETHERIP) {
m_freem(m);
IP6_STATINC(IP6_STAT_NOGIF);
return IPPROTO_DONE;
}
ip6 = mtod(m, const struct ip6_hdr *);
/* find device configured for this packet's src and dst */
LIST_FOREACH(sc, &etherip_softc_list, etherip_list) {
if (!sc->sc_src || !sc->sc_dst)
continue;
if (sc->sc_src->sa_family != AF_INET6 ||
sc->sc_dst->sa_family != AF_INET6)
continue;
src6 = (struct sockaddr_in6 *)sc->sc_src;
dst6 = (struct sockaddr_in6 *)sc->sc_dst;
if (!IN6_ARE_ADDR_EQUAL(&src6->sin6_addr, &ip6->ip6_dst) ||
!IN6_ARE_ADDR_EQUAL(&dst6->sin6_addr, &ip6->ip6_src))
continue;
ifp = &sc->sc_ec.ec_if;
break;
}
/* no matching device found */
if (!ifp) {
m_freem(m);
IP6_STATINC(IP6_STAT_ODROPPED);
return IPPROTO_DONE;
}
m_adj(m, off);
/*
* Section 4 of RFC 3378 requires that the EtherIP header of incoming
* packets is verified to contain the correct values in the version and
* reserved fields, and packets with wrong values be dropped.
*
* There is some discussion about what exactly the header should look
* like, the RFC is not very clear there. To be compatible with broken
* implementations, we don't check the header on incoming packets,
* relying on the ethernet code to filter out garbage.
*
* The header we use for sending is compatible with the original
* implementation in OpenBSD, which was used in former NetBSD versions
* and is used in FreeBSD. One Linux implementation is known to use the
* same value.
*/
m_adj(m, sizeof(struct etherip_header));
m = m_pullup(m, sizeof(struct ether_header));
if (m == NULL) {
ifp->if_ierrors++;
return IPPROTO_DONE;
}
m_set_rcvif(m, ifp);
m->m_flags &= ~(M_BCAST|M_MCAST);
s = splnet();
if_input(ifp, m);
splx(s);
return IPPROTO_DONE;
}

View File

@ -1,38 +0,0 @@
/* $NetBSD: ip6_etherip.h,v 1.2 2010/08/24 00:07:00 jakllsch Exp $ */
/*
* Copyright (c) 2006, Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* All rights reserved.
*
* 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. Neither the name of Hans Rosenfeld nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 _NETINET6_IP6_ETHERIP_H_
#define _NETINET6_IP6_ETHERIP_H_
int ip6_etherip_output(struct ifnet *, struct mbuf *);
int ip6_etherip_input(struct mbuf **, int *, int);
#endif /* !_NETINET6_IP6_ETHERIP_H_ */

View File

@ -1,3 +0,0 @@
/* $NetBSD: etherip.h,v 1.1 2015/08/24 23:04:42 pooka Exp $ */
/* dummy */