瀏覽代碼

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.
Dario Nieuwenhuis 3 年之前
父節點
當前提交
dc5cee7b1a
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      src/socket/dhcpv4.rs

+ 1 - 3
src/socket/dhcpv4.rs

@@ -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();