mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-06 13:17:44 +03:00
sd-dhcp-server: propagate error on parsing DHCP packet
Otherwise, we silently ignore the received packet and that makes hard to
debug issue.
(cherry picked from commit 809da721f0
)
This commit is contained in:
parent
08c1aff483
commit
7483f75fa6
@ -1121,7 +1121,7 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message, siz
|
||||
|
||||
type = dhcp_option_parse(message, length, parse_request, req, &error_message);
|
||||
if (type < 0)
|
||||
return 0;
|
||||
return type;
|
||||
|
||||
r = ensure_sane_request(server, req, message);
|
||||
if (r < 0)
|
||||
|
@ -146,7 +146,7 @@ static void test_message_handler(void) {
|
||||
test.option_type.code = 0;
|
||||
test.option_type.length = 0;
|
||||
test.option_type.type = 0;
|
||||
assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
|
||||
assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == -ENOMSG);
|
||||
test.option_type.code = SD_DHCP_OPTION_MESSAGE_TYPE;
|
||||
test.option_type.length = 1;
|
||||
test.option_type.type = DHCP_DISCOVER;
|
||||
|
Loading…
Reference in New Issue
Block a user