Set broadcast flag in DHCP requests when sending broadcasts
authorMartin Willi <martin@revosec.ch>
Thu, 14 Apr 2011 14:01:47 +0000 (16:01 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 15 Apr 2011 11:00:23 +0000 (13:00 +0200)
src/libcharon/plugins/dhcp/dhcp_socket.c

index 8851c1b..c98d505 100644 (file)
@@ -201,6 +201,9 @@ static int prepare_dhcp(private_dhcp_socket_t *this,
        dhcp->transaction_id = transaction->get_id(transaction);
        if (chunk_equals(broadcast, this->dst->get_address(this->dst)))
        {
        dhcp->transaction_id = transaction->get_id(transaction);
        if (chunk_equals(broadcast, this->dst->get_address(this->dst)))
        {
+               /* Set broadcast flag to get broadcasted replies, as we actually
+                * do not own the MAC we request an address for. */
+               dhcp->flags = htons(0x8000);
                /* TODO: send with 0.0.0.0 source address */
        }
        else
                /* TODO: send with 0.0.0.0 source address */
        }
        else