Skip to content

Commit

Permalink
Added PXE support
Browse files Browse the repository at this point in the history
  • Loading branch information
Qubasa committed Oct 27, 2021
1 parent c8141bb commit 4bc28ad
Show file tree
Hide file tree
Showing 4 changed files with 518 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/iface/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ let iface = InterfaceBuilder::new(device)
#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg(feature = "medium-ethernet")]
#[allow(clippy::large_enum_variant)]
enum EthernetPacket<'a> {
#[cfg(feature = "proto-ipv4")]
Arp(ArpRepr),
Expand Down
16 changes: 16 additions & 0 deletions src/socket/dhcpv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ impl Dhcpv4Socket {
let mut dhcp_repr = DhcpRepr {
message_type: DhcpMessageType::Discover,
transaction_id: next_transaction_id,
secs: 0,
sname: None,
boot_file: None,
client_hardware_address: ethernet_addr,
client_ip: Ipv4Address::UNSPECIFIED,
your_ip: Ipv4Address::UNSPECIFIED,
Expand All @@ -420,6 +423,11 @@ impl Dhcpv4Socket {
max_size: Some((cx.caps.ip_mtu() - MAX_IPV4_HEADER_LEN - UDP_HEADER_LEN) as u16),
lease_duration: None,
dns_servers: None,
time_offset: None,
client_arch_list: None,
client_interface_id: None,
client_machine_id: None,
vendor_class_id: None,
};

let udp_repr = UdpRepr {
Expand Down Expand Up @@ -735,6 +743,9 @@ mod test {
const DHCP_DEFAULT: DhcpRepr = DhcpRepr {
message_type: DhcpMessageType::Unknown(99),
transaction_id: TXID,
secs: 0,
sname: None,
boot_file: None,
client_hardware_address: MY_MAC,
client_ip: Ipv4Address::UNSPECIFIED,
your_ip: Ipv4Address::UNSPECIFIED,
Expand All @@ -750,6 +761,11 @@ mod test {
dns_servers: None,
max_size: None,
lease_duration: None,
time_offset: None,
client_arch_list: None,
client_interface_id: None,
client_machine_id: None,
vendor_class_id: None,
};

const DHCP_DISCOVER: DhcpRepr = DhcpRepr {
Expand Down

0 comments on commit 4bc28ad

Please sign in to comment.