chromiumos/third_party/dhcpcd.git
15 months agodhcpcd: Request and report Web Proxy Auto-Discovery 67/59967/3 factory-4455.B factory-pit-4390.B factory-pit-4471.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-pit-4482.B firmware-wolf-4389.24.B master release-R30-4537.B stabilize-4443.B stabilize-4512.B
Paul Stewart [Tue, 25 Jun 2013 20:10:22 +0000 (13:10 -0700)]
dhcpcd: Request and report Web Proxy Auto-Discovery

Request the Web Proxy Auto-Discovery DHCP option, and report
any retrieved value over over DBus.

BUG=chromium:253915
TEST=Packet capture from network_DhcpNegotiationSuccess autotest
Turn on dhcp debugging in shill and note that a WebProxyAutoDiscoveryUrl
key is received (but ignored).

Change-Id: Ib3a0fe4fd4559c7f61545e2a64077265adf0fe7c
Reviewed-on: https://gerrit.chromium.org/gerrit/59967
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

16 months agoUPSTREAM: Randomize ip_id and remove IPTOS_LOWDELAY and IP_DF flags. 29/31729/4 factory-4128.B factory-4290.B factory-pit-4280.B factory-spring-4131.B factory-spring-4262.B release-R29-4319.B stabilize-4255.B stabilize-4287.B
Roy Marples [Fri, 12 Mar 2010 20:33:15 +0000 (20:33 +0000)]
UPSTREAM: Randomize ip_id and remove IPTOS_LOWDELAY and IP_DF flags.

This makes us a better net citizen.
(cherry picked from commit 571b8298bf67f96b91e26a15b708ffb26808531d)

BUG=chromium:215026
TEST=(TODO: Use DHCP autotests)

Change-Id: I29a52a5c088c28f442be915760a34a842d21ef3c
Reviewed-on: https://gerrit.chromium.org/gerrit/31729
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
16 months agoUPSTREAM: Import cut down arc4ramdom.c from OpenBSD for better randomness. 28/31728/4
Roy Marples [Wed, 13 Jan 2010 23:44:14 +0000 (23:44 +0000)]
UPSTREAM: Import cut down arc4ramdom.c from OpenBSD for better randomness.

Partially addresses #183.

(cherry picked from commit c140606bfb03da65fa5dab73b52b5c264748ddbd)

BUG=chromium:215026
TEST=(TODO: Use DHCP autotests)

Change-Id: I71e4db2ca13c07879382e0446d24d85bab3ad75b
Reviewed-on: https://gerrit.chromium.org/gerrit/31728
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
16 months agoUPSTREAM: We should not set a maximum message size... 27/31727/4
Roy Marples [Sat, 6 Mar 2010 17:46:01 +0000 (17:46 +0000)]
UPSTREAM: We should not set a maximum message size...

...bigger than what we can actually handle.

(cherry picked from commit 7916f8d3428670e6a5f6e88e14cb043ad7156d18)

BUG=chromium:215026
TEST=(TODO: Use DHCP autotests)

Change-Id: Icdb9459534543d6c1f6132acbedd367be985df85
Reviewed-on: https://gerrit.chromium.org/gerrit/31727
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
16 months agoUPSTREAM: Fix a crash when using clientid's. 26/31726/4
Roy Marples [Thu, 3 Jun 2010 23:28:13 +0000 (00:28 +0100)]
UPSTREAM: Fix a crash when using clientid's.

(cherry picked from commit 6624d6bbc1a379bb8338390938a387e22283397b)

BUG=chromium:215026
TEST=(TODO: Use DHCP autotests)

Change-Id: Ib8099fb0f934dd5f0f59e0f4f86c8695cd5a7818
Reviewed-on: https://gerrit.chromium.org/gerrit/31726
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
16 months agoUPSTREAM: Work out the size of the buffer we need to read netlink messages as recent 25/31725/4
Roy Marples [Wed, 21 Jul 2010 08:51:47 +0000 (09:51 +0100)]
UPSTREAM: Work out the size of the buffer we need to read netlink messages as recent

64-bit Linux kernels have increased their header size and overflowed
the fixed buffer we used.

Could also fix #192.
(cherry picked from commit 7eeba667a9d6bdcd6dd4bd08dcc0b9c1d99e7703)

BUG=chromium:215026
TEST=(TODO: Use DHCP autotests)

Change-Id: I208f2b6ac5f34424813cff24d7525376caa57702
Reviewed-on: https://gerrit.chromium.org/gerrit/31725
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
16 months agoUPSTREAM: Validate the IP address offered 24/31724/4
Roy Marples [Thu, 24 Mar 2011 01:55:06 +0000 (01:55 +0000)]
UPSTREAM: Validate the IP address offered

as some faulty DHCP servers like to give is an invalid one.
(cherry picked from commit 4d0527546e63ccb8b1894817ead6297844e74afd)

BUG=chromium:215026
TEST=(TODO: Use DHCP autotests)

Change-Id: Ife84faed7fd999b73569e7817e840b5a2eac1ec4
Reviewed-on: https://gerrit.chromium.org/gerrit/31724
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
19 months agodhcpcd: Log IP address packet came from 22/42622/2 factory-spring-3842.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-spring-3833.B release-R26-3701.B release-R27-3912.B release-R28-4100.B stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-3881.0.B stabilize-3912.79.B stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B stabilize-4100.38.B stabilize-bluetooth-smart stabilize-spring-4100.53.B toolchain-3701.42.B toolchainA toolchainB
Paul Stewart [Tue, 5 Feb 2013 17:20:29 +0000 (09:20 -0800)]
dhcpcd: Log IP address packet came from

When we do not have a server-id, log the source IP address that the
DHCP frame came from.

BUG=chromium-os:38529
TEST=Manual: Faked a NAK packet during authentication

Change-Id: Iade97407bf50fdd8502c8d4dea6164e3d9658f8d
Reviewed-on: https://gerrit.chromium.org/gerrit/42622
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
22 months agoCHROMIUMOS: dhcp: dbus: Encode classless routes as a string 83/38183/2 factory-3536.B release-R25-3428.B stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-3658.0.0 stabilize2 toolchain-3428.65.B
Paul Stewart [Fri, 16 Nov 2012 06:01:45 +0000 (22:01 -0800)]
CHROMIUMOS: dhcp: dbus: Encode classless routes as a string

Encoding classless static routes as an array of UINT32 values
did not make any sense, since the string-form of these routes
is an array of alternating "address/prefix address" sets,
which doesn't have any readily straightforward conversion
into DBus.  Since shill can easily parse these values, leave
that value as a string.

BUG=chromium-os:25908
TEST=New client autotest network_DhcpClasslessStaticRoute

Change-Id: I86d7a201ae37bf6d3f108a44650e3176d00b65c6
Reviewed-on: https://gerrit.chromium.org/gerrit/38183
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
23 months agodhcpcd: Sanitize strings sent over DBus 16/36716/3
Paul Stewart [Fri, 26 Oct 2012 20:05:47 +0000 (13:05 -0700)]
dhcpcd: Sanitize strings sent over DBus

The DBus library will crash if string arguments are not ASCII or
properly formatted UTF-8 strings.  Sanitize all upstream strings
to printable ASCII.

BUG=chromium-os:35756
TEST=Run new autotest network_DhcpNonAsciiParameter
(https://gerrit.chromium.org/gerrit/36714) before and after this change.

Change-Id: Id4aef5d9d970761e913747dc336e012f5c4c76be
Reviewed-on: https://gerrit.chromium.org/gerrit/36716
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
2 years agoCHROMIUMOS: dhcpcd: Be more verbose about output packets factory-2460.B factory-2475.B factory-2569.B factory-2717.B factory-2723.14.B factory-2846.B factory-2848.B factory-2914.B factory-2985.B factory-2993.B factory-3004.B firmware-butterfly-2788.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B firmware-stout-2817.B release-R21-2465.B release-R22-2723.B
Paul Stewart [Fri, 8 Jun 2012 02:21:02 +0000 (19:21 -0700)]
CHROMIUMOS: dhcpcd: Be more verbose about output packets

The "request" and "inform" stages were silent before.  Add
log messages when these events occur to be explicit.

BUG=chromium-os:31630
TEST=Manual: Read messages as dhcpcd connects

Change-Id: I5dc250166c29320aaa5bd4e7dff5dbf852bcb193
Reviewed-on: https://gerrit.chromium.org/gerrit/24835
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
2 years agoCHROMIUMOS: dhcpcd: Reduce time to restart after ARP failure
Paul Stewart [Wed, 6 Jun 2012 16:22:12 +0000 (09:22 -0700)]
CHROMIUMOS: dhcpcd: Reduce time to restart after ARP failure

Reduce the time between an ARP failure and the next DHCP
request.

BUG=chromium-os:16885
TEST=Recompile (need more testing before commit)

Change-Id: I3eb26643c2e138f35158136a8d9d2c6ac49de3b2
Reviewed-on: https://gerrit.chromium.org/gerrit/24620
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>

2 years agodhcpcd: Teach DHCP client to do unicast-ARP for gateway factory-2338.B factory-2368.B factory-2394.B firmware-link-2348.B
Paul Stewart [Mon, 14 May 2012 22:57:29 +0000 (15:57 -0700)]
dhcpcd: Teach DHCP client to do unicast-ARP for gateway

Implement RFC-4436 ("Detecting Network Attachment in IPv4 (DNAv4)").
Keep track of the MAC address of the default gateway in a file as
a part of the arpgw change ("-R" option), and append this info to
the end of the saved lease.

Implement a separate command line option ("-U") which will use
the MAC address stored in the lease to do a unicast ARP to the
default gateway saved in the lease.  If this succeeds, notify
listeners that this succeeded, along with the contents of the lease,
but do not stop the normal DHCP process.  This returns immediate,
fast feedback that our lease will likely work, but continues the
DHCP process so we know for sure.

BUG=chromium-os:25717
TEST=Manual: Hex dumps of the lease file with or without the "-R"
option set.  Ensure gateway MAC address appears in the lease when run
to success with "-R", and that a successive run without "-R" casuses
the MAC to disappear.  tcpdump packet captures of DHCP and ARP traffic
when running with and without the "-U" option set after a previous run
with or without the "-R" option set.

Change-Id: Ic0cacc9d50241926a4e080b81db77d6554b5d84b
Reviewed-on: https://gerrit.chromium.org/gerrit/22643
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>

2 years agoFix dhcpcd running as a regular user. factory-2305.B
Jorge Lucangeli Obes [Mon, 14 May 2012 20:43:20 +0000 (13:43 -0700)]
Fix dhcpcd running as a regular user.

dhcpcd lease files are created with 0400 permissions (user read).
This means that after creating the lease file, the next time
the file is opened for write, dhcpcd cannot write to it.
This error shows when dhcpcd is run as a regular user.

Fix by creating the file with 0600 permissions (user r/w),
so that when the existing lease file is opened for write,
the write succeeds.

Moreover, also soften the log message shown when not running as root,
since by using Linux capabilities dhcpcd can run fine as a regular user.

BUG=chromium-os:28336
TEST=Build and boot an image, network still works.
TEST=New lease files are created with 0600 permissions.

Change-Id: I39a22814fb257db26dd7e3b19625c40f609a1e0b
Reviewed-on: https://gerrit.chromium.org/gerrit/22644
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>

2 years agoAdd permissions for 'dhcp' user in dhcpcd D-Bus config.
Jorge Lucangeli Obes [Fri, 11 May 2012 00:13:49 +0000 (17:13 -0700)]
Add permissions for 'dhcp' user in dhcpcd D-Bus config.

BUG=chromium-os:28336
TEST=Build and boot an image, networking still works.

Change-Id: Ic9eb0f8003bec3e61cfb57c1e88138f9fce20f79
Reviewed-on: https://gerrit.chromium.org/gerrit/22597
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>

2 years agodhcpcd: Fix pid file formatting factory-2268.16.B release-R20-2268.B
Paul Stewart [Tue, 8 May 2012 21:56:13 +0000 (14:56 -0700)]
dhcpcd: Fix pid file formatting

dhcpcd names its pidfile after the interface if one (and only one)
is specified on the command line.  Update the code that generates
the PID file to handle interfaces that specify custom lease file
names.

BUG=chromium-os:25717
TEST=Restart shill (which restarts dhcpcd) and monitor /var/run for pidfiles
Run dhcpcd with no arguments, in order to exercise the other branch of the
filename formatting, and confirm that it creates "dhcpcd.pid".  Start "dhcpcd
eth0", and confirm that it picks up the "dhcpcd-eth0.pid" file and complains
that the server is already running (from the shill-invoked copy).

Change-Id: I389d94673cef20423e96cc4500c2c0f89110d37d
Reviewed-on: https://gerrit.chromium.org/gerrit/22170
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
2 years agodhcpcd: Allow lease file to be set on command line
Paul Stewart [Mon, 7 May 2012 18:28:06 +0000 (11:28 -0700)]
dhcpcd: Allow lease file to be set on command line

Currently, dhcpcd names its lease files using the interface name
as the unique part of the name.  There are a couple reasons why
this may not work well: firstly if "eth0" can have different MAC
addresses (multiple USB-Ethernet dongles for example) leases for
one interface aren't valid for the other.  Secondly, when using
a wireless interface, it would be convenient to hold multiple
leases in parallel for each SSID one is connected to.

This change adds a suffix to each interface argument (dhcpcd can
accept multiple interface arguments) that specifies the identifier
to use to save lease files with.  By default, the behavior is
identical.

BUG=chromium-os:25717
TEST=Re-run dhcpcd with and without an identifier suffix.

Change-Id: Iac282c1686695239a790bbcc0d110c6a69bf45e0
Reviewed-on: https://gerrit.chromium.org/gerrit/21991
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
3 years agodhcpcd: Add arpgw command line flag 0.14.811.B 0.15.877.B 780.B factory-1020.B factory-1235.B factory-1284.B factory-1412.B factory-1987.B factory-980.B firmware-881-u-boot-v1 firmware-kiev-2.112.B firmware-u-boot-v1 firmware-uboot_v2-1299.B release-1011.B release-R16-1193.B release-R17-1412.B release-R18-1660.B release-R19-2046.B test-982.B
Paul Stewart [Fri, 1 Jul 2011 01:42:33 +0000 (18:42 -0700)]
dhcpcd: Add arpgw command line flag

We added a configuration file flag for this feature in
http://gerrit.chromium.org/gerrit/3080 ; now make the
command line flag accessible.

BUG=chromium-os:16885
TEST=Manual -- use new flimflam set-arp-gateway command to turn on
arpgw, ensure dhcpcd starts up, shows command line flag in "ps" listing
and that /var/log/messages shows that it actually arped successfully for
its gateway.

Change-Id: I8e3ba4bf8e327a29e76a689c024c2ea7267ed552
Reviewed-on: http://gerrit.chromium.org/gerrit/3531
Reviewed-by: Sam Leffler <sleffler@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
3 years agoOptioninally ARP for gateway IP address
Paul Stewart [Tue, 21 Jun 2011 17:22:05 +0000 (10:22 -0700)]
Optioninally ARP for gateway IP address

If the "arpgw" option is enabled in the config, we ARP for
the gateway provided in the DHCP response as part of the
process of testing our lease.  If this fails (ARP times
out) we DECLINE our lease in the hope that a new lease will
work better.  This can allow us to work around issues with
infrastructures where IP address / MAC pairs are placed on
a "dummy" VLAN under certain conditions.  Requesting a
different IP can sometimes help resolve this.

The code is setup so that for each dhcpcd instance, the
"arpgw" function is allowed to only fail once.  This is
to protect ourselves from mistakenly diagnosing a bad
system, or from looping endlessly if the system is truly
hosed.

BUG=chromium-os:16885
TEST=Manual -- confirm that positive case works, and
manufacture a negative case.  Packet dumps of ARP traffic.
ARP test adds ~0.02 seconds in the successful case.

Verify by using the WiFi testbed tweaked to have the
testbed server advertise default routes.  Recorded multiple
runs for old dhcpcd, dhpcd with arpgw disabled and with
arpgw enabled:

old:     0.879 0.065 0.052 0.877 0.057 0.075 0.920 0.360 0.057 0.964 0.055 0.063
new/off: 0.921 0.055 0.050 0.901 0.420 0.359 0.533 0.350 0.057 0.985 0.061 0.098
new/on:  2.309 0.088 0.087 0.262 0.086 0.083 0.997 0.072 0.076 0.215 0.089 0.077

Change-Id: I64ee2d95ec873b0020f258f7ff15e4f005145a00
Reviewed-on: http://gerrit.chromium.org/gerrit/3080
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
3 years agodhcpcd: add PRESUBMIT.cfg
Paul Stewart [Fri, 24 Jun 2011 19:22:56 +0000 (12:22 -0700)]
dhcpcd: add PRESUBMIT.cfg

Disable presubmit checks that don't apply to this 3rd party code.
Shamelessly stolen from sleffler who stole it from jglasgow.
Re-enabled a few checks that are valid for this package.

BUG=None
TEST=Submit this change without --no-verify

Change-Id: Icce102f1c4b517da1dec9d723482c3b03d96975c
Reviewed-on: http://gerrit.chromium.org/gerrit/3176
Reviewed-by: Sam Leffler <sleffler@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
3 years agoRespect PKG_CONFIG variable if set in the environment.
David James [Tue, 7 Jun 2011 17:48:17 +0000 (10:48 -0700)]
Respect PKG_CONFIG variable if set in the environment.

This is required for the new cross-compilation support using pkg-config
wrappers instead of changing the pkg-config files themselves.

BUG=chromium-os:16248
TEST=Verify package compiles on arm both with and without the pkg-config
     wrapper.

Change-Id: I6a9ed6138d06920e2df981773e4a670e5e2e76bc
Reviewed-on: http://gerrit.chromium.org/gerrit/2228
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: David James <davidjames@chromium.org>
3 years agoCHROMIUMOS: Escape | and & characters when passing to the shell. 0.12.433.B 0.12.433.B109 0.12.433.B62 0.13.434.B 0.13.509.B 0.13.558.B 0.13.587.B
Paul Stewart [Sun, 17 Apr 2011 05:25:19 +0000 (22:25 -0700)]
CHROMIUMOS: Escape | and & characters when passing to the shell.

Add functions for hooks to check validity of domain names and paths.
Ensure we set a valid hostname, DNS domain and NIS domain.
Document the need for input validation in dhcpcd-run-hooks(8).

Fixes CVE-2011-996.
Based on patches to dhcpcd-3 by Marius Tomaschewski <mt@suse.de>.

BUG=chromium-os:14192
TEST=Compile and run only -- this code path does not fire in ChromeOS.
Our version has all hooks removed so only the escape changes above apply.

Change-Id: Ia8c7b3e4af6e13b13319ee7f5cc58f3ab8e02b13

R=sleffler@chromium.org,sumit@chromium.org

Review URL: http://codereview.chromium.org/6873012

3 years agoCHROMIUMOS: dhcp: Remove errant extra ref 0.12.362.B 0.12.369.B 0.12.392.B
Paul Stewart [Fri, 25 Mar 2011 20:42:19 +0000 (13:42 -0700)]
CHROMIUMOS: dhcp: Remove errant extra ref

In the utility function get_option, a buffer is allocated and returned
if there is more than one instance of the desired option in the dhcp
message.  Unfortunately this code has never worked (fixed somewhere
upstream).  It used to return the address of the buf pointer instead of
the buffer itself.  This solves issues with DHCP servers with surprising
(but perhaps valid) duplicate messages in their response.

BUG=n0ne
TEST=Aruba RAP-5WN

Change-Id: Iaa648cc2b602c670d2c331edd64374ccbe4d0bde

R=sleffler@chromium.org

Review URL: http://codereview.chromium.org/6738002

4 years agoDeprecate libcrash.a 0.11.241.B 11.1.241.B
Ken Mixter [Wed, 15 Sep 2010 01:19:00 +0000 (18:19 -0700)]
Deprecate libcrash.a

Change-Id: I82eda81bd1fcf7ba707e72b1ce30159f3c6de969

BUG=5870
TEST=build_packages

Review URL: http://codereview.chromium.org/3389003

4 years agodhcpcd: cherry-pick 4 commits from upstream
Paul Stewart [Wed, 25 Aug 2010 17:24:25 +0000 (10:24 -0700)]
dhcpcd: cherry-pick 4 commits from upstream

These cherry-picks address issues with "Bad file descriptor" errors.

-H, --xidhwaddr will use the last four bytes of the hardware address as the xid instead of generating a random number. Fixes #183, thanks to Aurelien.
(cherry picked from commit fce0ef8639b442c219a6f2d59a8115be91f79651)

Infinite lease times are always valid when reading leases.
(cherry picked from commit 437e01e01db4f963f8b15d7ee55b00a72d87e292)

If we reboot an old valid lease but fail to ACK it, we need to clear the address when discovering. Fixes #185.
(cherry picked from commit 9eee804aed30995b1dd8f075cae5e6c343289242)

Reorganise the opening and closing of sockets a bit. Attempt at addressing #190.
(Required small manual fixups due to our local changes, but
 cherry picked from commit e957b51d2650226bcde95e96d06df1b459a01fa9)

BUG=chromium-os:6042
TEST=Manual + MatFunc in the testbed

Review URL: http://codereview.chromium.org/3155041

4 years agoAdded a D-Bus filter to find out when flimflamd dies, so that we can clean up and...
Eric Shienbrood [Mon, 26 Jul 2010 21:11:36 +0000 (17:11 -0400)]
Added a D-Bus filter to find out when flimflamd dies, so that we can clean up and exit.

BUG=chromium-os:5035
TEST=Start flimflamd. Observe that it starts dhcpcd to configure eth0.
Kill flimflamd with a signal that it doesn't catch (SIGQUIT or SIGSEGV
will do). Observe that dhcpcd exits. Also tested the "normal" case
in which flimflamd is terminated with a SIGTERM, and observed that
it behaves as it did before, i.e., it does an orderly shutdown and
sends a release request to dhcpcd.

Review URL: http://codereview.chromium.org/3060016

4 years agoSend a "ping" message outwards so folks know we started
Paul Stewart [Mon, 26 Jul 2010 20:10:57 +0000 (13:10 -0700)]
Send a "ping" message outwards so folks know we started

BUG=none
TEST=Instrumented flimflamd

Review URL: http://codereview.chromium.org/3061018

4 years agofix dhcpcd handling of Release dbus msg
Sam Leffler [Wed, 14 Jul 2010 19:02:06 +0000 (12:02 -0700)]
fix dhcpcd handling of Release dbus msg

Don't stop the interface on Release; that clears state and exit's

TEST=send Release and note the dhcpcd process exit's; apply fix and note it sticks around until flimflam tells it to terminate

Review URL: http://codereview.chromium.org/2957010

4 years agoVarious dhcpcd fixups.
Sam Leffler [Wed, 14 Jul 2010 15:56:09 +0000 (08:56 -0700)]
Various dhcpcd fixups.

- fix Rebind; previous use of bind_interface was wrong
- don't use signals to effect state changes; call directly
  into the code to avoid the signal delivery and associated
  socketpair dance
- release lease and terminate if dbus goes away
- set nocarrier in dhcpcd.conf to disable carrier checking;
  we act solely on dbus msgs
- while here do some code cleanups (e.g. kill #if 0 code)

TEST=do roaming tests and observe a single dhcpcd process renew leases as required; also tested release logic and dbus drop out logic by killing dbus-daemon

Review URL: http://codereview.chromium.org/2965010

4 years agoPut Introspect method on the correct interface,
Nathan Williams [Thu, 24 Jun 2010 22:57:30 +0000 (18:57 -0400)]
Put Introspect method on the correct interface,
org.freedesktop.DBus.Introspectable (DBUS_INTERFACE_INTROSPECTABLE),
not our local interface.

Adjust the configuration file to allow use of this interface.

TEST=
dbus-send --system --print-reply --dest=... /org/chromium/dhcpcd org.freedesktop.DBus.Introspectable.Introspect
dbus-send --system --print-reply --dest=... / org.freedesktop.DBus.Introspectable.Introspect

Review URL: http://codereview.chromium.org/2865017

4 years agodhcpcd-dbus.c::msg_handler(): Call raise() instead of handle_signal(),
Nathan Williams [Thu, 24 Jun 2010 22:55:42 +0000 (18:55 -0400)]
dhcpcd-dbus.c::msg_handler(): Call raise() instead of handle_signal(),
since the latter is looking for something on the internal signal pipe,
and not paying attention to its argument.

TEST=Send org.chromium.dhcpcd.Release method to dhcpcd, note that it exits (possibly by sending the method call twice and noting that it fails to contact dhcpcd the second time).
Details: Start a dhcpcd with a known DBus ID by running "dbus-monitor --system interface=org.chromium.dhcpcd" and plugging in an Ethernet cable; look for the "sender=" value.
Send the release command with "dbus-send --system --print-reply --dest=[DBus ID] /org/chromium/dhcpcd org.chromium.dhcpcd.Release"

Review URL: http://codereview.chromium.org/2851023

4 years agodbus-dict.c::append_config_array(): Fix up DBUS_TYPE_UINT32 handling
Nathan Williams [Thu, 24 Jun 2010 19:36:02 +0000 (15:36 -0400)]
dbus-dict.c::append_config_array(): Fix up DBUS_TYPE_UINT32 handling
to work for arrays of more than one element by parsing the current
token rather than the entire string and avoiding fallthrough to the
default case.

TEST=Run flimflam (with -P dhclient) and connect to a network where
the DHCP server provides multiple DNS servers. Check that the
resulting resolv.conf file contains all of the DNS servers.

Review URL: http://codereview.chromium.org/2851022

4 years agoOverhaul dhcpcd for chrome os use:
Sam Leffler [Wed, 9 Jun 2010 16:34:23 +0000 (09:34 -0700)]
Overhaul dhcpcd for chrome os use:
- merge dbus support
- remove direct configuration of system resources; instead signal flimflam via dbus
- add breakpad support
- add python test scripts
- rename dbus service name to org.chromium.dhcpcd to avoid confusion

TEST=collect dhcp leases from a variety of servers and monitor dbus msgs; replace dhclient w/ flimflam and test wired, wireless, and 3g operation (verify lease contents are properly configured by flimflam)
BUG=574

Note: requires separate changes for flimflam and ebuild glue

Review URL: http://codereview.chromium.org/2428004

4 years agoinherit review settings
Mandeep Singh Baines [Mon, 24 May 2010 23:19:35 +0000 (16:19 -0700)]
inherit review settings

TBR=cmasone

Review URL: http://codereview.chromium.org/2161003

4 years agoRelease dhcpcd-5.1.4
Roy Marples [Wed, 23 Dec 2009 08:22:32 +0000 (08:22 +0000)]
Release dhcpcd-5.1.4

4 years agoFix compile.
Roy Marples [Wed, 23 Dec 2009 08:05:57 +0000 (08:05 +0000)]
Fix compile.

4 years agoOnly warn about CSR when binding.
Roy Marples [Wed, 23 Dec 2009 07:18:22 +0000 (07:18 +0000)]
Only warn about CSR when binding.

4 years agoFix finding deleted routes on Linux.
Roy Marples [Mon, 14 Dec 2009 14:47:16 +0000 (14:47 +0000)]
Fix finding deleted routes on Linux.

4 years agoStyle
Roy Marples [Mon, 14 Dec 2009 14:46:54 +0000 (14:46 +0000)]
Style

4 years agoWait 1/100th of a second before release as testing shows the
Roy Marples [Thu, 3 Dec 2009 13:30:09 +0000 (13:30 +0000)]
Wait 1/100th of a second before release as testing shows the
release is sent correctly even in a heavy load.

4 years agoFix the -S option, #181.
Roy Marples [Tue, 1 Dec 2009 00:57:45 +0000 (00:57 +0000)]
Fix the -S option, #181.

4 years agoGive the RELEASE packet a chance to leave the kernel
Roy Marples [Tue, 24 Nov 2009 01:15:08 +0000 (01:15 +0000)]
Give the RELEASE packet a chance to leave the kernel
before dropping the ip.

4 years agoIf we have to bring an interface up, and we don't have any carriers
Roy Marples [Fri, 20 Nov 2009 15:14:27 +0000 (15:14 +0000)]
If we have to bring an interface up, and we don't have any carriers
then we need to wait for a second to allow an interface to settle.

4 years agoSmall code optimisation.
Roy Marples [Fri, 20 Nov 2009 14:35:36 +0000 (14:35 +0000)]
Small code optimisation.

4 years agoFix the import target a little.
Roy Marples [Fri, 20 Nov 2009 12:40:59 +0000 (12:40 +0000)]
Fix the import target a little.

4 years agoAllow --without-getline to skip the getline test.
Roy Marples [Fri, 20 Nov 2009 12:20:10 +0000 (12:20 +0000)]
Allow --without-getline to skip the getline test.
This makes NetBSD importing a little easier.

4 years agoRe-apply lease info if different - fixes occasional release being broadcast.
Roy Marples [Thu, 19 Nov 2009 21:53:25 +0000 (21:53 +0000)]
Re-apply lease info if different - fixes occasional release being broadcast.
Ensure we use a new xid when releasing.

4 years agodhcpcd should log to syslog even with quiet.
Roy Marples [Thu, 19 Nov 2009 21:31:41 +0000 (21:31 +0000)]
dhcpcd should log to syslog even with quiet.

4 years agoStyle.
Roy Marples [Sun, 25 Oct 2009 23:21:21 +0000 (23:21 +0000)]
Style.

4 years agoRelease dhpcd-5.1.3
Roy Marples [Sun, 25 Oct 2009 23:08:14 +0000 (23:08 +0000)]
Release dhpcd-5.1.3

4 years agoDocument default behaviour better for running on a single interface.
Roy Marples [Sun, 25 Oct 2009 14:44:28 +0000 (14:44 +0000)]
Document default behaviour better for running on a single interface.

4 years agoWe need to enable waitip when running on a single interface to retain
Roy Marples [Sun, 25 Oct 2009 10:56:54 +0000 (10:56 +0000)]
We need to enable waitip when running on a single interface to retain
compat with older dhcpcd versions.

4 years agoTypo
Christoph Egger [Sat, 24 Oct 2009 22:36:56 +0000 (23:36 +0100)]
Typo

4 years agoDon't always request classless_static_routes, instead add it to dhcpcd.conf
Roy Marples [Sat, 17 Oct 2009 15:31:39 +0000 (16:31 +0100)]
Don't always request classless_static_routes, instead add it to dhcpcd.conf
as a default option. Add a debug message when adding classless_static_routes.
This is because some DHCP servers have this option badly setup and it could
not be otherwise disabled.

4 years agoDon't allow the same hook to be added more than once.
Roy Marples [Sat, 17 Oct 2009 06:58:42 +0000 (07:58 +0100)]
Don't allow the same hook to be added more than once.

4 years agoIf using --with-hooks, don't detect any other hooks.
Roy Marples [Fri, 16 Oct 2009 21:36:51 +0000 (22:36 +0100)]
If using --with-hooks, don't detect any other hooks.

4 years agoRelease dhcpcd-5.1.2
Roy Marples [Fri, 16 Oct 2009 21:13:41 +0000 (22:13 +0100)]
Release dhcpcd-5.1.2

4 years agoAdd back -w, --waitip so that user has total control over behaviour.
Roy Marples [Fri, 16 Oct 2009 19:59:30 +0000 (20:59 +0100)]
Add back -w, --waitip so that user has total control over behaviour.

4 years agoThe hwaddr could have changed for existing interfaces.
Roy Marples [Thu, 15 Oct 2009 07:33:24 +0000 (08:33 +0100)]
The hwaddr could have changed for existing interfaces.

4 years agoOnly work with ethernet by default so firewire does not slow down the boot.
Roy Marples [Thu, 15 Oct 2009 07:32:49 +0000 (08:32 +0100)]
Only work with ethernet by default so firewire does not slow down the boot.

4 years agoMultiple debug no longer stops backgrounding.
Roy Marples [Thu, 15 Oct 2009 00:33:23 +0000 (01:33 +0100)]
Multiple debug no longer stops backgrounding.

4 years agoJust have one open socket for AF_NET.
Roy Marples [Thu, 15 Oct 2009 00:30:54 +0000 (01:30 +0100)]
Just have one open socket for AF_NET.

4 years agoRemove the -w option and make it the default action if at least one
Roy Marples [Wed, 14 Oct 2009 15:16:07 +0000 (16:16 +0100)]
Remove the -w option and make it the default action if at least one
interface reports a carrier.

4 years agowait -> waitip
Roy Marples [Tue, 13 Oct 2009 06:02:30 +0000 (07:02 +0100)]
wait -> waitip
It's more descriptive and allows future wait$entity commands.

4 years agowait should work in dhcpcd.conf
Roy Marples [Sat, 10 Oct 2009 16:25:06 +0000 (17:25 +0100)]
wait should work in dhcpcd.conf

4 years agoAbort when we have an invalid interface list.
Roy Marples [Fri, 9 Oct 2009 19:24:22 +0000 (20:24 +0100)]
Abort when we have an invalid interface list.

4 years agoAlways unlink the lease file on ARP failure so we never rebind the failed address.
Roy Marples [Fri, 9 Oct 2009 19:23:50 +0000 (20:23 +0100)]
Always unlink the lease file on ARP failure so we never rebind the failed address.

4 years agoWe need to ensure sockets are open for sending a DECLINE.
Roy Marples [Fri, 9 Oct 2009 19:00:34 +0000 (20:00 +0100)]
We need to ensure sockets are open for sending a DECLINE.

4 years agoRemeber preferred domain list order so we fall back correctly.
Roy Marples [Fri, 9 Oct 2009 16:26:23 +0000 (17:26 +0100)]
Remeber preferred domain list order so we fall back correctly.
Stop ypbind when we don't have any domains so we don't stall.

4 years agoAdd new hook, 50-ypbind for BSD ypbind versions.
Roy Marples [Fri, 9 Oct 2009 13:12:20 +0000 (14:12 +0100)]
Add new hook, 50-ypbind for BSD ypbind versions.
configure now detects ntpd and ypbind for automatic hook install.

4 years agoImprove import so it's more generic.
Roy Marples [Thu, 8 Oct 2009 20:21:23 +0000 (21:21 +0100)]
Improve import so it's more generic.

4 years agoAdd an extra timeout for IPv4LL when in use.
Roy Marples [Thu, 8 Oct 2009 19:56:52 +0000 (20:56 +0100)]
Add an extra timeout for IPv4LL when in use.

4 years agoTimeout should not automagically increase when using IPv4LL.
Roy Marples [Thu, 8 Oct 2009 07:07:25 +0000 (08:07 +0100)]
Timeout should not automagically increase when using IPv4LL.
If we need extra we should handle that at handle_exit_timeout() and log.

4 years ago-w, --wait forces dhcpcd to wait for an ip address or timeout when
Roy Marples [Wed, 7 Oct 2009 21:11:14 +0000 (22:11 +0100)]
-w, --wait forces dhcpcd to wait for an ip address or timeout when
running on more than one interface.

4 years agoDon't export git .gitignore file
Roy Marples [Fri, 2 Oct 2009 20:57:44 +0000 (21:57 +0100)]
Don't export git .gitignore file

4 years agoImprove config generation style more
Roy Marples [Fri, 2 Oct 2009 19:08:59 +0000 (20:08 +0100)]
Improve config generation style more

4 years agoStyle config.h a little better.
Roy Marples [Fri, 2 Oct 2009 18:39:03 +0000 (19:39 +0100)]
Style config.h a little better.

5 years agoReport ClientID being used in debug.
Roy Marples [Sat, 26 Sep 2009 08:00:25 +0000 (09:00 +0100)]
Report ClientID being used in debug.

5 years agoAdd -fno-common to debugging CFLAGS.
Roy Marples [Thu, 24 Sep 2009 21:29:18 +0000 (22:29 +0100)]
Add -fno-common to debugging CFLAGS.
Declare udp_dhcp_len as extern.
Include common.h in dhcp.h to get _packed definition.
Thanks to David Wu for pointing this out.

5 years agoRelease dhcpcd-5.1.1
Roy Marples [Tue, 22 Sep 2009 06:26:04 +0000 (07:26 +0100)]
Release dhcpcd-5.1.1

5 years agoAdd a comment about enabling a ClientID.
Roy Marples [Sun, 20 Sep 2009 16:20:31 +0000 (17:20 +0100)]
Add a comment about enabling a ClientID.

5 years agoFix various typos and grammatical errors.
Stephen Borrill [Sat, 19 Sep 2009 14:25:48 +0000 (15:25 +0100)]
Fix various typos and grammatical errors.

5 years agoSimplify config.
Roy Marples [Wed, 9 Sep 2009 10:32:48 +0000 (11:32 +0100)]
Simplify config.

5 years agoDon't null terminate gratuitously when handling quotes.
Roy Marples [Mon, 7 Sep 2009 21:05:46 +0000 (22:05 +0100)]
Don't null terminate gratuitously when handling quotes.

5 years agoReally fix no debug by default.
Roy Marples [Fri, 4 Sep 2009 23:27:53 +0000 (00:27 +0100)]
Really fix no debug by default.

5 years agoDisable debugging by default if not built from git.
Roy Marples [Fri, 4 Sep 2009 23:15:18 +0000 (00:15 +0100)]
Disable debugging by default if not built from git.

5 years agoAccept --bindir and --sbindir to modify SBINDIR - we don't use BINDIR.
Roy Marples [Thu, 3 Sep 2009 12:18:03 +0000 (13:18 +0100)]
Accept --bindir and --sbindir to modify SBINDIR - we don't use BINDIR.
--help now prints a simple message.

5 years agoUse our defined CPPFLAGS and CFLAGS for compile tests.
Roy Marples [Thu, 3 Sep 2009 10:10:51 +0000 (11:10 +0100)]
Use our defined CPPFLAGS and CFLAGS for compile tests.
Fixes #178.

5 years agoRelease dhcpcd-5.1.0
Roy Marples [Wed, 2 Sep 2009 20:21:11 +0000 (21:21 +0100)]
Release dhcpcd-5.1.0

5 years agoRemove escapes in man pages for vendor ,"hello world"
Roy Marples [Wed, 2 Sep 2009 18:32:28 +0000 (19:32 +0100)]
Remove escapes in man pages for vendor ,"hello world"
Fixes #177 again.

5 years agoAllow an un-encapsulated vendor option.
Roy Marples [Tue, 1 Sep 2009 20:38:01 +0000 (21:38 +0100)]
Allow an un-encapsulated vendor option.
Fixes #177.

5 years agoFix parsing of escape codes.
Roy Marples [Tue, 1 Sep 2009 20:37:34 +0000 (21:37 +0100)]
Fix parsing of escape codes.

5 years agoWe should not affect other interfaces when handling new interface
Roy Marples [Tue, 1 Sep 2009 07:45:11 +0000 (08:45 +0100)]
We should not affect other interfaces when handling new interface
notifications.

5 years agoDon't pass "dhcpcd $iface" to discover_interfaces so our
Roy Marples [Mon, 31 Aug 2009 21:51:17 +0000 (22:51 +0100)]
Don't pass "dhcpcd $iface" to discover_interfaces so our
denyinterfaces config option works for hotplugged interfaces.

5 years agoWhitespace.
Roy Marples [Wed, 12 Aug 2009 08:38:41 +0000 (09:38 +0100)]
Whitespace.

5 years agoFix timeout of 0 disabling the timeout.
Roy Marples [Tue, 11 Aug 2009 20:12:46 +0000 (21:12 +0100)]
Fix timeout of 0 disabling the timeout.

5 years agoFix persistent option.
Roy Marples [Tue, 11 Aug 2009 20:08:02 +0000 (21:08 +0100)]
Fix persistent option.

5 years agoDon't check family on point to point interfaces as we monitor them.
Roy Marples [Wed, 5 Aug 2009 21:39:42 +0000 (22:39 +0100)]
Don't check family on point to point interfaces as we monitor them.

5 years agoSome drivers report ENODEV when bring the interface up if their kill switch is on.
Roy Marples [Wed, 5 Aug 2009 21:16:09 +0000 (22:16 +0100)]
Some drivers report ENODEV when bring the interface up if their kill switch is on.
This stops dhcpcd from using the interface, so we now just blunder on and await
a carrier up event.
IMO, ENODEV is the wrong error code as the device IS present, it's just disabled.
But the patch here still makes sense.

5 years agoEnable debugging for git by default.
Roy Marples [Wed, 5 Aug 2009 21:15:50 +0000 (22:15 +0100)]
Enable debugging for git by default.