diff options
Diffstat (limited to 'src/network/networkd-netdev-tuntap.c')
-rw-r--r-- | src/network/networkd-netdev-tuntap.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c index ba84e802fc..088a4d8d32 100644 --- a/src/network/networkd-netdev-tuntap.c +++ b/src/network/networkd-netdev-tuntap.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -19,11 +17,18 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <sys/ioctl.h> -#include <net/if.h> +#include <fcntl.h> #include <linux/if_tun.h> +#include <net/if.h> +#include <netinet/if_ether.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/types.h> +#include "alloc-util.h" +#include "fd-util.h" #include "networkd-netdev-tuntap.h" +#include "user-util.h" #define TUN_DEV "/dev/net/tun" @@ -86,7 +91,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { assert(t); - if(t->user_name) { + if (t->user_name) { user = t->user_name; @@ -125,7 +130,7 @@ static int netdev_create_tuntap(NetDev *netdev) { int r; r = netdev_fill_tuntap_message(netdev, &ifr); - if(r < 0) + if (r < 0) return r; return netdev_tuntap_add(netdev, &ifr); @@ -143,11 +148,8 @@ static void tuntap_done(NetDev *netdev) { assert(t); - free(t->user_name); - t->user_name = NULL; - - free(t->group_name); - t->group_name = NULL; + t->user_name = mfree(t->user_name); + t->group_name = mfree(t->group_name); } static int tuntap_verify(NetDev *netdev, const char *filename) { |