Skip to content

TUNTAP_MODE_PERSIST broken? #67

@oe1rsa

Description

@oe1rsa

I tried to create a persistent tun0 on linux, but failed. While the setting of the persistence works ok, the logic in the file tuntap-unix-linux.c looks broken:

void
tuntap_sys_destroy(struct device *dev)
{
       if (ioctl(dev->tun_fd, TUNSETPERSIST, 0) == -1) {
               tuntap_log(TUNTAP_LOG_WARN, "Can't destroy the interface");
       }
}

This function tries to unconditionally set the persistence to "do not persist" and only if the call fails logs a message which has not much to do with persistence.

To me it looks as if the author of the destroy function might have been in the believe that the 0 argument makes the ioctl read the current state. This is, however, not the case. The effect is that the persistence is cleared and it is impossible with libtuntap to create a persistent interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions