support linux l2 bridge (#1044)

* support linux l2 bridge

* unified timeout name

* typo

* minor code style adaptions

* feature define

* feature define

* feature define

* feature define

* added hint to bridging to help output

* added hint to bridging

* drafted bridging documentation

* added bridging hint

---------

Co-authored-by: Logan oos Even <46396513+Logan007@users.noreply.github.com>
This commit is contained in:
Dylan Yee
2023-05-04 11:00:38 +08:00
committed by GitHub
co-authored by Logan oos Even
parent 39b9c6b1c0
commit e01daf4a85
8 changed files with 105 additions and 6 deletions
+1
View File
@@ -35,6 +35,7 @@
#define N2N_HAVE_DAEMON /* needs to be defined before it gets undefined */
#define N2N_HAVE_TCP /* needs to be defined before it gets undefined */
#define HAVE_BRIDGING_SUPPORT
/* #define N2N_CAN_NAME_IFACE */
+3 -1
View File
@@ -51,7 +51,9 @@
#define REGISTER_SUPER_INTERVAL_DFL 20 /* sec, usually UDP NAT entries in a firewall expire after 30 seconds */
#define SWEEP_TIME 30 /* sec, indicates the value after which we have to sort the hash list of supernodes in edges
* and when we send out packets to query selection-relevant informations from supernodes. */
#ifdef HAVE_BRIDGING_SUPPORT
#define HOSTINFO_TIMEOUT 300 /* sec, how long after last seen will the hostinfo be deleted */
#endif
#define NUMBER_SN_PINGS_INITIAL 15 /* number of supernodes to concurrently ping during bootstrap and immediately afterwards */
#define NUMBER_SN_PINGS_REGULAR 5 /* number of supernodes to concurrently ping during regular edge operation */
+13 -2
View File
@@ -470,6 +470,15 @@ struct peer_info {
typedef struct peer_info peer_info_t;
#ifdef HAVE_BRIDGING_SUPPORT
struct host_info {
n2n_mac_t mac_addr;
n2n_mac_t edge_addr;
time_t last_seen;
UT_hash_handle hh; /* makes this structure hashable */
};
#endif
typedef struct n2n_edge n2n_edge_t;
/* *************************************************** */
@@ -723,8 +732,10 @@ struct n2n_edge {
/* Peers */
struct peer_info * known_peers; /**< Edges we are connected to. */
struct peer_info * pending_peers; /**< Edges we have tried to register with. */
/* Timers */
#ifdef HAVE_BRIDGING_SUPPORT
struct host_info * known_hosts; /**< hosts we know. */
#endif
/* Timers */
time_t last_register_req; /**< Check if time to re-register with super*/
time_t last_p2p; /**< Last time p2p traffic was received. */
time_t last_sup; /**< Last time a packet arrived from supernode. */