networkd-netdev-tuntap.c revision aa9f11405829fd4755fef28602a7167dba3ddc89
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Susant Sahani <susant@redhat.com>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "networkd-netdev-tuntap.h"
TunTap *t;
} else {
}
if (!t->packet_info)
if (t->one_queue)
if (t->multi_queue)
return 0;
}
_cleanup_close_ int fd;
const char *user;
const char *group;
int r = 0;
if (fd < 0) {
"Failed to open tun dev: %s",
strerror(-r));
return r;
}
if (r < 0) {
"TUNSETIFF failed on tun dev: %s",
strerror(-r));
return r;
}
else
assert(t);
if(t->user_name) {
if (r < 0) {
log_error("Cannot resolve user name %s: %s",
return 0;
}
if ( r < 0) {
"TUNSETOWNER failed on tun dev: %s",
strerror(-r));
}
}
if(t->group_name) {
group = t->group_name;
if (r < 0) {
log_error("Cannot resolve group name %s: %s",
t->group_name, strerror(-r));
return 0;
}
if( r < 0) {
"TUNSETGROUP failed on tun dev: %s",
strerror(-r));
return r;
}
}
if (r < 0) {
"TUNSETPERSIST failed on tun dev: %s",
strerror(-r));
return r;
}
return r;
}
int r;
if(r < 0)
return r;
}
else
assert(t);
free(t->group_name);
t->group_name = NULL;
}
const NetDevVTable tun_vtable = {
.object_size = sizeof(TunTap),
.sections = "Match\0NetDev\0Tun\0",
.done = tuntap_done,
};
const NetDevVTable tap_vtable = {
.object_size = sizeof(TunTap),
.sections = "Match\0NetDev\0Tap\0",
.done = tuntap_done,
};