summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/dhcp-client.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-12-17 16:24:16 +0100
committerTom Gundersen <teg@jklm.no>2013-12-17 16:24:16 +0100
commit97b9372db178baadb121634fb4ae12bda8969cfe (patch)
tree02635e9fdef9eb434e591363daccb12e69b38aa8 /src/libsystemd-dhcp/dhcp-client.c
parent187dc6e554f2d5b4b5a3bee72c73ff5df6418aa6 (diff)
dhcp: Properly handle unsuccessful cases for DHCP Ack
Ignore DHCP Ack packets if they are found to be erroneous or have an unexpected xid by setting the result to zero instead of propagating an error. Also remember to report a DHCP Nak and stop the DHCP client.
Diffstat (limited to 'src/libsystemd-dhcp/dhcp-client.c')
-rw-r--r--src/libsystemd-dhcp/dhcp-client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd-dhcp/dhcp-client.c b/src/libsystemd-dhcp/dhcp-client.c
index 01d406c27b..c0c348cbf1 100644
--- a/src/libsystemd-dhcp/dhcp-client.c
+++ b/src/libsystemd-dhcp/dhcp-client.c
@@ -897,6 +897,9 @@ static int client_receive_raw_message(sd_event_source *s, int fd,
client->receive_message =
sd_event_source_unref(client->receive_message);
}
+
+ r = 0;
+
break;
case DHCP_STATE_INIT:
@@ -910,7 +913,7 @@ static int client_receive_raw_message(sd_event_source *s, int fd,
}
error:
- if (r < 0)
+ if (r < 0 || r == DHCP_EVENT_NO_LEASE)
return client_stop(client, r);
return 0;