@@ -72,7 +72,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
7272 if ((* tcp_relay_ports )[* tcp_relay_port_count ] < MIN_ALLOWED_PORT
7373 || (* tcp_relay_ports )[* tcp_relay_port_count ] > MAX_ALLOWED_PORT ) {
7474 write_log (LOG_LEVEL_WARNING , "Port #%d: Invalid port: %u, should be in [%d, %d]. Skipping.\n" , i ,
75- (* tcp_relay_ports )[* tcp_relay_port_count ], MIN_ALLOWED_PORT , MAX_ALLOWED_PORT );
75+ (* tcp_relay_ports )[* tcp_relay_port_count ], MIN_ALLOWED_PORT , MAX_ALLOWED_PORT );
7676 continue ;
7777 }
7878
@@ -92,7 +92,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
9292
9393 if (config_setting_is_array (ports_array ) == CONFIG_FALSE ) {
9494 write_log (LOG_LEVEL_ERROR , "'%s' setting should be an array. Array syntax: 'setting = [value1, value2, ...]'.\n" ,
95- NAME_TCP_RELAY_PORTS );
95+ NAME_TCP_RELAY_PORTS );
9696 return ;
9797 }
9898
@@ -126,7 +126,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
126126 if ((* tcp_relay_ports )[* tcp_relay_port_count ] < MIN_ALLOWED_PORT
127127 || (* tcp_relay_ports )[* tcp_relay_port_count ] > MAX_ALLOWED_PORT ) {
128128 write_log (LOG_LEVEL_WARNING , "Port #%d: Invalid port: %u, should be in [%d, %d]. Skipping.\n" , i ,
129- (* tcp_relay_ports )[* tcp_relay_port_count ], MIN_ALLOWED_PORT , MAX_ALLOWED_PORT );
129+ (* tcp_relay_ports )[* tcp_relay_port_count ], MIN_ALLOWED_PORT , MAX_ALLOWED_PORT );
130130 continue ;
131131 }
132132
@@ -142,7 +142,8 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
142142 }
143143}
144144
145- int get_general_config (const char * cfg_file_path , char * * pid_file_path , char * * keys_file_path , int * port , int * enable_ipv6 ,
145+ int get_general_config (const char * cfg_file_path , char * * pid_file_path , char * * keys_file_path , int * port ,
146+ int * enable_ipv6 ,
146147 int * enable_ipv4_fallback , int * enable_lan_discovery , int * enable_tcp_relay , uint16_t * * tcp_relay_ports ,
147148 int * tcp_relay_port_count , int * enable_motd , char * * motd )
148149{
@@ -209,23 +210,23 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k
209210 if (config_lookup_bool (& cfg , NAME_ENABLE_IPV4_FALLBACK , enable_ipv4_fallback ) == CONFIG_FALSE ) {
210211 write_log (LOG_LEVEL_WARNING , "No '%s' setting in configuration file.\n" , NAME_ENABLE_IPV4_FALLBACK );
211212 write_log (LOG_LEVEL_WARNING , "Using default '%s': %s\n" , NAME_ENABLE_IPV4_FALLBACK ,
212- DEFAULT_ENABLE_IPV4_FALLBACK ? "true" : "false" );
213+ DEFAULT_ENABLE_IPV4_FALLBACK ? "true" : "false" );
213214 * enable_ipv4_fallback = DEFAULT_ENABLE_IPV4_FALLBACK ;
214215 }
215216
216217 // Get LAN discovery option
217218 if (config_lookup_bool (& cfg , NAME_ENABLE_LAN_DISCOVERY , enable_lan_discovery ) == CONFIG_FALSE ) {
218219 write_log (LOG_LEVEL_WARNING , "No '%s' setting in configuration file.\n" , NAME_ENABLE_LAN_DISCOVERY );
219220 write_log (LOG_LEVEL_WARNING , "Using default '%s': %s\n" , NAME_ENABLE_LAN_DISCOVERY ,
220- DEFAULT_ENABLE_LAN_DISCOVERY ? "true" : "false" );
221+ DEFAULT_ENABLE_LAN_DISCOVERY ? "true" : "false" );
221222 * enable_lan_discovery = DEFAULT_ENABLE_LAN_DISCOVERY ;
222223 }
223224
224225 // Get TCP relay option
225226 if (config_lookup_bool (& cfg , NAME_ENABLE_TCP_RELAY , enable_tcp_relay ) == CONFIG_FALSE ) {
226227 write_log (LOG_LEVEL_WARNING , "No '%s' setting in configuration file.\n" , NAME_ENABLE_TCP_RELAY );
227228 write_log (LOG_LEVEL_WARNING , "Using default '%s': %s\n" , NAME_ENABLE_TCP_RELAY ,
228- DEFAULT_ENABLE_TCP_RELAY ? "true" : "false" );
229+ DEFAULT_ENABLE_TCP_RELAY ? "true" : "false" );
229230 * enable_tcp_relay = DEFAULT_ENABLE_TCP_RELAY ;
230231 }
231232
@@ -239,7 +240,7 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k
239240 if (config_lookup_bool (& cfg , NAME_ENABLE_MOTD , enable_motd ) == CONFIG_FALSE ) {
240241 write_log (LOG_LEVEL_WARNING , "No '%s' setting in configuration file.\n" , NAME_ENABLE_MOTD );
241242 write_log (LOG_LEVEL_WARNING , "Using default '%s': %s\n" , NAME_ENABLE_MOTD ,
242- DEFAULT_ENABLE_MOTD ? "true" : "false" );
243+ DEFAULT_ENABLE_MOTD ? "true" : "false" );
243244 * enable_motd = DEFAULT_ENABLE_MOTD ;
244245 }
245246
@@ -315,6 +316,7 @@ uint8_t *hex_string_to_bin(char *hex_string)
315316
316317 char * pos = hex_string ;
317318 size_t i ;
319+
318320 for (i = 0 ; i < len ; ++ i , pos += 2 ) {
319321 sscanf (pos , "%2hhx" , & ret [i ]);
320322 }
@@ -343,7 +345,8 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6)
343345 config_setting_t * node_list = config_lookup (& cfg , NAME_BOOTSTRAP_NODES );
344346
345347 if (node_list == NULL ) {
346- write_log (LOG_LEVEL_WARNING , "No '%s' setting in the configuration file. Skipping bootstrapping.\n" , NAME_BOOTSTRAP_NODES );
348+ write_log (LOG_LEVEL_WARNING , "No '%s' setting in the configuration file. Skipping bootstrapping.\n" ,
349+ NAME_BOOTSTRAP_NODES );
347350 config_destroy (& cfg );
348351 return 1 ;
349352 }
@@ -373,7 +376,8 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6)
373376
374377 // Check that all settings are present
375378 if (config_setting_lookup_string (node , NAME_PUBLIC_KEY , & bs_public_key ) == CONFIG_FALSE ) {
376- write_log (LOG_LEVEL_WARNING , "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n" , i , NAME_PUBLIC_KEY );
379+ write_log (LOG_LEVEL_WARNING , "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n" , i ,
380+ NAME_PUBLIC_KEY );
377381 goto next ;
378382 }
379383
@@ -390,13 +394,14 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6)
390394 // Process settings
391395 if (strlen (bs_public_key ) != crypto_box_PUBLICKEYBYTES * 2 ) {
392396 write_log (LOG_LEVEL_WARNING , "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n" , i , NAME_PUBLIC_KEY ,
393- bs_public_key );
397+ bs_public_key );
394398 goto next ;
395399 }
396400
397401 if (bs_port < MIN_ALLOWED_PORT || bs_port > MAX_ALLOWED_PORT ) {
398- write_log (LOG_LEVEL_WARNING , "Bootstrap node #%d: Invalid '%s': %d, should be in [%d, %d]. Skipping the node.\n" , i , NAME_PORT ,
399- bs_port , MIN_ALLOWED_PORT , MAX_ALLOWED_PORT );
402+ write_log (LOG_LEVEL_WARNING , "Bootstrap node #%d: Invalid '%s': %d, should be in [%d, %d]. Skipping the node.\n" , i ,
403+ NAME_PORT ,
404+ bs_port , MIN_ALLOWED_PORT , MAX_ALLOWED_PORT );
400405 goto next ;
401406 }
402407
0 commit comments