/** * Processes a received HELLO message. */ void olsr_process_received_hello(struct olsrv2 *olsr, struct message_header *m, union olsr_ip_addr *in_if, union olsr_ip_addr *from_addr) { struct hello_message message; if (hello_change_structure(olsr, &message, m) == OLSR_FALSE) {// wiss: bi 3abi kell el ma3loumet bel "message" w iza fet lahon ma3neta tghayar el form ...bisir bi tayer el message //Fix for Memory Loss // wiss: sar fi deformation bel message men tayerou olsr_free_hello_packet(&message); return; } process_hello(olsr, &message, in_if, from_addr); olsr_free_hello_packet(&message); olsr->stat.numHelloReceived++; if(DEBUG_OLSRV2) { olsr_printf("Increment Hello Message Received Count to %d\n", olsr->stat.numHelloReceived); } return; }
void olsr_hello_tap(struct hello_message *message, struct interface *in_if, const union olsr_ip_addr *from_addr) { struct neighbor_entry *neighbor; /* * Update link status */ struct link_entry *lnk = update_link_entry(&in_if->ip_addr, from_addr, message, in_if); /*check alias message->source_addr*/ if (!ipequal(&message->source_addr,from_addr)){ /*new alias of new neighbour are thrown in the mid table to speed up routing*/ if (olsr_validate_address(from_addr)) { union olsr_ip_addr * main_addr = mid_lookup_main_addr(from_addr); if ((main_addr==NULL)||(ipequal(&message->source_addr, main_addr))){ /*struct ipaddr_str srcbuf, origbuf; olsr_syslog(OLSR_LOG_INFO, "got hello from unknown alias ip of direct neighbour: ip: %s main-ip: %s", olsr_ip_to_string(&origbuf,&message->source_addr), olsr_ip_to_string(&srcbuf,from_addr));*/ insert_mid_alias(&message->source_addr, from_addr, message->vtime); } else { struct ipaddr_str srcbuf, origbuf; olsr_syslog(OLSR_LOG_INFO, "got hello with invalid from and originator adress pair (%s, %s) Duplicate Ips?\n", olsr_ip_to_string(&origbuf,&message->source_addr), olsr_ip_to_string(&srcbuf,from_addr)); } } } if (olsr_cnf->lq_level > 0) { struct hello_neighbor *walker; /* just in case our neighbor has changed its HELLO interval */ olsr_update_packet_loss_hello_int(lnk, message->htime); /* find the input interface in the list of neighbor interfaces */ for (walker = message->neighbors; walker != NULL; walker = walker->next) { if (walker->link != UNSPEC_LINK && ipequal(&walker->address, &in_if->ip_addr)) { break; } } /* * memorize our neighbour's idea of the link quality, so that we * know the link quality in both directions * * walker is NULL if there the current interface was not included in * the message (or was included as an UNSPEC_LINK) */ olsr_memorize_foreign_hello_lq(lnk, walker); /* update packet loss for link quality calculation */ olsr_received_hello_handler(lnk); } neighbor = lnk->neighbor; /* * Hysteresis */ if (olsr_cnf->use_hysteresis) { /* Update HELLO timeout */ /* printf("MESSAGE HTIME: %f\n", message->htime); */ olsr_update_hysteresis_hello(lnk, message->htime); } /* Check if we are chosen as MPR */ if (lookup_mpr_status(message, in_if)) /* source_addr is always the main addr of a node! */ olsr_update_mprs_set(&message->source_addr, message->vtime); /* Check willingness */ if (neighbor->willingness != message->willingness) { struct ipaddr_str buf; OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", olsr_ip_to_string(&buf, &neighbor->neighbor_main_addr), neighbor->willingness, message->willingness); /* *If willingness changed - recalculate */ neighbor->willingness = message->willingness; changes_neighborhood = true; changes_topology = true; } /* Don't register neighbors of neighbors that announces WILL_NEVER */ if (neighbor->willingness != WILL_NEVER) process_message_neighbors(neighbor, message); /* Process changes immedeatly in case of MPR updates */ olsr_process_changes(); olsr_free_hello_packet(message); return; }