Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Sep 11, 2024
1 parent 5006294 commit 6bae3f7
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions oryx-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ impl From<[u8; RawPacket::LEN]> for AppPacket {
RawPacket::Ip(packet, proto) => match packet {
IpHdr::V4(ipv4_packet) => match proto {
ip::ProtoHdr::Tcp(header) => {
//FIX: This does not work
// let tcphdr =
// unsafe { raw_packet.add(mem::size_of::<Ipv4Hdr>()) } as *const TcpHdr;

let tcp_packet = TcpPacket {
src_ip: IpAddr::V4(Ipv4Addr::from(u32::from_be(ipv4_packet.src_addr))),
src_port: u16::from_be(header.source),
Expand All @@ -69,10 +65,6 @@ impl From<[u8; RawPacket::LEN]> for AppPacket {
AppPacket::Ip(IpPacket::Tcp(tcp_packet))
}
ip::ProtoHdr::Udp(header) => {
// let udphdr = unsafe {
// raw_packet.offset(Ipv4Hdr::LEN.try_into().unwrap()) as *const UdpHdr
// };

let udp_packet = UdpPacket {
src_ip: IpAddr::V4(Ipv4Addr::from(u32::from_be(ipv4_packet.src_addr))),
src_port: u16::from_be(header.source),
Expand All @@ -82,10 +74,6 @@ impl From<[u8; RawPacket::LEN]> for AppPacket {
Self::Ip(IpPacket::Udp(udp_packet))
}
ip::ProtoHdr::Icmp(header) => {
// let icmphdr = unsafe {
// raw_packet.offset(Ipv4Hdr::LEN.try_into().unwrap()) as *const IcmpHdr
// };

let icmp_type = match header.type_ {
0 => IcmpType::EchoRequest,
1 => IcmpType::EchoReply,
Expand All @@ -99,7 +87,6 @@ impl From<[u8; RawPacket::LEN]> for AppPacket {
};
Self::Ip(IpPacket::Icmp(icmp_packet))
}
_ => unreachable!(),
},
IpHdr::V6(ipv6_packet) => match ipv6_packet.next_hdr {
IpProto::Tcp => {
Expand Down

0 comments on commit 6bae3f7

Please sign in to comment.