NetBSD-Bugs archive

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

Re: bin/53705: dhcpcd spams syslogd



The following reply was made to PR bin/53705; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/53705: dhcpcd spams syslogd
Date: Wed, 07 Nov 2018 12:12:20 +0700

 Aside from the missing "what's wrong" from the last message,
 the patch was actually wrong, this is what it should be (inverted
 time test...)
 
 Index: dhcp6.c
 ===================================================================
 RCS file: /cvsroot/src/external/bsd/dhcpcd/dist/src/dhcp6.c,v
 retrieving revision 1.2
 diff -u -r1.2 dhcp6.c
 --- dhcp6.c	4 Nov 2018 16:30:28 -0000	1.2
 +++ dhcp6.c	7 Nov 2018 05:10:57 -0000
 @@ -43,6 +43,7 @@
  #include <string.h>
  #include <unistd.h>
  #include <fcntl.h>
 +#include <time.h>
  
  #define ELOOP_QUEUE 4
  #include "config.h"
 @@ -1916,6 +1917,8 @@
  	void * (*f)(void *, size_t, uint16_t, uint16_t *), *farg;
  	char buf[32], *sbuf;
  	const char *status;
 +	time_t now;
 +	static time_t reported[__arraycount(dhcp6_statuses)];
  
  	f = p ? dhcp6_findoption : dhcp6_findmoption;
  	if (p)
 @@ -1936,6 +1939,13 @@
  	if (code == D6_STATUS_OK)
  		return 1;
  
 +	now = time(NULL);
 +	if (code < __arraycount(reported)) {
 +		if (reported[code] + (3600 * 2) > now)
 +			return -1;
 +		reported[code] = now;
 +	}
 +
  	/* Anything after the code is a message. */
  	opt += sizeof(code);
  	mlen = opt_len - sizeof(code);
 
 


Home | Main Index | Thread Index | Old Index