gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (33de5802a -> d0ce6a748)


From: gnunet
Subject: [gnunet] branch master updated (33de5802a -> d0ce6a748)
Date: Sat, 23 Nov 2019 00:43:43 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a change to branch master
in repository gnunet.

    from 33de5802a displaydot.sh: this is sh(1) syntax.
     new f4690d7c8 configure: define XBSD (see NOTE, needs better handling in 
general), add logic to find and define tun.h
     new 00ddb1c1d exit: initial (very rough, builds) *BSD support - to the 
point where the Linux specific binaries would still be used, thus marked as 
experimental.
     new d0ce6a748 ignore binaries build in abd.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                  | 12 ++++++++++++
 src/abd/.gitignore            |  2 ++
 src/exit/Makefile.am          |  6 ++++++
 src/exit/gnunet-helper-exit.c | 38 +++++++++++++++++++++++++++++++++++++-
 4 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 src/abd/.gitignore

diff --git a/configure.ac b/configure.ac
index 451d30496..f7b1c569a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,6 +193,10 @@ AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
 AM_CONDITIONAL(XNETBSD, test "$build_target" = "netbsd")
 AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd")
 AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd")
+# FIXME: We need a define BSD for some binaries like we
+# need define LINUX for some. This does not scale, how
+# can we solve this better?
+AM_CONDITIONAL(XBSD, test "$build_target" = "netbsd" -o "$build_target" = 
"freebsd" -o "$build_target" = "openbsd")
 AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
 AM_CONDITIONAL(GNU, test "$build_target" = "gnu")
 
@@ -376,6 +380,14 @@ AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], 
"$NEED_LIBGCRYPT_VERSION", [require
 
 AC_CHECK_DECLS([struct in6_ifreq], [], [], [[#include <linux/if_tun.h>]])
 
+AC_CHECK_HEADER([if_tun.h],
+    [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"], [if_tun.h include path])],
+    [AC_CHECK_HEADER([linux/if_tun.h],
+        [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
+        [AC_CHECK_HEADER([net/if_tun.h],
+            [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
+            [AC_CHECK_HEADER([net/tun/if_tun.h],
+                [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
 
 
 # should the build process be building the documentation?
diff --git a/src/abd/.gitignore b/src/abd/.gitignore
new file mode 100644
index 000000000..ee1eb7837
--- /dev/null
+++ b/src/abd/.gitignore
@@ -0,0 +1,2 @@
+gnunet-abd
+gnunet-service-abd
diff --git a/src/exit/Makefile.am b/src/exit/Makefile.am
index c0323d0d6..811761ed0 100644
--- a/src/exit/Makefile.am
+++ b/src/exit/Makefile.am
@@ -17,6 +17,12 @@ dist_pkgcfg_DATA = \
 if LINUX
 EXITBIN = gnunet-helper-exit
 endif
+# For testing purposes:
+if HAVE_EXPERIMENTAL
+if XBSD
+EXITBIN = gnunet-helper-exit
+endif
+endif
 
 
 libexec_PROGRAMS = \
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c
index cf322725d..9d20a0c50 100644
--- a/src/exit/gnunet-helper-exit.c
+++ b/src/exit/gnunet-helper-exit.c
@@ -42,7 +42,15 @@
  * - Philipp Tölke
  */
 #include "platform.h"
-#include <linux/if_tun.h>
+
+#ifdef IF_TUN_HDR
+#include IF_TUN_HDR
+#endif
+
+#if defined(BSD) || defined(SOLARIS)
+#define ifr_netmask ifr_ifru.ifru_addr
+#define SIOGIFINDEX SIOCGIFINDEX
+#endif
 
 /**
  * Need 'struct GNUNET_MessageHeader'.
@@ -182,6 +190,7 @@ fork_and_exec (const char *file,
  *        if *dev == '\\0', uses the name supplied by the kernel;
  * @return the fd to the tun or -1 on error
  */
+#ifdef IFF_TUN /* LINUX */
 static int
 init_tun (char *dev)
 {
@@ -225,7 +234,34 @@ init_tun (char *dev)
   strcpy (dev, ifr.ifr_name);
   return fd;
 }
+#else /* BSD et al, including DARWIN */
 
+#ifdef SIOCIFCREATE
+static int
+init_tun(char *dev)
+{
+  int fd;
+  int s;
+  struct ifreq ifr;
+
+  fd = open(dev, O_RDWR);
+  if(fd == -1)
+  {
+    s = socket(AF_INET, SOCK_DGRAM, 0);
+    if (s < 0)
+      return -1;
+    memset(&ifr, 0, sizeof(ifr));
+    strncpy(ifr.ifr_name, dev + 5, sizeof(ifr.ifr_name) - 1);
+    if (!ioctl(s, SIOCIFCREATE, &ifr))
+      fd = open(dev, O_RDWR);
+    close(s);
+  }
+  return fd;
+}
+#else
+#define init_tun(dev) open(dev, O_RDWR)
+#endif
+#endif /* !IFF_TUN (BSD) */
 
 /**
  * @brief Sets the IPv6-Address given in address on the interface dev

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]