Merge branch 'dev' into rp

This commit is contained in:
Logan oos Even 2020-07-25 18:54:33 +05:45 committed by GitHub
commit 5ceb839b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 410 additions and 360 deletions

View File

@ -114,10 +114,6 @@ typedef struct ether_hdr ether_hdr_t;
#include <zstd.h>
#endif
#ifdef __ANDROID_NDK__
#define ARP_PERIOD_INTERVAL (10) /* sec */
#endif /* #ifdef __ANDROID_NDK__ */
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
@ -240,6 +236,9 @@ typedef struct n2n_edge_callbacks {
/* Called whenever the IP address of the TAP interface changes. */
void (*ip_address_changed)(n2n_edge_t *eee, uint32_t old_ip, uint32_t new_ip);
/* Called periodically in the main loop. */
void (*main_loop_period)(n2n_edge_t *eee, time_t now);
} n2n_edge_callbacks_t;
/* ***************************************************** */

View File

@ -124,8 +124,8 @@ static void help() {
#endif /* #ifndef WIN32 */
#ifdef __linux__
"[-T <tos>]"
"[-n cidr:gateway] "
#endif
"[-n cidr:gateway] "
"[-m <MAC address>] "
"-l <supernode host:port>\n"
" "
@ -182,8 +182,8 @@ static void help() {
printf("-S | Do not connect P2P. Always use the supernode.\n");
#ifdef __linux__
printf("-T <tos> | TOS for packets (e.g. 0x48 for SSH like priority)\n");
printf("-n <cidr:gateway> | Route an IPv4 network via the gw. Use 0.0.0.0/0 for the default gw. Can be set multiple times.\n");
#endif
printf("-n <cidr:gateway> | Route an IPv4 network via the gw. Use 0.0.0.0/0 for the default gw. Can be set multiple times.\n");
printf("-v | Make more verbose. Repeat as required.\n");
printf("-t <port> | Management UDP Port (for multiple edges on a machine).\n");
@ -443,6 +443,7 @@ static int setOption(int optkey, char *optargument, n2n_tuntap_priv_config_t *ec
break;
}
#endif
case 'n':
{
@ -480,7 +481,6 @@ static int setOption(int optkey, char *optargument, n2n_tuntap_priv_config_t *ec
break;
}
#endif
case 's': /* Subnet Mask */
{
@ -539,13 +539,13 @@ static const struct option long_options[] =
static int loadFromCLI(int argc, char *argv[], n2n_edge_conf_t *conf, n2n_tuntap_priv_config_t *ec) {
u_char c;
while((c = getopt_long(argc, argv,
"k:a:bc:Eu:g:m:M:s:d:l:p:fvhrt:i:SDL:z::A::H"
while ((c = getopt_long(argc, argv,
"k:a:bc:Eu:g:m:M:s:d:l:p:fvhrt:i:SDL:z::A::Hn:"
#ifdef __linux__
"T:n:"
"T:"
#endif
,
long_options, NULL)) != '?') {
,
long_options, NULL)) != '?') {
if(c == 255) break;
setOption(c, optarg, ec, conf);
}

File diff suppressed because it is too large Load Diff

View File

@ -90,6 +90,12 @@ void closeTraceFile() {
if (traceFile != NULL && traceFile != stdout) {
fclose(traceFile);
}
#ifndef WIN32
if (useSyslog && syslog_opened) {
closelog();
syslog_opened = 0;
}
#endif
}
#define N2N_TRACE_DATESIZE 32

View File

@ -356,7 +356,7 @@ int main(int argc, char * const argv[]) {
#if defined(N2N_HAVE_DAEMON)
if(sss_node.daemon) {
useSyslog=1; /* traceEvent output now goes to syslog. */
setUseSyslog(1); /* traceEvent output now goes to syslog. */
if(-1 == daemon(0, 0)) {
traceEvent(TRACE_ERROR, "Failed to become daemon.");