diff --git a/src/libsystemd-network/dhcp-relay-downstream.c b/src/libsystemd-network/dhcp-relay-downstream.c index 5c3311d979..eca140a92c 100644 --- a/src/libsystemd-network/dhcp-relay-downstream.c +++ b/src/libsystemd-network/dhcp-relay-downstream.c @@ -303,7 +303,7 @@ int downstream_process_message( /* RFC 1542 section 4.1.1: * The relay agent MUST silently discard BOOTREQUEST messages whose 'hops' field exceeds the value 16. */ - if (message->header.hops >= 16) + if (message->header.hops > 16) return 0; message->header.hops++; diff --git a/src/libsystemd-network/test-dhcp-relay.c b/src/libsystemd-network/test-dhcp-relay.c index 2a7131e59b..74ccbb9dc9 100644 --- a/src/libsystemd-network/test-dhcp-relay.c +++ b/src/libsystemd-network/test-dhcp-relay.c @@ -314,7 +314,7 @@ TEST(forwarding) { /* Invalid message (too large hops). */ ASSERT_OK(dhcp_message_append_option_u8(m, SD_DHCP_OPTION_MESSAGE_TYPE, 101)); - m->header.hops = 16; + m->header.hops = 17; send_message(downstream_fd[1], m); dhcp_message_remove_option(m, SD_DHCP_OPTION_MESSAGE_TYPE); m->header.hops = 0;