Patched bug with endianness handling in RawBOOTPPacket -> BOOTPPacket conversion

This commit is contained in:
Xnoe 2022-09-23 17:12:01 +01:00
parent f36792e08f
commit 4e2454394d
Signed by: xnoe
GPG Key ID: 45AC398F44F0DAFE

View File

@ -123,22 +123,22 @@ impl From<RawBOOTPPacket> for BOOTPPacket {
ciaddr: if item.ciaddr == 0 { ciaddr: if item.ciaddr == 0 {
None None
} else { } else {
Some(std::net::Ipv4Addr::from(item.ciaddr)) Some(std::net::Ipv4Addr::from(u32::from_be(item.ciaddr)))
}, },
yiaddr: if item.yiaddr == 0 { yiaddr: if item.yiaddr == 0 {
None None
} else { } else {
Some(std::net::Ipv4Addr::from(item.yiaddr)) Some(std::net::Ipv4Addr::from(u32::from_be(item.yiaddr)))
}, },
siaddr: if item.siaddr == 0 { siaddr: if item.siaddr == 0 {
None None
} else { } else {
Some(std::net::Ipv4Addr::from(item.siaddr)) Some(std::net::Ipv4Addr::from(u32::from_be(item.siaddr)))
}, },
giaddr: if item.giaddr == 0 { giaddr: if item.giaddr == 0 {
None None
} else { } else {
Some(std::net::Ipv4Addr::from(item.giaddr)) Some(std::net::Ipv4Addr::from(u32::from_be(item.giaddr)))
}, },
chaddr: MacAddress::from_bytes(&item.chaddr[0..6]).unwrap(), chaddr: MacAddress::from_bytes(&item.chaddr[0..6]).unwrap(),
sname: item.sname, sname: item.sname,