* [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode
@ 2015-02-28 9:59 Vadim Kochan
2015-03-01 22:07 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: Vadim Kochan @ 2015-02-28 9:59 UTC (permalink / raw)
To: stephen; +Cc: netdev, Vadim Kochan
From: Vadim Kochan <vadim4j@gmail.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@gmail.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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode
2015-03-01 22:13 ` Jonathon Reinhart
@ 2015-03-01 22:03 ` Vadim Kochan
0 siblings, 0 replies; 5+ messages in thread
From: Vadim Kochan @ 2015-03-01 22:03 UTC (permalink / raw)
To: Jonathon Reinhart; +Cc: Stephen Hemminger, Vadim Kochan, Linux Netdev List
On Sun, Mar 01, 2015 at 05:13:39PM -0500, Jonathon Reinhart wrote:
> On Sun, Mar 1, 2015 at 5:07 PM, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > No. mode should not depend on device name.
>
> Isn't this looking at the "tap" part of "ip tap", not the device name?
Right it checks 'ip tap' not the device name.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode
2015-02-28 9:59 [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode Vadim Kochan
@ 2015-03-01 22:07 ` Stephen Hemminger
2015-03-01 22:13 ` Jonathon Reinhart
2015-03-03 18:53 ` Vadim Kochan
0 siblings, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-03-01 22:07 UTC (permalink / raw)
To: Vadim Kochan; +Cc: netdev
On Sat, 28 Feb 2015 11:59:46 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:
> From: Vadim Kochan <vadim4j@gmail.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@gmail.com>
No. mode should not depend on device name.
Also, I noticed that reading kernel code it is possible to
create a broken tun device if type is not set.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode
2015-03-01 22:07 ` Stephen Hemminger
@ 2015-03-01 22:13 ` Jonathon Reinhart
2015-03-01 22:03 ` Vadim Kochan
2015-03-03 18:53 ` Vadim Kochan
1 sibling, 1 reply; 5+ messages in thread
From: Jonathon Reinhart @ 2015-03-01 22:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Vadim Kochan, Linux Netdev List
On Sun, Mar 1, 2015 at 5:07 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> No. mode should not depend on device name.
Isn't this looking at the "tap" part of "ip tap", not the device name?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode
2015-03-01 22:07 ` Stephen Hemminger
2015-03-01 22:13 ` Jonathon Reinhart
@ 2015-03-03 18:53 ` Vadim Kochan
1 sibling, 0 replies; 5+ messages in thread
From: Vadim Kochan @ 2015-03-03 18:53 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Vadim Kochan, netdev
On Sun, Mar 01, 2015 at 02:07:15PM -0800, Stephen Hemminger wrote:
> On Sat, 28 Feb 2015 11:59:46 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
>
> > From: Vadim Kochan <vadim4j@gmail.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@gmail.com>
>
> No. mode should not depend on device name.
>
> Also, I noticed that reading kernel code it is possible to
> create a broken tun device if type is not set.
>
Is it still bad if it checks for 'tap' in 'ip tap' ?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-03 19:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-28 9:59 [PATCH iproute2] ip tap: Simplify add 'tap' device w/o mode Vadim Kochan
2015-03-01 22:07 ` Stephen Hemminger
2015-03-01 22:13 ` Jonathon Reinhart
2015-03-01 22:03 ` Vadim Kochan
2015-03-03 18:53 ` Vadim Kochan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.