diff --git a/config/loopDetect b/config/loopDetect deleted file mode 100644 index 98007857ea59790e2d04119d09f7a17141558dd1..0000000000000000000000000000000000000000 --- a/config/loopDetect +++ /dev/null @@ -1,4 +0,0 @@ -config loop-detect_config - option send_loop_discovery_period '10' - option send_discovery_numbertimes '6' - diff --git a/ethernetThreadPool.c b/ethernetThreadPool.c index 3d4d227733f5c303ec08f8e18311dc6d9b9a566a..6dbc8da2d114372d80310e121349cfd05adf9b3d 100644 --- a/ethernetThreadPool.c +++ b/ethernetThreadPool.c @@ -39,7 +39,7 @@ uint8_t numberDetectedLoops = 0; char **portsLoop; /* - * functions that allows to control ethernet ports that corresponds to L2Loops + * functions that allows to control ethernet ports that corresponds to L2 loops */ void init_portsLoop(void){ uint8_t i; @@ -143,7 +143,7 @@ void ethernetCaptureLoopHandler( u_char *args, const struct pcap_pkthdr *packet_ if(test && senddiscoverycheck==1 && numberDetectedLoops == 0) { senddiscoverycheck = 0; - fprintf(stdout,"L2Loop detected in the port: %s\n", args); + fprintf(stdout,"L2 loop is detected on port: %s\n", args); ethernetDeviceUpDown(args, "down"); sent_after_loop_counter = 1; addPortsLoop(args); diff --git a/loop-detector.c b/loop-detector.c index d3bb7fc02994caffc8ad2f372ba278ea2fb7c7fb..899d42b5c62152d15944e7dccf589dd91d2433df 100644 --- a/loop-detector.c +++ b/loop-detector.c @@ -56,7 +56,7 @@ void getAppUciParams(void){ if (!uci_ctx) fprintf(stdout, "uci_ctx alloc failed\n"); } - if (uci_load(uci_ctx, "loopDetect", &uci_config_package)) { + if (uci_load(uci_ctx, "loop_detection", &uci_config_package)) { uci_free_context(uci_ctx); uci_ctx = NULL; return; @@ -68,10 +68,10 @@ void getAppUciParams(void){ s = uci_to_section(e2); uci_foreach_element(&s->options, e3) { opt = uci_to_option(e3); - if(!strcmp(opt->e.name, "send_loop_discovery_period")) { + if(!strcmp(opt->e.name, "discovery_interval")) { send_loop_discovery_period = atoi(opt->v.string); } - if(!strcmp(opt->e.name, "send_discovery_numbertimes")) { + if(!strcmp(opt->e.name, "recovery_check_tries")) { send_discovery_numbertimes = atoi(opt->v.string); } } @@ -164,8 +164,10 @@ int main(int argc, char *argv[]) { findPortsNumberNames(); buildL2LoopDiscoveryFrame(); - init_l2loop_send_discovery_thread(); - init_ethernet_thread_pool(); - join_ports_threads(); + fprintf(stdout, "L2 loop detection started with discovery interval set to %d seconds and recovery check tries set to %d\n", send_loop_discovery_period, send_discovery_numbertimes); + + init_l2loop_send_discovery_thread(); + init_ethernet_thread_pool(); + join_ports_threads(); return 0; }