Commit Graph

102 Commits

Author SHA1 Message Date
Roy Marples
c62f687eb8 Rework the recvmsg_realloc function to handle flags.
Commit also includes mistakenly added ifam_pid patch for BSD.
It does no harm being here, even though no BSD supports this yet.
2016-09-02 08:09:47 +00:00
Roy Marples
26a52fe1a1 Use a dynamically sized buffer for reading route(4) messages on BSD
instead of a fixed 2048 byte buffer.
2016-09-01 14:37:48 +00:00
Roy Marples
13247615a9 Move duid and ipv6 secret file reading code into a common function. 2016-05-06 16:01:54 +00:00
Roy Marples
71725cbcfe Touched these in 2016. 2016-02-03 11:07:33 +00:00
Roy Marples
9e4c967ad9 Don't be gready in allocating space for extra SLA's if we overflow 64 bit prefix. 2016-02-03 01:17:28 +00:00
Roy Marples
cd1b8510fc Move ROUNDUP8 to common.h as it's not IPv6 specific. 2016-02-02 23:59:10 +00:00
Roy Marples
d056e4b5d0 Obey the hostname_short option even for FQDN hostnames passed via config.
Fixes [c7c4e51c72] based on a patch by sem@altlinux.org.
2015-11-13 11:18:44 +00:00
Roy Marples
820e1c7be7 Mark our logger function as sysloglike because we enjoy using %m in the format.
If there is no compiler support for it, fallback to printflike.
Correct some whitespace while here.
2015-10-26 10:25:00 +00:00
Roy Marples
65e35a35ce Remove _dead macro and swap printflike position. 2015-10-23 20:48:20 +00:00
Roy Marples
7f04897310 DHCPv6 elapsed time is centiseconds, not seconds.
Start the measurement from when the first message is actually sent rather
than when DHCPv6 started.
2015-07-03 23:35:56 +00:00
Roy Marples
cf16405b87 Replace custom uptime() with clock_gettime(2) calls for more accurate
time handling.
2015-06-29 12:39:44 +00:00
Roy Marples
f5c3ca19e9 For each ND, output the time of acquisition and the current time in seconds. 2015-05-15 13:47:35 +00:00
Roy Marples
2be15e8895 Handle ND options in the same way we handle DHCP and DHCPv6 options. 2015-05-14 19:46:21 +00:00
Roy Marples
70207f79e9 setting signals should require an explicit len rather than NULL termination. 2015-05-12 23:47:25 +00:00
Roy Marples
9437df595b Remove compat for polling, dhcpcd now requires pselect as a minimum fallback. 2015-05-12 20:03:36 +00:00
Roy Marples
069e2f284f syslogd(8) may not always be running before dhcpcd so any startup errors are
lost. Also, it's output with LOG_PERROR is ugly and LOG_PERROR isn't portable.

logger is a new function to solve the above which is identical to syslog(3)
but takes a dhcpcd_ctx for context so it functions in the RTEMS OS.
When writing to stdout/stderr or a given logfile, logger will convert %m
into the error string based on errno, just like syslog(3) does.
If your libc supports %m via printf, then define HAVE_PRINTF_M to remove
a fair chunk of code. There is no way of working out if your libc supports
this, especially in cross-compiled environment.
If the logfile is rotated, send dhcpcd a SIGUSR2 and the logfile will be
re-opened.

This does add about an exta 4K on 64-bit platforms so for size constraints
this can be compiled out by defining USE_LOGFILE to 0.
2015-03-17 23:46:38 +00:00
Roy Marples
60e82d0ef3 Fix compile on Linux 2015-03-03 18:31:14 +00:00
Roy Marples
573d048785 Replace timeval with timespec. 2015-03-03 17:27:25 +00:00
Roy Marples
f9584c9506 Update copyrights to 2015. 2015-01-02 20:03:28 +00:00
Roy Marples
6c9c458324 be32enc is missing on OpenBSD, so provide a configure test.
Fix compile on OpenBSD.
2014-06-05 13:53:20 +00:00
Roy Marples
f969dd2a71 Fix compile on Linux 2014-06-03 21:09:42 +00:00
Roy Marples
4f5b9dd2aa Check against reserved IPv6 addresses.
Start using be*enc BSD functions and supply own if missing in common.h.
2014-06-03 20:52:42 +00:00
Roy Marples
3ed12ab824 Implement Stable Private Addresses for SLAAC as per RFC7217.
Add a SHA256 implementation by Collin Percival if one in libc/libmd not found.
2014-06-02 14:48:33 +00:00
Roy Marples
26c177737e Source now compiles on Solaris, just missing the if-sun.c support so
linking fails.
2014-05-21 23:07:52 +00:00
Roy Marples
1a7ff10050 Move net.c to if.c.
Ensure that if.c and if-KERNEL.c are namespaced correctly.
2014-04-25 10:42:37 +00:00
Roy Marples
34457fe661 Add -Wconversion to debug CFLAGS and fix fallout. 2014-03-27 22:14:52 +00:00
Roy Marples
4eb7b4896f Move all global variables into contexts, with a small exception for
signal handling.
This allows dhcpcd to work better in a threaded environment such as rtems.
2014-02-12 00:39:46 +00:00
Roy Marples
c1b54b57cb get_line is now static inside of if-options.c and is a simple wrapper around getline(3). 2014-02-07 21:48:24 +00:00
Roy Marples
ebc8827ae5 writepid is now a static inline function 2014-02-07 17:48:13 +00:00
Roy Marples
cc0502023e Remove custom set_cloexec and set_nonblock functions.
Instead pass O_CLOEXEC or SOCK_CLOEXEC to open, socket, etc.
This requires a fairly modern system.
2014-02-07 17:32:08 +00:00
Roy Marples
a144b30772 Changed these files in 2014. 2014-02-04 14:55:04 +00:00
Roy Marples
a9d78def54 Remove DEBUG_MEMORY guard and always free memory and resources.
Remove all atexit(3) and exit(3) calls, instead exiting via the eloop.
2014-02-04 14:39:26 +00:00
Roy Marples
2a7f1a95c8 We're not extracting the address from proc, so convert our match address
to the same string format and compare instead.
2014-01-21 09:58:55 +00:00
Roy Marples
d6a1865476 Add the option hostname_short, which will force the sending of the
short hostname so DDNS will always work, even if the hostname domain
is different from the DHCP servers.

Change hostname_fqdn to true/false/unset value.
unset means use what the DHCP server supplies
 (DHCPv4/DHCPv6 maybe inconsistent depending on server setup)
true/false force the hostname to be either a FQDN or a short name.
2013-07-25 15:10:16 +00:00
Roy Marples
cc3c3560f6 Add DHPCv6 FQDN support (RFC4704)
Improve hostname support in general, so we are aware of hostname changes.
When setting the hostname, prefer the FQDN name or append a domain.
2013-06-05 16:23:24 +00:00
Roy Marples
a83be7a8de More compile fixes. 2013-05-03 14:43:51 +00:00
Roy Marples
3491ea4d56 Change from _unused to __unused to match NetBSD cdefs and avoid
a compiler failure on linux-headers-3.7
2013-04-24 09:38:18 +00:00
Roy Marples
8cc47ba26d White space police 2013-04-04 20:31:04 +00:00
Roy Marples
237e8234a7 Change from ppoll(2) to pollts(2).
I was going to go with ppoll(2) because I would guess the Open Group
would prefer the name of it over pollts(2) if they ever standardised it.
However that causes a problem with _GNU_SOURCE and my code base so I've
gone to pollts(2) and suck in the compat header for Linux users to avoid
that sillyness.
2013-02-18 21:25:07 +00:00
Roy Marples
28382337e1 Remove the xmalloc function.
Now we have removed all our xmalloc like functions dhcpcd can still
try to operate as best it can in low memory conditions.
2013-02-16 13:21:35 +00:00
Roy Marples
7836964635 Remove xstrdup 2013-02-15 22:46:47 +00:00
Roy Marples
fa245a4dea Remove xrealloc 2013-02-15 22:20:18 +00:00
Roy Marples
10e17e3f63 Remove xzalloc function 2013-02-15 21:45:08 +00:00
Roy Marples
4123fdf910 Normalise timing 2012-11-13 20:40:04 +00:00
Roy Marples
e54dee19ba Implement the core DHCPv6 client for SOLICIT, REQUEST, RENEW, CONFIRM. 2012-11-06 23:40:15 +00:00
Roy Marples
ea112ab290 Change the NS times so that we assume reachable until the reachable
time expires, then send probes at retrans intervals until
DELAY_FIRST_PROBE_TIME is reached at which point we expire the router.
2012-08-06 19:32:15 +00:00
Roy Marples
8273ac5a42 Fix copyright dates 2011-12-15 02:41:10 +00:00
Roy Marples
91cd732493 Add an implementation of an IPv6 Router Solicitor as specified in
RFC6016 with regards to RDNSS and DNSSL.
2011-12-15 02:35:47 +00:00
Roy Marples
d5234a51d9 Fix compile on some sytems, fixes #223. 2011-05-27 16:30:04 +00:00
Roy Marples
2dd8d70da0 Fix tests and compile for NetBSD. 2009-07-14 15:10:09 +00:00