socket/dhcp: do not set BROADCAST flag.

Reasons:
1. We were already accidentally not setting the BROADCAST flag due to it being the wrong bit (see previous commit).
2. Major OSes don't set it.
3. rfc1542 section 3.1.1 states it's discouraged, and the issue it's supposed to workaround doesn't apply to smoltcp.

    Unfortunately, some client implementations are
    unable to receive such unicast IP datagrams until they know their own
    IP address
    (..)
    This addition to the protocol is a workaround for old host
    implementations.  Such implementations SHOULD be modified so
    that they may receive unicast BOOTREPLY messages, thus making
    use of this workaround unnecessary.  In general, the use of
    this mechanism is discouraged.
master
Dario Nieuwenhuis 2021-10-14 14:03:50 +02:00
parent 6d37633353
commit d34f4f783b
1 changed files with 1 additions and 3 deletions

View File

@ -354,7 +354,7 @@ impl Dhcpv4Socket {
router: None,
subnet_mask: None,
relay_agent_ip: Ipv4Address::UNSPECIFIED,
broadcast: true,
broadcast: false,
requested_ip: None,
client_identifier: Some(ethernet_addr),
server_identifier: None,
@ -410,7 +410,6 @@ impl Dhcpv4Socket {
}
dhcp_repr.message_type = DhcpMessageType::Request;
dhcp_repr.broadcast = false;
dhcp_repr.requested_ip = Some(state.requested_ip);
dhcp_repr.server_identifier = Some(state.server.identifier);
@ -445,7 +444,6 @@ impl Dhcpv4Socket {
ipv4_repr.dst_addr = state.server.address;
dhcp_repr.message_type = DhcpMessageType::Request;
dhcp_repr.client_ip = state.config.address.address();
dhcp_repr.broadcast = false;
net_debug!("DHCP send renew to {}: {:?}", ipv4_repr.dst_addr, dhcp_repr);
ipv4_repr.payload_len = udp_repr.header_len() + dhcp_repr.buffer_len();