This source file includes following definitions.
- netdev_vlan_fill_message_create
- netdev_vlan_verify
- vlan_init
#include <net/if.h>
#include "networkd-netdev-vlan.h"
#include "network-internal.h"
#include "list.h"
static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
VLan *v = VLAN(netdev);
int r;
assert(netdev);
assert(v);
assert(link);
assert(req);
if (v->id <= VLANID_MAX) {
r = sd_rtnl_message_append_u16(req, IFLA_VLAN_ID, v->id);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_VLAN_ID attribute: %s",
strerror(-r));
return r;
}
}
return 0;
}
static int netdev_vlan_verify(NetDev *netdev, const char *filename) {
VLan *v = VLAN(netdev);
assert(netdev);
assert(v);
assert(filename);
if (v->id > VLANID_MAX) {
log_warning("VLAN without valid Id (%"PRIu64") configured in %s. Ignoring", v->id, filename);
return -EINVAL;
}
return 0;
}
static void vlan_init(NetDev *netdev) {
VLan *v = VLAN(netdev);
assert(netdev);
assert(v);
v->id = VLANID_MAX + 1;
}
const NetDevVTable vlan_vtable = {
.object_size = sizeof(VLan),
.init = vlan_init,
.sections = "Match\0NetDev\0VLAN\0",
.fill_message_create = netdev_vlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
.config_verify = netdev_vlan_verify,
};