[Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.14, 1.15

Andreas T�nnesen (spam-protected)
Sat Jan 7 09:17:45 CET 2006


Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16043/nameservice/src

Modified Files:
	nameservice.c 
Log Message:
Adapted plugins to the cleanup of external variables in olsrd

Index: nameservice.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** nameservice.c	29 May 2005 12:47:42 -0000	1.14
--- nameservice.c	7 Jan 2006 08:17:43 -0000	1.15
***************
*** 217,221 ****
  		if (name->ip.v4 == 0) {
  			// insert main_addr
! 			memcpy(&name->ip, &main_addr, ipsize);
  			prev = name;
  		} else {
--- 217,221 ----
  		if (name->ip.v4 == 0) {
  			// insert main_addr
! 			memcpy(&name->ip, &olsr_cnf->main_addr, olsr_cnf->ipsize);
  			prev = name;
  		} else {
***************
*** 240,244 ****
  	if (have_dns_server) {
  		if (my_dns_server.v4 == 0) {
! 			memcpy(&my_dns_server, &main_addr, ipsize);
  			printf("\nNAME PLUGIN: announcing upstream DNS server: %s\n", 
  				olsr_ip_to_string(&my_dns_server));
--- 240,244 ----
  	if (have_dns_server) {
  		if (my_dns_server.v4 == 0) {
! 			memcpy(&my_dns_server, &olsr_cnf->main_addr, olsr_cnf->ipsize);
  			printf("\nNAME PLUGIN: announcing upstream DNS server: %s\n", 
  				olsr_ip_to_string(&my_dns_server));
***************
*** 355,359 ****
  			message->v4.olsr_msgtype = MESSAGE_TYPE;
  			message->v4.olsr_vtime = double_to_me(my_timeout);
! 			memcpy(&message->v4.originator, &main_addr, ipsize);
  			message->v4.ttl = MAX_TTL;
  			message->v4.hopcnt = 0;
--- 355,359 ----
  			message->v4.olsr_msgtype = MESSAGE_TYPE;
  			message->v4.olsr_vtime = double_to_me(my_timeout);
! 			memcpy(&message->v4.originator, &olsr_cnf->main_addr, olsr_cnf->ipsize);
  			message->v4.ttl = MAX_TTL;
  			message->v4.hopcnt = 0;
***************
*** 370,374 ****
  			message->v6.olsr_msgtype = MESSAGE_TYPE;
  			message->v6.olsr_vtime = double_to_me(my_timeout);
! 			memcpy(&message->v6.originator, &main_addr, ipsize);
  			message->v6.ttl = MAX_TTL;
  			message->v6.hopcnt = 0;
--- 370,374 ----
  			message->v6.olsr_msgtype = MESSAGE_TYPE;
  			message->v6.olsr_vtime = double_to_me(my_timeout);
! 			memcpy(&message->v6.originator, &olsr_cnf->main_addr, olsr_cnf->ipsize);
  			message->v6.ttl = MAX_TTL;
  			message->v6.hopcnt = 0;
***************
*** 404,408 ****
  
  	/* Fetch the originator of the messsage */
! 	memcpy(&originator, &m->v4.originator, ipsize);
  		
  	/* Fetch the message based on IP version */
--- 404,408 ----
  
  	/* Fetch the originator of the messsage */
! 	memcpy(&originator, &m->v4.originator, olsr_cnf->ipsize);
  		
  	/* Fetch the message based on IP version */
***************
*** 420,424 ****
  	/* Check if message originated from this node. 
  	If so - back off */
! 	if(memcmp(&originator, &main_addr, ipsize) == 0)
  		return;
  
--- 420,424 ----
  	/* Check if message originated from this node. 
  	If so - back off */
! 	if(memcmp(&originator, &olsr_cnf->main_addr, olsr_cnf->ipsize) == 0)
  		return;
  
***************
*** 471,475 ****
  		to_packet->type = htons(NAME_FORWARDER);
  		to_packet->len = htons(0);
! 		memcpy(&to_packet->ip, &my_dns_server, ipsize);
  		pos += sizeof(struct name);
  		i++;
--- 471,475 ----
  		to_packet->type = htons(NAME_FORWARDER);
  		to_packet->len = htons(0);
! 		memcpy(&to_packet->ip, &my_dns_server, olsr_cnf->ipsize);
  		pos += sizeof(struct name);
  		i++;
***************
*** 485,489 ****
  		to_packet->type = htons(my_name->type);
  		to_packet->len = htons(my_name->len);
! 		memcpy(&to_packet->ip, &my_name->ip, ipsize);
  		pos += sizeof(struct name);
  		strncpy(pos, my_name->name, my_name->len);
--- 485,489 ----
  		to_packet->type = htons(my_name->type);
  		to_packet->len = htons(my_name->len);
! 		memcpy(&to_packet->ip, &my_name->ip, olsr_cnf->ipsize);
  		pos += sizeof(struct name);
  		strncpy(pos, my_name->name, my_name->len);
***************
*** 535,539 ****
  		tmp->len = ntohs(from_packet->len) > MAX_NAME ? MAX_NAME : ntohs(from_packet->len);
  		tmp->name = olsr_malloc(tmp->len+1, "new name_entry name");
! 		memcpy(&tmp->ip, &from_packet->ip, ipsize);
  		pos += sizeof(struct name);
  		strncpy(tmp->name, pos, tmp->len);
--- 535,539 ----
  		tmp->len = ntohs(from_packet->len) > MAX_NAME ? MAX_NAME : ntohs(from_packet->len);
  		tmp->name = olsr_malloc(tmp->len+1, "new name_entry name");
! 		memcpy(&tmp->ip, &from_packet->ip, olsr_cnf->ipsize);
  		pos += sizeof(struct name);
  		strncpy(tmp->name, pos, tmp->len);
***************
*** 572,576 ****
  	for (entry = list[hash]; entry != NULL; entry = entry->next)
  	{
! 		if (memcmp(originator, &entry->originator, ipsize) == 0) {
  			// found
  			olsr_printf(4, "NAME PLUGIN: %s found\n", 
--- 572,576 ----
  	for (entry = list[hash]; entry != NULL; entry = entry->next)
  	{
! 		if (memcmp(originator, &entry->originator, olsr_cnf->ipsize) == 0) {
  			// found
  			olsr_printf(4, "NAME PLUGIN: %s found\n", 
***************
*** 591,595 ****
  	entry = olsr_malloc(sizeof(struct db_entry), "new db_entry");
  	
! 	memcpy(&entry->originator, originator, ipsize);
  	olsr_get_timestamp(vtime * 1000, &entry->timer);
  	entry->names = NULL;
--- 591,595 ----
  	entry = olsr_malloc(sizeof(struct db_entry), "new db_entry");
  	
! 	memcpy(&entry->originator, originator, olsr_cnf->ipsize);
  	olsr_get_timestamp(vtime * 1000, &entry->timer);
  	entry->names = NULL;
***************
*** 727,731 ****
  					
  					tmp = olsr_malloc(sizeof(struct rt_entry), "new rt_entry");
! 					memcpy(&tmp->rt_dst, &route->rt_dst, ipsize);
  					tmp->rt_etx = route->rt_etx;
  					tmp->next = best_routes;
--- 727,731 ----
  					
  					tmp = olsr_malloc(sizeof(struct rt_entry), "new rt_entry");
! 					memcpy(&tmp->rt_dst, &route->rt_dst, olsr_cnf->ipsize);
  					tmp->rt_etx = route->rt_etx;
  					tmp->next = best_routes;
***************
*** 748,752 ****
  						
  						tmp = olsr_malloc(sizeof(struct rt_entry), "new rt_entry");
! 						memcpy(&tmp->rt_dst, &route->rt_dst, ipsize);
  						tmp->rt_etx = route->rt_etx;
  						tmp->next = last->next;
--- 748,752 ----
  						
  						tmp = olsr_malloc(sizeof(struct rt_entry), "new rt_entry");
! 						memcpy(&tmp->rt_dst, &route->rt_dst, olsr_cnf->ipsize);
  						tmp->rt_etx = route->rt_etx;
  						tmp->next = last->next;





More information about the Olsr-cvs mailing list