Hello All,

I tried to load a PROG_TYPE_SCHED_CLS eBPF program and attach it to a linux interface, netlink fails because it is not able to find the interface.

Those are the steps  I did:

sudo ifconfig veth1:1 192.168.2.210/32 up

`

#!/usr/bin/python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

from bcc import BPF
from pyroute2 import IPRoute

ipr = IPRoute()

b = BPF(src_file="helloworld.c", debug=0)
fn = b.load_func("hello", BPF.SCHED_CLS)

idx = ipr.link_lookup(ifname="veth1:1")[0]

try:
    ipr.tc("add", "ingress", idx, "ffff:")
    ipr.tc("add-filter", "bpf", idx, ":1", fd=fn.fd,
        name=fn.name, parent="ffff:", action="ok", classid=1)

    raw_input("promt: ")
finally:
    ipr.tc("del", "ingress", idx)

print("BPF tc functionality - SCHED_CLS: OK")
`

`

Traceback (most recent call last):
  File "./helloworld.py", line 13, in <module>
    idx = ipr.link_lookup(ifname="veth1:1")[0]
IndexError: list index out of range

`

It is possible to attach eBPF programs to virtual interfaces?

Thanks,

Mauricio




_______________________________________________
iovisor-dev mailing list
iovisor-dev@lists.iovisor.org
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to