Skip to content

Commit

Permalink
Fix #50
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjad Pourali authored and Sajjad Pourali committed Jul 24, 2024
1 parent 2aaf0e8 commit b3daf6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/tun2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
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");
Expand Down
2 changes: 1 addition & 1 deletion examples/tun_wintun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
});
}
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");
Expand Down
4 changes: 2 additions & 2 deletions src/stream/unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>) -> Result<(), Error> {
loop {
Expand Down

0 comments on commit b3daf6d

Please sign in to comment.