ip6_tunnel: fix error code when tunnel exists
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Mon, 16 Mar 2015 14:56:05 +0000 (15:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Mar 2015 19:01:18 +0000 (15:01 -0400)
commit37355565ba57fd45f78f0934305be2761b641f8f
treea27e5012a75f82be3c1956720ffa0b0b61bf887b
parentad41faa88e39af451427c921a0f8b441e104b6fa
ip6_tunnel: fix error code when tunnel exists

After commit 2b0bb01b6edb, the kernel returns -ENOBUFS when user tries to add
an existing tunnel with ioctl API:
$ ip -6 tunnel add ip6tnl1 mode ip6ip6 dev eth1
add tunnel "ip6tnl0" failed: No buffer space available

It's confusing, the right error is EEXIST.

This patch also change a bit the code returned:
 - ENOBUFS -> ENOMEM
 - ENOENT -> ENODEV

Fixes: 2b0bb01b6edb ("ip6_tunnel: Return an error when adding an existing tunnel.")
CC: Steffen Klassert <steffen.klassert@secunet.com>
Reported-by: Pierre Cheynier <me@pierre-cheynier.net>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_tunnel.c