From c68ec92614004fabdb98e5b9a6c6db813ff2ac17 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 7 Sep 2023 18:23:07 -0500 Subject: [PATCH] Updating n2n --- .gitignore | 3 + hamncheese/main.gd | 12 +++ hamncheese/peers.gd | 14 +++ modules/n2nvpn/SCsub | 2 +- modules/n2nvpn/config.h | 5 +- modules/n2nvpn/n2n/.gitignore | 7 -- .../packages/debian/{Makefile.in => Makefile} | 13 ++- modules/n2nvpn/n2n/packages/debian/README | 2 +- .../n2nvpn/n2n/packages/debian/configure.ac | 3 + .../n2nvpn/n2n/packages/debian/configure.in | 60 ------------ .../n2n/packages/debian/debian/changelog | 4 + .../n2n/packages/debian/debian/changelog.in | 4 - .../debian/debian/{control.in => control} | 4 +- .../n2n/packages/debian/debian/files.in | 1 - .../debian/debian/{rules.in => rules} | 3 +- ...topng@.service.in => edge-ntopng@.service} | 0 .../system/{edge.service.in => edge.service} | 0 .../{edge@.service.in => edge@.service} | 0 ...supernode.service.in => supernode.service} | 0 modules/n2nvpn/n2n/packages/rpm/configure.in | 4 - modules/n2nvpn/n2n/scripts/n2n-ctl | 33 +++++++ modules/n2nvpn/n2n/src/edge_management.c | 2 +- modules/n2nvpn/n2n/src/edge_utils.c | 2 + modules/n2nvpn/n2n/src/n2n.c | 3 +- modules/n2nvpn/n2n/src/sn_management.c | 4 +- modules/n2nvpn/n2n/src/sn_utils.c | 5 +- modules/n2nvpn/n2nvpn.cpp | 1 + modules/n2nvpn/stddclmr.h | 95 +++++++++++++++++++ supernode.sh | 12 ++- 29 files changed, 203 insertions(+), 95 deletions(-) rename modules/n2nvpn/n2n/packages/debian/{Makefile.in => Makefile} (72%) create mode 100644 modules/n2nvpn/n2n/packages/debian/configure.ac delete mode 100644 modules/n2nvpn/n2n/packages/debian/configure.in create mode 100644 modules/n2nvpn/n2n/packages/debian/debian/changelog delete mode 100644 modules/n2nvpn/n2n/packages/debian/debian/changelog.in rename modules/n2nvpn/n2n/packages/debian/debian/{control.in => control} (92%) delete mode 100644 modules/n2nvpn/n2n/packages/debian/debian/files.in rename modules/n2nvpn/n2n/packages/debian/debian/{rules.in => rules} (93%) rename modules/n2nvpn/n2n/packages/etc/systemd/system/{edge-ntopng@.service.in => edge-ntopng@.service} (100%) rename modules/n2nvpn/n2n/packages/etc/systemd/system/{edge.service.in => edge.service} (100%) rename modules/n2nvpn/n2n/packages/etc/systemd/system/{edge@.service.in => edge@.service} (100%) rename modules/n2nvpn/n2n/packages/etc/systemd/system/{supernode.service.in => supernode.service} (100%) create mode 100644 modules/n2nvpn/stddclmr.h diff --git a/.gitignore b/.gitignore index 2d971c9..402c519 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ output.log bin/ hamncheese/export_presets.cfg temp/ +scp.sh +start-edge.sh +console-edge.sh diff --git a/hamncheese/main.gd b/hamncheese/main.gd index 9547256..2a2078d 100644 --- a/hamncheese/main.gd +++ b/hamncheese/main.gd @@ -1,3 +1,15 @@ +# +# Things to do: +# - Add libzstd +# +# Issues to watch: +# - https://github.com/ntop/n2n/issues/1090 (P2P connections still occupy server traffic) +# - https://github.com/ntop/n2n/issues/1087 (Slow shutdown on Windows) +# - https://github.com/ntop/n2n/issues/1082 (A large ping value every 20 seconds) +# - https://github.com/ntop/n2n/issues/610 (n2nGaming Application?) +# - https://github.com/ntop/n2n/issues/934 (Upnp is missing) +# + extends Control diff --git a/hamncheese/peers.gd b/hamncheese/peers.gd index a745b56..fb3435e 100644 --- a/hamncheese/peers.gd +++ b/hamncheese/peers.gd @@ -2,6 +2,7 @@ extends Node var _server: HttpServer = null +var _client: HTTPRequest var _userInfo: Dictionary # This array is of dictionary elements that contain: @@ -12,12 +13,20 @@ var _userInfo: Dictionary # "refresh": Do we need to redraw this entry? var peerArray: Array + +func _http_request_completed(result, response_code, headers, body): + print("HTTP: ", result, " ", response_code) + func _process(_delta): pass func _ready(): + # DEBUG - See if using the VPN fixes our peer removal issue. + _client = HTTPRequest.new() + add_child(_client) + _client.request_completed.connect(self._http_request_completed) clear() @@ -95,5 +104,10 @@ func update(peersFromCPP: Array): peerArray.sort_custom(_sort_by_ip) print("Peers After: ", peerArray) + + # DEBUG - See if using the VPN fixes our peer removal issue. + var error = _client.request("http://" + _server.bind_address + ":" + str(_server.port)) + if error != OK: + push_error("An error occurred in the HTTP request.") return changed diff --git a/modules/n2nvpn/SCsub b/modules/n2nvpn/SCsub index acc1cbe..6e7c4f9 100644 --- a/modules/n2nvpn/SCsub +++ b/modules/n2nvpn/SCsub @@ -74,4 +74,4 @@ env_n2nvpn.Append(CCFLAGS=['-g', '-O2']) # Check with the documentation of the external library to see which library # files should be included/linked. -#env.Append(LIBS=['lib1', 'lib2']) +env.Append(LIBS=['pthread']) diff --git a/modules/n2nvpn/config.h b/modules/n2nvpn/config.h index 3702ae2..6c4f935 100644 --- a/modules/n2nvpn/config.h +++ b/modules/n2nvpn/config.h @@ -1,6 +1,3 @@ -/* include/config.h. Generated from config.h.in by configure. */ -/* include/config.h.in. Generated from configure.ac by autoheader. */ - /* Define to 1 if you have the `cap' library (-lcap). */ /* #undef HAVE_LIBCAP */ @@ -17,7 +14,7 @@ /* #undef HAVE_LIBPCAP */ /* Define to 1 if you have the `pthread' library (-lpthread). */ -/* #undef HAVE_LIBPTHREAD */ +#define HAVE_LIBPTHREAD 1 /* Define to 1 if you have the `zstd' library (-lzstd). */ /* #undef HAVE_LIBZSTD */ diff --git a/modules/n2nvpn/n2n/.gitignore b/modules/n2nvpn/n2n/.gitignore index 4c2c448..38224e1 100644 --- a/modules/n2nvpn/n2n/.gitignore +++ b/modules/n2nvpn/n2n/.gitignore @@ -24,14 +24,7 @@ build .idea .vscode .vs -packages/debian/debian/changelog -packages/debian/debian/control packages/debian/debian/files -packages/debian/debian/rules -packages/etc/systemd/system/edge-ntopng@.service -packages/etc/systemd/system/edge.service -packages/etc/systemd/system/edge@.service -packages/etc/systemd/system/supernode.service *dSYM* __pycache__ diff --git a/modules/n2nvpn/n2n/packages/debian/Makefile.in b/modules/n2nvpn/n2n/packages/debian/Makefile similarity index 72% rename from modules/n2nvpn/n2n/packages/debian/Makefile.in rename to modules/n2nvpn/n2n/packages/debian/Makefile index 8b8b993..d458b3d 100644 --- a/modules/n2nvpn/n2n/packages/debian/Makefile.in +++ b/modules/n2nvpn/n2n/packages/debian/Makefile @@ -1,9 +1,19 @@ # # Change it according to your setup # +# Prerequisite: apt-get install devscripts +# +# N2N_HOME=$(PWD)/../.. N2N_BUILD=${N2N_HOME}/packages/debian/n2n +include ${N2N_HOME}/config.mak + +# TODO: continue to untangle the version generation +# we either should not need to override the config.mak here or +# should never set the version in config.mak and always calculate it +PACKAGE_VERSION := $(shell ${N2N_HOME}/scripts/version.sh) + all: clean pkg pkg: @@ -19,7 +29,8 @@ pkg: install -m644 ../../community.list ${N2N_BUILD}/usr/share/doc/n2n/examples/ install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/ @/bin/rm -f ../n2n*.deb - dpkg-buildpackage -rfakeroot -d -us -uc -a@EXTN@ + DEBEMAIL=builder@example.com dch -v ${PACKAGE_VERSION} --no-auto-nmu Auto Build + dpkg-buildpackage -rfakeroot -d -us -uc --host-type ${CONFIG_HOST} -dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes @/bin/mv ../n2n_*deb . diff --git a/modules/n2nvpn/n2n/packages/debian/README b/modules/n2nvpn/n2n/packages/debian/README index 915a7c1..f500d7f 100644 --- a/modules/n2nvpn/n2n/packages/debian/README +++ b/modules/n2nvpn/n2n/packages/debian/README @@ -1,6 +1,6 @@ Prerequisites ------------- -apt-get install debhelper fakeroot dpkg-sig +apt-get install debhelper fakeroot dpkg-sig devscripts EdgeOS ------ diff --git a/modules/n2nvpn/n2n/packages/debian/configure.ac b/modules/n2nvpn/n2n/packages/debian/configure.ac new file mode 100644 index 0000000..2e3ae73 --- /dev/null +++ b/modules/n2nvpn/n2n/packages/debian/configure.ac @@ -0,0 +1,3 @@ +AC_INIT([Makefile.in], 1.0) +# TODO: Remove this file before the next stable release +echo "This configure script is no longer needed, update your build system" diff --git a/modules/n2nvpn/n2n/packages/debian/configure.in b/modules/n2nvpn/n2n/packages/debian/configure.in deleted file mode 100644 index e01e987..0000000 --- a/modules/n2nvpn/n2n/packages/debian/configure.in +++ /dev/null @@ -1,60 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION=$(../../scripts/version.sh) - -DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l` - -EXTRA_DEP="" -if test $DEBIAN_VERSION = "0"; then -EXTRA_DEP=", libzstd1" -fi - -if test "${EXTN+set}" != set; then - MACHINE=`uname -m` - SHORT_MACHINE=`echo $MACHINE | cut -b1-3` - - if test $MACHINE = "x86_64"; then - EXTN="amd64" - else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - else - EXTN="i386" - fi - fi - fi - fi -fi - -if test "${with_edgex+set}" = set; then - EXTN="mipsel" -fi - -APP=n2n -DATE=`date -R` - -AC_SUBST(APP) -AC_SUBST(N2N_VERSION) -AC_SUBST(EXTN) -AC_SUBST(DATE) -AC_SUBST(EXTRA_DEP) - -AC_CONFIG_FILES(debian/changelog) -AC_CONFIG_FILES(debian/files) -AC_CONFIG_FILES(debian/control) -AC_CONFIG_FILES(debian/rules) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) -AC_CONFIG_FILES(Makefile) -AC_OUTPUT diff --git a/modules/n2nvpn/n2n/packages/debian/debian/changelog b/modules/n2nvpn/n2n/packages/debian/debian/changelog new file mode 100644 index 0000000..9861f54 --- /dev/null +++ b/modules/n2nvpn/n2n/packages/debian/debian/changelog @@ -0,0 +1,4 @@ +n2n (3.0) table; urgency=high + * Last stable release + + -- Luca Deri Wed, 27 Oct 2021 20:43:08 +0200 diff --git a/modules/n2nvpn/n2n/packages/debian/debian/changelog.in b/modules/n2nvpn/n2n/packages/debian/debian/changelog.in deleted file mode 100644 index 5669566..0000000 --- a/modules/n2nvpn/n2n/packages/debian/debian/changelog.in +++ /dev/null @@ -1,4 +0,0 @@ -@APP@ (@N2N_VERSION@) table; urgency=high - * Last packaged version - - -- Luca Deri @DATE@ diff --git a/modules/n2nvpn/n2n/packages/debian/debian/control.in b/modules/n2nvpn/n2n/packages/debian/debian/control similarity index 92% rename from modules/n2nvpn/n2n/packages/debian/debian/control.in rename to modules/n2nvpn/n2n/packages/debian/debian/control index 7303119..266a17c 100644 --- a/modules/n2nvpn/n2n/packages/debian/debian/control.in +++ b/modules/n2nvpn/n2n/packages/debian/debian/control @@ -6,9 +6,9 @@ Standards-Version: 4.6.0 Build-Depends: Package: n2n -Architecture: @EXTN@ +Architecture: any Suggests: uml-utilities -Depends: ${shlibs:Depends}, ${misc:Depends} @EXTRA_DEP@ +Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: n2n (<< 2.1.0-1) Replaces: n2n (<< 2.1.0-1) Description: a layer-two peer-to-peer virtual private network (VPN) diff --git a/modules/n2nvpn/n2n/packages/debian/debian/files.in b/modules/n2nvpn/n2n/packages/debian/debian/files.in deleted file mode 100644 index 510512c..0000000 --- a/modules/n2nvpn/n2n/packages/debian/debian/files.in +++ /dev/null @@ -1 +0,0 @@ -n2n_@N2N_VERSION@_@EXTN@.deb free optional diff --git a/modules/n2nvpn/n2n/packages/debian/debian/rules.in b/modules/n2nvpn/n2n/packages/debian/debian/rules similarity index 93% rename from modules/n2nvpn/n2n/packages/debian/debian/rules.in rename to modules/n2nvpn/n2n/packages/debian/debian/rules index 4e879b9..391dfd4 100755 --- a/modules/n2nvpn/n2n/packages/debian/debian/rules.in +++ b/modules/n2nvpn/n2n/packages/debian/debian/rules @@ -12,7 +12,7 @@ # http://www.tin.org/bin/man.cgi?section=7&topic=debhelper # -package=@APP@ +package=n2n build: build-stamp build-stamp: @@ -50,6 +50,7 @@ binary-arch: build install cp -r ../etc debian/n2n find debian/n2n -name "*.in" -exec /bin/rm {} ';' find debian/n2n -name "*~" -exec /bin/rm {} ';' + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info dh_link dh_gencontrol dh_md5sums diff --git a/modules/n2nvpn/n2n/packages/etc/systemd/system/edge-ntopng@.service.in b/modules/n2nvpn/n2n/packages/etc/systemd/system/edge-ntopng@.service similarity index 100% rename from modules/n2nvpn/n2n/packages/etc/systemd/system/edge-ntopng@.service.in rename to modules/n2nvpn/n2n/packages/etc/systemd/system/edge-ntopng@.service diff --git a/modules/n2nvpn/n2n/packages/etc/systemd/system/edge.service.in b/modules/n2nvpn/n2n/packages/etc/systemd/system/edge.service similarity index 100% rename from modules/n2nvpn/n2n/packages/etc/systemd/system/edge.service.in rename to modules/n2nvpn/n2n/packages/etc/systemd/system/edge.service diff --git a/modules/n2nvpn/n2n/packages/etc/systemd/system/edge@.service.in b/modules/n2nvpn/n2n/packages/etc/systemd/system/edge@.service similarity index 100% rename from modules/n2nvpn/n2n/packages/etc/systemd/system/edge@.service.in rename to modules/n2nvpn/n2n/packages/etc/systemd/system/edge@.service diff --git a/modules/n2nvpn/n2n/packages/etc/systemd/system/supernode.service.in b/modules/n2nvpn/n2n/packages/etc/systemd/system/supernode.service similarity index 100% rename from modules/n2nvpn/n2n/packages/etc/systemd/system/supernode.service.in rename to modules/n2nvpn/n2n/packages/etc/systemd/system/supernode.service diff --git a/modules/n2nvpn/n2n/packages/rpm/configure.in b/modules/n2nvpn/n2n/packages/rpm/configure.in index e65d3c0..a10a389 100644 --- a/modules/n2nvpn/n2n/packages/rpm/configure.in +++ b/modules/n2nvpn/n2n/packages/rpm/configure.in @@ -48,9 +48,5 @@ AC_SUBST(DATE) AC_SUBST(RPM_SIGN_CMD) AC_CONFIG_FILES(n2n.spec) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/modules/n2nvpn/n2n/scripts/n2n-ctl b/modules/n2nvpn/n2n/scripts/n2n-ctl index e389ecb..17f6ef9 100755 --- a/modules/n2nvpn/n2n/scripts/n2n-ctl +++ b/modules/n2nvpn/n2n/scripts/n2n-ctl @@ -7,6 +7,7 @@ import argparse import socket import json import collections +import time class JsonUDP(): @@ -171,6 +172,28 @@ def str_table(rows, columns, orderby): return ''.join(result) +def num2timestr(seconds): + """Convert a number of seconds into a human time""" + + if seconds == 0: + return "now" + + days, seconds = divmod(seconds, (60*60*24)) + hours, seconds = divmod(seconds, (60*60)) + minutes, seconds = divmod(seconds, 60) + + r = [] + if days: + r += [f"{days}d"] + if hours: + r += [f"{hours}h"] + if minutes: + r += [f"{minutes}m"] + if seconds: + r += [f"{seconds}s"] + return "".join(r) + + def subcmd_show_supernodes(rpc, args): rows = rpc.read('supernodes') columns = [ @@ -179,8 +202,13 @@ def subcmd_show_supernodes(rpc, args): 'macaddr', 'sockaddr', 'uptime', + 'last_seen', ] + now = int(time.time()) + for row in rows: + row["last_seen"] = num2timestr(now - row["last_seen"]) + return str_table(rows, columns, args.orderby) @@ -192,8 +220,13 @@ def subcmd_show_edges(rpc, args): 'macaddr', 'sockaddr', 'desc', + 'last_seen', ] + now = int(time.time()) + for row in rows: + row["last_seen"] = num2timestr(now - row["last_seen"]) + return str_table(rows, columns, args.orderby) diff --git a/modules/n2nvpn/n2n/src/edge_management.c b/modules/n2nvpn/n2n/src/edge_management.c index 27d9ca9..2207066 100644 --- a/modules/n2nvpn/n2n/src/edge_management.c +++ b/modules/n2nvpn/n2n/src/edge_management.c @@ -607,7 +607,7 @@ void readFromMgmtSocket (n2n_edge_t *eee) { msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), "%-19s %1s%1s | %-17s | %-21s | %-15s | %9s | %10s\n", peer->version, - (peer->purgeable == false) ? "l" : "", + (peer->purgeable) ? "" : "l", (peer == eee->curr_sn) ? (eee->sn_wait ? "." : "*" ) : "", is_null_mac(peer->mac_addr) ? "" : macaddr_str(mac_buf, peer->mac_addr), sock_to_cstr(sockbuf, &(peer->sock)), diff --git a/modules/n2nvpn/n2n/src/edge_utils.c b/modules/n2nvpn/n2n/src/edge_utils.c index 9592e51..4afdb64 100644 --- a/modules/n2nvpn/n2n/src/edge_utils.c +++ b/modules/n2nvpn/n2n/src/edge_utils.c @@ -683,6 +683,7 @@ static void register_with_new_peer (n2n_edge_t *eee, scan->sock = *peer; scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */ scan->last_valid_time_stamp = initial_time_stamp(); + scan->purgeable = true; if(via_multicast) scan->local = 1; @@ -1903,6 +1904,7 @@ static int check_query_peer_info (n2n_edge_t *eee, time_t now, n2n_mac_t mac) { scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */ scan->last_seen = now; /* Don't change this it marks the pending peer for removal. */ scan->last_valid_time_stamp = initial_time_stamp(); + scan->purgeable = true; HASH_ADD_PEER(eee->pending_peers, scan); } diff --git a/modules/n2nvpn/n2n/src/n2n.c b/modules/n2nvpn/n2n/src/n2n.c index 5d48ebf..dc16229 100644 --- a/modules/n2nvpn/n2n/src/n2n.c +++ b/modules/n2nvpn/n2n/src/n2n.c @@ -528,6 +528,7 @@ struct peer_info* add_sn_to_list_by_mac_or_sock (struct peer_info **sn_list, n2n if(peer) { sn_selection_criterion_default(&(peer->selection_criterion)); peer->last_valid_time_stamp = initial_time_stamp(); + peer->purgeable = true; memcpy(&(peer->sock), sock, sizeof(n2n_sock_t)); memcpy(peer->mac_addr, mac, sizeof(n2n_mac_t)); HASH_ADD_PEER(*sn_list, peer); @@ -687,7 +688,7 @@ size_t clear_peer_list (struct peer_info ** peer_list) { size_t retval = 0; HASH_ITER(hh, *peer_list, scan, tmp) { - if (scan->purgeable == false && scan->ip_addr) { + if (!scan->purgeable && scan->ip_addr) { free(scan->ip_addr); } HASH_DEL(*peer_list, scan); diff --git a/modules/n2nvpn/n2n/src/sn_management.c b/modules/n2nvpn/n2n/src/sn_management.c index 00f8773..62c1994 100644 --- a/modules/n2nvpn/n2n/src/sn_management.c +++ b/modules/n2nvpn/n2n/src/sn_management.c @@ -371,7 +371,7 @@ int process_mgmt (n2n_sn_t *sss, ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, "%s '%s'\n", - (community->is_federation) ? "FEDERATION" : ((community->purgeable == false) ? "FIXED NAME COMMUNITY" : "COMMUNITY"), + (community->is_federation) ? "FEDERATION" : ((community->purgeable) ? "COMMUNITY" : "FIXED NAME COMMUNITY"), (community->is_federation) ? "-/-" : community->community); sendto_mgmt(sss, sender_sock, sock_size, (const uint8_t *) resbuf, ressize); ressize = 0; @@ -382,7 +382,7 @@ int process_mgmt (n2n_sn_t *sss, ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, "%4u | %-19s | %-17s | %-21s %-3s | %-15s | %9s\n", ++num, - (peer->dev_addr.net_addr == 0) ? ((peer->purgeable == false) ? "-l" : "") : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), + (peer->dev_addr.net_addr == 0) ? ((peer->purgeable) ? "" : "-l") : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), sock_to_cstr(sockbuf, &(peer->sock)), ((peer->socket_fd >= 0) && (peer->socket_fd != sss->sock)) ? "TCP" : "", diff --git a/modules/n2nvpn/n2n/src/sn_utils.c b/modules/n2nvpn/n2n/src/sn_utils.c index 62ca053..13ac267 100644 --- a/modules/n2nvpn/n2n/src/sn_utils.c +++ b/modules/n2nvpn/n2n/src/sn_utils.c @@ -1145,6 +1145,9 @@ static int update_edge (n2n_sn_t *sss, /* Known */ if(auth_edge(&(scan->auth), &(reg->auth), answer_auth, comm) == 0) { if(!sock_equal(sender_sock, &(scan->sock))) { + scan->dev_addr.net_addr = reg->dev_addr.net_addr; + scan->dev_addr.net_bitlen = reg->dev_addr.net_bitlen; + memcpy((char*)scan->dev_desc, reg->dev_desc, N2N_DESC_SIZE); memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); scan->socket_fd = socket_fd; scan->last_cookie = reg->cookie; @@ -1480,7 +1483,7 @@ static int purge_expired_communities (n2n_sn_t *sss, } } - if((comm->edges == NULL) && (comm->purgeable == true)) { + if((comm->edges == NULL) && (comm->purgeable)) { traceEvent(TRACE_INFO, "purging idle community %s", comm->community); if(NULL != comm->header_encryption_ctx_static) { /* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */ diff --git a/modules/n2nvpn/n2nvpn.cpp b/modules/n2nvpn/n2nvpn.cpp index 2c57d63..5828be1 100644 --- a/modules/n2nvpn/n2nvpn.cpp +++ b/modules/n2nvpn/n2nvpn.cpp @@ -1,6 +1,7 @@ #include #include +#include "stddclmr.h" #include "n2nvpn.h" extern "C" { diff --git a/modules/n2nvpn/stddclmr.h b/modules/n2nvpn/stddclmr.h new file mode 100644 index 0000000..8e6b3d9 --- /dev/null +++ b/modules/n2nvpn/stddclmr.h @@ -0,0 +1,95 @@ +#ifndef STDDCLMR_H +#define STDDCLMR_H + +/* +Action figures sold separately. Add toner. All models over 18 years of age. +All rights reserved. Allow four to six weeks for delivery. An equal +opportunity employer. Any resemblance to actual persons, living or dead, is +unintentional and purely coincidental. Apply only to affected area. Approved +for veterans. As seen on TV. At participating locations only. Avoid contact +with mucous membranes. Avoid contact with skin. Avoid extreme temperatures +and store in a cool dry place. Batteries not included. Be sure each item is +properly endorsed. Beware of dog. Booths for two or more. Breaking seal +constitutes acceptance of agreement. Call toll free number before digging. +Caveat emptor. Check here if tax deductible. Close cover before striking +Colors may fade. Contains a substantial amount of non-tobacco ingredients. +Contents may settle during shipment. Contestants have been briefed on some +questions before the show. Copyright 1995 Joker's Wild. Disclaimer does +not cover hurricane, lightning, tornado, tsunami, volcanic eruption, +earthquake, flood, and other Acts of God, misuse, neglect, unauthorized +repair, damage from improper installation, broken antenna or marred cabinet, +incorrect line voltage, missing or altered serial numbers, sonic boom +vibrations, electromagnetic radiation from nuclear blasts, customer +adjustments that are not covered in the joke list, and incidents owing to +airplane crash, ship sinking, motor vehicle accidents, leaky roof, broken +glass, falling rocks, mud slides, forest fire, flying projectiles, or +dropping the item. Do not bend, fold, mutilate, or spindle. Do not place +near flammable or magnetic source. Do not puncture, incinerate, or store +above 120 degrees Fahrenheit. Do not stamp. Use other side for additional +listings. Do not use while operating a motor vehicle or heavy equipment. Do +not write below this line. Documents are provided "as is" without any +warranties expressed or implied. Don't quote me on anything. Don't quote me +on that. Driver does not carry cash. Drop in any mailbox. Edited for +television. Employees and their families are not eligible. Falling rock. +First pull up, then pull down. Flames redirected to /dev/null. For a +limited time only. For external use only. For off-road use only. For office +use only. For recreational use only. Do not disturb. Freshest if eaten +before date on carton. Hand wash only, tumble dry on low heat. If a rash, +redness, irritation, or swelling develops, discontinue use. If condition +persists, consult your physician. If defects are discovered, do not attempt +to fix them yourself, but return to an authorized service center. If +ingested, do not induce vomiting, if symptoms persist, consult a doctor. +Keep away from open flames and avoid inhaling fumes. Keep away from +sunlight, pets, and small children. Keep cool; process promptly. Limit +one-per-family please. Limited time offer, call now to ensure prompt +delivery. List at least two alternate dates. List each check separately by +bank number. List was current at time of printing. Lost ticket pays maximum +rate. May be too intense for some viewers. Must be 18 to enter. No Canadian +coins. No alcohol, dogs or horses. No anchovies unless otherwise specified. +No animals were harmed in the production of these documents. No money down. +No other warranty expressed or implied. No passes accepted for this +engagement. No postage necessary if mailed in the United States. No +preservatives added. No purchase necessary. No salt, MSG, artificial color +or flavor added. No shoes, no shirt, no service, no kidding. No solicitors. +No substitutions allowed. No transfers issued until the bus comes to a +complete stop. No user-serviceable parts inside. Not affiliated with the +American Red Cross. Not liable for damages due to use or misuse. Not +recommended for children. Not responsible for direct, indirect, incidental +or consequential damages resulting from any defect, error or failure to +perform. Not the Beatles. Objects in mirror may be closer than they appear. +One size fits all. Many suitcases look alike. Other copyright laws for +specific entries apply wherever noted. Other restrictions may apply. Package +sold by weight, not volume. Parental advisory - explicit lyrics. Penalty for +private use. Place stamp here. Please remain seated until the ride has come +to a complete stop. Possible penalties for early withdrawal. Post office will +not deliver without postage. Postage will be paid by addressee. Prerecorded +for this time zone. Price does not include taxes. Processed at location +stamped in code at top of carton. Quantities are limited while supplies last. +Read at your own risk. Record additional transactions on back of previous +stub. Replace with same type. Reproduction strictly prohibited. Restaurant +package, not for resale. Return to sender, no forwarding order on file, +unable to forward. Safety goggles may be required during use. Sanitized for +your protection. Sealed for your protection, do not use if the safety seal is +broken. See label for sequence. Shading within a garment may occur. Sign here +without admitting guilt. Simulated picture. Slightly enlarged to show detail. +Slightly higher west of the Rockies. Slippery when wet. Smoking these may be +hazardous to your health. Some assembly required. Some equipment shown is +optional. Some of the trademarks mentioned in this product appear for +identification purposes only. Subject to FCC approval. Subject to change +without notice. Substantial penalty for early withdrawal. Text may contain +material some readers may find objectionable, parental guidance is advised. +Text used in these documents is made from 100% recycled electrons and magnetic +particles. These documents do not reflect the thoughts or opinions of either +myself, my company, my friends, or my rabbit. This is not an offer to sell +securities. This offer is void where prohibited, taxed, or otherwise +restricted. This product is meant for educational purposes only. Times +approximate. Unix is a registered trademark of AT&T. Use only as directed. Use +only in a well-ventilated are. User assumes full liabilities. Void where +prohibited. We have sent the forms which seem right for you. You must be +present to win. You need not be present to win. Your canceled check is your +receipt. Your mileage may vary. I didn't do it. You can't prove anything. + +This supersedes all previous notices. +*/ + +#endif // STDDCLMR_H diff --git a/supernode.sh b/supernode.sh index 538b0f1..928e16d 100755 --- a/supernode.sh +++ b/supernode.sh @@ -6,10 +6,14 @@ mkdir -p bin pushd modules/n2nvpn/n2n ./autogen.sh -./configure -make supernode +./configure --enable-pthread +#--enable-miniupnp --enable-natpmp + +make +#supernode mv supernode ../../../bin/. -make clean -rm include/config.h +mv edge ../../../bin/. +#make clean +#rm include/config.h popd