Thread (33 messages) 33 messages, 7 authors, 2021-01-22

Re: [PATCHv10 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

From: Jesper Dangaard Brouer <hidden>
Date: 2021-01-22 10:41:40
Also in: netdev

On Fri, 22 Jan 2021 10:50:07 +0800
Hangbin Liu [off-list ref] wrote:
This patch add a xdp program on egress to show that we can modify
the packet on egress. In this sample we will set the pkt's src
mac to egress's mac address. The xdp_prog will be attached when
-X option supplied.

Signed-off-by: Hangbin Liu <redacted>
---
I think we have nitpicked this enough ;-)

Acked-by: Jesper Dangaard Brouer <redacted>
v10:
make xdp_redirect_map() always inline.

v9:
roll back to just set src mac to egress interface mac on 2nd xdp prog,
this could avoid packet reorder introduce in patch v6.

v8: Fix some checkpatch issues.

v7:
a) use bpf_object__find_program_by_name() instad of
   bpf_object__find_program_by_title()
b) set default devmap fd to 0

v6: no code update, only rebase the code on latest bpf-next

v5:
a) close fd when err out in get_mac_addr()
b) exit program when both -S and -X supplied.

v4:
a) Update get_mac_addr socket create
b) Load dummy prog regardless of 2nd xdp prog on egress

v3:
a) modify the src mac address based on egress mac

v2:
a) use pkt counter instead of IP ttl modification on egress program
b) make the egress program selectable by option -X
---
 samples/bpf/xdp_redirect_map_kern.c |  60 +++++++++++++--
 samples/bpf/xdp_redirect_map_user.c | 112 +++++++++++++++++++++++-----
 2 files changed, 147 insertions(+), 25 deletions(-)
 
-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help