Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/wgconfig [ozaki-r] Add wg files



details:   https://anonhg.NetBSD.org/src/rev/45619a77d277
branches:  trunk
changeset: 975032:45619a77d277
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Aug 20 21:28:00 2020 +0000

description:
[ozaki-r] Add wg files

diffstat:

 distrib/sets/lists/base/mi                   |     5 +-
 distrib/sets/lists/base/shl.mi               |     5 +-
 distrib/sets/lists/comp/mi                   |     5 +-
 distrib/sets/lists/comp/shl.mi               |     3 +-
 distrib/sets/lists/debug/mi                  |     5 +-
 distrib/sets/lists/debug/shl.mi              |     3 +-
 distrib/sets/lists/man/mi                    |    11 +-
 distrib/sets/lists/tests/mi                  |    13 +-
 etc/mtree/NetBSD.dist.tests                  |     3 +-
 sys/net/if_wg.c                              |  4432 ++++++++++++++++++++++++++
 sys/net/if_wg.h                              |    45 +
 sys/rump/include/opt/wg.h                    |     3 +
 sys/rump/net/lib/libwireguard/Makefile       |    27 +
 sys/rump/net/lib/libwireguard/WG.ioconf      |     7 +
 sys/rump/net/lib/libwireguard/wg_component.c |    42 +
 sys/rump/net/lib/libwireguard/wg_user.c      |   423 ++
 sys/rump/net/lib/libwireguard/wg_user.h      |    52 +
 tests/net/wireguard/Makefile                 |    13 +
 tests/net/wireguard/common.sh                |   200 +
 tests/net/wireguard/t_basic.sh               |   485 ++
 tests/net/wireguard/t_interoperability.sh    |   279 +
 tests/net/wireguard/t_misc.sh                |   600 +++
 tests/net/wireguard/t_tunnel.sh              |   332 +
 usr.sbin/wg-keygen/Makefile                  |     9 +
 usr.sbin/wg-keygen/wg-keygen.8               |    55 +
 usr.sbin/wg-keygen/wg-keygen.c               |   136 +
 usr.sbin/wg-userspace/Makefile               |     7 +
 usr.sbin/wg-userspace/wg-userspace.8         |    57 +
 usr.sbin/wg-userspace/wg-userspace.sh        |    63 +
 usr.sbin/wgconfig/Makefile                   |     9 +
 usr.sbin/wgconfig/wgconfig.8                 |    55 +
 usr.sbin/wgconfig/wgconfig.c                 |   760 ++++
 32 files changed, 8135 insertions(+), 9 deletions(-)

diffs (truncated from 8397 to 300 lines):

diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/base/mi        Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1256 2020/07/22 19:02:01 roy Exp $
+# $NetBSD: mi,v 1.1257 2020/08/20 21:28:00 riastradh Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -2101,6 +2101,9 @@
 ./usr/sbin/vndconfig                           base-sysutil-bin
 ./usr/sbin/wake                                        base-obsolete           obsolete
 ./usr/sbin/wakeonlan                           base-netutil-bin
+./usr/sbin/wg-keygen                           base-netutil-bin
+./usr/sbin/wg-userspace                                base-netutil-bin
+./usr/sbin/wgconfig                            base-netutil-bin
 ./usr/sbin/wiconfig                            base-sysutil-bin
 ./usr/sbin/wire-test                           base-netutil-bin
 ./usr/sbin/wlanctl                             base-sysutil-bin
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi    Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/base/shl.mi    Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.895 2020/08/03 17:30:17 christos Exp $
+# $NetBSD: shl.mi,v 1.896 2020/08/20 21:28:00 riastradh Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -832,6 +832,9 @@
 ./usr/lib/librumpnet_vlan.so                   base-rump-shlib         rump
 ./usr/lib/librumpnet_vlan.so.0                 base-rump-shlib         rump
 ./usr/lib/librumpnet_vlan.so.0.0               base-rump-shlib         rump
+./usr/lib/librumpnet_wireguard.so              base-rump-shlib         rump
+./usr/lib/librumpnet_wireguard.so.0            base-rump-shlib         rump
+./usr/lib/librumpnet_wireguard.so.0.0          base-rump-shlib         rump
 ./usr/lib/librumpres.so                                base-rumpclient-shlib   compatfile,rump
 ./usr/lib/librumpres.so.0                      base-rumpclient-shlib   compatfile,rump
 ./usr/lib/librumpres.so.0.0                    base-rumpclient-shlib   compatfile,rump
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/comp/mi        Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2343 2020/08/14 00:53:15 riastradh Exp $
+#      $NetBSD: mi,v 1.2344 2020/08/20 21:28:00 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -2400,6 +2400,7 @@
 ./usr/include/net/if_tun.h                     comp-c-include
 ./usr/include/net/if_types.h                   comp-c-include
 ./usr/include/net/if_vlanvar.h                 comp-c-include
+./usr/include/net/if_wg.h                      comp-c-include
 ./usr/include/net/net_stats.h                  comp-c-include
 ./usr/include/net/netisr.h                     comp-c-include
 ./usr/include/net/npf.h                                comp-c-include
@@ -3866,6 +3867,8 @@
 ./usr/lib/librumpnet_virtif_p.a                        comp-c-proflib          rump,profile
 ./usr/lib/librumpnet_vlan.a                    comp-c-lib              rump
 ./usr/lib/librumpnet_vlan_p.a                  comp-c-proflib          rump,profile
+./usr/lib/librumpnet_wireguard.a               comp-c-lib              rump
+./usr/lib/librumpnet_wireguard_p.a             comp-c-proflib          rump,profile
 ./usr/lib/librumpres.a                         comp-c-lib              compatfile,rump
 ./usr/lib/librumpres_p.a                       comp-c-proflib          compatfile,rump,profile
 ./usr/lib/librumpuser.a                                comp-c-lib              compatfile,rump
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/comp/shl.mi
--- a/distrib/sets/lists/comp/shl.mi    Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/comp/shl.mi    Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.336 2020/06/15 23:41:55 christos Exp $
+# $NetBSD: shl.mi,v 1.337 2020/08/20 21:28:00 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -248,6 +248,7 @@
 ./usr/lib/librumpnet_tun_pic.a                 comp-c-piclib           picinstall,rump
 ./usr/lib/librumpnet_virtif_pic.a              comp-c-piclib           picinstall,rump
 ./usr/lib/librumpnet_vlan_pic.a                        comp-c-piclib           picinstall,rump
+./usr/lib/librumpnet_wireguard_pic.a           comp-c-piclib           picinstall,rump
 ./usr/lib/librumpres_pic.a                     comp-c-piclib           compatfile,picinstall,rump
 ./usr/lib/librumpuser_pic.a                    comp-c-piclib           compatfile,picinstall,rump
 ./usr/lib/librumpvfs_aio_pic.a                 comp-c-piclib           picinstall,rump
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi       Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/debug/mi       Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.328 2020/08/18 03:02:50 perseant Exp $
+# $NetBSD: mi,v 1.329 2020/08/20 21:28:01 riastradh Exp $
 ./etc/mtree/set.debug                           comp-sys-root
 ./usr/lib                                      comp-sys-usr            compatdir
 ./usr/lib/i18n/libBIG5_g.a                     comp-c-debuglib         debuglib,compatfile
@@ -237,6 +237,7 @@
 ./usr/lib/librumpnet_tun_g.a                   comp-c-debuglib         debuglib,rump
 ./usr/lib/librumpnet_virtif_g.a                        comp-c-debuglib         debuglib,rump
 ./usr/lib/librumpnet_vlan_g.a                  comp-c-debuglib         debuglib,rump
+./usr/lib/librumpnet_wireguard_g.a             comp-c-debuglib         debuglib,rump
 ./usr/lib/librumpres_g.a                       comp-c-debuglib         debuglib,compatfile,rump
 ./usr/lib/librumpuser_g.a                      comp-c-debuglib         debuglib,compatfile,rump
 ./usr/lib/librumpvfs_aio_g.a                   comp-c-debuglib         debuglib,rump
@@ -1349,6 +1350,8 @@
 ./usr/libdata/debug/usr/sbin/vnconfig.debug    comp-sysutil-debug      debug
 ./usr/libdata/debug/usr/sbin/wake.debug                comp-obsolete           obsolete,compatfile
 ./usr/libdata/debug/usr/sbin/wakeonlan.debug   comp-netutil-debug      debug
+./usr/libdata/debug/usr/sbin/wg-keygen.debug   comp-netutil-debug      debug
+./usr/libdata/debug/usr/sbin/wgconfig.debug    comp-netutil-debug      debug
 ./usr/libdata/debug/usr/sbin/wiconfig.debug    comp-sysutil-debug      debug
 ./usr/libdata/debug/usr/sbin/wire-test.debug   comp-netutil-debug      debug
 ./usr/libdata/debug/usr/sbin/wlanctl.debug     comp-sysutil-debug      debug
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/debug/shl.mi
--- a/distrib/sets/lists/debug/shl.mi   Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/debug/shl.mi   Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.257 2020/08/03 17:30:17 christos Exp $
+# $NetBSD: shl.mi,v 1.258 2020/08/20 21:28:01 riastradh Exp $
 ./usr/lib/libbfd_g.a                                           comp-c-debuglib debuglib,compatfile,binutils
 ./usr/libdata/debug/lib                                                base-sys-usr    debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug                    comp-zfs-debug  debug,dynamicroot,zfs
@@ -290,6 +290,7 @@
 ./usr/libdata/debug/usr/lib/librumpnet_tun.so.0.0.debug                comp-rump-debug debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_virtif.so.0.0.debug     comp-rump-debug debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_vlan.so.0.0.debug       comp-rump-debug debug,rump
+./usr/libdata/debug/usr/lib/librumpnet_wireguard.so.0.0.debug  comp-rump-debug debug,rump
 ./usr/libdata/debug/usr/lib/librumpres.so.0.0.debug            comp-rump-debug debug,compatfile,rump
 ./usr/libdata/debug/usr/lib/librumpuser.so.0.1.debug           comp-rump-debug debug,compatfile,rump
 ./usr/libdata/debug/usr/lib/librumpvfs.so.0.0.debug            comp-rump-debug debug,compatfile,rump
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/man/mi Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1697 2020/07/26 15:13:09 jdolecek Exp $
+# $NetBSD: mi,v 1.1698 2020/08/20 21:28:01 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3277,6 +3277,9 @@
 ./usr/share/man/cat8/walnut/MAKEDEV.0          man-obsolete            obsolete
 ./usr/share/man/cat8/walnut/makedev.0          man-obsolete            obsolete
 ./usr/share/man/cat8/wdogctl.0                 man-sysutil-catman      .cat
+./usr/share/man/cat8/wg-keygen.0               man-netutil-catman      .cat
+./usr/share/man/cat8/wg-userspace.0            man-netutil-catman      .cat
+./usr/share/man/cat8/wgconfig.0                        man-netutil-catman      .cat
 ./usr/share/man/cat8/wiconfig.0                        man-netutil-catman      .cat
 ./usr/share/man/cat8/wire-test.0               man-netutil-catman      .cat
 ./usr/share/man/cat8/wizd.0                    man-sysutil-catman      .cat
@@ -6184,6 +6187,9 @@
 ./usr/share/man/html8/wake.html                        man-obsolete            obsolete
 ./usr/share/man/html8/wakeonlan.html           man-netutil-htmlman     html
 ./usr/share/man/html8/wdogctl.html             man-sysutil-htmlman     html
+./usr/share/man/html8/wg-keygen.html           man-netutil-htmlman     html
+./usr/share/man/html8/wg-userspace.html                man-netutil-htmlman     html
+./usr/share/man/html8/wgconfig.html            man-netutil-htmlman     html
 ./usr/share/man/html8/wiconfig.html            man-netutil-htmlman     html
 ./usr/share/man/html8/wire-test.html           man-netutil-htmlman     html
 ./usr/share/man/html8/wizd.html                        man-sysutil-htmlman     html
@@ -9466,6 +9472,9 @@
 ./usr/share/man/man8/walnut/MAKEDEV.8          man-obsolete            obsolete
 ./usr/share/man/man8/walnut/makedev.8          man-obsolete            obsolete
 ./usr/share/man/man8/wdogctl.8                 man-sysutil-man         .man
+./usr/share/man/man8/wg-keygen.8               man-netutil-man         .man
+./usr/share/man/man8/wg-userspace.8            man-netutil-man         .man
+./usr/share/man/man8/wgconfig.8                        man-netutil-man         .man
 ./usr/share/man/man8/wiconfig.8                        man-netutil-man         .man
 ./usr/share/man/man8/wire-test.8               man-netutil-man         .man
 ./usr/share/man/man8/wizd.8                    man-sysutil-man         .man
diff -r bce7314ca318 -r 45619a77d277 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Thu Aug 20 21:21:31 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.895 2020/08/20 17:45:46 rillig Exp $
+# $NetBSD: mi,v 1.896 2020/08/20 21:28:01 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3866,6 +3866,13 @@
 ./usr/tests/net/if_vlan/Kyuafile               tests-net-tests         atf,rump,kyua
 ./usr/tests/net/if_vlan/siocXmulti             tests-net-tests         atf,rump
 ./usr/tests/net/if_vlan/t_vlan                 tests-net-tests         atf,rump
+./usr/tests/net/wireguard                      tests-net-tests         compattestfile,atf
+./usr/tests/net/wireguard/Atffile              tests-net-tests         atf,rump
+./usr/tests/net/wireguard/Kyuafile             tests-net-tests         atf,rump,kyua
+./usr/tests/net/wireguard/t_basic              tests-net-tests         atf,rump
+./usr/tests/net/wireguard/t_interoperability   tests-net-tests         atf,rump
+./usr/tests/net/wireguard/t_misc               tests-net-tests         atf,rump
+./usr/tests/net/wireguard/t_tunnel             tests-net-tests         atf,rump
 ./usr/tests/net/in_cksum                       tests-net-tests         compattestfile,atf
 ./usr/tests/net/in_cksum/Atffile               tests-net-tests         compattestfile,atf
 ./usr/tests/net/in_cksum/Kyuafile              tests-net-tests         compattestfile,atf,kyua
@@ -3946,6 +3953,10 @@
 ./usr/tests/net/sys/t_listen                   tests-obsolete          obsolete
 ./usr/tests/net/sys/t_rfc6056                  tests-net-tests         compattestfile,atf
 ./usr/tests/net/sys/t_socketpair               tests-obsolete          obsolete
+./usr/tests/net/wireguard                      tests-net-tests         compattestfile,atf
+./usr/tests/net/wireguard/Atffile              tests-net-tests         compattestfile,atf
+./usr/tests/net/wireguard/Kyuafile             tests-net-tests         compattestfile,atf,kyua
+./usr/tests/net/wireguard/t_basic              tests-net-tests         atf,rump
 ./usr/tests/opencrypto                         tests-obsolete          obsolete
 ./usr/tests/rump                               tests-rump-tests        compattestfile,atf
 ./usr/tests/rump/Atffile                       tests-rump-tests        atf,rump
diff -r bce7314ca318 -r 45619a77d277 etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests       Thu Aug 20 21:21:31 2020 +0000
+++ b/etc/mtree/NetBSD.dist.tests       Thu Aug 20 21:28:00 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.tests,v 1.174 2020/07/26 05:06:29 riastradh Exp $
+#      $NetBSD: NetBSD.dist.tests,v 1.175 2020/08/20 21:28:01 riastradh Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -367,6 +367,7 @@
 ./usr/tests/net/npf
 ./usr/tests/net/route
 ./usr/tests/net/sys
+./usr/tests/net/wireguard
 ./usr/tests/rump
 ./usr/tests/rump/modautoload
 ./usr/tests/rump/rumpkern
diff -r bce7314ca318 -r 45619a77d277 sys/net/if_wg.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/net/if_wg.c   Thu Aug 20 21:28:00 2020 +0000
@@ -0,0 +1,4432 @@
+/*     $NetBSD: if_wg.c,v 1.1 2020/08/20 21:28:01 riastradh Exp $      */
+
+/*
+ * Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
+ * 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.
+ */
+
+/*
+ * This is an implementation of WireGuard, a fast, modern, secure VPN protocol,
+ * for the NetBSD kernel and rump kernels.
+ *
+ * The implementation is based on the paper of WireGuard as of 2018-06-30 [1].
+ * The paper is referred in the source code with label [W].  Also the
+ * specification of the Noise protocol framework as of 2018-07-11 [2] is
+ * referred with label [N].
+ *
+ * [1] https://www.wireguard.com/papers/wireguard.pdf
+ * [2] http://noiseprotocol.org/noise.pdf
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.1 2020/08/20 21:28:01 riastradh Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/timespec.h>
+#include <sys/socketvar.h>
+#include <sys/syslog.h>
+#include <sys/cpu.h>
+#include <sys/intr.h>
+#include <sys/kmem.h>
+#include <sys/device.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rwlock.h>
+#include <sys/pserialize.h>
+#include <sys/psref.h>
+#include <sys/kthread.h>
+#include <sys/cprng.h>
+#include <sys/atomic.h>
+#include <sys/sysctl.h>
+#include <sys/domain.h>
+#include <sys/pcq.h>
+#include <sys/queue.h>
+#include <sys/percpu.h>
+#include <sys/callout.h>
+



Home | Main Index | Thread Index | Old Index