Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 187753 | Differences between
and this patch

Collapse All | Expand All

(-)arp.c (-1 / +16 lines)
Lines 105-110 Link Here
105
	int nprobes = 0;
105
	int nprobes = 0;
106
	int nclaims = 0;
106
	int nclaims = 0;
107
	struct in_addr null_address;
107
	struct in_addr null_address;
108
	struct timeval stopat;
109
	struct timeval now;
108
110
109
	if (! iface->arpable) {
111
	if (! iface->arpable) {
110
		logger (LOG_DEBUG, "interface `%s' is not ARPable", iface->name);
112
		logger (LOG_DEBUG, "interface `%s' is not ARPable", iface->name);
Lines 159-166 Link Here
159
				retval = 0;
161
				retval = 0;
160
				break;
162
				break;
161
			}
163
			}
164
165
			/* Setup our stop time */
166
			if (get_time (&stopat) != 0)
167
				break;
168
			stopat.tv_usec += timeout;
162
		}
169
		}
163
		
170
	
171
		/* We maybe ARP flooded, so check our time */
172
		if (get_time (&now) != 0)
173
			break;
174
		if (timercmp (&now, &stopat, >)) {
175
			timeout = 0;
176
			continue;
177
		}
178
164
		if (! FD_ISSET (iface->fd, &rset))
179
		if (! FD_ISSET (iface->fd, &rset))
165
			continue;
180
			continue;
166
181
(-)Makefile (-5 / +9 lines)
Lines 1-4 Link Here
1
VERSION = 3.1.3
1
VERSION = 3.1.4_pre1
2
CFLAGS ?= -O2 -pipe
2
CFLAGS ?= -O2 -pipe
3
3
4
# Should work for both GNU make and BSD make
4
# Should work for both GNU make and BSD make
Lines 49-60 Link Here
49
dhcpcd_OBJS = arp.o client.o common.o configure.o dhcp.o dhcpcd.o duid.o \
49
dhcpcd_OBJS = arp.o client.o common.o configure.o dhcp.o dhcpcd.o duid.o \
50
		info.o interface.o ipv4ll.o logger.o signals.o socket.o
50
		info.o interface.o ipv4ll.o logger.o signals.o socket.o
51
51
52
# By default we don't need to link to anything
52
# These are nasty hacks to work out what libs we need to link to
53
# Except on Darwin where we need -lresolv, so they need to uncomment this
53
# We require librt for glibc bases systems
54
#dhcpcd_LIBS = -lresolv
54
_LIBRT != ldd /bin/date 2>/dev/null | grep -q /librt.so && echo "-lrt" || exit 0
55
LIBRT ?= $(_LIBRT) $(shell ldd /bin/date 2>/dev/null | grep -q /librt.so && echo "-lrt")
55
56
57
# Darwin needs this, but we have no way of detecting this atm
58
#LIRESOLV = -lresolv
59
56
dhcpcd: $(dhcpcd_H) $(dhcpcd_OBJS)
60
dhcpcd: $(dhcpcd_H) $(dhcpcd_OBJS)
57
	$(CC) $(LDFLAGS) $(dhcpcd_OBJS) $(dhcpcd_LIBS) -o dhcpcd
61
	$(CC) $(LDFLAGS) $(dhcpcd_OBJS) $(LIBRT) $(LIBRESOLV) -o dhcpcd
58
62
59
version.h:
63
version.h:
60
	echo '#define VERSION "$(VERSION)"' > version.h
64
	echo '#define VERSION "$(VERSION)"' > version.h
(-)common.c (-8 / +13 lines)
Lines 76-92 Link Here
76
#  endif
76
#  endif
77
#endif
77
#endif
78
78
79
/* This requires us to link to rt on glibc, so we use sysinfo instead */
79
/* Handy function to get the time. */
80
#ifdef __linux__
80
int get_time(struct timeval *tp)
81
#include <sys/sysinfo.h>
82
long uptime (void)
83
{
81
{
84
	struct sysinfo info;
82
	struct timespec ts;
85
83
86
	sysinfo (&info);
84
	if (clock_gettime (CLOCK_MONOTONIC, &ts) == -1) {
87
	return info.uptime;
85
		logger (LOG_ERR, "clock_gettime: %s", strerror (errno));
86
		return (-1);
87
	}
88
89
	tp->tv_sec = ts.tv_sec;
90
	tp->tv_usec = ts.tv_nsec / 1000;
91
	return (0);
88
}
92
}
89
#elif __APPLE__
93
94
#ifdef __APPLE__
90
/* Darwin doesn't appear to have an uptime, so try and make one ourselves */
95
/* Darwin doesn't appear to have an uptime, so try and make one ourselves */
91
long uptime (void)
96
long uptime (void)
92
{
97
{
(-)common.h (+2 lines)
Lines 23-28 Link Here
23
#define COMMON_H
23
#define COMMON_H
24
24
25
/* string.h pulls in features.h so the below define checks work */
25
/* string.h pulls in features.h so the below define checks work */
26
#include <sys/time.h>
26
#include <string.h>
27
#include <string.h>
27
28
28
/* Only GLIBC doesn't support strlcpy */
29
/* Only GLIBC doesn't support strlcpy */
Lines 36-41 Link Here
36
void srandomdev (void);
37
void srandomdev (void);
37
#endif
38
#endif
38
39
40
int get_time(struct timeval *tp);
39
long uptime (void);
41
long uptime (void);
40
void *xmalloc (size_t size);
42
void *xmalloc (size_t size);
41
char *xstrdup (const char *str);
43
char *xstrdup (const char *str);

Return to bug 187753