Commit Graph

90 Commits

Author SHA1 Message Date
Roy Marples
a3b1468fac Fix compile warnings. 2016-04-08 20:50:58 +00:00
Roy Marples
b62ca4490e Don't dick with IPv4LL route reactions on BSD. 2016-04-08 20:35:09 +00:00
Roy Marples
baa179d338 If a normal default route is added, delete our IPv4LL default route.
If a normal defaulr route is deleted, and no other exists, add our IPv4LL
default route.

Fixes [bd6daf1d59].
2016-04-08 20:02:41 +00:00
Roy Marples
7db1547f3f Fix TEST for IPv4LL. 2015-09-19 16:43:12 +00:00
Roy Marples
3f3dae6c20 Add IPv4LL subnet routes like the kernel does.
Build the routing table before applying routes, fixes [a3de5dcae1].
2015-08-07 08:49:07 +00:00
Roy Marples
ca6cdf5847 Move route state into it's own flag.
Instead of setting the interface MTU directly, set the MTU for each of the
routes derived from the DHCP message in the same way we do for IPv6 RA.
2015-07-28 13:58:31 +00:00
Roy Marples
1b34ac49dd When dropping IPv4LL state, remove the address and rebuild routes before
calling dhcpcd-run-hooks.
Ensure that the IPv4LL random state is only used when picking addresses
and the original state is restored.
2015-07-24 20:47:08 +00:00
Roy Marples
c0641ab079 If we only have IPv4LL addresses, add a default route to the link so that
we stand a chance at communicating with non IPv4LL addresses on the same link.
2015-07-24 10:22:50 +00:00
Roy Marples
4445cd18d6 When ending IPv4LL, only rebuild routes if we dropped an address. 2015-07-22 10:11:44 +00:00
Roy Marples
957500a4cc Only run the IPv4LL script on drop when actually dropping an IPv4LL address. 2015-07-09 13:51:26 +00:00
Roy Marples
706afa0ff4 Send the IPv4LL interface to listeners.
Send the expired IP in the old_ prefix.
2015-06-29 15:31:33 +00:00
Roy Marples
b2f9b24191 Add an option to keep arp state when deleting addresses, which is needed
for IPv4LL.
Call IPV4LL instead of EXPIRE when removing the IPV4LL address,
which is similar to how ROUTERADVERT works.
2015-06-29 15:03:31 +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
c066ceb886 As DHCP and IPv4LL now have separate route generators, we need to assign
the source address when we get them, not each time we parse them.
Also, assign the source address to the route when reading from the kernel.
2015-06-26 19:37:31 +00:00
Roy Marples
62672f18cc Announce our IPv4LL address. 2015-06-26 08:43:46 +00:00
Roy Marples
c477e2458f Add an free callback to ARP states so that they can notify their parents they
are gone to avoid any double frees.
Fixes [5fdd9b8d08].
2015-06-25 15:36:28 +00:00
Roy Marples
bb0f63fb91 Check the interface has an IPv4 state before enumarting addresses. 2015-06-16 09:34:23 +00:00
Roy Marples
f282a7b126 Remove a pre-existing IPv4LL address when binding a DHCP address. 2015-06-15 09:59:37 +00:00
Roy Marples
7a80156de0 Build routes and daemonise when we get an IPv4LL address. 2015-06-13 10:33:56 +00:00
Roy Marples
46d7f0d194 Improve IPv4LL debug messages. 2015-06-12 21:05:21 +00:00
Roy Marples
3eb3c5fee4 Fix network_number. 2015-06-12 20:27:12 +00:00
Roy Marples
3736295d26 Use macro HTONL to fix compile on Linux and drop address correctly. 2015-06-12 20:25:42 +00:00
Roy Marples
accc0bb871 Stop making IPv4LL into a DHCP lease and treat it independantly from any
DHCP lease.
This allows us to manage IPv4LL and DHCP at the same time a lot easier.
2015-06-12 19:21:32 +00:00
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