clarified error message (#634)

This commit is contained in:
Logan oos Even 2021-02-08 17:24:03 +05:45 committed by GitHub
parent 408f24d778
commit 54ba76e3bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

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

View File

@ -55,9 +55,13 @@ int edge_verify_conf (const n2n_edge_conf_t *conf) {
if(conf->community_name[0] == 0)
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)
return(-2);
if(HASH_COUNT(conf->supernodes) == 0)
return(-5);
if(conf->register_interval < 1)
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)))
return(-4);
if(HASH_COUNT(conf->supernodes) == 0)
return(-5);
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);
if(rv != 0) {
traceEvent(TRACE_WARNING, "Invalid socket");
traceEvent(TRACE_WARNING, "Invalid supernode address");
free(sock);
return(1);
}