Skip to content

Commit

Permalink
dont block tcp
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm committed Nov 29, 2023
1 parent d0e30a8 commit 175b226
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sdf-ebpf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use aya_bpf::{bindings::xdp_action, macros::{xdp, classifier, map}, programs::{XdpContext, TcContext}, maps::HashMap};
use aya_log_ebpf::{info, error};
use network_types::{eth::{EthHdr, EtherType}, ip::{Ipv4Hdr, IpProto}, udp::UdpHdr, tcp::TcpHdr};
use network_types::{eth::{EthHdr, EtherType}, ip::{Ipv4Hdr, IpProto}, udp::UdpHdr};

use crate::parse::{ptr_at, tc_ptr_at};

Expand Down Expand Up @@ -70,10 +70,10 @@ fn try_sdf_ingress(ctx: XdpContext) -> Result<u32, ()> {
let udphdr: *const UdpHdr = ptr_at(&ctx, EthHdr::LEN + Ipv4Hdr::LEN)?;
((*udphdr).source.to_be(), (*udphdr).dest.to_be())
},
IpProto::Tcp => {
let tcphdr: *const TcpHdr = ptr_at(&ctx, EthHdr::LEN + Ipv4Hdr::LEN)?;
((*tcphdr).source.to_be(), (*tcphdr).dest.to_be())
}
// IpProto::Tcp => {
// let tcphdr: *const TcpHdr = ptr_at(&ctx, EthHdr::LEN + Ipv4Hdr::LEN)?;
// ((*tcphdr).source.to_be(), (*tcphdr).dest.to_be())
// }
_ => return Ok(xdp_action::XDP_PASS)
}
};
Expand Down

0 comments on commit 175b226

Please sign in to comment.