'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));
--

-john

Reply via email to