Skip to contentSkip to conversation

ip: ipv6: add tokenized interface identifier support

PATCH Applied Daniel Borkmann 3 participants 3 messages Apr 30, 2013 – May 3, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip: ipv6: add tokenized interface identifier support

This patch adds support for tokenized IIDs, that enable administrators to assign well-known host-part addresses to nodes whilst still obtaining global network prefix from Router Advertisements. This is the iproute2 part for the kernel patch f53adae4eae5 (``net: ipv6: add tokenized interface identifier support'').

Example commands with iproute2:

Setting a device token:

  # ip token set ::1a:2b:3c:4d/64 dev eth1

Getting a device token:

  # ip token get dev eth1
  token ::1a:2b:3c:4d dev eth1

Listing all tokens:

  # ip token list  (or: ip token)
  token :: dev eth0
  token ::1a:2b:3c:4d dev eth1

---
For iproute2 3.10.x and onwards. v1->v2:
- Rebased original submission on latest iproute2 tree
- No code change since then, except only added an error message if there's no support for ipv6 token, that's all.

 include/linux/if_link.h |   1 +
 ip/Makefile             |   2 +-
 ip/ip.c                 |   3 +-
 ip/ip_common.h          |   1 +
 ip/iptoken.c            | 210 ++++++++++++++++++++++++++++++++++++++++++++++++
 man/man8/Makefile       |   2 +-
 man/man8/ip-token.8     |  66 +++++++++++++++
 7 files changed, 282 insertions(+), 3 deletions(-)
 create mode 100644 ip/iptoken.c
 create mode 100644 man/man8/ip-token.8
include/linux/if_link.h +1 -0
index 40167af..f3a1b29 100644
@@ -199,6 +199,7 @@ enum {
 	IFLA_INET6_MCAST,	/* MC things. What of them?	*/
 	IFLA_INET6_CACHEINFO,	/* time values and max reasm size */
 	IFLA_INET6_ICMP6STATS,	/* statistics (icmpv6)		*/
+	IFLA_INET6_TOKEN,	/* device token			*/
 	__IFLA_INET6_MAX
 };
 
ip/Makefile +1 -1
index 2b606d4..48bd4a1 100644
@@ -1,6 +1,6 @@
 IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
     rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
-    ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o \
+    ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \
     ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
     iplink_vlan.o link_veth.o link_gre.o iplink_can.o \
     iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o \
ip/ip.c +2 -1
index e10ddb2..69bd5ff 100644
@@ -45,7 +45,7 @@ static void usage(void)
 "       ip [ -force ] -batch filename\n"
 "where  OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |\n"
 "                   tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |\n"
-"                   netns | l2tp | tcp_metrics }\n"
+"                   netns | l2tp | tcp_metrics | token }\n"
 "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
 "                    -f[amily] { inet | inet6 | ipx | dnet | bridge | link } |\n"
 "                    -4 | -6 | -I | -D | -B | -0 |\n"
@@ -80,6 +80,7 @@ static const struct cmd {
 	{ "tunl",	do_iptunnel },
 	{ "tuntap",	do_iptuntap },
 	{ "tap",	do_iptuntap },
+	{ "token",	do_iptoken },
 	{ "tcpmetrics",	do_tcp_metrics },
 	{ "tcp_metrics",do_tcp_metrics },
 	{ "monitor",	do_ipmonitor },
ip/ip_common.h +1 -0
index de56810..f9b4734 100644
@@ -49,6 +49,7 @@ extern int do_xfrm(int argc, char **argv);
 extern int do_ipl2tp(int argc, char **argv);
 extern int do_tcp_metrics(int argc, char **argv);
 extern int do_ipnetconf(int argc, char **argv);
+extern int do_iptoken(int argc, char **argv);
 
 static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
 {
ip/iptoken.c new file +210 -0

210 lines not on this page · raw message

man/man8/Makefile +1 -1
index d208f3b..ff80c98 100644
@@ -9,7 +9,7 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 ss.8 \
 	ip-addrlabel.8 ip-l2tp.8 \
 	ip-maddress.8 ip-monitor.8 ip-mroute.8 ip-neighbour.8 \
 	ip-netns.8 ip-ntable.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \
-	ip-tcp_metrics.8 ip-netconf.8
+	ip-tcp_metrics.8 ip-netconf.8 ip-token.8
 
 all: $(TARGETS)
 
man/man8/ip-token.8 new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Daniel Borkmann

This patch adds support for tokenized IIDs, that enable administrators to assign well-known host-part addresses to nodes whilst still obtaining global network prefix from Router Advertisements. This is the iproute2 part for the kernel patch f53adae4eae5 (``net: ipv6: add tokenized interface identifier support'').

Example commands with iproute2:

Setting a device token:

  # ip token set ::1a:2b:3c:4d/64 dev eth1

Getting a device token:

  # ip token get dev eth1
  token ::1a:2b:3c:4d dev eth1
Quoted 6 lines

Listing all tokens:

  # ip token list  (or: ip token)
  token :: dev eth0
  token ::1a:2b:3c:4d dev eth1

Thanks!

#2 lore raw
In reply to Daniel Borkmann
Quoted 16 lines · On Tue, 30 Apr 2013 18:22:50 +0200 Daniel Borkmann <[email protected]> wrote:

This patch adds support for tokenized IIDs, that enable administrators to assign well-known host-part addresses to nodes whilst still obtaining global network prefix from Router Advertisements. This is the iproute2 part for the kernel patch f53adae4eae5 (``net: ipv6: add tokenized interface identifier support'').

Example commands with iproute2:

Setting a device token:

  # ip token set ::1a:2b:3c:4d/64 dev eth1

Getting a device token:

  # ip token get dev eth1
  token ::1a:2b:3c:4d dev eth1
Quoted 6 lines

Listing all tokens:

  # ip token list  (or: ip token)
  token :: dev eth0
  token ::1a:2b:3c:4d dev eth1

Applied