All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next v2 0/2] ip nexthop: support fdb destination port
@ 2026-07-23  1:25 Jack Ma
  2026-07-23  1:25 ` [PATCH iproute2-next v2 1/2] uapi: add NHA_DST_PORT Jack Ma
  2026-07-23  1:25 ` [PATCH iproute2-next v2 2/2] ip nexthop: support fdb destination port Jack Ma
  0 siblings, 2 replies; 4+ messages in thread
From: Jack Ma @ 2026-07-23  1:25 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Stephen Hemminger, Jakub Kicinski, Jack Ma

Kernel side (net-next), which adds NHA_DST_PORT and is the reason for
this change:

  net: nexthop: per-nexthop UDP dst port for fdb (VXLAN) nexthops
  https://lore.kernel.org/netdev/20260723-b4-vxlan-fdb-port-v4-0-46e3a2dd88a3@gmail.com/

Signed-off-by: Jack Ma <jack4it@gmail.com>
---
Changes in v2:
- Rename NHA_FDB_PORT to NHA_DST_PORT and the "port" keyword to "dst_port",
  tracking the kernel rename (generic name, still fdb-only validated).
- Split the uapi header sync into its own patch (Ido Schimmel).
- Add the ip-nexthop(8) man page entry for dst_port (Ido Schimmel).
- Drop "fdb" from the "dst_port" usage; the kernel enforces the pairing
  (Ido Schimmel).
- Print the dumped port as "dst_port %u " and add the missing trailing
  space to "fdb" (Ido Schimmel).
- Link to v1: https://lore.kernel.org/netdev/20260722-b4-vxlan-fdb-port-iproute2-v1-1-45199b1ee240@gmail.com/

---
Jack Ma (2):
      uapi: add NHA_DST_PORT
      ip nexthop: support fdb destination port

 include/uapi/linux/nexthop.h |  3 +++
 ip/ipnexthop.c               | 18 ++++++++++++++++--
 ip/nh_common.h               |  1 +
 man/man8/ip-nexthop.8        | 15 ++++++++++++++-
 4 files changed, 34 insertions(+), 3 deletions(-)
---
base-commit: 35a237091c24858cac6c6679175bb6a628cbe400
change-id: 20260722-b4-vxlan-fdb-port-iproute2-13165877ba46

Best regards,
--  
Jack Ma <jack4it@gmail.com>


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

* [PATCH iproute2-next v2 1/2] uapi: add NHA_DST_PORT
  2026-07-23  1:25 [PATCH iproute2-next v2 0/2] ip nexthop: support fdb destination port Jack Ma
@ 2026-07-23  1:25 ` Jack Ma
  2026-07-23  1:25 ` [PATCH iproute2-next v2 2/2] ip nexthop: support fdb destination port Jack Ma
  1 sibling, 0 replies; 4+ messages in thread
From: Jack Ma @ 2026-07-23  1:25 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Stephen Hemminger, Jakub Kicinski, Jack Ma

Rebase uapi to have support for NHA_DST_PORT.

Signed-off-by: Jack Ma <jack4it@gmail.com>
---
 include/uapi/linux/nexthop.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/nexthop.h b/include/uapi/linux/nexthop.h
index afbd064..ad336f4 100644
--- a/include/uapi/linux/nexthop.h
+++ b/include/uapi/linux/nexthop.h
@@ -83,6 +83,9 @@ enum {
 	/* u32; read-only; whether any driver collects HW stats */
 	NHA_HW_STATS_USED,
 
+	/* be16; UDP destination port for an fdb nexthop (e.g. VXLAN) */
+	NHA_DST_PORT,
+
 	__NHA_MAX,
 };
 

-- 
2.43.0


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

* [PATCH iproute2-next v2 2/2] ip nexthop: support fdb destination port
  2026-07-23  1:25 [PATCH iproute2-next v2 0/2] ip nexthop: support fdb destination port Jack Ma
  2026-07-23  1:25 ` [PATCH iproute2-next v2 1/2] uapi: add NHA_DST_PORT Jack Ma
@ 2026-07-23  1:25 ` Jack Ma
  2026-07-23  7:49   ` Ido Schimmel
  1 sibling, 1 reply; 4+ messages in thread
From: Jack Ma @ 2026-07-23  1:25 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Stephen Hemminger, Jakub Kicinski, Jack Ma

The kernel gained NHA_DST_PORT, an optional per-nexthop UDP destination
port for fdb nexthops.  VXLAN uses it to reach several receivers that
share an underlay IP but listen on different ports, load-balancing a
flow across (IP, port) legs of one nexthop group.

Wire it into `ip nexthop`:

  ip nexthop add id 1 via 192.0.2.1 fdb dst_port 4790

The port is parsed on add (sent as NHA_DST_PORT, __be16, network order)
and printed back on dump/get.  The kernel only accepts it together with
fdb and a gateway.

Signed-off-by: Jack Ma <jack4it@gmail.com>
---
 ip/ipnexthop.c        | 18 ++++++++++++++++--
 ip/nh_common.h        |  1 +
 man/man8/ip-nexthop.8 | 15 ++++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
index 14b525a..ad8ad0c 100644
--- a/ip/ipnexthop.c
+++ b/ip/ipnexthop.c
@@ -52,7 +52,7 @@ static void usage(void)
 		"SELECTOR := [ id ID ] [ dev DEV ] [ vrf NAME ] [ master DEV ]\n"
 		"            [ groups ] [ fdb ]\n"
 		"BUCKET_SELECTOR := SELECTOR | [ nhid ID ]\n"
-		"NH := { blackhole | [ via ADDRESS ] [ dev DEV ] [ onlink ]\n"
+		"NH := { blackhole | [ via ADDRESS ] [ dev DEV ] [ onlink ] [ dst_port PORT ]\n"
 		"        [ encap ENCAPTYPE ENCAPHDR ] |\n"
 		"        group GROUP [ fdb ] [ type TYPE [ TYPE_ARGS ] ] }\n"
 		"GROUP := [ <id[,weight]>/<id[,weight]>/... ]\n"
@@ -531,6 +531,8 @@ static int ipnh_parse_nhmsg(FILE *fp, const struct nhmsg *nhm, int len,
 
 	nhe->nh_blackhole = !!tb[NHA_BLACKHOLE];
 	nhe->nh_fdb = !!tb[NHA_FDB];
+	if (tb[NHA_DST_PORT])
+		nhe->nh_dst_port = rta_getattr_be16(tb[NHA_DST_PORT]);
 
 	nhe->nh_family = nhm->nh_family;
 	nhe->nh_protocol = nhm->nh_protocol;
@@ -593,7 +595,11 @@ static void __print_nexthop_entry(FILE *fp, const char *jsobj,
 	print_rt_flags(fp, nhe->nh_flags);
 
 	if (nhe->nh_fdb)
-		print_null(PRINT_ANY, "fdb", "fdb", NULL);
+		print_null(PRINT_ANY, "fdb", "fdb ", NULL);
+
+	if (nhe->nh_dst_port)
+		print_uint(PRINT_ANY, "dst_port", "dst_port %u ",
+			   nhe->nh_dst_port);
 
 	if ((show_details > 0 || show_stats) && nhe->nh_hw_stats_supported) {
 		open_json_object("hw_stats");
@@ -1112,6 +1118,14 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv)
 				req.nhm.nh_family = AF_INET;
 		} else if (!strcmp(*argv, "fdb")) {
 			addattr_l(&req.n, sizeof(req), NHA_FDB, NULL, 0);
+		} else if (!strcmp(*argv, "dst_port")) {
+			__u16 port;
+
+			NEXT_ARG();
+			if (get_u16(&port, *argv, 0))
+				invarg("\"dst_port\" value is invalid\n", *argv);
+			addattr16(&req.n, sizeof(req), NHA_DST_PORT,
+				  htons(port));
 		} else if (!strcmp(*argv, "onlink")) {
 			nh_flags |= RTNH_F_ONLINK;
 		} else if (!strcmp(*argv, "group")) {
diff --git a/ip/nh_common.h b/ip/nh_common.h
index afbd16b..f58bad4 100644
--- a/ip/nh_common.h
+++ b/ip/nh_common.h
@@ -33,6 +33,7 @@ struct nh_entry {
 
 	bool			nh_blackhole;
 	bool			nh_fdb;
+	__u16			nh_dst_port;
 
 	bool			nh_hw_stats_supported;
 	bool			nh_hw_stats_enabled;
diff --git a/man/man8/ip-nexthop.8 b/man/man8/ip-nexthop.8
index aad6869..f902c3c 100644
--- a/man/man8/ip-nexthop.8
+++ b/man/man8/ip-nexthop.8
@@ -65,7 +65,9 @@ ip-nexthop \- nexthop object management
 .BR onlink " ] [ "
 .B encap
 .IR ENCAP " ] [ "
-.BR fdb " ] | "
+.BR fdb " ] [ "
+.B dst_port
+.IR PORT " ] | "
 .B  group
 .IR GROUP " [ "
 .BR hw_stats " { "
@@ -210,6 +212,12 @@ A fdb nexthop group can only have fdb nexthops.
 Example: Used to represent a vxlan remote vtep ip. layer-2 vxlan
 fdb entry pointing to an ecmp nexthop group containing multiple
 remote vtep ips.
+.TP
+.BI dst_port " PORT"
+UDP destination port to use for an fdb nexthop, in place of the VXLAN
+device's default port. Only valid together with
+.B fdb
+and a gateway.
 .RE
 
 .TP
@@ -311,6 +319,11 @@ ip nexthop add id 5 via 192.168.1.2 fdb
 Adds a fdb nexthop with id 5.
 .RE
 .PP
+ip nexthop add id 6 via 192.168.1.2 fdb dst_port 4790
+.RS 4
+Adds a fdb nexthop with id 6 forwarding to 192.168.1.2 on UDP port 4790.
+.RE
+.PP
 ip nexthop add id 7 group 5/6 fdb
 .RS 4
 Adds a fdb nexthop group with id 7. A fdb nexthop group can only have

-- 
2.43.0


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

* Re: [PATCH iproute2-next v2 2/2] ip nexthop: support fdb destination port
  2026-07-23  1:25 ` [PATCH iproute2-next v2 2/2] ip nexthop: support fdb destination port Jack Ma
@ 2026-07-23  7:49   ` Ido Schimmel
  0 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2026-07-23  7:49 UTC (permalink / raw)
  To: Jack Ma; +Cc: netdev, David Ahern, Stephen Hemminger, Jakub Kicinski

On Thu, Jul 23, 2026 at 01:25:08AM +0000, Jack Ma wrote:
> The kernel gained NHA_DST_PORT, an optional per-nexthop UDP destination
> port for fdb nexthops.  VXLAN uses it to reach several receivers that
> share an underlay IP but listen on different ports, load-balancing a
> flow across (IP, port) legs of one nexthop group.
> 
> Wire it into `ip nexthop`:
> 
>   ip nexthop add id 1 via 192.0.2.1 fdb dst_port 4790
> 
> The port is parsed on add (sent as NHA_DST_PORT, __be16, network order)
> and printed back on dump/get.  The kernel only accepts it together with
> fdb and a gateway.
> 
> Signed-off-by: Jack Ma <jack4it@gmail.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

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

end of thread, other threads:[~2026-07-23  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  1:25 [PATCH iproute2-next v2 0/2] ip nexthop: support fdb destination port Jack Ma
2026-07-23  1:25 ` [PATCH iproute2-next v2 1/2] uapi: add NHA_DST_PORT Jack Ma
2026-07-23  1:25 ` [PATCH iproute2-next v2 2/2] ip nexthop: support fdb destination port Jack Ma
2026-07-23  7:49   ` Ido Schimmel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.