* [PATCH] ip: (ipvlan) introduce L3s mode
@ 2016-09-19 21:39 Mahesh Bandewar
2016-09-20 16:51 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Mahesh Bandewar @ 2016-09-19 21:39 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Mahesh Bandewar
From: Mahesh Bandewar <maheshb@google.com>
The new mode 'l3s' can be set like -
ip link add link <master> dev <IPvlan-slave> type ipvlan mode l3s
e.g. ip link add link eth0 dev ipvl0 type ipvlan mode l3s
Also did some trivial code restructuring.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
include/linux/if_link.h | 1 +
ip/iplink_ipvlan.c | 32 +++++++++++++-------------------
2 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 1feb708902ac..78ef2c6ae04e 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -461,6 +461,7 @@ enum {
enum ipvlan_mode {
IPVLAN_MODE_L2 = 0,
IPVLAN_MODE_L3,
+ IPVLAN_MODE_L3S,
IPVLAN_MODE_MAX
};
diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c
index a6273be88a2a..f7735f3a13ef 100644
--- a/ip/iplink_ipvlan.c
+++ b/ip/iplink_ipvlan.c
@@ -20,18 +20,7 @@
static void ipvlan_explain(FILE *f)
{
- fprintf(f, "Usage: ... ipvlan [ mode { l2 | l3 } ]\n");
-}
-
-static void explain(void)
-{
- ipvlan_explain(stderr);
-}
-
-static int mode_arg(void)
-{
- fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", or \"l3\"\n");
- return -1;
+ fprintf(f, "Usage: ... ipvlan [ mode { l2 | l3 | l3s } ]\n");
}
static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
@@ -47,20 +36,24 @@ static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
mode = IPVLAN_MODE_L2;
else if (strcmp(*argv, "l3") == 0)
mode = IPVLAN_MODE_L3;
- else
- return mode_arg();
-
+ else if (strcmp(*argv, "l3s") == 0)
+ mode = IPVLAN_MODE_L3S;
+ else {
+ fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", \"l3\" or \"l3s\"\n");
+ return -1;
+ }
addattr16(n, 1024, IFLA_IPVLAN_MODE, mode);
} else if (matches(*argv, "help") == 0) {
- explain();
+ ipvlan_explain(stderr);
return -1;
} else {
fprintf(stderr, "ipvlan: unknown option \"%s\"?\n",
*argv);
- explain();
+ ipvlan_explain(stderr);
return -1;
}
- argc--, argv++;
+ argc--;
+ argv++;
}
return 0;
@@ -78,7 +71,8 @@ static void ipvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, " mode %s ",
mode == IPVLAN_MODE_L2 ? "l2" :
- mode == IPVLAN_MODE_L3 ? "l3" : "unknown");
+ mode == IPVLAN_MODE_L3 ? "l3" :
+ mode == IPVLAN_MODE_L3S ? "l3s" : "unknown");
}
}
}
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ip: (ipvlan) introduce L3s mode
2016-09-19 21:39 [PATCH] ip: (ipvlan) introduce L3s mode Mahesh Bandewar
@ 2016-09-20 16:51 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-09-20 16:51 UTC (permalink / raw)
To: Mahesh Bandewar; +Cc: netdev, Mahesh Bandewar
On Mon, 19 Sep 2016 14:39:40 -0700
Mahesh Bandewar <mahesh@bandewar.net> wrote:
> From: Mahesh Bandewar <maheshb@google.com>
>
> The new mode 'l3s' can be set like -
>
> ip link add link <master> dev <IPvlan-slave> type ipvlan mode l3s
>
> e.g. ip link add link eth0 dev ipvl0 type ipvlan mode l3s
>
> Also did some trivial code restructuring.
>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Applied to net-next
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-20 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 21:39 [PATCH] ip: (ipvlan) introduce L3s mode Mahesh Bandewar
2016-09-20 16:51 ` Stephen Hemminger
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).