Commit Graph

67 Commits

Author SHA1 Message Date
Roy Marples
d686aa4f7d Support IN_IFF_TENTATIVE and IN_IFF_DUPLICATED on NetBSD. 2015-05-01 09:41:54 +00:00
Roy Marples
bb5825b3e2 Let arp_new take an address so we never have duplicate
ARP states.
2015-05-01 08:10:16 +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
8bc7487f70 Cast random for gcc. 2015-03-13 19:51:33 +00:00
Roy Marples
f9584c9506 Update copyrights to 2015. 2015-01-02 20:03:28 +00:00
Roy Marples
dced13fe96 Add a guard to IPv4LL probed in case of an ARP race. 2014-11-14 07:16:49 +00:00
Roy Marples
725f6f1e63 Backup and restore any DHCP lease offered during the binding
of the IPv4LL address.
2014-11-13 18:45:04 +00:00
Roy Marples
fac143bfd1 When closing the IPv4LL state, close any timers as well. 2014-11-11 09:17:06 +00:00
Roy Marples
76dc9cd65d Remove dead store 2014-11-07 21:08:48 +00:00
Roy Marples
2ed4bfa16d We should not use a DHCP lease for IPV4LL. 2014-10-24 19:24:29 +00:00
Roy Marples
741dbf636d Improve IPv4LL -> DHCP state transitions 2014-10-24 11:00:03 +00:00
Roy Marples
4d1491e53b Fix transition from IPv4LL to a valid DHCP state. 2014-10-24 09:14:16 +00:00
Roy Marples
c4563942ab Add a helper function to report conflicts to shrink the binary. 2014-10-23 19:58:36 +00:00
Roy Marples
1d5d236a81 Rework the ARP code so that we can have multiple ARP states.
Split the ARP resolution code to dhcp or ipv4ll where it belongs.
This allows us to probe IPv4LL while still DISCOVERing a DHCP lease.
2014-10-23 19:07:35 +00:00
Roy Marples
2bb3652962 Simplfy 2014-10-22 04:17:25 +00:00
Roy Marples
673c00481a RFC 3927 Section 2.1 states that the random number generator should be
seeded with a known value derived from the IEEE 802 MAC address and that
the first 256 and last 256 addresses are reserved for future use.
2014-10-21 22:55:30 +00:00
Roy Marples
bcb1388a64 Fix off by one MAX_CONFLICTS error. 2014-10-21 18:33:44 +00:00
Roy Marples
47dea0d495 Check local interfaces for a duplicate IPv4LL address before ARP. 2014-10-21 13:04:06 +00:00
Roy Marples
0b27dd5c41 Only reset the IPv4LL conflict counter after we have finished
announcing our address or we bind a non IPv4LL address.
2014-10-21 11:06:36 +00:00
Roy Marples
e12c421a00 Fix recovering from a failed defeat of an IPv4LL address. 2014-10-20 19:15:36 +00:00
Roy Marples
3355d8fa0b Log the address IPv4LL defends. 2014-10-20 15:50:32 +00:00
Roy Marples
da1bbe3add Place IPv4LL into the same queue as DHCP. 2014-10-17 10:35:57 +00:00
Roy Marples
27dd88dc34 Fix compile warning 2014-06-07 21:05:19 +00:00
Roy Marples
6eda989ce8 Should use arc4random_uniform when wanting a randon number between
1 and N.
Improve the compat arc4random function a little and re-stir on fork.
2014-05-24 19:58:50 +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
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
c6eb161be2 Implement support for RFC 3203, FORCERENEW message. 2014-01-31 11:47:27 +00:00
Roy Marples
b64cef1bfd Fix compile 2014-01-29 14:16:31 +00:00
Roy Marples
d4154ba7a8 Add nodhcp and nodhcp6 directives.
Thanks to Sebastian Huber for the initial patch and testing.
2014-01-29 14:05:58 +00:00
Roy Marples
322ebc208b Ensure that config.h or common.h is the first included local header.
Thanks to Sebastian Huber.
2014-01-24 11:09:39 +00:00
Roy Marples
5979b60841 Clarify IPv4LL defence failure. 2014-01-21 13:40:33 +00:00
Roy Marples
8cc47ba26d White space police 2013-04-04 20:31:04 +00:00
Roy Marples
10e17e3f63 Remove xzalloc function 2013-02-15 21:45:08 +00:00
Roy Marples
95fdd136ae Move if_state into interface->if_data as dhcp_state.
This should reduce memory usage for non IPv4 interfaces.
2013-02-03 22:55:45 +00:00
Roy Marples
5dc65f77b3 Move ipv4 specific infos from interface to if_state. 2013-02-03 14:52:24 +00:00
Roy Marples
294eff4df4 Remove IPv4 and DHCP4 specific setup from dhcpcd.c and move into ipv4.c
and dhcp.c
Split configure.c into script.c and move the rest into dhcp.c

This starts the goal of making the base of dhcpcd protocol agnostic and
working towards building IPv4 and/or IPv6 code only to reduce size and
allow growing any future new protocol easier.
2013-02-02 14:05:55 +00:00
Roy Marples
760780dd5c Use a proper namespace for IPv4LL 2012-11-13 11:44:20 +00:00
Roy Marples
9eb6e8dc94 Use a proper namespace for eloop 2012-11-13 11:25:51 +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
1876157a45 Update some copyrights. 2011-03-24 18:08:16 +00:00
Roy Marples
c06fa755a2 Clear timeouts on IPv4LL failure. 2010-05-26 07:13:23 +00:00
Roy Marples
f3870b2ccc Fix IPv4LL defending and add a bit more logging. 2010-05-12 16:20:55 +00:00
Roy Marples
716f288882 When trying IPv4LL from a DHCP lease with an IPv4LL address, just
use the address and nothing else.
2010-02-26 15:06:51 +00:00
Roy Marples
bdeff18fc4 Deleting all timeouts for the interface is better. 2010-02-26 13:46:07 +00:00
Roy Marples
207d7b4fac Clear timeouts when starting ipv4ll. 2010-02-26 13:41:38 +00:00
Roy Marples
1cc00d8a7c Allow IPv4LL address range to be configured by DHCP.
We now check the message for a DHCP cookie instead of the address
assigned to test for local link.
2010-02-17 22:23:17 +00:00
Roy Marples
5fff28a154 Replace the mk stubs with a autotools like configure script.
Split compat libc functions out into subdir.
2009-07-14 13:59:30 +00:00
Roy Marples
601fb3d500 Add (c) to Copyright 2009-05-01 13:57:45 +00:00
Roy Marples
eab2229cfa Enforce NetBSD KNF style more 2009-02-11 17:56:22 +00:00