introduced n2n-portfwd tool (#1008)

* moved dev to version 3.1.1

* introduced n2n-portfwd tool

* moved port-forwarding source to tool

* adjusted tiny things, seemingly works with ./configure's  --enable-miniupnp  and  --enable-natpmp

* adjusted for Windows

* wished for better typing skills

* applied some finishing touch

* typo
This commit is contained in:
Logan oos Even
2022-06-05 18:05:40 +02:00
committed by GitHub
parent 99b6b6b66d
commit 51a3a71f95
12 changed files with 398 additions and 228 deletions
-2
View File
@@ -158,9 +158,7 @@
#include "network_traffic_filter.h"
#include "auth.h"
#if defined(HAVE_MINIUPNP) || defined(HAVE_NATPMP)
#include "n2n_port_mapping.h"
#endif // HAVE_MINIUPNP || HAVE_NATPMP
#include "json.h"
+3 -4
View File
@@ -20,13 +20,12 @@
#ifndef _N2N_PORT_MAPPING_H_
#define _N2N_PORT_MAPPING_H_
#ifdef HAVE_PORT_FORWARDING
#include <stdint.h>
#ifdef HAVE_MINIUPNP
#ifdef CMAKE_BUILD
// CMAKE uses static linked lib as submodule which requires different includes than
// CMAKE uses statically linked lib as submodule which requires different includes than
// the dynamically linked, intalled library in case of plain make
#include <miniupnpc.h>
#include <upnpcommands.h>
@@ -44,8 +43,8 @@
#endif // HAVE_NATPMP
void n2n_chg_port_mapping (struct n2n_edge *eee, const uint16_t port);
void n2n_set_port_mapping (const uint16_t port);
void n2n_del_port_mapping (const uint16_t port);
#endif // HAVE_PORT_FORWARDING
#endif // _N2N_PORT_MAPPING_H_
-18
View File
@@ -634,21 +634,6 @@ typedef struct n2n_resolve_parameter {
/* *************************************************** */
// structure to hold port mapping thread's parameters
typedef struct n2n_port_map_parameter {
#ifdef HAVE_PTHREAD
pthread_t id; /* thread id */
pthread_mutex_t access; /* mutex for shared access */
#endif
uint16_t mgmt_port;
uint16_t mapped_port;
uint16_t new_port; /* REVISIT: remove with management port subscriptions */
} n2n_port_map_parameter_t;
/* *************************************************** */
typedef struct n2n_edge_conf {
struct peer_info *supernodes; /**< List of supernodes */
n2n_community_t community_name; /**< The community. 16 full octets. */
@@ -686,7 +671,6 @@ typedef struct n2n_edge_conf {
uint8_t sn_selection_strategy; /**< encodes currently chosen supernode selection strategy. */
uint8_t number_max_sn_pings; /**< Number of maximum concurrently allowed supernode pings. */
uint64_t mgmt_password_hash; /**< contains hash of managament port password. */
uint8_t port_forwarding; /**< indicates if port forwarding UPNP/PMP is enabled */
} n2n_edge_conf_t;
@@ -747,8 +731,6 @@ struct n2n_edge {
n2n_resolve_parameter_t *resolve_parameter; /**< Pointer to name resolver's parameter block */
uint8_t resolution_request; /**< Flag an immediate DNS resolution request */
n2n_port_map_parameter_t *port_map_parameter; /**< Pointer to port mapping thread's parameter block */
n2n_tuntap_priv_config_t tuntap_priv_conf; /**< Tuntap config */
network_traffic_filter_t *network_traffic_filter;