All of lore.kernel.org
 help / color / mirror / Atom feed
* 'ip tunnel add' uses the wrong interface name on error
@ 2016-03-08  2:39 John Morrissey
  0 siblings, 0 replies; only message in thread
From: John Morrissey @ 2016-03-08  2:39 UTC (permalink / raw)
  To: netdev

'ip tunnel add' uses the wrong interface name in its error output.
For example, if the requested interface already exists:

--
[jwm@boost:pts/8 ~> sudo ip tunnel add sit1 mode sit remote 10.10.10.11 local 10.10.10.10
add tunnel "sit0" failed: No buffer space available
--

ip/tunnel.c:tnl_add_ioctl() only uses the passed interface name on
SIOCCHGTUNNEL, not SIOCADDTUNNEL. Shouldn't it always use the passed
interface name, if present?

--
int tnl_add_ioctl(int cmd, const char *basedev, const char *name, void *p)
{
    struct ifreq ifr;
    int fd;
    int err;

    if (cmd == SIOCCHGTUNNEL && name[0])
        strncpy(ifr.ifr_name, name, IFNAMSIZ);
    else
        strncpy(ifr.ifr_name, basedev, IFNAMSIZ);
[...]
    err = ioctl(fd, cmd, &ifr);
    if (err)
        fprintf(stderr, "add tunnel \"%s\" failed: %s\n", ifr.ifr_name,
            strerror(errno));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-08  2:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08  2:39 'ip tunnel add' uses the wrong interface name on error John Morrissey

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.