Skip to content

Commit 7b446db

Browse files
committed
fix: fix combination of feature flags
The combination `medium-ieee802154` + `medium-ip` + `proto-ipv4` + `proto-ipv6` did not compile because of `lookup_hardware_addr`.
1 parent d2d9a24 commit 7b446db

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

ci.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ FEATURES_TEST=(
3030
"std,medium-ieee802154,proto-rpl,proto-sixlowpan,proto-sixlowpan-fragmentation,socket-udp"
3131
"std,medium-ip,proto-ipv4,proto-ipv6,socket-tcp,socket-udp"
3232
"std,medium-ethernet,medium-ip,medium-ieee802154,proto-ipv4,proto-ipv6,socket-raw,socket-udp,socket-tcp,socket-icmp,socket-dns,async"
33+
"std,medium-ieee802154,medium-ip,proto-ipv4,socket-raw"
3334
)
3435

3536
FEATURES_TEST_NIGHTLY=(

src/iface/interface/mod.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,16 +1336,21 @@ impl InterfaceInner {
13361336
let b = dst_addr.as_bytes();
13371337
let hardware_addr = match *dst_addr {
13381338
#[cfg(feature = "proto-ipv4")]
1339-
IpAddress::Ipv4(_addr) => {
1340-
HardwareAddress::Ethernet(EthernetAddress::from_bytes(&[
1339+
IpAddress::Ipv4(_addr) => match self.caps.medium {
1340+
#[cfg(feature = "medium-ethernet")]
1341+
Medium::Ethernet => HardwareAddress::Ethernet(EthernetAddress::from_bytes(&[
13411342
0x01,
13421343
0x00,
13431344
0x5e,
13441345
b[1] & 0x7F,
13451346
b[2],
13461347
b[3],
1347-
]))
1348-
}
1348+
])),
1349+
#[cfg(feature = "medium-ieee802154")]
1350+
Medium::Ieee802154 => unreachable!(),
1351+
#[cfg(feature = "medium-ip")]
1352+
Medium::Ip => unreachable!(),
1353+
},
13491354
#[cfg(feature = "proto-ipv6")]
13501355
IpAddress::Ipv6(_addr) => match self.caps.medium {
13511356
#[cfg(feature = "medium-ethernet")]
@@ -1376,8 +1381,10 @@ impl InterfaceInner {
13761381
}
13771382

13781383
match (src_addr, dst_addr) {
1379-
#[cfg(feature = "proto-ipv4")]
1380-
(&IpAddress::Ipv4(src_addr), IpAddress::Ipv4(dst_addr)) => {
1384+
#[cfg(all(feature = "medium-ethernet", feature = "proto-ipv4"))]
1385+
(&IpAddress::Ipv4(src_addr), IpAddress::Ipv4(dst_addr))
1386+
if matches!(self.caps.medium, Medium::Ethernet) =>
1387+
{
13811388
net_debug!(
13821389
"address {} not in neighbor cache, sending ARP request",
13831390
dst_addr

src/iface/neighbor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Cache {
146146
}
147147
}
148148

149-
#[cfg(any(feature = "medium-ethernet", feature = "medium-ip"))]
149+
#[cfg(feature = "medium-ethernet")]
150150
#[cfg(test)]
151151
mod test {
152152
use super::*;

0 commit comments

Comments
 (0)