On Tue, May 28, 2019 at 09:20 PM, Gary Lin wrote:
On Tue, May 28, 2019 at 07:32:33PM -0700, forrest0579@... wrote:
The script does nothing really meaningful but demostrates how to use
What kind of network topology should I set up to make xdp_redirect_map.py runnable and what user-case this example represent for?
It redirects all traffic from one network interface to another, so you
need a machine with at least two XDP-enabled network interfaces. When you
send a packet from eth0 of Machine B to eth0 of Machine A, the script
swaps the src IP and dst IP of the incoming packets and sends them out
through eth1 of Machine A, so the packets will flow like this:
(Machine A) (Machine B)
[ eth0 ]<------[ eth0 ]
[ eth1 ] ---------+
The script also counts the number of packet processed per second as a
rough performance measurement for XDP_REDIRECT, so you can generate a
huge volume of traffic with the programs like trafgen in Machine B to
do the test.
PS: I have the same question about xdp_macswap_count.py too
Thanks for helping me!
These two examples swap mac instead of IP address.
And as an effect with the given topology, the egress package from MachineA-eth1 has dst mac of MachineB-eth0 and src mac of MachineA-eth0, dst IP of MachineA and src IP of MachineB. Assume that due to the dst mac, the package finally delivered back to MachineB, but the dst IP does not match the IP in MachineB. I have no idea in which kind of topology the package could be consumed.
Another question, after swap mac, shouldn't we re-calculate the l2 csum? or if I modify that field like src/dst IP/Port, how can I re-calculate these csum? Does BPF_FUNC_csum_diff
helper function work for this?