Lines Matching defs:netdev
26 #include "networkd-netdev-tuntap.h"
31 static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) {
34 assert(netdev);
35 assert(netdev->ifname);
38 if (netdev->kind == NETDEV_KIND_TAP) {
39 t = TAP(netdev);
42 t = TUN(netdev);
58 strncpy(ifr->ifr_name, netdev->ifname, IFNAMSIZ-1);
63 static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
72 assert(netdev);
77 return log_netdev_error_errno(netdev, -errno, "Failed to open tun dev: %m");
81 return log_netdev_error_errno(netdev, -errno, "TUNSETIFF failed on tun dev: %m");
83 if (netdev->kind == NETDEV_KIND_TAP)
84 t = TAP(netdev);
86 t = TUN(netdev);
96 return log_netdev_error_errno(netdev, r, "Cannot resolve user name %s: %m", t->user_name);
100 return log_netdev_error_errno(netdev, -errno, "TUNSETOWNER failed on tun dev: %m");
109 return log_netdev_error_errno(netdev, r, "Cannot resolve group name %s: %m", t->group_name);
113 return log_netdev_error_errno(netdev, -errno, "TUNSETGROUP failed on tun dev: %m");
119 return log_netdev_error_errno(netdev, -errno, "TUNSETPERSIST failed on tun dev: %m");
124 static int netdev_create_tuntap(NetDev *netdev) {
128 r = netdev_fill_tuntap_message(netdev, &ifr);
132 return netdev_tuntap_add(netdev, &ifr);
135 static void tuntap_done(NetDev *netdev) {
138 assert(netdev);
140 if (netdev->kind == NETDEV_KIND_TUN)
141 t = TUN(netdev);
143 t = TAP(netdev);
151 static int tuntap_verify(NetDev *netdev, const char *filename) {
152 assert(netdev);
154 if (netdev->mtu)
155 log_netdev_warning(netdev, "MTU configured for %s, ignoring", netdev_kind_to_string(netdev->kind));
157 if (netdev->mac)
158 log_netdev_warning(netdev, "MAC configured for %s, ignoring", netdev_kind_to_string(netdev->kind));