Skip to contentSkip to conversation

iplink_geneve: Support IFLA_GENEVE_LOCAL and IFLA_GENEVE_LOCAL6.

PATCH Superseded Kuniyuki Iwashima 2 participants 3 messages Jun 2

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iplink_geneve: Support IFLA_GENEVE_LOCAL and IFLA_GENEVE_LOCAL6.

IFLA_GENEVE_LOCAL and IFLA_GENEVE_LOCAL6 allow specifying a local IPv4/IPv6 address for the backend UDP socket of a GENEVE devcie.

Let's support the attributes with the "local" keyword.

  # for i in $(seq 1 2);
  do
          ip link add geneve4_${i} type geneve local 192.168.0.${i} external
          ip addr add 192.168.0.${i}/24 dev geneve4_${i}
          ip link set geneve4_${i} up
          ip link add geneve6_${i} type geneve local 2001:9292::${i} external
          ip addr add 2001:9292::${i}/64 dev geneve6_${i} nodad
          ip link set geneve6_${i} up

done

  # ip -d l | grep geneve
  9: geneve4_1: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
      geneve external id 0 local 192.168.0.1 ...
  10: geneve6_1: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
      geneve external id 0 local 2001:9292::1 ...
  11: geneve4_2: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
      geneve external id 0 local 192.168.0.2 ...
  12: geneve6_2: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
      geneve external id 0 local 2001:9292::2 ...
  # ss -ua | grep geneve
  UNCONN 0      0         192.168.0.2:geneve      0.0.0.0:*
  UNCONN 0      0         192.168.0.1:geneve      0.0.0.0:*
  UNCONN 0      0      [2001:9292::2]:geneve            *:*
  UNCONN 0      0      [2001:9292::1]:geneve            *:*

Note that kernel dumps the wildcard address if the device created with IFLA_GENEVE_COLLECT_METADATA is not dualstack.

---
The corresponding kernel patch will be posted separately.

v2: Print LOCAL/LOCAL6 even if wildcard to match the kernel dump behaviour

v1: https://lore.kernel.org/netdev/[email protected]/

---
 include/uapi/linux/if_link.h |  2 ++
 ip/iplink_geneve.c           | 41 +++++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +2 -0
index a8c64be26f2c..d692d466da6b 100644
@@ -1487,6 +1487,8 @@ enum {
 	IFLA_GENEVE_INNER_PROTO_INHERIT,
 	IFLA_GENEVE_PORT_RANGE,
 	IFLA_GENEVE_GRO_HINT,
+	IFLA_GENEVE_LOCAL,
+	IFLA_GENEVE_LOCAL6,
 	__IFLA_GENEVE_MAX
 };
 #define IFLA_GENEVE_MAX	(__IFLA_GENEVE_MAX - 1)
ip/iplink_geneve.c +40 -1

79 lines not on this page · raw message

Signature · 1 line
2.54.0.1013.g208068f2d8-goog
#1 lore raw

ip/iplink_geneve.c static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) · line 312

Quoted 7 lines · On Tue, 2 Jun 2026 18:56:51 +0000 Kuniyuki Iwashima <[email protected]> wrote:
ip/iplink_geneve.c +7 -0
+	if (tb[IFLA_GENEVE_LOCAL]) {
+		__be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_LOCAL]);
+
+		print_string(PRINT_ANY,
+			     "local",
+			     "local %s ",
+			     format_host(AF_INET, 4, &addr));

Should use print_color_string(PRINT_ANY, COLOR_INET, ...

ip/iplink_geneve.c static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) · line 323

Quoted 10 lines
ip/iplink_geneve.c +10 -0
+		struct in6_addr addr;
+
+		memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_LOCAL6]), sizeof(struct in6_addr));
+		if (!IN6_IS_ADDR_UNSPECIFIED(&addr)) {
+			print_string(PRINT_ANY,
+				     "local6",
+				     "local %s ",
+				     format_host(AF_INET6,
+						 sizeof(struct in6_addr),
+						 &addr));

And print_color_string(PRINT_ANY, COLOR_INET6, ...

Quoted 2 lines
ip/iplink_geneve.c +2 -0
+		}
+	}
#2 lore raw
Quoted 25 lines · Stephen Hemminger

ip/iplink_geneve.c static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) · line 312

Quoted 7 lines · On Tue, 2 Jun 2026 18:56:51 +0000 Kuniyuki Iwashima <[email protected]> wrote:
ip/iplink_geneve.c +7 -0
+     if (tb[IFLA_GENEVE_LOCAL]) {
+             __be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_LOCAL]);
+
+             print_string(PRINT_ANY,
+                          "local",
+                          "local %s ",
+                          format_host(AF_INET, 4, &addr));

Should use print_color_string(PRINT_ANY, COLOR_INET, ...

ip/iplink_geneve.c static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) · line 323

Quoted 10 lines
ip/iplink_geneve.c +10 -0
+             struct in6_addr addr;
+
+             memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_LOCAL6]), sizeof(struct in6_addr));
+             if (!IN6_IS_ADDR_UNSPECIFIED(&addr)) {
+                     print_string(PRINT_ANY,
+                                  "local6",
+                                  "local %s ",
+                                  format_host(AF_INET6,
+                                              sizeof(struct in6_addr),
+                                              &addr));
Quoted 1 line

And print_color_string(PRINT_ANY, COLOR_INET6, ...

Will use them, thanks !