Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/3] ip: support LISP (RFC 9300) tunnel devices
@ 2026-11-27 22:37 Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 1/3] uapi: add the attributes of the lisp devices Vincent Jardin via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-11-27 22:37 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: netdev, Matthieu Baerts, Vincent Jardin

This series adds the lisp link type to ip, for the LISP (RFC 9300)
tunnel devices of the kernel series
  "lisp: add a LISP (RFC 9300) tunnel device"
posted for net-next:

  https://lore.kernel.org/r/20261126-for-upstream-lisp-v1-v1-0-7382a4bcfd9b@free.fr

The purpose of this serie is to support the selftest of the kernel:

  https://lore.kernel.org/all/8707e3b0-c948-44ea-8afc-d33387925173@kernel.org/

A LISP device carries the packets of an instance ID, or of the
instance IDs that have no device when it collects metadata. The routing
locators of a destination come from the encapsulation of its route or
of its nexthop, which ip already sets: the series only adds the device.

  ip link add link wan name lisp101 type lisp id 101 local 192.0.2.1
  ip -6 nexthop add id 1 encap ip dst 198.51.100.1 dev lisp101
  ip route add 10.2.0.0/24 vrf site nhid 1

Patches:
- patch 1 uAPI header
- patch 2 link type, with its manual page
- patch 3 test

---
Vincent Jardin (3):
      uapi: add the attributes of the lisp devices
      ip: add the lisp link type
      testsuite: add test for lisp

 include/uapi/linux/if_link.h            |  12 +++
 ip/Makefile                             |   2 +-
 ip/iplink.c                             |   2 +-
 ip/iplink_lisp.c                        | 137 ++++++++++++++++++++++++++++++++
 man/man8/ip-link.8.in                   |  66 +++++++++++++++
 testsuite/tests/ip/link/add_type_lisp.t |  59 ++++++++++++++
 6 files changed, 276 insertions(+), 2 deletions(-)
---
base-commit: 8055701cb470fdc9e5e9909369bff3f7e24c872e
change-id: 20261127-iproute2-lisp-639a94e27fe3

Best regards,
-- 
Vincent Jardin <vjardin@free.fr>



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

* [PATCH iproute2-next 1/3] uapi: add the attributes of the lisp devices
  2026-11-27 22:37 [PATCH iproute2-next 0/3] ip: support LISP (RFC 9300) tunnel devices Vincent Jardin via B4 Relay
@ 2026-11-27 22:37 ` Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 2/3] ip: add the lisp link type Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 3/3] testsuite: add test for lisp Vincent Jardin via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-11-27 22:37 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: netdev, Matthieu Baerts, Vincent Jardin

From: Vincent Jardin <vjardin@free.fr>

Use IFLA_LISP_* from the uAPI header of the kernel

See:
  https://lore.kernel.org/r/20261126-for-upstream-lisp-v1-v1-0-7382a4bcfd9b@free.fr

Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
 include/uapi/linux/if_link.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 7ce01d81..786a16b3 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -1536,6 +1536,18 @@ enum {
 
 #define IFLA_BAREUDP_MAX (__IFLA_BAREUDP_MAX - 1)
 
+/* LISP section */
+enum {
+	IFLA_LISP_UNSPEC,
+	IFLA_LISP_ID,
+	IFLA_LISP_COLLECT_METADATA,
+	IFLA_LISP_LOCAL,
+	IFLA_LISP_LOCAL6,
+	__IFLA_LISP_MAX
+};
+
+#define IFLA_LISP_MAX (__IFLA_LISP_MAX - 1)
+
 /* PPP section */
 enum {
 	IFLA_PPP_UNSPEC,

-- 
2.43.0



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

* [PATCH iproute2-next 2/3] ip: add the lisp link type
  2026-11-27 22:37 [PATCH iproute2-next 0/3] ip: support LISP (RFC 9300) tunnel devices Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 1/3] uapi: add the attributes of the lisp devices Vincent Jardin via B4 Relay
@ 2026-11-27 22:37 ` Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 3/3] testsuite: add test for lisp Vincent Jardin via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-11-27 22:37 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: netdev, Matthieu Baerts, Vincent Jardin

From: Vincent Jardin <vjardin@free.fr>

A LISP device is the data plane of the Locator/ID Separation Protocol
(RFC 9300) in the kernel. It carries the packets of an
instance ID, or of the instance IDs that have no device when it
collects metadata:

  ip link add lisp101 type lisp id 101 local 192.0.2.1 local 2001:db8::1
  ip link add lisp0 type lisp external

The local addresses are the source addresses of the packets that the
device sends, one per family. The generic "link" gives the device or
the VRF that the remote addresses, the routing locators, are reached
through:

  ip link add link wan name lisp101 type lisp id 101

The routing locator of a destination and, with "external", its
instance ID come from the encapsulation of its route or of its
nexthop, which ip already sets:

  ip -6 nexthop add id 1 encap ip dst 198.51.100.1 dev lisp101
  ip route add 10.2.0.0/24 nhid 1
  ip -6 nexthop add id 2 encap ip6 id 102 dst 2001:db8:2::1 dev lisp0

  $ ip -d link show lisp101
  9: lisp101: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1444 [...]
      link/none  promiscuity 0 allmulti 0 minmtu 68 maxmtu 65499
      lisp id 101 local 192.0.2.1 local 2001:db8::1 [...]
  $ ip -d -j link show lisp101 | jq -c '.[0].linkinfo'
  {"info_kind":"lisp","info_data":{"id":101,"local":"192.0.2.1","local6":"2001:db8::1"}}

Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
 ip/Makefile           |   2 +-
 ip/iplink.c           |   2 +-
 ip/iplink_lisp.c      | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++
 man/man8/ip-link.8.in |  66 ++++++++++++++++++++++++
 4 files changed, 205 insertions(+), 2 deletions(-)

diff --git a/ip/Makefile b/ip/Makefile
index 978f6841..4cfcd243 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -13,7 +13,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
     ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o iplink_rmnet.o \
     ipnexthop.o ipmptcp.o iplink_bareudp.o iplink_wwan.o ipioam6.o \
     iplink_amt.o iplink_batadv.o iplink_gtp.o iplink_virt_wifi.o \
-    iplink_netkit.o ipstats.o iplink_ovpn.o
+    iplink_netkit.o ipstats.o iplink_ovpn.o iplink_lisp.o
 
 RTMONOBJ=rtmon.o
 
diff --git a/ip/iplink.c b/ip/iplink.c
index 6b325e20..ed8a3dad 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -40,7 +40,7 @@ void iplink_types_usage(void)
 		"TYPE := { amt | bareudp | bond | bond_slave | bridge | bridge_slave |\n"
 		"          dsa | dummy | erspan | geneve | gre | gretap | gtp | hsr |\n"
 		"          ifb | ip6erspan | ip6gre | ip6gretap | ip6tnl |\n"
-		"          ipip | ipoib | ipvlan | ipvtap |\n"
+		"          ipip | ipoib | ipvlan | ipvtap | lisp |\n"
 		"          macsec | macvlan | macvtap | netdevsim |\n"
 		"          netkit | nlmon | ovpn | pfcp | rmnet | sit | team | team_slave |\n"
 		"          vcan | veth | vlan | vrf | vti | vxcan | vxlan | wwan |\n"
diff --git a/ip/iplink_lisp.c b/ip/iplink_lisp.c
new file mode 100644
index 00000000..cd83a9af
--- /dev/null
+++ b/ip/iplink_lisp.c
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * iplink_lisp.c	LISP device support
+ *
+ * Copyright (c) 2026 Vincent Jardin <vjardin@free.fr>, Free Mobile
+ *
+ * Authors:	Vincent Jardin <vjardin@free.fr>
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <linux/if_link.h>
+#include <linux/rtnetlink.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+/* An instance ID is 24 bits wide, RFC 9300 section 5.3. */
+#define LISP_IID_MAX	0xffffff
+
+static void print_explain(FILE *f)
+{
+	fprintf(f,
+		"Usage: ... lisp { id IID | external }\n"
+		"		[ local ADDR ]...\n"
+		"\n"
+		"Where:	IID  := 0-16777215\n"
+		"	ADDR := IPv4 or IPv6 address, at most one of each\n"
+	);
+}
+
+static void explain(void)
+{
+	print_explain(stderr);
+}
+
+static int lisp_parse_opt(struct link_util *lu, int argc, char **argv,
+			  struct nlmsghdr *n)
+{
+	inet_prefix local6 = {};
+	inet_prefix local = {};
+	bool external = false;
+	bool has_id = false;
+	inet_prefix addr;
+	__u32 id = 0;
+
+	while (argc > 0) {
+		if (strcmp(*argv, "id") == 0) {
+			NEXT_ARG();
+			if (has_id)
+				duparg("id", *argv);
+			if (get_u32(&id, *argv, 0) || id > LISP_IID_MAX)
+				invarg("invalid id", *argv);
+			has_id = true;
+		} else if (strcmp(*argv, "external") == 0) {
+			external = true;
+		} else if (strcmp(*argv, "local") == 0) {
+			NEXT_ARG();
+			get_addr(&addr, *argv, AF_UNSPEC);
+			if (addr.family == AF_INET6) {
+				if (local6.family)
+					duparg2("local", *argv);
+				local6 = addr;
+			} else if (addr.family == AF_INET) {
+				if (local.family)
+					duparg2("local", *argv);
+				local = addr;
+			} else {
+				invarg("invalid local address", *argv);
+			}
+		} else {
+			if (strcmp(*argv, "help") != 0)
+				fprintf(stderr,
+					"lisp: unknown command \"%s\"?\n",
+					*argv);
+			explain();
+			return -1;
+		}
+		argc--, argv++;
+	}
+
+	if (external == has_id) {
+		fprintf(stderr,
+			"lisp: one of \"id\" and \"external\" is required\n");
+		return -1;
+	}
+
+	if (external)
+		addattr(n, 1024, IFLA_LISP_COLLECT_METADATA);
+	else if (has_id)
+		addattr32(n, 1024, IFLA_LISP_ID, id);
+	if (local.family)
+		addattr_l(n, 1024, IFLA_LISP_LOCAL, local.data, local.bytelen);
+	if (local6.family)
+		addattr_l(n, 1024, IFLA_LISP_LOCAL6, local6.data,
+			  local6.bytelen);
+
+	return 0;
+}
+
+static void lisp_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+	if (!tb)
+		return;
+
+	if (tb[IFLA_LISP_ID])
+		print_uint(PRINT_ANY, "id", "id %u ",
+			   rta_getattr_u32(tb[IFLA_LISP_ID]));
+
+	if (tb[IFLA_LISP_COLLECT_METADATA])
+		print_bool(PRINT_ANY, "external", "external ", true);
+
+	if (tb[IFLA_LISP_LOCAL])
+		print_color_string(PRINT_ANY, COLOR_INET, "local", "local %s ",
+				   format_host_rta(AF_INET,
+						   tb[IFLA_LISP_LOCAL]));
+
+	if (tb[IFLA_LISP_LOCAL6])
+		print_color_string(PRINT_ANY, COLOR_INET6, "local6",
+				   "local %s ",
+				   format_host_rta(AF_INET6,
+						   tb[IFLA_LISP_LOCAL6]));
+}
+
+static void lisp_print_help(struct link_util *lu, int argc, char **argv,
+			    FILE *f)
+{
+	print_explain(f);
+}
+
+struct link_util lisp_link_util = {
+	.id		= "lisp",
+	.maxattr	= IFLA_LISP_MAX,
+	.parse_opt	= lisp_parse_opt,
+	.print_opt	= lisp_print_opt,
+	.print_help	= lisp_print_help,
+};
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 8fd900e6..97990a4c 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -280,6 +280,7 @@ ip-link \- network device configuration
 .BR ipoib " |"
 .BR ipvlan " |"
 .BR ipvtap " |"
+.BR lisp " |"
 .BR lowpan " |"
 .BR macsec " |"
 .BR macvlan  " | "
@@ -410,6 +411,9 @@ Link types:
 .BR ipvtap
 - Interface for L3 (IPv6/IPv4) based VLANs and TAP
 .sp
+.BR lisp
+- Locator/ID Separation Protocol (LISP) tunnel
+.sp
 .BR lowpan
 - Interface for 6LoWPAN (IPv6) over IEEE 802.15.4 / Bluetooth
 .sp
@@ -1596,6 +1600,68 @@ When
 is "ipv4", this allows the tunnel to also handle IPv6. This option is disabled
 by default.
 
+.TP
+LISP Type Support
+For a link of type
+.I LISP
+the following additional arguments are supported:
+
+.BI "ip link add " DEVICE
+[
+.BI link " DEVICE "
+]
+.BR type " lisp " {
+.BI id " IID "
+|
+.B external
+} [
+.BI local " ADDR "
+]...
+
+.in +8
+.sp
+.BI id " IID"
+- specifies the instance ID of the packets that the device sends and receives,
+from 0 to 16777215.
+
+.sp
+.B external
+- makes the device serve the instance IDs that have no device: the instance ID
+of a packet comes from its tunnel metadata, as the
+.B id
+of the encapsulation of its route.
+.B ip rule
+or
+.B tc
+find it there for the packets that the device receives. One of
+.B id
+and
+.B external
+is required.
+
+.sp
+.BI local " ADDR"
+- specifies the source address of the packets sent to a routing locator of the
+same family, when the encapsulation of the route does not give one. It can be
+given once per family.
+
+.sp
+.BI link " DEVICE"
+- specifies the device, or the VRF, that the routing locators are reached
+through.
+
+.in -8
+The routing locator of a destination is the
+.B dst
+of the encapsulation of its route or of its nexthop,
+.B encap ip
+or
+.BR "encap ip6" ,
+see
+.BR ip-route (8)
+and
+.BR ip-nexthop (8).
+
 .TP
 AMT Type Support
 For a link of type

-- 
2.43.0



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

* [PATCH iproute2-next 3/3] testsuite: add test for lisp
  2026-11-27 22:37 [PATCH iproute2-next 0/3] ip: support LISP (RFC 9300) tunnel devices Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 1/3] uapi: add the attributes of the lisp devices Vincent Jardin via B4 Relay
  2026-11-27 22:37 ` [PATCH iproute2-next 2/3] ip: add the lisp link type Vincent Jardin via B4 Relay
@ 2026-11-27 22:37 ` Vincent Jardin via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-11-27 22:37 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: netdev, Matthieu Baerts, Vincent Jardin

From: Vincent Jardin <vjardin@free.fr>

LISP checks

Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
 testsuite/tests/ip/link/add_type_lisp.t | 59 +++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/testsuite/tests/ip/link/add_type_lisp.t b/testsuite/tests/ip/link/add_type_lisp.t
new file mode 100755
index 00000000..d42f6dd3
--- /dev/null
+++ b/testsuite/tests/ip/link/add_type_lisp.t
@@ -0,0 +1,59 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2026 Vincent Jardin <vjardin@free.fr>, Free Mobile
+
+. lib/generic.sh
+
+# Skip test on a kernel without LISP
+NEW_DEV="$(rand_dev)"
+$IP link add dev "$NEW_DEV" type lisp id 1 2> /dev/null || ts_skip
+$IP link del dev "$NEW_DEV"
+
+ts_log "[Testing Add LISP interface (instance ID)]"
+NEW_DEV="$(rand_dev)"
+
+ts_ip "$0" "Add $NEW_DEV LISP interface (instance ID)" link add dev "$NEW_DEV" type lisp id 101
+
+ts_ip "$0" "Show $NEW_DEV LISP interface (instance ID)" -d link show dev "$NEW_DEV"
+test_on "$NEW_DEV"
+test_on "lisp id 101"
+test_on_not "external"
+test_on_not "local"
+
+ts_ip "$0" "Del $NEW_DEV LISP interface (instance ID)" link del dev "$NEW_DEV"
+
+
+ts_log "[Testing Add LISP interface (local RLOCs)]"
+NEW_DEV="$(rand_dev)"
+
+ts_ip "$0" "Add $NEW_DEV LISP interface (local RLOCs)" link add dev "$NEW_DEV" type lisp id 16777215 local 192.0.2.1 local 2001:db8::1
+
+ts_ip "$0" "Show $NEW_DEV LISP interface (local RLOCs)" -d link show dev "$NEW_DEV"
+test_on "$NEW_DEV"
+test_on "lisp id 16777215"
+test_on "local 192.0.2.1"
+test_on "local 2001:db8::1"
+
+ts_ip "$0" "Show $NEW_DEV LISP interface (local RLOCs, JSON)" -d -j link show dev "$NEW_DEV"
+test_on '"id":16777215'
+test_on '"local":"192.0.2.1"'
+test_on '"local6":"2001:db8::1"'
+
+ts_ip "$0" "Del $NEW_DEV LISP interface (local RLOCs)" link del dev "$NEW_DEV"
+
+
+ts_log "[Testing Add LISP interface (metadata)]"
+NEW_DEV="$(rand_dev)"
+
+ts_ip "$0" "Add $NEW_DEV LISP interface (metadata)" link add dev "$NEW_DEV" type lisp external
+
+ts_ip "$0" "Show $NEW_DEV LISP interface (metadata)" -d link show dev "$NEW_DEV"
+test_on "$NEW_DEV"
+test_on "lisp external"
+test_on_not "lisp id"
+
+ts_ip "$0" "Show $NEW_DEV LISP interface (metadata, JSON)" -d -j link show dev "$NEW_DEV"
+test_on '"external":true'
+
+ts_ip "$0" "Del $NEW_DEV LISP interface (metadata)" link del dev "$NEW_DEV"
+

-- 
2.43.0



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

end of thread, other threads:[~2026-11-27 22:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 22:37 [PATCH iproute2-next 0/3] ip: support LISP (RFC 9300) tunnel devices Vincent Jardin via B4 Relay
2026-11-27 22:37 ` [PATCH iproute2-next 1/3] uapi: add the attributes of the lisp devices Vincent Jardin via B4 Relay
2026-11-27 22:37 ` [PATCH iproute2-next 2/3] ip: add the lisp link type Vincent Jardin via B4 Relay
2026-11-27 22:37 ` [PATCH iproute2-next 3/3] testsuite: add test for lisp Vincent Jardin via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox