Re: [PATCH 2/2] Display warning if multiple IPs are found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fabio M. Di Nitto napsal(a):
> On 12/3/2012 12:13 PM, Jan Friesse wrote:
>> Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
>> ---
>>  exec/totemip.c |    8 ++++++++
>>  1 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/exec/totemip.c b/exec/totemip.c
>> index 77bcad5..35741c5 100644
>> --- a/exec/totemip.c
>> +++ b/exec/totemip.c
>> @@ -53,12 +53,15 @@
>>  
>>  #include <corosync/totem/totemip.h>
>>  #include <corosync/swab.h>
>> +#include <corosync/logsys.h>
>>  
>>  #define LOCALHOST_IPV4 "127.0.0.1"
>>  #define LOCALHOST_IPV6 "::1"
>>  
>>  #define NETLINK_BUFSIZE 16384
>>  
>> +LOGSYS_DECLARE_SUBSYS ("IP");
>> +
>>  #ifdef SO_NOSIGPIPE
>>  void totemip_nosigpipe(int s)
>>  {
>> @@ -287,6 +290,11 @@ int totemip_parse(struct totem_ip_address *totemip, const char *addr, int family
>>  	else
>>  		memcpy(totemip->addr, &sa6->sin6_addr, sizeof(struct in6_addr));
>>  
>> +	if (ainfo->ai_next != NULL) {
>> +		log_printf(LOGSYS_LEVEL_WARNING,
>> +		    "More then one address found for %s. Please consider using /etc/hosts", addr);
>> +	}
>> +
>>  	freeaddrinfo(ainfo);
>>  	return 0;
>>  }
>>
> 
> This patch doesn´t look right. We can´t add a subsystem without logging
> config et all. And calling log_printf directly breaks totem logging
> callbacks.
> 

Actually, config should be created by LOGSYS_DECLARE_SUBSYS

> How about returning a different error code from totemip_parse if there
> is more than one ip?
> 
> < 0 == error
> 0 == all good
>> 0 == more than one ip
> 

Ya, that was actually idea. Problem is, that call of this function is in
multiple places, and (at least) totemconfig.c also doesn't register
itself to logsys...

> and log from the caller instead?
> 
> Fabio
> _______________________________________________
> discuss mailing list
> discuss@xxxxxxxxxxxx
> http://lists.corosync.org/mailman/listinfo/discuss
> 

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss



[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux