Skip to content

Commit e270df1

Browse files
committed
packet03: update README
Update README to describe the effect of enabling/disabling forwarding on the results of the bpf_fib_lookup function. Also, use per-interface forwarding in the example, so that the whole system is not affected. Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
1 parent cb23e30 commit e270df1

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

packet03-redirecting/README.org

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,10 @@ Assignment 4 shows how to use this helper to write a program for full
6363
redirection.
6464

6565
One thing to note when using the =bpf_fib_lookup()= function is that it will
66-
return an error code if forwarding is disabled, so enable forwarding before
67-
running code from the Assignment 4.
68-
#+begin_src sh
69-
$ sudo sysctl net.ipv6.conf.all.forwarding=1
70-
net.ipv6.conf.all.forwarding = 1
71-
$ sudo sysctl net.ipv4.ip_forward=1
72-
net.ipv4.ip_forward = 1
73-
#+end_src
74-
66+
return an error code if forwarding is disabled for the ingress interface, so we
67+
need to enable forwarding before running code from the Assignment 4. Note that
68+
enabling forwarding is not required by the =bpf_redirect_map= or =bpf_redirect=
69+
functions, only for =bpf_fib_lookup=.
7570

7671
* Assignments
7772

@@ -253,12 +248,22 @@ and =XDP_FORWARD= for inner-inner.
253248

254249
Try more than two test environments. Run the =xdp_stats= program to verify that
255250
this is the XDP program does forwarding, and not the network stack (as
256-
forwarding should be enabled for this Assignment as noted above):
251+
forwarding should be enabled for this Assignment as noted above). Don't forget
252+
to enable forwarding for the interfaces.
253+
257254
#+begin_src sh
258255
$ t setup -n uno --legacy-ip
259256
$ t setup -n dos --legacy-ip
260257
$ t setup -n tres --legacy-ip
261258

259+
$ sudo sysctl net.ipv4.conf.uno.forwarding=1
260+
$ sudo sysctl net.ipv4.conf.dos.forwarding=1
261+
$ sudo sysctl net.ipv4.conf.tres.forwarding=1
262+
263+
$ sudo sysctl net.ipv6.conf.uno.forwarding=1
264+
$ sudo sysctl net.ipv6.conf.dos.forwarding=1
265+
$ sudo sysctl net.ipv6.conf.tres.forwarding=1
266+
262267
$ sudo ./xdp_loader -d uno --progsec xdp_router --skb -F
263268
$ sudo ./xdp_loader -d dos --progsec xdp_router --skb -F
264269
$ sudo ./xdp_loader -d tres --progsec xdp_router --skb -F

0 commit comments

Comments
 (0)