* [PATCH iproute2-next v3] ip-link: add support for nolocalbypass in vxlan
@ 2023-05-18 4:00 Vladimir Nikishkin
2023-05-18 13:29 ` Ido Schimmel
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Nikishkin @ 2023-05-18 4:00 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, eng.alaamohamedsoliman.am, gnault,
razor, idosch, liuhangbin, eyal.birger, jtoppins,
Vladimir Nikishkin
Add userspace support for the [no]localbypass vxlan netlink
attribute. With localbypass on (default), the vxlan driver processes
the packets destined to the local machine by itself, bypassing the
userspace nework stack. With nolocalbypass the packets are always
forwarded to the userspace network stack, so userspace programs,
such as tcpdump have a chance to process them.
Signed-off-by: Vladimir Nikishkin <vladimir@nikishkin.pw>
---
v2=>v3: 1. replace fputs with print_string 2. fix 77 char line length 3. fix typos and improve man page 4. reformat strcmp usage this patch matches commit 69474a8a5837be63f13c6f60a7d622b98ed5c539 in the main tree.
ip/iplink_vxlan.c | 20 ++++++++++++++++++++
man/man8/ip-link.8.in | 10 ++++++++++
2 files changed, 30 insertions(+)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index c7e0e1c4..966b0daf 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -45,6 +45,7 @@ static void print_explain(FILE *f)
" [ [no]remcsumtx ] [ [no]remcsumrx ]\n"
" [ [no]external ] [ gbp ] [ gpe ]\n"
" [ [no]vnifilter ]\n"
+ " [ [no]localbypass ]\n"
"\n"
"Where: VNI := 0-16777215\n"
" ADDR := { IP_ADDRESS | any }\n"
@@ -276,6 +277,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
} else if (!matches(*argv, "noudpcsum")) {
check_duparg(&attrs, IFLA_VXLAN_UDP_CSUM, *argv, *argv);
addattr8(n, 1024, IFLA_VXLAN_UDP_CSUM, 0);
+ } else if (strcmp(*argv, "localbypass") == 0) {
+ check_duparg(&attrs, IFLA_VXLAN_LOCALBYPASS,
+ *argv, *argv);
+ addattr8(n, 1024, IFLA_VXLAN_LOCALBYPASS, 1);
+ } else if (strcmp(*argv, "nolocalbypass") == 0) {
+ check_duparg(&attrs, IFLA_VXLAN_LOCALBYPASS,
+ *argv, *argv);
+ addattr8(n, 1024, IFLA_VXLAN_LOCALBYPASS, 0);
} else if (!matches(*argv, "udp6zerocsumtx")) {
check_duparg(&attrs, IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
*argv, *argv);
@@ -613,6 +622,17 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
}
}
+ if (tb[IFLA_VXLAN_LOCALBYPASS]) {
+ __u8 localbypass = rta_getattr_u8(tb[IFLA_VXLAN_LOCALBYPASS]);
+
+ print_bool(PRINT_JSON, "localbypass", NULL, localbypass);
+ if (localbypass) {
+ print_string(PRINT_FP, NULL, "localbypass ", NULL);
+ } else {
+ print_string(PRINT_FP, NULL, "nolocalbypass ", NULL);
+ }
+ }
+
if (tb[IFLA_VXLAN_UDP_ZERO_CSUM6_TX]) {
__u8 csum6 = rta_getattr_u8(tb[IFLA_VXLAN_UDP_ZERO_CSUM6_TX]);
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index bf3605a9..ef6a800d 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -630,6 +630,8 @@ the following additional arguments are supported:
] [
.RB [ no ] udpcsum
] [
+.RB [ no ] localbypass
+] [
.RB [ no ] udp6zerocsumtx
] [
.RB [ no ] udp6zerocsumrx
@@ -734,6 +736,14 @@ are entered into the VXLAN device forwarding database.
.RB [ no ] udpcsum
- specifies if UDP checksum is calculated for transmitted packets over IPv4.
+.sp
+.RB [ no ] localbypass
+- if FDB destination is local, with nolocalbypass set, forward encapsulated
+packets to the userspace network stack. If there is a userspace process
+listening for these packets, it will have a chance to process them. If
+localbypass is active (default), bypass the userspace network stack and
+inject the packets ingit to the target VXLAN device, assuming one exists.
+
.sp
.RB [ no ] udp6zerocsumtx
- skip UDP checksum calculation for transmitted packets over IPv6.
--
2.35.8
--
Fastmail.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2-next v3] ip-link: add support for nolocalbypass in vxlan
2023-05-18 4:00 [PATCH iproute2-next v3] ip-link: add support for nolocalbypass in vxlan Vladimir Nikishkin
@ 2023-05-18 13:29 ` Ido Schimmel
0 siblings, 0 replies; 2+ messages in thread
From: Ido Schimmel @ 2023-05-18 13:29 UTC (permalink / raw)
To: Vladimir Nikishkin
Cc: netdev, davem, edumazet, kuba, pabeni, eng.alaamohamedsoliman.am,
gnault, razor, idosch, liuhangbin, eyal.birger, jtoppins
On Thu, May 18, 2023 at 12:00:30PM +0800, Vladimir Nikishkin wrote:
> Add userspace support for the [no]localbypass vxlan netlink
> attribute. With localbypass on (default), the vxlan driver processes
> the packets destined to the local machine by itself, bypassing the
> userspace nework stack. With nolocalbypass the packets are always
> forwarded to the userspace network stack, so userspace programs,
> such as tcpdump have a chance to process them.
>
> Signed-off-by: Vladimir Nikishkin <vladimir@nikishkin.pw>
> ---
> v2=>v3: 1. replace fputs with print_string 2. fix 77 char line length 3. fix typos and improve man page 4. reformat strcmp usage this patch matches commit 69474a8a5837be63f13c6f60a7d622b98ed5c539 in the main tree.
The changelog is corrupted
[...]
> +.sp
> +.RB [ no ] localbypass
> +- if FDB destination is local, with nolocalbypass set, forward encapsulated
> +packets to the userspace network stack. If there is a userspace process
> +listening for these packets, it will have a chance to process them. If
> +localbypass is active (default), bypass the userspace network stack and
s/userspace/kernel/
> +inject the packets ingit to the target VXLAN device, assuming one exists.
s/ingit/into/ ?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-18 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-18 4:00 [PATCH iproute2-next v3] ip-link: add support for nolocalbypass in vxlan Vladimir Nikishkin
2023-05-18 13:29 ` Ido Schimmel
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).