summaryrefslogtreecommitdiffstats
path: root/src/net/udp/dhcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/udp/dhcp.c')
-rw-r--r--src/net/udp/dhcp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 10482e94..9a231840 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -941,6 +941,13 @@ int dhcp_create_packet ( struct dhcp_packet *dhcppkt,
&dhcphdr->flags );
memcpy ( dhcphdr->options, options, options_len );
+ /* If the network device already has an IPv4 address then
+ * unicast responses from the DHCP server may be rejected, so
+ * request broadcast responses.
+ */
+ if ( ipv4_has_any_addr ( netdev ) )
+ dhcphdr->flags |= htons ( BOOTP_FL_BROADCAST );
+
/* Initialise DHCP packet structure */
memset ( dhcppkt, 0, sizeof ( *dhcppkt ) );
dhcppkt_init ( dhcppkt, data, max_len );