[haiku-commits] haiku: hrev53078 - in src: bin/network/tunconfig add-ons/kernel/network/devices/tun

  • From: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 17 Apr 2019 17:19:15 -0400 (EDT)

hrev53078 adds 3 changesets to branch 'master'
old head: 612c05bd76765ee7afafe094b87ff502bf8a46ae
new head: 16525505c6c41729d900780e4234291c2cf849b9
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=16525505c6c4+%5E612c05bd7676

----------------------------------------------------------------------------

e60aa2b8f922: network/tun: Fix incorrect module var name

f8a5dd082860: network/tunconfig: Initial work on a tool to manage tunnels
  
  * Modeled after pppconfig to some degree.
  * Normally various VPN and other services will create / manage
    tunnels directly, however this gives us a good way to
    test / play with things initially.

16525505c6c4: network/tun: install-tun target for rapid tun testing

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

5 files changed, 102 insertions(+), 3 deletions(-)
src/add-ons/kernel/network/devices/tun/Jamfile |  4 ++
src/add-ons/kernel/network/devices/tun/tun.cpp |  4 +-
src/bin/network/Jamfile                        |  2 +-
src/bin/network/tunconfig/Jamfile              | 19 ++++++
src/bin/network/tunconfig/tunconfig.cpp        | 76 ++++++++++++++++++++++

############################################################################

Commit:      e60aa2b8f922e40a51ac0b6a09005dd773afac79
URL:         https://git.haiku-os.org/haiku/commit/?id=e60aa2b8f922
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Wed Apr 17 21:14:58 2019 UTC

network/tun: Fix incorrect module var name

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/network/devices/tun/tun.cpp 
b/src/add-ons/kernel/network/devices/tun/tun.cpp
index e14813549b..2ad444c9c7 100644
--- a/src/add-ons/kernel/network/devices/tun/tun.cpp
+++ b/src/add-ons/kernel/network/devices/tun/tun.cpp
@@ -169,7 +169,7 @@ tun_std_ops(int32 op, ...)
 }
 
 
-net_device_module_info sLoopbackModule = {
+net_device_module_info sTunModule = {
        {
                "network/devices/tun/v1",
                0,
@@ -191,6 +191,6 @@ net_device_module_info sLoopbackModule = {
 };
 
 module_info* modules[] = {
-       (module_info*)&sLoopbackModule,
+       (module_info*)&sTunModule,
        NULL
 };

############################################################################

Commit:      f8a5dd0828600bc765fb91c361c6af29db361b63
URL:         https://git.haiku-os.org/haiku/commit/?id=f8a5dd082860
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Wed Apr 17 21:16:00 2019 UTC

network/tunconfig: Initial work on a tool to manage tunnels

* Modeled after pppconfig to some degree.
* Normally various VPN and other services will create / manage
  tunnels directly, however this gives us a good way to
  test / play with things initially.

----------------------------------------------------------------------------

diff --git a/src/bin/network/Jamfile b/src/bin/network/Jamfile
index 854037362b..236ef56a6b 100644
--- a/src/bin/network/Jamfile
+++ b/src/bin/network/Jamfile
@@ -18,4 +18,4 @@ SubInclude HAIKU_TOP src bin network route ;
 SubInclude HAIKU_TOP src bin network telnet ;
 SubInclude HAIKU_TOP src bin network telnetd ;
 SubInclude HAIKU_TOP src bin network traceroute ;
-
+SubInclude HAIKU_TOP src bin network tunconfig ;
diff --git a/src/bin/network/tunconfig/Jamfile 
b/src/bin/network/tunconfig/Jamfile
new file mode 100644
index 0000000000..34ef84f6c9
--- /dev/null
+++ b/src/bin/network/tunconfig/Jamfile
@@ -0,0 +1,19 @@
+SubDir HAIKU_TOP src bin network tunconfig ;
+
+UsePrivateKernelHeaders ;
+UsePrivateHeaders net ;
+UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libppp
+       headers ] : true ;
+UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared
+       libkernelppp headers ] : true ;
+
+BinCommand tunconfig :
+       tunconfig.cpp
+       :
+       be libppp.a [ TargetLibsupc++ ] libbsd.so $(TARGET_NETWORK_LIBS)
+;
+
+# Installation
+HaikuInstall install-tun
+       : /boot/home/config/non-packaged/bin
+       : tunconfig ;
diff --git a/src/bin/network/tunconfig/tunconfig.cpp 
b/src/bin/network/tunconfig/tunconfig.cpp
new file mode 100644
index 0000000000..5005d61e70
--- /dev/null
+++ b/src/bin/network/tunconfig/tunconfig.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2006-2019, Haiku, Inc. All rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *   Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
+ */
+
+
+#include <stdio.h>
+#include <String.h>
+
+#include <NetworkInterface.h>
+#include <NetworkRoster.h>
+
+
+static
+status_t
+print_help()
+{
+       fprintf(stderr, "tunconfig\n");
+       fprintf(stderr, "With tunconfig you can create and manage tun/tap 
devices.\n");
+       fprintf(stderr, "Usage:\n");
+       fprintf(stderr, "  tunconfig show | -a\n");
+       fprintf(stderr, "  tunconfig init <name>\n");
+       fprintf(stderr, "  tunconfig create <name>\n");
+       fprintf(stderr, "  tunconfig delete <name|interface|id>\n");
+       fprintf(stderr, "  tunconfig details <name|interface|id>\n");
+       fprintf(stderr, "\t<name> must be an interface description file\n");
+       
+       return -1;
+}
+
+
+static
+status_t
+show_interface(const char* name)
+{
+       printf("%s\n", name);
+       return B_OK;
+}
+
+
+static
+status_t
+show_all()
+{
+       BNetworkRoster& roster = BNetworkRoster::Default();
+
+       BNetworkInterface interface;
+       uint32 cookie = 0;
+
+       while (roster.GetNextInterface(&cookie, interface) == B_OK) {
+               BNetworkAddress linkAddress;
+               status_t status = interface.GetHardwareAddress(linkAddress);
+               if (status == B_OK && linkAddress.LinkLevelType() == IFT_TUN)
+                       show_interface(interface.Name());
+       }
+       return B_OK;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+       if (argc == 2) {
+               if (!strcmp(argv[1], "show") || !strcmp(argv[1], "-a"))
+                       return show_all();
+               else
+                       return print_help();
+       } else {
+               return print_help();
+       }
+
+       return 0;
+}

############################################################################

Revision:    hrev53078
Commit:      16525505c6c41729d900780e4234291c2cf849b9
URL:         https://git.haiku-os.org/haiku/commit/?id=16525505c6c4
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Wed Apr 17 21:18:18 2019 UTC

network/tun: install-tun target for rapid tun testing

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/network/devices/tun/Jamfile 
b/src/add-ons/kernel/network/devices/tun/Jamfile
index 87976f35ea..d5053b68f8 100644
--- a/src/add-ons/kernel/network/devices/tun/Jamfile
+++ b/src/add-ons/kernel/network/devices/tun/Jamfile
@@ -7,3 +7,7 @@ KernelAddon tun :
        tun.cpp
 ;
 
+# Installation
+HaikuInstall install-tun
+        : /boot/home/config/non-packaged/add-ons/kernel/network/devices/
+        : tun ;


Other related posts:

  • » [haiku-commits] haiku: hrev53078 - in src: bin/network/tunconfig add-ons/kernel/network/devices/tun - Alex von Gluck IV