netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] sample: bpf: xdp_router_ipv4: allow the kernel to send arp requests
@ 2022-05-25  9:44 Lorenzo Bianconi
  2022-05-31 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2022-05-25  9:44 UTC (permalink / raw)
  To: bpf; +Cc: ast, daniel, andrii, netdev, lorenzo.bianconi

Forward the packet to the kernel if the gw router mac address is missing
in to trigger ARP discovery.

Fixes: 85bf1f51691c ("samples: bpf: Convert xdp_router_ipv4 to XDP samples helper")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 samples/bpf/xdp_router_ipv4.bpf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/samples/bpf/xdp_router_ipv4.bpf.c b/samples/bpf/xdp_router_ipv4.bpf.c
index 248119ca7938..0643330d1d2e 100644
--- a/samples/bpf/xdp_router_ipv4.bpf.c
+++ b/samples/bpf/xdp_router_ipv4.bpf.c
@@ -150,6 +150,15 @@ int xdp_router_ipv4_prog(struct xdp_md *ctx)
 
 				dest_mac = bpf_map_lookup_elem(&arp_table,
 							       &prefix_value->gw);
+				if (!dest_mac) {
+					/* Forward the packet to the kernel in
+					 * order to trigger ARP discovery for
+					 * the default gw.
+					 */
+					if (rec)
+						NO_TEAR_INC(rec->xdp_pass);
+					return XDP_PASS;
+				}
 			}
 		}
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] sample: bpf: xdp_router_ipv4: allow the kernel to send arp requests
  2022-05-25  9:44 [PATCH bpf-next] sample: bpf: xdp_router_ipv4: allow the kernel to send arp requests Lorenzo Bianconi
@ 2022-05-31 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-31 22:50 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: bpf, ast, daniel, andrii, netdev, lorenzo.bianconi

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Wed, 25 May 2022 11:44:27 +0200 you wrote:
> Forward the packet to the kernel if the gw router mac address is missing
> in to trigger ARP discovery.
> 
> Fixes: 85bf1f51691c ("samples: bpf: Convert xdp_router_ipv4 to XDP samples helper")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  samples/bpf/xdp_router_ipv4.bpf.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Here is the summary with links:
  - [bpf-next] sample: bpf: xdp_router_ipv4: allow the kernel to send arp requests
    https://git.kernel.org/bpf/bpf-next/c/4c7cbcc9c097

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-31 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-25  9:44 [PATCH bpf-next] sample: bpf: xdp_router_ipv4: allow the kernel to send arp requests Lorenzo Bianconi
2022-05-31 22:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).