|
@ -162,7 +162,9 @@ static void help() { |
|
|
" | eg. -m 01:02:03:04:05:06\n"); |
|
|
" | eg. -m 01:02:03:04:05:06\n"); |
|
|
printf("-M <mtu> | Specify n2n MTU of edge interface (default %d).\n", DEFAULT_MTU); |
|
|
printf("-M <mtu> | Specify n2n MTU of edge interface (default %d).\n", DEFAULT_MTU); |
|
|
printf("-r | Enable packet forwarding through n2n community.\n"); |
|
|
printf("-r | Enable packet forwarding through n2n community.\n"); |
|
|
|
|
|
#ifdef N2N_HAVE_AES |
|
|
printf("-A | Set AES CBC as the preferred encryption mode.\n"); |
|
|
printf("-A | Set AES CBC as the preferred encryption mode.\n"); |
|
|
|
|
|
#endif |
|
|
printf("-E | Accept multicast MAC addresses (default=drop).\n"); |
|
|
printf("-E | Accept multicast MAC addresses (default=drop).\n"); |
|
|
printf("-v | Make more verbose. Repeat as required.\n"); |
|
|
printf("-v | Make more verbose. Repeat as required.\n"); |
|
|
printf("-t <port> | Management UDP Port (for multiple edges on a machine).\n"); |
|
|
printf("-t <port> | Management UDP Port (for multiple edges on a machine).\n"); |
|
@ -269,12 +271,14 @@ static int setOption(int optkey, char *optargument, edge_conf_t *ec, n2n_edge_t |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef N2N_HAVE_AES |
|
|
case 'A': |
|
|
case 'A': |
|
|
{ |
|
|
{ |
|
|
eee->preferred_aes = 1; |
|
|
eee->preferred_aes = 1; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
case 'l': /* supernode-list */ |
|
|
case 'l': /* supernode-list */ |
|
|
if(optargument) { |
|
|
if(optargument) { |
|
|
if(eee->sn_num < N2N_EDGE_NUM_SUPERNODES) { |
|
|
if(eee->sn_num < N2N_EDGE_NUM_SUPERNODES) { |
|
@ -364,7 +368,11 @@ static int loadFromCLI(int argc, char *argv[], edge_conf_t *ec, n2n_edge_t *eee) |
|
|
u_char c; |
|
|
u_char c; |
|
|
|
|
|
|
|
|
while((c = getopt_long(argc, argv, |
|
|
while((c = getopt_long(argc, argv, |
|
|
"K:k:a:bc:Eu:g:m:M:s:d:l:p:fvhrAt:", |
|
|
"K:k:a:bc:Eu:g:m:M:s:d:l:p:fvhrt:" |
|
|
|
|
|
#ifdef N2N_HAVE_AES |
|
|
|
|
|
"A" |
|
|
|
|
|
#endif |
|
|
|
|
|
, |
|
|
long_options, NULL)) != '?') { |
|
|
long_options, NULL)) != '?') { |
|
|
if(c == 255) break; |
|
|
if(c == 255) break; |
|
|
setOption(c, optarg, ec, eee); |
|
|
setOption(c, optarg, ec, eee); |
|
@ -672,14 +680,18 @@ int main(int argc, char* argv[]) { |
|
|
traceEvent(TRACE_NORMAL, "Binding to local port %d", (signed int)ec.local_port); |
|
|
traceEvent(TRACE_NORMAL, "Binding to local port %d", (signed int)ec.local_port); |
|
|
|
|
|
|
|
|
if(ec.encrypt_key) { |
|
|
if(ec.encrypt_key) { |
|
|
|
|
|
#ifdef N2N_HAVE_AES |
|
|
if(edge_init_aes_psk(&eee, (uint8_t *)(ec.encrypt_key), strlen(ec.encrypt_key)) < 0) { |
|
|
if(edge_init_aes_psk(&eee, (uint8_t *)(ec.encrypt_key), strlen(ec.encrypt_key)) < 0) { |
|
|
fprintf(stderr, "Error: AES PSK setup failed.\n"); |
|
|
fprintf(stderr, "Error: AES PSK setup failed.\n"); |
|
|
return(-1); |
|
|
return(-1); |
|
|
} |
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
if(edge_init_twofish_psk(&eee, (uint8_t *)(ec.encrypt_key), strlen(ec.encrypt_key)) < 0) { |
|
|
if(edge_init_twofish_psk(&eee, (uint8_t *)(ec.encrypt_key), strlen(ec.encrypt_key)) < 0) { |
|
|
fprintf(stderr, "Error: twofish PSK setup failed.\n"); |
|
|
fprintf(stderr, "Error: twofish PSK setup failed.\n"); |
|
|
return(-1); |
|
|
return(-1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else if(strlen(eee.keyschedule) > 0) { |
|
|
} else if(strlen(eee.keyschedule) > 0) { |
|
|
if(edge_init_keyschedule(&eee) != 0) { |
|
|
if(edge_init_keyschedule(&eee) != 0) { |
|
|
fprintf(stderr, "Error: keyschedule setup failed.\n"); |
|
|
fprintf(stderr, "Error: keyschedule setup failed.\n"); |
|
|