Browse Source

clarified error message (#634)

pull/635/head
Logan oos Even 4 years ago
committed by GitHub
parent
commit
54ba76e3bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/edge.c
  2. 9
      src/edge_utils.c

6
src/edge.c

@ -497,11 +497,11 @@ static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *e
break; break;
} }
case 'l': /* supernode-list */ case 'l': /* supernode-list */ {
if(optargument) { if(optargument) {
if(edge_conf_add_supernode(conf, optargument) != 0) { if(edge_conf_add_supernode(conf, optargument) != 0) {
traceEvent(TRACE_WARNING, "Too many supernodes!"); traceEvent(TRACE_WARNING, "Failed to add supernode '%s'", optargument);
exit(1); }
} }
break; break;
} }

9
src/edge_utils.c

@ -55,9 +55,13 @@ int edge_verify_conf (const n2n_edge_conf_t *conf) {
if(conf->community_name[0] == 0) if(conf->community_name[0] == 0)
return(-1); return(-1);
// REVISIT: are the following two conditions equal? if so, remove one. but note that sn_num is used elsewhere
if(conf->sn_num == 0) if(conf->sn_num == 0)
return(-2); return(-2);
if(HASH_COUNT(conf->supernodes) == 0)
return(-5);
if(conf->register_interval < 1) if(conf->register_interval < 1)
return(-3); return(-3);
@ -65,9 +69,6 @@ int edge_verify_conf (const n2n_edge_conf_t *conf) {
((conf->encrypt_key != NULL) && (conf->transop_id == N2N_TRANSFORM_ID_NULL))) ((conf->encrypt_key != NULL) && (conf->transop_id == N2N_TRANSFORM_ID_NULL)))
return(-4); return(-4);
if(HASH_COUNT(conf->supernodes) == 0)
return(-5);
return(0); return(0);
} }
@ -3064,7 +3065,7 @@ int edge_conf_add_supernode (n2n_edge_conf_t *conf, const char *ip_and_port) {
rv = supernode2sock(sock, ip_and_port); rv = supernode2sock(sock, ip_and_port);
if(rv != 0) { if(rv != 0) {
traceEvent(TRACE_WARNING, "Invalid socket"); traceEvent(TRACE_WARNING, "Invalid supernode address");
free(sock); free(sock);
return(1); return(1);
} }

Loading…
Cancel
Save