Skip to content
Snippets Groups Projects
Commit c2c4b1de authored by Sukru Senli's avatar Sukru Senli
Browse files

adapt loop-detector to new uci config and options

parent 021d27c6
No related branches found
No related tags found
No related merge requests found
config loop-detect_config
option send_loop_discovery_period '10'
option send_discovery_numbertimes '6'
......@@ -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);
......
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment