Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src add l2tp(4) L2TPv3 interface.
details: https://anonhg.NetBSD.org/src/rev/cc9c1734bdd0
branches: trunk
changeset: 351493:cc9c1734bdd0
user: knakahara <knakahara%NetBSD.org@localhost>
date: Thu Feb 16 08:12:43 2017 +0000
description:
add l2tp(4) L2TPv3 interface.
originally implemented by IIJ SEIL team.
diffstat:
distrib/sets/lists/comp/mi | 5 ++++-
distrib/sets/lists/modules/mi | 4 +++-
sys/conf/files | 5 ++++-
sys/modules/Makefile | 3 ++-
sys/net/Makefile | 4 ++--
sys/net/files.net | 5 ++++-
sys/net/if_bridge.c | 17 ++++++++++-------
sys/net/if_types.h | 3 ++-
sys/netinet/Makefile | 4 ++--
sys/netinet/in.h | 3 ++-
sys/netinet/in_proto.c | 14 ++++++++++++--
sys/netinet/ip_var.h | 5 +++--
sys/netinet6/Makefile | 4 ++--
sys/netinet6/in6_ifattach.c | 5 +++--
sys/netinet6/in6_proto.c | 14 ++++++++++++--
15 files changed, 67 insertions(+), 28 deletions(-)
diffs (truncated from 382 to 300 lines):
diff -r 507575cb4b2f -r cc9c1734bdd0 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Thu Feb 16 08:08:01 2017 +0000
+++ b/distrib/sets/lists/comp/mi Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.2108 2017/02/08 03:44:40 kamil Exp $
+# $NetBSD: mi,v 1.2109 2017/02/16 08:12:43 knakahara Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
./etc/mtree/set.comp comp-sys-root
@@ -2215,6 +2215,7 @@
./usr/include/net/if_hippi.h comp-c-include
./usr/include/net/if_ieee1394.h comp-c-include
./usr/include/net/if_ieee80211.h comp-obsolete obsolete
+./usr/include/net/if_l2tp.h comp-c-include
./usr/include/net/if_llc.h comp-c-include
./usr/include/net/if_media.h comp-c-include
./usr/include/net/if_mpls.h comp-c-include
@@ -2296,6 +2297,7 @@
./usr/include/netinet/igmp_var.h comp-c-include
./usr/include/netinet/in.h comp-c-include
./usr/include/netinet/in_gif.h comp-c-include
+./usr/include/netinet/in_l2tp.h comp-c-include
./usr/include/netinet/in_pcb.h comp-c-include
./usr/include/netinet/in_pcb_hdr.h comp-c-include
./usr/include/netinet/in_route.h comp-obsolete obsolete
@@ -2349,6 +2351,7 @@
./usr/include/netinet6/in6_gif.h comp-c-include
./usr/include/netinet6/in6_ifattach.h comp-c-include
./usr/include/netinet6/in6_pcb.h comp-c-include
+./usr/include/netinet6/in6_l2tp.h comp-c-include
./usr/include/netinet6/in6_var.h comp-c-include
./usr/include/netinet6/ip6.h comp-obsolete obsolete
./usr/include/netinet6/ip6_mroute.h comp-c-include
diff -r 507575cb4b2f -r cc9c1734bdd0 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi Thu Feb 16 08:08:01 2017 +0000
+++ b/distrib/sets/lists/modules/mi Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.107 2017/01/04 15:45:18 christos Exp $
+# $NetBSD: mi,v 1.108 2017/02/16 08:12:43 knakahara Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -150,6 +150,8 @@
./@MODULEDIR@/if_gif/if_gif.kmod base-kernel-modules kmod
./@MODULEDIR@/if_gre base-kernel-modules kmod
./@MODULEDIR@/if_gre/if_gre.kmod base-kernel-modules kmod
+./@MODULEDIR@/if_l2tp base-kernel-modules kmod
+./@MODULEDIR@/if_l2tp/if_l2tp.kmod base-kernel-modules kmod
./@MODULEDIR@/if_loop base-kernel-modules kmod
./@MODULEDIR@/if_loop/if_loop.kmod base-kernel-modules kmod
./@MODULEDIR@/if_mpls base-kernel-modules kmod
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/conf/files
--- a/sys/conf/files Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/conf/files Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1169 2017/02/02 19:50:35 macallan Exp $
+# $NetBSD: files,v 1.1170 2017/02/16 08:12:43 knakahara Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20150846
@@ -120,6 +120,8 @@
defflag opt_gre.h GRE_DEBUG
+defparam opt_l2tp.h L2TP_ID_HASH_SIZE
+
# Write Ahead Physical Block Logging
defflag opt_wapbl.h WAPBL WAPBL_DEBUG
defparam opt_wapbl.h WAPBL_DEBUG_PRINT
@@ -1435,6 +1437,7 @@
defpseudodev tap: ifnet, ether, arp
defpseudo carp: ifnet, ether, arp
defpseudodev etherip: ifnet, ether, arp
+defpseudodev l2tp: ifnet, ether, arp
defpseudo sequencer
defpseudo clockctl
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/modules/Makefile
--- a/sys/modules/Makefile Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/modules/Makefile Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.188 2016/12/15 06:48:14 pgoyette Exp $
+# $NetBSD: Makefile,v 1.189 2017/02/16 08:12:43 knakahara Exp $
.include <bsd.own.mk>
@@ -55,6 +55,7 @@
SUBDIR+= if_faith
SUBDIR+= if_gif
SUBDIR+= if_gre
+SUBDIR+= if_l2tp
SUBDIR+= if_loop
SUBDIR+= if_mpls
SUBDIR+= if_npflog
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/net/Makefile
--- a/sys/net/Makefile Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/net/Makefile Thu Feb 16 08:12:43 2017 +0000
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.32 2012/10/27 22:36:14 alnsn Exp $
+# $NetBSD: Makefile,v 1.33 2017/02/16 08:12:44 knakahara 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_gre.h if_hippi.h if_ieee1394.h if_llc.h if_media.h if_mpls.h \
- if_pflog.h if_ppp.h if_pppoe.h if_sppp.h if_srt.h if_stf.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 \
netisr.h pfil.h pfkeyv2.h pfvar.h ppp-comp.h ppp_defs.h radix.h \
raw_cb.h route.h slcompress.h slip.h zlib.h
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/net/files.net
--- a/sys/net/files.net Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/net/files.net Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.net,v 1.12 2017/02/02 02:52:10 ozaki-r Exp $
+# $NetBSD: files.net,v 1.13 2017/02/16 08:12:44 knakahara Exp $
# XXX CLEANUP
define net
@@ -23,6 +23,7 @@
file net/if_hippisubr.c hippi needs-flag
file net/if_ieee1394subr.c ieee1394
file net/if_llatbl.c inet | inet6
+file net/if_l2tp.c l2tp needs-flag
file net/if_loop.c loop
file net/if_media.c net
file net/if_mpls.c mpls needs-flag
@@ -58,6 +59,7 @@
file netinet/in4_cksum.c inet
file netinet/in_cksum.c inet
file netinet/in_gif.c gif & inet
+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
@@ -65,6 +67,7 @@
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
include "net/agr/files.agr"
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/net/if_bridge.c Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bridge.c,v 1.132 2017/01/23 10:19:03 ozaki-r Exp $ */
+/* $NetBSD: if_bridge.c,v 1.133 2017/02/16 08:12:44 knakahara Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.132 2017/01/23 10:19:03 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.133 2017/02/16 08:12:44 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_bridge_ipf.h"
@@ -735,11 +735,6 @@
if (ifs == NULL)
return (ENOENT);
- if (sc->sc_if.if_mtu != ifs->if_mtu) {
- error = EINVAL;
- goto out;
- }
-
if (ifs->if_bridge == sc) {
error = EEXIST;
goto out;
@@ -765,6 +760,12 @@
switch (ifs->if_type) {
case IFT_ETHER:
+ if (sc->sc_if.if_mtu != ifs->if_mtu) {
+ error = EINVAL;
+ goto out;
+ }
+ /* FALLTHROUGH */
+ case IFT_L2TP:
if ((error = ether_enable_vlan_mtu(ifs)) > 0)
goto out;
/*
@@ -840,6 +841,7 @@
switch (ifs->if_type) {
case IFT_ETHER:
+ case IFT_L2TP:
/*
* Take the interface out of promiscuous mode.
* Don't call it with holding a spin lock.
@@ -898,6 +900,7 @@
if (req->ifbr_ifsflags & IFBIF_STP) {
switch (bif->bif_ifp->if_type) {
case IFT_ETHER:
+ case IFT_L2TP:
/* These can do spanning tree. */
break;
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/net/if_types.h
--- a/sys/net/if_types.h Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/net/if_types.h Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_types.h,v 1.26 2012/08/05 21:21:41 wiz Exp $ */
+/* $NetBSD: if_types.h,v 1.27 2017/02/16 08:12:44 knakahara Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -263,6 +263,7 @@
#define IFT_FAITH 0xf2
#define IFT_PFLOG 0xf5 /* Packet filter logging */
#define IFT_PFSYNC 0xf6 /* Packet filter state syncing */
+#define IFT_L2TP 0xf7 /* L2TPv3 I/F */
#define IFT_CARP 0xf8 /* Common Address Redundancy Protocol */
#endif /* !_NET_IF_TYPES_H_ */
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/netinet/Makefile
--- a/sys/netinet/Makefile Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/netinet/Makefile Thu Feb 16 08:12:43 2017 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.27 2015/10/13 21:28:35 rjs Exp $
+# $NetBSD: Makefile,v 1.28 2017/02/16 08:12:44 knakahara Exp $
INCSDIR= /usr/include/netinet
INCS= dccp.h icmp6.h icmp_var.h if_atm.h if_ether.h if_inarp.h igmp.h \
- igmp_var.h in.h in_gif.h in_pcb.h in_pcb_hdr.h \
+ igmp_var.h in.h in_gif.h in_l2tp.h in_pcb.h in_pcb_hdr.h \
in_selsrc.h in_systm.h \
in_var.h ip.h ip_carp.h ip6.h ip_ecn.h ip_encap.h \
ip_icmp.h ip_mroute.h ip_var.h pim.h pim_var.h portalgo.h \
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/netinet/in.h
--- a/sys/netinet/in.h Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/netinet/in.h Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in.h,v 1.99 2016/08/01 03:15:30 ozaki-r Exp $ */
+/* $NetBSD: in.h,v 1.100 2017/02/16 08:12:44 knakahara Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -105,6 +105,7 @@
#define IPPROTO_IPCOMP 108 /* IP Payload Comp. Protocol */
#define IPPROTO_VRRP 112 /* VRRP RFC 2338 */
#define IPPROTO_CARP 112 /* Common Address Resolution Protocol */
+#define IPPROTO_L2TP 115 /* L2TPv3 */
#define IPPROTO_SCTP 132 /* SCTP */
#define IPPROTO_PFSYNC 240 /* PFSYNC */
#define IPPROTO_RAW 255 /* raw IP packet */
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/netinet/in_proto.c
--- a/sys/netinet/in_proto.c Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/netinet/in_proto.c Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_proto.c,v 1.121 2017/02/13 07:18:20 ozaki-r Exp $ */
+/* $NetBSD: in_proto.c,v 1.122 2017/02/16 08:12:44 knakahara 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.121 2017/02/13 07:18:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.122 2017/02/16 08:12:44 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_mrouting.h"
@@ -360,6 +360,16 @@
.pr_init = carp_init,
},
#endif /* NCARP > 0 */
+{ .pr_type = SOCK_RAW,
+ .pr_domain = &inetdomain,
+ .pr_protocol = IPPROTO_L2TP,
+ .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
+ .pr_input = encap4_input,
+ .pr_ctlinput = rip_ctlinput,
+ .pr_ctloutput = rip_ctloutput,
+ .pr_usrreqs = &rip_usrreqs, /*XXX*/
+ .pr_init = encap_init,
+},
#if NPFSYNC > 0
{ .pr_type = SOCK_RAW,
.pr_domain = &inetdomain,
diff -r 507575cb4b2f -r cc9c1734bdd0 sys/netinet/ip_var.h
--- a/sys/netinet/ip_var.h Thu Feb 16 08:08:01 2017 +0000
+++ b/sys/netinet/ip_var.h Thu Feb 16 08:12:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_var.h,v 1.116 2016/12/08 05:16:33 ozaki-r Exp $ */
+/* $NetBSD: ip_var.h,v 1.117 2017/02/16 08:12:44 knakahara Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -157,8 +157,9 @@
#define IP_STAT_TOOLONG 27 /* ip length > max ip packet size */
#define IP_STAT_NOGIF 28 /* no match gif found */
#define IP_STAT_BADADDR 29 /* invalid address on header */
Home |
Main Index |
Thread Index |
Old Index