netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "Hannes Frederic Sowa" <hannes@stressinduktion.org>,
	netdev@vger.kernel.org, "Bjørn Mork" <bjorn@mork.no>
Subject: [PATCH iproute2 3/4] iplink: support show and set of "addrgenmode random"
Date: Mon,  4 Jan 2016 10:58:05 +0100	[thread overview]
Message-ID: <1451901486-3497-4-git-send-email-bjorn@mork.no> (raw)
In-Reply-To: <1451901486-3497-1-git-send-email-bjorn@mork.no>

"random" is a new IPv6 addrgenmode, enabling "stable_secret" type
addresses with an auto-generated secret.

$ ip link set eth0 addrgenmode random

$ ip -d link show dev eth0
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:21:86:a3:25:7d brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode random

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 ip/ipaddress.c | 3 +++
 ip/iplink.c    | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index a495a391a0ec..9d254d27bc1b 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -296,6 +296,9 @@ static void print_af_spec(FILE *fp, struct rtattr *af_spec_attr)
 		case IN6_ADDR_GEN_MODE_STABLE_PRIVACY:
 			fprintf(fp, "addrgenmode stable_secret ");
 			break;
+		case IN6_ADDR_GEN_MODE_RANDOM:
+			fprintf(fp, "addrgenmode random ");
+			break;
 		default:
 			fprintf(fp, "addrgenmode %#.2hhx ", mode);
 			break;
diff --git a/ip/iplink.c b/ip/iplink.c
index e824082f7d81..75b21540c6b5 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -84,7 +84,7 @@ void iplink_usage(void)
 	fprintf(stderr, "				   [ state { auto | enable | disable} ] ]\n");
 	fprintf(stderr, "			  [ master DEVICE ]\n");
 	fprintf(stderr, "			  [ nomaster ]\n");
-	fprintf(stderr, "			  [ addrgenmode { eui64 | none | stable_secret } ]\n");
+	fprintf(stderr, "			  [ addrgenmode { eui64 | none | stable_secret | random } ]\n");
 	fprintf(stderr, "	                  [ protodown { on | off } ]\n");
 	fprintf(stderr, "       ip link show [ DEVICE | group GROUP ] [up] [master DEV] [type TYPE]\n");
 
@@ -178,6 +178,8 @@ static int get_addr_gen_mode(const char *mode)
 		return IN6_ADDR_GEN_MODE_NONE;
 	if (strcasecmp(mode, "stable_secret") == 0)
 		return IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
+	if (strcasecmp(mode, "random") == 0)
+		return IN6_ADDR_GEN_MODE_RANDOM;
 	return -1;
 }
 
-- 
2.1.4

  parent reply	other threads:[~2016-01-04  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04  9:58 [PATCH iproute2 0/4] addrgenmode updates for net-next Bjørn Mork
2016-01-04  9:58 ` [PATCH iproute2 1/4] include: update kernel headers Bjørn Mork
2016-01-06 17:23   ` Stephen Hemminger
2016-01-04  9:58 ` [PATCH iproute2 2/4] iplink: support setting addrgenmode stable_secret Bjørn Mork
2016-01-04  9:58 ` Bjørn Mork [this message]
2016-01-04  9:58 ` [PATCH iproute2 4/4] man: iplink: document new addrgenmodes Bjørn Mork
2016-01-06 17:23 ` [PATCH iproute2 0/4] addrgenmode updates for net-next Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1451901486-3497-4-git-send-email-bjorn@mork.no \
    --to=bjorn@mork.no \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).