Orange-OpenSource/bmc-cache

tx_filter does not work?

Closed this issue · 2 comments

After I start bmc, I can see that rx_filter has received data, but tx_filter has never been called.I don't see tx_filter being attached to the egress hook of tc in the code. Do I need to attach it separately?How to attach it?

Yes, the tx_filter program needs to be attached separately.
To do so, you first need to make sure that the BPF filesystem is mounted, if it isn't you can mount it with the following command:

# mount -t bpf none /sys/fs/bpf/

Once bmc is running and the tx_filter program has been pinned to /sys/fs/bpf/bmc_tx_filter you can attach it using the tc command line:

# tc qdisc add dev <interface_name> clsact
# tc filter add dev <interface_name> egress bpf object-pinned /sys/fs/bpf/bmc_tx_filter

After you are done using bmc, you can detach the program with these commands:

# tc filter del dev <interface_name> egress
# tc qdisc del dev <interface_name> clsact

And unpin the program with # rm /sys/fs/bpf/bmc_tx_filter

Thank you very much for your answers