From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru, jmorris@namei.org,
yoshfuji@linux-ipv6.org, kaber@trash.net,
sfeldma@cumulusnetworks.com, arvid.brodin@alten.se,
sucheta.chakraborty@qlogic.com, hannes@stressinduktion.org,
stephen@networkplumber.org
Subject: [patch iproute2] iproute2: allow to ipv6 set address generation mode
Date: Fri, 11 Jul 2014 10:30:24 +0200 [thread overview]
Message-ID: <1405067424-11911-1-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1405066774-11740-1-git-send-email-jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
include/linux/if_link.h | 6 ++++++
ip/iplink.c | 22 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index fadef0f..39cb62c 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -202,11 +202,17 @@ enum {
IFLA_INET6_CACHEINFO, /* time values and max reasm size */
IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
IFLA_INET6_TOKEN, /* device token */
+ IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */
__IFLA_INET6_MAX
};
#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
+enum in6_addr_gen_mode {
+ IN6_ADDR_GEN_MODE_EUI64,
+ IN6_ADDR_GEN_MODE_NONE,
+};
+
enum {
BRIDGE_MODE_UNSPEC,
BRIDGE_MODE_HAIRPIN,
diff --git a/ip/iplink.c b/ip/iplink.c
index 0d020ef..ecb05d6 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -81,6 +81,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 } ]\n");
fprintf(stderr, " ip link show [ DEVICE | group GROUP ] [up]\n");
if (iplink_have_newlink()) {
@@ -161,6 +162,15 @@ static int get_link_mode(const char *mode)
return -1;
}
+static int get_addr_gen_mode(const char *mode)
+{
+ if (strcasecmp(mode, "eui64") == 0)
+ return IN6_ADDR_GEN_MODE_EUI64;
+ if (strcasecmp(mode, "none") == 0)
+ return IN6_ADDR_GEN_MODE_NONE;
+ return -1;
+}
+
#if IPLINK_IOCTL_COMPAT
static int have_rtnl_newlink = -1;
@@ -557,6 +567,18 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
invarg("Invalid \"numrxqueues\" value\n", *argv);
addattr_l(&req->n, sizeof(*req), IFLA_NUM_RX_QUEUES,
&numrxqueues, 4);
+ } else if (matches(*argv, "addrgenmode") == 0) {
+ struct rtattr *afs, *afs6;
+ int mode;
+ NEXT_ARG();
+ mode = get_addr_gen_mode(*argv);
+ if (mode < 0)
+ invarg("Invalid address generation mode\n", *argv);
+ afs = addattr_nest(&req->n, sizeof(*req), IFLA_AF_SPEC);
+ afs6 = addattr_nest(&req->n, sizeof(*req), AF_INET6);
+ addattr8(&req->n, sizeof(*req), IFLA_INET6_ADDR_GEN_MODE, mode);
+ addattr_nest_end(&req->n, afs6);
+ addattr_nest_end(&req->n, afs);
} else {
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
--
1.9.0
next prev parent reply other threads:[~2014-07-11 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 8:19 [patch net-next] ipv6: addrconf: implement address generation modes Jiri Pirko
2014-07-11 8:30 ` Jiri Pirko [this message]
2014-07-11 9:16 ` YOSHIFUJI Hideaki
2014-07-11 15:40 ` Dan Williams
-- strict thread matches above, loose matches on Subject: below --
2014-07-11 19:10 [patch net-next v2] " Jiri Pirko
2014-07-11 19:11 ` [patch iproute2] iproute2: allow to ipv6 set address generation mode Jiri Pirko
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=1405067424-11911-1-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=arvid.brodin@alten.se \
--cc=davem@davemloft.net \
--cc=hannes@stressinduktion.org \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
--cc=sucheta.chakraborty@qlogic.com \
--cc=yoshfuji@linux-ipv6.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).