dhcp: Ignore DHCP OFFER messages without assigned address
authorTobias Brunner <tobias@strongswan.org>
Tue, 16 Oct 2018 10:07:05 +0000 (12:07 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 26 Oct 2018 09:26:50 +0000 (11:26 +0200)
FreeRADIUS seems to respond that way if it can't allocate an address to
the client.

src/libcharon/plugins/dhcp/dhcp_socket.c

index 1e208d0..ecd92f2 100644 (file)
@@ -489,6 +489,16 @@ static void handle_offer(private_dhcp_socket_t *this, dhcp_t *dhcp, int optlen)
        offer = host_create_from_chunk(AF_INET,
                                        chunk_from_thing(dhcp->your_address), 0);
 
+       if (offer->is_anyaddr(offer))
+       {
+               server = host_create_from_chunk(AF_INET,
+                                       chunk_from_thing(dhcp->server_address), 0);
+               DBG1(DBG_CFG, "ignoring DHCP OFFER %+H from %H", offer, server);
+               server->destroy(server);
+               offer->destroy(offer);
+               return;
+       }
+
        this->mutex->lock(this->mutex);
        enumerator = this->discover->create_enumerator(this->discover);
        while (enumerator->enumerate(enumerator, &transaction))