Commit Graph

730 Commits

Author SHA1 Message Date
Roy Marples
902f2f0071 recvmsg expects an array of iovec structures, not a pointer to the first one. 2016-09-05 22:27: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
60d7a50110 Check if we loaded options or not. 2016-08-18 14:37:53 +00:00
Roy Marples
47c18997b8 Only stop_interface() if it's active instead of checking if options exist.
Thanks to Koichi Okamoto.
2016-08-18 11:28:16 +00:00
Roy Marples
95fae65a9a When deactivating an interface, set the carrier to unknown as it's no longer being tracked.
Thanks to Koichi Okamoto.
2016-07-28 13:10:20 +00:00
Roy Marples
b4a8658466 Add --inactive which makes all interfaces inactive on initial start.
Subsequent dhcpcd commands will start each interface.
2016-07-27 16:47:34 +00:00
Roy Marples
8a3872e96f Apply command line options to profile.
Fixes [87d9d6b583].
2016-07-08 19:44:18 +00:00
Roy Marples
f6bdf24c69 Disable ARP for POINTOPOINT. 2016-05-25 09:38:51 +00:00
Roy Marples
b6f10046d8 Spit handlelink into smaller functions to increase read-ability. 2016-05-19 20:27:07 +00:00
Roy Marples
053b3dedb7 managelink -> hanlelink 2016-05-19 15:01:47 +00:00
Roy Marples
6bbedd2c41 Preserve lo0 routes if the global default is to persist. 2016-05-09 08:22:38 +00:00
Roy Marples
e3ea49b384 Check we actually have options allocated before adding commandline options. 2016-05-06 20:44:24 +00:00
Roy Marples
a67f0194df DHCP messages are really BOOTP so lets name the structure accordingly.
While here, stop making assumptions about the size of a DHCP packet based
on a fixed structure from a default MTU of 1500.
Instead, make it flexable and set the DHCP packet size to the interface MTU
less UDP and IP headers.
As a result, we need to know the size of the DHCP packet received
rather than just walking the old fixed DHCP message structure.

This makes Coverity happy about tainted scalar values when parsing DHCP
messages.
2016-05-06 13:26:41 +00:00
Roy Marples
886c09031b Fix a potential memory issue. 2016-05-03 20:25:30 +00:00
Roy Marples
8b71cd46f3 Rework control_open to be cleaner for static analysis. 2016-05-03 14:31:50 +00:00
Roy Marples
9d3a9d1320 Remove useless range check. 2016-05-03 14:17:37 +00:00
Roy Marples
41eefe94da Prefix dhcp definition type with OT_ 2016-05-01 14:20:21 +00:00
Roy Marples
d4b2fdf14a Revert prior and just move the RUNDIR check above pidfile_lock. 2016-04-26 20:09:34 +00:00
Roy Marples
e8c7db4b59 Remove closefrom as we don't suffer from fd starvation. 2016-04-22 21:07:22 +00:00
Roy Marples
ac440ab1f6 Make fork process clearer. 2016-04-10 18:46:12 +00:00
Roy Marples
39e27886c1 Fix compile on BSD. 2016-04-07 20:41:51 +00:00
Roy Marples
d306a8f2df Linux netlink nlmsg_pid is not process id - only the first socket opened
has that. So after opening the link socket, open a persistent route socket
and record the nlmsg_pid the kernel creates which is guaranteed unique
and won't clash with a process id which can then be ignored by testing it
directly and not that it's some large number.
2016-04-07 20:35:57 +00:00
Roy Marples
665551d7af Fix pidfile_lock compat on Linux. 2016-04-01 21:27:22 +00:00
Roy Marples
61f6ce0e11 Remove pidfile handling from dhcpcd and use pidfile_lock(3) from libutil
instead.
pidfile_lock(3) should be found in NetBSD 8.
Provide a compat shim, from an earlier implementation I wrote still based
around flock if not available on host OS.
2016-04-01 21:14:28 +00:00
Roy Marples
eeda296867 Make eloop a tad easier to use. 2016-03-17 14:35:13 +00:00
Roy Marples
9843976ae0 Fix compile on older platforms which lack O_CLOEXEC.
Thanks to OBATA Akio.
2016-03-11 13:44:42 +00:00
Roy Marples
aafc7d05c8 Export STATIC6 to libdhcpcd. 2016-02-15 21:19:56 +00:00
Roy Marples
408fe75557 Implement IPv6 static address, fixes [29417b793e]. 2016-02-14 08:04:55 +00:00
Roy Marples
f5afdbdb72 Change IF_SSIDSIZE to IF_SSIDLEN to be more clear about it.
Store an extra char for a NULL terminator solely for debubgging purposes.
A better fix for [be2bbe6e37].
2016-02-11 16:06:26 +00:00
Roy Marples
2fbd190065 Fix activating a stopped interface. 2016-02-04 21:51:10 +00:00
Roy Marples
598e6cc727 When activating an interface, bring up a basic config that does nothing.
Then apply enough of the config for the base protocol, passed via an
argument, to work.

This means that when a prefix is delegated to an inactive interface, it
won't magically start configuring IPv4 on it.
2016-02-04 21:42:14 +00:00
Roy Marples
b699cc3d5c Introduce IF_INACTIVE, IF_ACTIVE and IF_ACTIVE_USER flags. The intent is that IF_ACTIVE is an interface is active with a system config and IF_ACTIVE_USER with a user config. 2016-02-04 10:43:16 +00:00
Roy Marples
490428b6a9 Fix build without INET 2016-01-22 10:11:16 +00:00
Roy Marples
4507db9410 Fix delegation activating interfaces. 2016-01-20 19:08:12 +00:00
Roy Marples
df57499917 Add the -1, --oneshot option which causes dhcpcd to exit once an
interface has been configured.
2016-01-14 17:05:16 +00:00
Roy Marples
75c82b879f Improve interval arrival and departure when running on a fixed interface list. 2016-01-14 13:43:15 +00:00
Roy Marples
1abca982eb Only stop the interface if it's active when the interface departs.
Fixes [97eb3351d3].
2016-01-11 14:02:01 +00:00
Roy Marples
c31b17193e Add -P, --printpidfile to print the pidfile dhcpcd will use to stdout. 2016-01-07 19:52:54 +00:00
Roy Marples
3369605a5a If we are to add/delete/change a route but have not yet daemonised,
flag that we are to track the parent pid.
On successful route message, remember the sequence number.
Once daemonised, ignore messages from the parent pid until we find
the saved sequence number - at this point remove the flag to track parent pid.

This fixes an issue where we didn't correctly ignore messages we generated
before forking but catching them in the child process.
2016-01-06 10:54:36 +00:00
Roy Marples
16f7ac1276 Correct function to report error for. 2016-01-06 10:21:22 +00:00
Roy Marples
54ec8d0fdb Welcome to 2016 2016-01-04 17:15:15 +00:00
Roy Marples
3eeb66d7bd Remove FreeBSD specific defines and include the needed headers via config.h.
This allows better compile for derivatives such as kFreeBSD.
For kFreeBSD, also define BSD.
Fixes [1987e7b3a3].
2015-12-31 16:27:44 +00:00
Roy Marples
a96ef5defc Fix a bogus gcc warning about a potential signed overflow. 2015-12-21 11:07:32 +00:00
Roy Marples
9820ccc8a3 -g must go via the command socket as it's no longer SIGUSR1 2015-12-21 11:07:04 +00:00
Roy Marples
dd30f5cd2c When stopping and starting interfaces, just toggle the active flag
and prestart if needed instead of adding them to the list they are already now in.
2015-12-17 12:37:07 +00:00
Roy Marples
80e9033d45 Instead of maintaining a seperate list, instead mark each interface as active
dhcpcd will actively work on.
This will allow dhcpcd to move addresses around interfaces much more easily
as well.
2015-12-17 02:34:36 +00:00
Roy Marples
363c200a57 When parsing the routing table, create an interface for any interfaces dhcpcd
is not directly controling in ctx->oifaces.
This allows dhcpcd to manipulate the correct route at all times.

Fixes [ebdb4b447a].
2015-12-17 00:25:03 +00:00
Roy Marples
11e39fe1b0 If dumping lease returns an error, return it to userland. 2015-11-19 11:00:34 +00:00
Roy Marples
7bbecef4f9 Fix memory issue with prior commit. 2015-11-18 12:06:47 +00:00
Roy Marples
72d87266c3 -U, --dumplease now works with standard input.
It no longer works with a filename.
2015-11-18 11:59:11 +00:00