Merge pull request #26 from dmitris/skb-mode

for xdp, retry load with SKB_MODE flags
pull/27/head
Dave Tucker 3 years ago committed by GitHub
commit 31a7d0edb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,6 +16,7 @@ use aya::programs::SkMsg;
use {{crate_name}}_common::SockKey; use {{crate_name}}_common::SockKey;
use std::convert::TryFrom; use std::convert::TryFrom;
{%- when "xdp" -%} {%- when "xdp" -%}
use anyhow::Context;
use aya::programs::{Xdp, XdpFlags}; use aya::programs::{Xdp, XdpFlags};
{%- when "classifier" -%} {%- when "classifier" -%}
use aya::programs::{tc, SchedClassifier, TcAttachType}; use aya::programs::{tc, SchedClassifier, TcAttachType};
@ -104,7 +105,8 @@ fn try_main() -> Result<(), anyhow::Error> {
{%- when "xdp" -%} {%- when "xdp" -%}
let program: &mut Xdp = bpf.program_mut("{{crate_name}}").unwrap().try_into()?; let program: &mut Xdp = bpf.program_mut("{{crate_name}}").unwrap().try_into()?;
program.load()?; program.load()?;
program.attach(&opt.iface, XdpFlags::default())?; program.attach(&opt.iface, XdpFlags::default())
.context("failed to attach the XDP program with default flags - try changing XdpFlags::default() to XdpFlags::SKB_MODE")?;
{%- when "classifier" -%} {%- when "classifier" -%}
tc::qdisc_add_clsact(&opt.iface)?; tc::qdisc_add_clsact(&opt.iface)?;
let program: &mut SchedClassifier = bpf.program_mut("{{crate_name}}").unwrap().try_into()?; let program: &mut SchedClassifier = bpf.program_mut("{{crate_name}}").unwrap().try_into()?;

Loading…
Cancel
Save