diff --git a/examples/tun2.rs b/examples/tun2.rs index cd9af17..c3e2a2b 100644 --- a/examples/tun2.rs +++ b/examples/tun2.rs @@ -152,7 +152,7 @@ async fn main() -> Result<(), Box> { } IpStackStream::UnknownTransport(u) => { let n = number; - if u.src_addr().is_ipv4() && u.ip_protocol() == IpNumber::ICMP { + if u.src_addr().is_ipv4() && IpNumber::from(u.ip_protocol()) == IpNumber::ICMP { let (icmp_header, req_payload) = Icmpv4Header::from_slice(u.payload())?; if let etherparse::Icmpv4Type::EchoRequest(req) = icmp_header.icmp_type { log::info!("#{n} ICMPv4 echo"); diff --git a/examples/tun_wintun.rs b/examples/tun_wintun.rs index 9c6c9d0..5ef0f38 100644 --- a/examples/tun_wintun.rs +++ b/examples/tun_wintun.rs @@ -84,7 +84,7 @@ async fn main() -> Result<(), Box> { }); } IpStackStream::UnknownTransport(u) => { - if u.src_addr().is_ipv4() && u.ip_protocol() == IpNumber::ICMP { + if u.src_addr().is_ipv4() && IpNumber::from(u.ip_protocol()) == IpNumber::ICMP { let (icmp_header, req_payload) = Icmpv4Header::from_slice(u.payload())?; if let etherparse::Icmpv4Type::EchoRequest(req) = icmp_header.icmp_type { println!("ICMPv4 echo"); diff --git a/src/stream/unknown.rs b/src/stream/unknown.rs index 838d93f..ede0f13 100644 --- a/src/stream/unknown.rs +++ b/src/stream/unknown.rs @@ -45,8 +45,8 @@ impl IpStackUnknownTransport { pub fn payload(&self) -> &[u8] { &self.payload } - pub fn ip_protocol(&self) -> IpNumber { - self.protocol + pub fn ip_protocol(&self) -> u8 { + self.protocol.0 } pub fn send(&self, mut payload: Vec) -> Result<(), Error> { loop {