Giter Site home page Giter Site logo

n2n's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

n2n's Issues

N2N Builder

Good afternoon!

I created a repository prepared to build n2n, having the edge and supernode output on x86_64 and arm32v7, I hope it helps you, making it easier to build on different architectures.

To build in a specific commit just change the N2N_COMMIT_HASH inside the Makefile.

Repo: https://github.com/supermock/n2n-builder

Well ... that's it, I'm just going to let you know about this repo! =D

Windows port is not running successfully

Have to change something to compile with VS2017. After running supernode and edge on same machine , they are waiting like these.

t:\SHARED>edge -a 10.1.2.2 -c mynetwork -k encryptme -l 10.150.17.217:12345
03/Oct/2018 11:13:33 [edge.c:606] Starting n2n edge 2.0.0 Oct 3 2018 10:32:05
03/Oct/2018 11:13:33 [edge.c:609] supernode 0 => 10.150.17.217:12345
03/Oct/2018 11:13:33 [edge.c:649] ip_mode='static'
Open device [name={B3A4C17F-ABD0-4FDF-9B7A-58D79D31C7CA}][ip=10.1.2.2][ifName=Ethernet 2][MTU=1400][mac=00:FF:B3:A4:C1:7F]
Setting Ethernet 2 device address...

Device Ethernet 2 set to 10.1.2.2/255.255.255.0
03/Oct/2018 11:13:33 [edge.c:694] edge started
03/Oct/2018 11:13:33 [edge_utils.c:672] Chose new tx_transop_idx=1
03/Oct/2018 11:13:33 [edge_utils.c:1371] Rx REGISTER_SUPER_ACK myMAC=00:FF:B3:A4:C1:7F [10.150.17.217:12345] (external 10.150.17.217:58198). Attempts 2

t:\SHARED>supernode -v -l 12345
03/Oct/2018 11:13:23 [sn.c:836] supernode is listening on UDP 12345 (main)
03/Oct/2018 11:13:23 [sn.c:847] supernode is listening on UDP 5645 (management)
03/Oct/2018 11:13:23 [sn.c:850] supernode started
03/Oct/2018 11:13:33 [n2n.c:317] Purging old registrations
03/Oct/2018 11:13:33 [n2n.c:322] Remove 0 registrations
03/Oct/2018 11:13:33 [sn.c:148] update_edge created 00:FF:B3:A4:C1:7F ==> 10.150.17.217:58198
03/Oct/2018 11:14:37 [n2n.c:317] Purging old registrations
03/Oct/2018 11:14:37 [n2n.c:322] Remove 0 registrations

Setting MAC address on edge under windows

Hi,

Has anyone been able to set the MAC address of the tap interface using the -m parameter under windows? As far as I can tell this hasn't been implemented in Win32.

edge.exe -c mynetwork -a 1.2.3.4 -l 10.0.0.5:1234 -m 00:FF:34:BD:A7:A1

Edge nodes public port for direct communication

In the current implementation, in order for two edge nodes to communicate directly without going through a supernode, an edge node (or both?) is required to have all the ports open. In a real world environment, this is impractical to implement because of:

  1. Firewalls: we don't want do open all the ports
  2. NAT

When a user is in control of his firewall and NAT, it's easy for him to just open/port map a single port for incoming communications. It would be great if n2n provided a way for a node to advertise such a public port to the other nodes, so that they can try to contact it directly through this port.

How to connect 2 supernodes for HA

According to this picture from the official site 2 supernodes can talk to each other (im hoping it can used for High availability)

I have not found how this is done and if it can be done.
Can 1 edge connect to 2 supernodes ?

compile fails,please help me

[root@tlx build]# make
[ 14%] Built target doc
[ 19%] Building C object CMakeFiles/n2n.dir/version.c.o
/root/n2n/version.c:1:20: error: config.h: No such file or directory
/root/n2n/version.c:3: error: ‘PACKAGE_VERSION’ undeclared here (not in a function)
/root/n2n/version.c:4: error: ‘PACKAGE_OSNAME’ undeclared here (not in a function)
make[2]: *** [CMakeFiles/n2n.dir/version.c.o] Error 1
make[1]: *** [CMakeFiles/n2n.dir/all] Error 2
make: *** [all] Error 2

Windows cannot compile

I've tried a lot of ways, but I've failed.vs2008,vs2010,msys,msys2,cmake-gui,mingw32,"struct stat " error

Verify edge node identity

A rogue supernode or another edge node in the same community could impersonate an edge node by spoofing its MAC and IP address. Edge nodes should provide a fingerprint to be verified by the connecting node in a similar way as the SSH protocol does.

Supernode service user

When installed as a service, the supernode runs as root and there is no possibility to drop privileges via options. Ideally it should run as a new n2n user instead.

n2n network performance very slow

I have tried to do some speedtests:

  1. from edge1 -> edge2 i only get 100mbit
  2. from same servers without n2n i get 1gbit

why is there such a huge loss in performance ?
the cpu usage for edge when transferring files is 100% on the core it executes on. (is it an CPU / IO issue?)
MTU setting not changed (default to 1400)

I am sure i am not sending packets via the supernode , checked with iftop -i n2n0

Hash the key before use & Max out the key size

A hash on the key before feeding it into the AES or TF would be a good thing to do, as hashed values usually spread the bits broader and look more pseudo-random than an ASCII coded password ever could. This is also known as "key stretching". It makes more unpredictable use of the available key space.

As maximum AES and TF key size is 256 bit, the first half of SHA512 would deliver the key. The second half of the hash value could be used for HMAC or similar (seperate issue to be created later).

And then, the maximum key length of 256 bit should always be used. First of all, because it is easier to always use the complete first half of the hash value as key.

But also, as the bigger key size makes better use of the available key space as follows: There are (2 ^ 128)! different possible swirls for plain text blocks being transformed into cipher, with 128 being the block size and ! the factorial function. Each key (2 ^ 256) addresses one of these permutations, but not all, as (2 ^ 256) is much smaller than (2 ^ 128)! . So, if we already are not able to use the complete key space, why should the software limit itself even further by using even smaller keys? Though, performance might be an excuse. Not so sure about the difference it might make.

As for AES, a suitable place to apply the hash function might be the "add_aes_key"-function.

No need for a salt as long as no password hashes (or hashes of password hashes) are stored for verification purposes, i.e. authentication in terms of "approval".

[EDITed]

Multiple supernodes do not increase network availability

Hi I was wondering if a supernode is ok to be a client also.

Here is my setup

4 machines running edge, 2 of which have supernodes on them
all 4 machines subscribes to all supernodes

when i kill a supernode the network dies and does not use the other supernode.
Any ideas?

Installation issue on Mac OS X

Due to System Integrity Protection (SIP) of Mac OS (El Captain and later versions) the following command fails in order to install n2n:

myuser$ sudo make 
myuser$ sudo make install
echo "MANDIR=/usr/share/man"
MANDIR=/usr/share/man
mkdir -p /usr/sbin /usr/share/man/man1 /usr/share/man/man7 /usr/share/man/man8
install -m755 supernode /usr/sbin/
install: /usr/sbin//supernode: Operation not permitted
make: *** [install] Error 71

And in Apple community, it's not recommended to disable SIP at all. So the only way could be changing /usr/sbin install directory to usr/local/sbin which is writable without disabling SIP.

Any ideas?

edge_utils.c:1687:52: error: ‘SO_REUSEPORT’ undeclared (first use in this function)

Hi,
I downloaded git code and compiled on old linode VM machine.

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.8 (wheezy)
Release:        7.8
Codename:       wheezy
# uname -a
Linux asterisk1 4.15.13-x86_64-linode106 #1 SMP Tue Mar 27 14:42:14 UTC 2018 x86_64 GNU/Linux

While compilation i faced following error.

~/n2n# make 
/bin/sh: 1: pkg-config: not found
cc -g3  -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs   -c n2n.c
cc -g3  -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs   -c n2n_keyfile.c
cc -g3  -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs   -c wire.c
cc -g3  -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs   -c minilzo.c
cc -g3  -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs   -c twofish.c
cc -g3  -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs   -c edge_utils.c
edge_utils.c: In function ‘quick_edge_init’:
edge_utils.c:1687:52: error: ‘SO_REUSEPORT’ undeclared (first use in this function)
edge_utils.c:1687:52: note: each undeclared identifier is reported only once for each function it appears in
make: *** [edge_utils.o] Error 1

I am able to compile and run the program by commenting out the lines using ‘SO_REUSEPORT’

~/n2n# grep -r SO_REUSEPORT *
edge.c:  /*  setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse)); */
edge_utils.c:  /*  setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse)); */

After that make and make install go smoothly.
Can you suggest what the proper resolution?
Is there any limitation in using older kernels?

MAC address can not changed

I use command like this:

edge -f -vv -d n2n0 -a 192.168.20.1 -s 255.255.255.0 -c usoawork -m C1:7E:02:81:15:7B -l 127.0.0.1:5000 -f

but mac address not what I'm specifying

log as follows:

[root@vm-center ~]# edge -f -vv -d n2n0 -a 192.168.20.1 -s 255.255.255.0 -c usoawork -m C1:7E:02:81:15:7B -l 127.0.0.1:5000 -f
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2503] Adding supernode[0] = 127.0.0.1:5000
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2610] Starting n2n edge 2.1.0 Aug 18 2017 11:25:57
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2615] supernode 0 => 127.0.0.1:5000
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2615] supernode 1 =>
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2642] WARNING: Encryption is disabled in edge.
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2662] ip_mode='static'
SIOCSIFHWADDR: 无法指定被请求的地址
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/tuntap_linux.c: 100] Setting MAC: /sbin/ifconfig n2n0 hw ether C1:7E:02:81:15:7B
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/tuntap_linux.c: 115] Bringing up: /sbin/ifconfig n2n0 192.168.20.1 netmask 255.255.255.0 mtu 1400 up
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/tuntap_linux.c: 38] Interface n2n0 has MAC F6:45:DA:74:3B:18
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:2721] edge started
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c:1099] Registering with supernode (127.0.0.1:5000) (attempts left 2)
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c: 700] send REGISTER_SUPER to 127.0.0.1:5000
18/Aug/2017 11:31:24 [/opt/n2n/n2n_v2/n2n_v2/edge.c: 593] sendto sent=38 to

Hello,Windows cannot compile,Please help me

[root@lstcml win32]# mkdir build
[root@lstcml win32]# cd build/
[root@lstcml build]# cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/n2n/win32/build
[root@lstcml build]# make
Scanning dependencies of target n2n_win32
[ 33%] Building C object CMakeFiles/n2n_win32.dir/getopt1.c.o
[ 66%] Building C object CMakeFiles/n2n_win32.dir/getopt.c.o
[100%] Building C object CMakeFiles/n2n_win32.dir/wintap.c.o
In file included from /root/n2n/win32/wintap.c:6:0:
/root/n2n/win32/n2n_win32.h:20:22: fatal error: winsock2.h: No such file or directory
#include <winsock2.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/n2n_win32.dir/wintap.c.o] Error 1
make[1]: *** [CMakeFiles/n2n_win32.dir/all] Error 2
make: *** [all] Error 2

Version is't the same

2018-10-11, The version of n2n for windows is 2.0.0, for ubuntu is 2.5.0, and for padavan is 2.3.0.
Pay attention please, Thank you!

All edge traffic passes through the supernode

I built a supernode on Ubuntu and 2 edges on 2 Windows PC.
I connect the other Windows through Microsoft RDP and play video on it.

I view large traffic on the supernode.
So I want to know where I might be mistaken.

How to config real p2p connection that without passing through the supernode?

Port 0 bug.

I have been using n2n for some time. Occasionally I got this issue, I could not find information about it.
In supernode, a registering node is like this:
Registered new node [public_ip=(2)11.22.33.44:12345][private_ip=0.0.0.0:12345][mac=11:22:33:44:55:66][community=MY_COMMUNITY]
Of course ip and mac are fakes, just examples.
But some times the node registers itself as:
Registered new node [public_ip=(2)11.22.33.44:0][private_ip=0.0.0.0:12345][mac=11:22:33:44:55:66][community=MY_COMMUNITY]
Notice the ip port is 0 (ZERO).
When this happens the log gets filled with warnings like this:
WARNING: sendto() [sent=-1][attempted_to_send=84] [Invalid argument]
Sorry I did not have time to trace this bug to the source code, hope it helps.

Can not build master

When I build the latest master source, I got this error:

[root@host cmake]# make
Scanning dependencies of target doc
[  4%] Generating doc/edge.8.gz
[  9%] Generating doc/supernode.1.gz
make[2]: *** No rule to make target `/root/work/n2n/sources/n2n_v2.7', needed by `doc/n2n_v2.7.gz'.  Stop.
make[1]: *** [CMakeFiles/doc.dir/all] Error 2
make: *** [all] Error 2

more supernode support

Dear friend , I hope n2n would be realized cooperative work among more supernode, that means different supernode will be distributed in different places to establish VPN connections across the optimized path router.

Add explicit dependency for openssl in CMakeLists.txt

From cbc34333c144889136822e086b3a02ba03d72069 Mon Sep 17 00:00:00 2001
From: Dushara Jayasinghe [email protected]
Date: Mon, 28 Aug 2017 09:27:40 +1000
Subject: [PATCH] Add explicit dependency for openssl


CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9ad81c..51b0eb6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,6 +13,7 @@ endif(NOT DEFINED N2N_OPTION_AES)
add_definitions(-DN2N_VERSION='"${N2N_VERSION}"' -DN2N_OSNAME='"${N2N_OSNAME}"')

if(N2N_OPTION_AES)
+find_package(OpenSSL REQUIRED)
add_definitions(-DN2N_HAVE_AES)
endif(N2N_OPTION_AES)

--
2.7.4

Issue on running edge.exe

I tried on windows, but edge.exe crashes for some reason. I didn't get what could be the issue. Can you please specify how I can get it running?

Implement supernode management capability

Currently the supernode does not report any info about connected peers and activities. It would be nice to add a web GUI or at least a way to query it in order to understand the ongoing registrations etc.

No rule to make target n2n_v2.7 on macOS

Hello

when i clone the repository to a directory on macOS High Sierra 10.13.5. and:

$ export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
$ export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
$ mkdir build && cd build
$ cmake ..
$ make

it returns:

make[2]: *** No rule to make target ../n2n_v2.7', needed by doc/n2n_v2.7.gz'. Stop.
make[1]: *** [CMakeFiles/doc.dir/all] Error 2
make: *** [all] Error 2

I have installed openssl and tun.

Implement traffic layer-7 policy in the edge

As of today the edge allows all traffic regardless of its nature. It would be nice to use nDPI to set restrictions on exchanged traffic to block at the edge unwanted communications.

n2n edge connection times out

I have noticed that n2n sometimes stalls when there are a lot of packet drops due to unreliable communication channel. Restarting n2n on both the edge nodes solves the issue, so I suspect some metadata n2n packets (e.g. registration) are dropped and not retransmitted. I will provide more information when I reproduce the problem again.

Register succeed but two edge can't communicate in newest version,but a old version works..

Hi:
I used to setup a supernode in my server and run an edge in the same server and my personal workstation. They works well. I downloaded the newest version yesterday and sh ./autogen.sh
make PREFIX=some path install in both server and my workstation, and then I setup the supernode and edge in server, only edge in my workstation,they register succeed but they can not ping eachother through the n2n ip addr.

Ubuntu 16.04 Compile Error

fatal error: config.h: No such file or directory
compilation terminated.
CMakeFiles/n2n.dir/build.make:62: recipe for target 'CMakeFiles/n2n.dir/n2n.c.o' failed
make[2]: *** [CMakeFiles/n2n.dir/n2n.c.o] Error 1
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/n2n.dir/all' failed
make[1]: *** [CMakeFiles/n2n.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Implement micro-segmentation

Identify ways to allow edge nodes to connect via Internet only to the supernode, and route all the rest of traffic via n2n. This would promote the implementation of micro segmented services as well to restrict devices to selected communications. This could be interesting fields like IoT or automotive so that we can use n2n to policy traffic ad the edge and thus distributed the logic to peers.

Windows Supernode?

Is it possible to run N2N on Windows as a supernode? I've been trying to download and install the supernode application on ubuntu, but I'm very new to linux. This is the output I received after cloning the repo:

ubuntu@:~/n2n$ make
cc -g3 -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs -DN2N_HAVE_AES -c n2n.c
make: cc: Command not found
Makefile:90: recipe for target 'n2n.o' failed
make: *** [n2n.o] Error 127

Implement local peer discovery

On a LAN peers do not search each other and use the super node too often. It would be nice to implement some sort of discovery mechanisms to avoid that

Implement edge nodes listing in a community

A new message type could be used by an edge node to retrieve a list of the registered nodes within a community. This would be useful for the following reasons:

  • An edge node can use the returned list to contact another edge node directly without letting the supernode know. This is useful when the supernode is managed by a third-party and we don't want to disclose communication information to it.

  • All the MAC addresses of the nodes in the returned list can be added to the ARP table immediately.

ERROR: Failed to bind to local multicast group 224.0.0.68:1968

On Windows 10, with patch below so I compiled it successfully.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e351df..cacbb77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,7 +29,6 @@ endif(NOT DEFINED CMAKE_BUILD_TYPE)
 #set(CMAKE_BUILD_TYPE Debug)
 #set(CMAKE_BUILD_TYPE Release)

-if (DEFINED UNIX)
 # None
 set(CMAKE_C_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs")
 set(CMAKE_CXX_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs")
@@ -39,7 +38,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g")
 # Release
 set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
-endif()
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/include -Wl,-LC:\\\\MinGW\\\\lib -Wl,-LC:\\\\MinGW\\\\msys\\\\1.0\\\\lib")

 ## DEBUG FOR CMAKE
 #message(${N2N_VERSION})
diff --git a/edge.c b/edge.c
index d92472c..3028722 100644
--- a/edge.c
+++ b/edge.c
@@ -730,7 +730,15 @@ int main(int argc, char* argv[]) {

     /* allow multiple sockets to use the same PORT number */
     setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, &enable_reuse, sizeof(enable_reuse));
+#ifndef WIN32
+    /*
+     * From https://stackoverflow.com/questions/17212789/multiple-processes-listening-on-the-same-port
+     * Windows only knows the SO_REUSEADDR option, there is no SO_REUSEPORT.
+     * Setting SO_REUSEADDR on a socket in Windows behaves like setting
+     * SO_REUSEPORT and SO_REUSEADDR on a socket in BSD...
+     */
     setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse));
+#endif

     mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
     mreq.imr_interface.s_addr = htonl(INADDR_ANY);
diff --git a/edge_utils.c b/edge_utils.c
old mode 100644
new mode 100755
index 13bb7c9..01f34bb
--- a/edge_utils.c
+++ b/edge_utils.c
@@ -1743,7 +1743,16 @@ int quick_edge_init(char *device_name, char *community_name,

     /* allow multiple sockets to use the same PORT number */
     setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, &enable_reuse, sizeof(enable_reuse));
+
+#ifndef WIN32
+    /*
+     * From https://stackoverflow.com/questions/17212789/multiple-processes-listening-on-the-same-port
+     * Windows only knows the SO_REUSEADDR option, there is no SO_REUSEPORT.
+     * Setting SO_REUSEADDR on a socket in Windows behaves like setting
+     * SO_REUSEPORT and SO_REUSEADDR on a socket in BSD...
+     */
     setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse));
+#endif

     mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
     mreq.imr_interface.s_addr = htonl(INADDR_ANY);

When I start edge with

edge.exe -a static:<ip here> -c somename -k password -l domain:port -b

It failed with:

ERROR: Failed to bind to local multicast group 224.0.0.68:1968

ISP change port fast.

23:31:09.522852 IP person_IP.13108 > vps.localdomain.ndmp: UDP, length 85
23:31:09.523433 IP vps.localdomain.ndmp > person_IP.12978: UDP, length 93
23:31:10.562929 IP person_IP.13108 > vps.localdomain.ndmp: UDP, length 85
23:31:10.563471 IP vps.localdomain.ndmp > person_IP.12978: UDP, length 93

port 13108 is used now; port 12978 is register before.
Can you update n2n to use newest port?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.