#define STATE_RENEW_REQUESTED 5
#define STATE_RELEASED 6
-#define BOOTP_BROADCAST 0x8000
+#define BOOTP_BROADCAST_ON 0x8000
+#define BOOTP_BROADCAST_OFF 0x0000
#define DHCP_MAGIC 0x63825363
#define DHCP_REQUEST 1
// Handle the message specific settings
switch (msgtype) {
case DHCPDISCOVER: // Broadcast DISCOVER message to all servers
- state->pdhcp.flags = htons(BOOTP_BROADCAST); // Broadcast bit.
+ if (flag_chk(FLAG_B))
+ state->pdhcp.flags = htons(BOOTP_BROADCAST_ON); // Broadcast bit set.
+ else
+ state->pdhcp.flags = htons(BOOTP_BROADCAST_OFF); // Broadcast bit unset.
if (flag_chk(FLAG_r)) {
inet_aton(TT.req_ip, &rqsd);
pend = dhcpc_addreqipaddr(&rqsd, pend);
if (flag_chk(FLAG_x)) pend = set_xopt(pend);
break;
case DHCPREQUEST: // Send REQUEST message to the server that sent the *first* OFFER
- state->pdhcp.flags = htons(BOOTP_BROADCAST); // Broadcast bit.
+ if (flag_chk(FLAG_B))
+ state->pdhcp.flags = htons(BOOTP_BROADCAST_ON); // Broadcast bit set.
+ else
+ state->pdhcp.flags = htons(BOOTP_BROADCAST_OFF); // Broadcast bit unset.
if (state->status == STATE_RENEWING) memcpy(&state->pdhcp.ciaddr, &state->ipaddr.s_addr, 4);
pend = dhcpc_addmaxsize(pend, htons(sizeof(dhcp_raw_t)));
rqsd.s_addr = htonl(server);