Skip to content

Commit 0e771ca

Browse files
authored
Merge pull request #865 from thvdveld/prevent-ndisc-when-medium-ip
fix(ndisc): prevent ndisc when medium is IP.
2 parents f0d1c37 + 5a3ed88 commit 0e771ca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/iface/interface/ipv6.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,18 @@ impl InterfaceInner {
157157
// Forward any NDISC packets to the ndisc packet handler
158158
#[cfg(any(feature = "medium-ethernet", feature = "medium-ieee802154"))]
159159
Icmpv6Repr::Ndisc(repr) if ip_repr.hop_limit() == 0xff => match ip_repr {
160-
IpRepr::Ipv6(ipv6_repr) => self.process_ndisc(ipv6_repr, repr),
160+
IpRepr::Ipv6(ipv6_repr) => {
161+
use crate::phy::Medium;
162+
163+
match self.caps.medium {
164+
#[cfg(feature = "medium-ethernet")]
165+
Medium::Ethernet => self.process_ndisc(ipv6_repr, repr),
166+
#[cfg(feature = "medium-ieee802154")]
167+
Medium::Ieee802154 => self.process_ndisc(ipv6_repr, repr),
168+
#[cfg(feature = "medium-ip")]
169+
Medium::Ip => None,
170+
}
171+
}
161172
#[allow(unreachable_patterns)]
162173
_ => unreachable!(),
163174
},

0 commit comments

Comments
 (0)