[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1425117586-21461-1-git-send-email-vadim4j@gmail.com>
Date: Sat, 28 Feb 2015 11:59:46 +0200
From: Vadim Kochan <vadim4j@...il.com>
To: stephen@...workplumber.org
Cc: netdev@...r.kernel.org, Vadim Kochan <vadim4j@...il.com>
Subject: [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode
From: Vadim Kochan <vadim4j@...il.com>
It allows add 'tap' device w/o specify mode:
# ip tap add tap0
instead of return error message.
Signed-off-by: Vadim Kochan <vadim4j@...il.com>
---
ip/iptuntap.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index b9b28a1..61b6c19 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -107,6 +107,7 @@ static int tap_del_ioctl(struct ifreq *ifr)
static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_t *gid)
{
int count = 0;
+ char *cmd = *(argv - 2);
memset(ifr, 0, sizeof(*ifr));
@@ -187,8 +188,12 @@ static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_
}
if (!(ifr->ifr_flags & TUN_TYPE_MASK)) {
- fprintf(stderr, "You failed to specify a tunnel mode\n");
- return -1;
+ if(strncmp("tap", cmd, 3) == 0) {
+ ifr->ifr_flags |= IFF_TAP;
+ } else {
+ fprintf(stderr, "You failed to specify a tunnel mode\n");
+ return -1;
+ }
}
return 0;
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists