* [PATCH iproute2-next] iplink: add ipvtap support
@ 2018-09-19 3:03 Hangbin Liu
2018-09-19 7:58 ` Phil Sutter
2018-09-21 0:55 ` David Ahern
0 siblings, 2 replies; 3+ messages in thread
From: Hangbin Liu @ 2018-09-19 3:03 UTC (permalink / raw)
To: netdev
Cc: Stephen Hemminger, David Ahern, Phil Sutter, Sainath Grandhi,
Davide Caratti, Hangbin Liu
IPVLAN and IPVTAP are using the same functions and parameters. So we can
just add a new link_util with id ipvtap. Others are the same.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
ip/iplink.c | 4 ++--
ip/iplink_ipvlan.c | 28 ++++++++++++++++++----------
man/man8/ip-link.8.in | 4 ++++
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 0ba5f1a..d99c49e 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -120,8 +120,8 @@ void iplink_usage(void)
"TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap |\n"
" bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan |\n"
" gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan |\n"
- " vti | nlmon | team_slave | bond_slave | ipvlan | geneve |\n"
- " bridge_slave | vrf | macsec | netdevsim | rmnet }\n");
+ " vti | nlmon | team_slave | bond_slave | bridge_slave |\n"
+ " ipvlan | ipvtap | geneve | vrf | macsec | netdevsim | rmnet }\n");
}
exit(-1);
}
diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c
index 8889808..baae767 100644
--- a/ip/iplink_ipvlan.c
+++ b/ip/iplink_ipvlan.c
@@ -1,4 +1,4 @@
-/* iplink_ipvlan.c IPVLAN device support
+/* iplink_ipvlan.c IPVLAN/IPVTAP device support
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,15 +18,15 @@
#include "utils.h"
#include "ip_common.h"
-static void ipvlan_explain(FILE *f)
+static void print_explain(struct link_util *lu, FILE *f)
{
fprintf(f,
- "Usage: ... ipvlan [ mode MODE ] [ FLAGS ]\n"
+ "Usage: ... %s [ mode MODE ] [ FLAGS ]\n"
"\n"
"MODE: l3 | l3s | l2\n"
"FLAGS: bridge | private | vepa\n"
- "(first values are the defaults if nothing is specified).\n"
- );
+ "(first values are the defaults if nothing is specified).\n",
+ lu->id);
}
static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
@@ -61,12 +61,12 @@ static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
} else if (matches(*argv, "bridge") == 0 && !mflag_given) {
mflag_given = true;
} else if (matches(*argv, "help") == 0) {
- ipvlan_explain(stderr);
+ print_explain(lu, stderr);
return -1;
} else {
- fprintf(stderr, "ipvlan: unknown option \"%s\"?\n",
- *argv);
- ipvlan_explain(stderr);
+ fprintf(stderr, "%s: unknown option \"%s\"?\n",
+ lu->id, *argv);
+ print_explain(lu, stderr);
return -1;
}
argc--;
@@ -113,7 +113,7 @@ static void ipvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
static void ipvlan_print_help(struct link_util *lu, int argc, char **argv,
FILE *f)
{
- ipvlan_explain(f);
+ print_explain(lu, f);
}
struct link_util ipvlan_link_util = {
@@ -123,3 +123,11 @@ struct link_util ipvlan_link_util = {
.print_opt = ipvlan_print_opt,
.print_help = ipvlan_print_help,
};
+
+struct link_util ipvtap_link_util = {
+ .id = "ipvtap",
+ .maxattr = IFLA_IPVLAN_MAX,
+ .parse_opt = ipvlan_parse_opt,
+ .print_opt = ipvlan_print_opt,
+ .print_help = ipvlan_print_help,
+};
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 38e4ee6..9f345f9 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -215,6 +215,7 @@ ip-link \- network device configuration
.BR vti " |"
.BR nlmon " |"
.BR ipvlan " |"
+.BR ipvtap " |"
.BR lowpan " |"
.BR geneve " |"
.BR vrf " |"
@@ -329,6 +330,9 @@ Link types:
.BR ipvlan
- Interface for L3 (IPv6/IPv4) based VLANs
.sp
+.BR ipvtap
+- Interface for L3 (IPv6/IPv4) based VLANs and TAP
+.sp
.BR lowpan
- Interface for 6LoWPAN (IPv6) over IEEE 802.15.4 / Bluetooth
.sp
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2-next] iplink: add ipvtap support
2018-09-19 3:03 [PATCH iproute2-next] iplink: add ipvtap support Hangbin Liu
@ 2018-09-19 7:58 ` Phil Sutter
2018-09-21 0:55 ` David Ahern
1 sibling, 0 replies; 3+ messages in thread
From: Phil Sutter @ 2018-09-19 7:58 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev, Stephen Hemminger, David Ahern, Sainath Grandhi,
Davide Caratti
On Wed, Sep 19, 2018 at 11:03:29AM +0800, Hangbin Liu wrote:
> IPVLAN and IPVTAP are using the same functions and parameters. So we can
> just add a new link_util with id ipvtap. Others are the same.
>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2-next] iplink: add ipvtap support
2018-09-19 3:03 [PATCH iproute2-next] iplink: add ipvtap support Hangbin Liu
2018-09-19 7:58 ` Phil Sutter
@ 2018-09-21 0:55 ` David Ahern
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-09-21 0:55 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: Stephen Hemminger, Phil Sutter, Sainath Grandhi, Davide Caratti
On 9/18/18 8:03 PM, Hangbin Liu wrote:
> IPVLAN and IPVTAP are using the same functions and parameters. So we can
> just add a new link_util with id ipvtap. Others are the same.
>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> ip/iplink.c | 4 ++--
> ip/iplink_ipvlan.c | 28 ++++++++++++++++++----------
> man/man8/ip-link.8.in | 4 ++++
> 3 files changed, 24 insertions(+), 12 deletions(-)
>
applied to iproute2-next. Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-21 6:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-19 3:03 [PATCH iproute2-next] iplink: add ipvtap support Hangbin Liu
2018-09-19 7:58 ` Phil Sutter
2018-09-21 0:55 ` David Ahern
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).