Module Name: src Committed By: knakahara Date: Thu Feb 16 08:12:44 UTC 2017
Modified Files: src/distrib/sets/lists/comp: mi src/distrib/sets/lists/modules: mi src/sys/conf: files src/sys/modules: Makefile src/sys/net: Makefile files.net if_bridge.c if_types.h src/sys/netinet: Makefile in.h in_proto.c ip_var.h src/sys/netinet6: Makefile in6_ifattach.c in6_proto.c Log Message: add l2tp(4) L2TPv3 interface. originally implemented by IIJ SEIL team. To generate a diff of this commit: cvs rdiff -u -r1.2108 -r1.2109 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.107 -r1.108 src/distrib/sets/lists/modules/mi cvs rdiff -u -r1.1169 -r1.1170 src/sys/conf/files cvs rdiff -u -r1.188 -r1.189 src/sys/modules/Makefile cvs rdiff -u -r1.32 -r1.33 src/sys/net/Makefile cvs rdiff -u -r1.12 -r1.13 src/sys/net/files.net cvs rdiff -u -r1.132 -r1.133 src/sys/net/if_bridge.c cvs rdiff -u -r1.26 -r1.27 src/sys/net/if_types.h cvs rdiff -u -r1.27 -r1.28 src/sys/netinet/Makefile cvs rdiff -u -r1.99 -r1.100 src/sys/netinet/in.h cvs rdiff -u -r1.121 -r1.122 src/sys/netinet/in_proto.c cvs rdiff -u -r1.116 -r1.117 src/sys/netinet/ip_var.h cvs rdiff -u -r1.8 -r1.9 src/sys/netinet6/Makefile cvs rdiff -u -r1.110 -r1.111 src/sys/netinet6/in6_ifattach.c cvs rdiff -u -r1.115 -r1.116 src/sys/netinet6/in6_proto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2108 src/distrib/sets/lists/comp/mi:1.2109 --- src/distrib/sets/lists/comp/mi:1.2108 Wed Feb 8 03:44:40 2017 +++ src/distrib/sets/lists/comp/mi Thu Feb 16 08:12:43 2017 @@ -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 Index: src/distrib/sets/lists/modules/mi diff -u src/distrib/sets/lists/modules/mi:1.107 src/distrib/sets/lists/modules/mi:1.108 --- src/distrib/sets/lists/modules/mi:1.107 Wed Jan 4 15:45:18 2017 +++ src/distrib/sets/lists/modules/mi Thu Feb 16 08:12:43 2017 @@ -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 Index: src/sys/conf/files diff -u src/sys/conf/files:1.1169 src/sys/conf/files:1.1170 --- src/sys/conf/files:1.1169 Thu Feb 2 19:50:35 2017 +++ src/sys/conf/files Thu Feb 16 08:12:43 2017 @@ -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_fileassoc.h FILEASSOC 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 @@ defpseudo stf: ifnet defpseudodev tap: ifnet, ether, arp defpseudo carp: ifnet, ether, arp defpseudodev etherip: ifnet, ether, arp +defpseudodev l2tp: ifnet, ether, arp defpseudo sequencer defpseudo clockctl Index: src/sys/modules/Makefile diff -u src/sys/modules/Makefile:1.188 src/sys/modules/Makefile:1.189 --- src/sys/modules/Makefile:1.188 Thu Dec 15 06:48:14 2016 +++ src/sys/modules/Makefile Thu Feb 16 08:12:43 2017 @@ -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_axen SUBDIR+= if_faith SUBDIR+= if_gif SUBDIR+= if_gre +SUBDIR+= if_l2tp SUBDIR+= if_loop SUBDIR+= if_mpls SUBDIR+= if_npflog Index: src/sys/net/Makefile diff -u src/sys/net/Makefile:1.32 src/sys/net/Makefile:1.33 --- src/sys/net/Makefile:1.32 Sat Oct 27 22:36:14 2012 +++ src/sys/net/Makefile Thu Feb 16 08:12:44 2017 @@ -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 Index: src/sys/net/files.net diff -u src/sys/net/files.net:1.12 src/sys/net/files.net:1.13 --- src/sys/net/files.net:1.12 Thu Feb 2 02:52:10 2017 +++ src/sys/net/files.net Thu Feb 16 08:12:44 2017 @@ -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_gre.c gre needs-flag 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/if_atm.c atm 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/ip_etherip.c etherip & ine 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" Index: src/sys/net/if_bridge.c diff -u src/sys/net/if_bridge.c:1.132 src/sys/net/if_bridge.c:1.133 --- src/sys/net/if_bridge.c:1.132 Mon Jan 23 10:19:03 2017 +++ src/sys/net/if_bridge.c Thu Feb 16 08:12:44 2017 @@ -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 @@ bridge_ioctl_add(struct bridge_softc *sc 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 @@ bridge_ioctl_add(struct bridge_softc *sc 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 @@ bridge_ioctl_del(struct bridge_softc *sc 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 @@ bridge_ioctl_sifflags(struct bridge_soft if (req->ifbr_ifsflags & IFBIF_STP) { switch (bif->bif_ifp->if_type) { case IFT_ETHER: + case IFT_L2TP: /* These can do spanning tree. */ break; Index: src/sys/net/if_types.h diff -u src/sys/net/if_types.h:1.26 src/sys/net/if_types.h:1.27 --- src/sys/net/if_types.h:1.26 Sun Aug 5 21:21:41 2012 +++ src/sys/net/if_types.h Thu Feb 16 08:12:44 2017 @@ -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_ */ Index: src/sys/netinet/Makefile diff -u src/sys/netinet/Makefile:1.27 src/sys/netinet/Makefile:1.28 --- src/sys/netinet/Makefile:1.27 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/Makefile Thu Feb 16 08:12:44 2017 @@ -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 \ Index: src/sys/netinet/in.h diff -u src/sys/netinet/in.h:1.99 src/sys/netinet/in.h:1.100 --- src/sys/netinet/in.h:1.99 Mon Aug 1 03:15:30 2016 +++ src/sys/netinet/in.h Thu Feb 16 08:12:44 2017 @@ -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 @@ typedef __sa_family_t sa_family_t; #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 */ Index: src/sys/netinet/in_proto.c diff -u src/sys/netinet/in_proto.c:1.121 src/sys/netinet/in_proto.c:1.122 --- src/sys/netinet/in_proto.c:1.121 Mon Feb 13 07:18:20 2017 +++ src/sys/netinet/in_proto.c Thu Feb 16 08:12:44 2017 @@ -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 @@ const struct protosw inetsw[] = { .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, Index: src/sys/netinet/ip_var.h diff -u src/sys/netinet/ip_var.h:1.116 src/sys/netinet/ip_var.h:1.117 --- src/sys/netinet/ip_var.h:1.116 Thu Dec 8 05:16:33 2016 +++ src/sys/netinet/ip_var.h Thu Feb 16 08:12:44 2017 @@ -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 @@ struct ip_moptions { #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 */ +#define IP_STAT_NOL2TP 30 /* no match l2tp found */ -#define IP_NSTATS 30 +#define IP_NSTATS 31 #ifdef _KERNEL Index: src/sys/netinet6/Makefile diff -u src/sys/netinet6/Makefile:1.8 src/sys/netinet6/Makefile:1.9 --- src/sys/netinet6/Makefile:1.8 Fri Jan 6 14:17:11 2012 +++ src/sys/netinet6/Makefile Thu Feb 16 08:12:44 2017 @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.8 2012/01/06 14:17:11 drochner Exp $ +# $NetBSD: Makefile,v 1.9 2017/02/16 08:12:44 knakahara Exp $ INCSDIR= /usr/include/netinet6 -INCS= in6.h in6_gif.h in6_ifattach.h in6_pcb.h \ +INCS= in6.h in6_gif.h in6_l2tp.h in6_ifattach.h in6_pcb.h \ in6_var.h ip6_mroute.h ip6_var.h ip6protosw.h \ mld6_var.h nd6.h pim6.h pim6_var.h \ raw_ip6.h udp6.h udp6_var.h Index: src/sys/netinet6/in6_ifattach.c diff -u src/sys/netinet6/in6_ifattach.c:1.110 src/sys/netinet6/in6_ifattach.c:1.111 --- src/sys/netinet6/in6_ifattach.c:1.110 Tue Jan 24 07:09:25 2017 +++ src/sys/netinet6/in6_ifattach.c Thu Feb 16 08:12:44 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_ifattach.c,v 1.110 2017/01/24 07:09:25 ozaki-r Exp $ */ +/* $NetBSD: in6_ifattach.c,v 1.111 2017/02/16 08:12:44 knakahara Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.110 2017/01/24 07:09:25 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.111 2017/02/16 08:12:44 knakahara Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -712,6 +712,7 @@ in6_ifattach(struct ifnet *ifp, struct i /* some of the interfaces are inherently not IPv6 capable */ switch (ifp->if_type) { case IFT_BRIDGE: + case IFT_L2TP: #ifdef IFT_PFLOG case IFT_PFLOG: #endif Index: src/sys/netinet6/in6_proto.c diff -u src/sys/netinet6/in6_proto.c:1.115 src/sys/netinet6/in6_proto.c:1.116 --- src/sys/netinet6/in6_proto.c:1.115 Mon Feb 13 07:18:20 2017 +++ src/sys/netinet6/in6_proto.c Thu Feb 16 08:12:44 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_proto.c,v 1.115 2017/02/13 07:18:20 ozaki-r Exp $ */ +/* $NetBSD: in6_proto.c,v 1.116 2017/02/16 08:12:44 knakahara 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.115 2017/02/13 07:18:20 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.116 2017/02/16 08:12:44 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_gateway.h" @@ -390,6 +390,16 @@ const struct ip6protosw inet6sw[] = { #endif /* NCARP */ { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, + .pr_protocol = IPPROTO_L2TP, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, + .pr_input = encap6_input, + .pr_ctlinput = rip6_ctlinput, + .pr_ctloutput = rip6_ctloutput, + .pr_usrreqs = &rip6_usrreqs, + .pr_init = encap_init, +}, +{ .pr_type = SOCK_RAW, + .pr_domain = &inet6domain, .pr_protocol = IPPROTO_PIM, .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = pim6_input,