network: add support for vlan confs(MVRP, reorder header, loose binding) (#5834)
This commit is contained in:
committed by
Lennart Poettering
parent
09b69d68fa
commit
6c1ff21b00
@@ -38,6 +38,9 @@ NetDev.MTUBytes, config_parse_iec_size, 0,
|
||||
NetDev.MACAddress, config_parse_hwaddr, 0, offsetof(NetDev, mac)
|
||||
VLAN.Id, config_parse_vlanid, 0, offsetof(VLan, id)
|
||||
VLAN.GVRP, config_parse_tristate, 0, offsetof(VLan, gvrp)
|
||||
VLAN.MVRP, config_parse_tristate, 0, offsetof(VLan, mvrp)
|
||||
VLAN.LooseBinding, config_parse_tristate, 0, offsetof(VLan, loose_binding)
|
||||
VLAN.ReorderHeader, config_parse_tristate, 0, offsetof(VLan, reorder_hdr)
|
||||
MACVLAN.Mode, config_parse_macvlan_mode, 0, offsetof(MacVlan, mode)
|
||||
MACVTAP.Mode, config_parse_macvlan_mode, 0, offsetof(MacVlan, mode)
|
||||
IPVLAN.Mode, config_parse_ipvlan_mode, 0, offsetof(IPVlan, mode)
|
||||
|
||||
@@ -45,6 +45,21 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
|
||||
SET_FLAG(flags.flags, VLAN_FLAG_GVRP, v->gvrp);
|
||||
}
|
||||
|
||||
if (v->mvrp != -1) {
|
||||
flags.mask |= VLAN_FLAG_MVRP;
|
||||
SET_FLAG(flags.flags, VLAN_FLAG_MVRP, v->mvrp);
|
||||
}
|
||||
|
||||
if (v->reorder_hdr != -1) {
|
||||
flags.mask |= VLAN_FLAG_REORDER_HDR;
|
||||
SET_FLAG(flags.flags, VLAN_FLAG_REORDER_HDR, v->reorder_hdr);
|
||||
}
|
||||
|
||||
if (v->loose_binding != -1) {
|
||||
flags.mask |= VLAN_FLAG_LOOSE_BINDING;
|
||||
SET_FLAG(flags.flags, VLAN_FLAG_LOOSE_BINDING, v->loose_binding);
|
||||
}
|
||||
|
||||
r = sd_netlink_message_append_data(req, IFLA_VLAN_FLAGS, &flags, sizeof(struct ifla_vlan_flags));
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_FLAGS attribute: %m");
|
||||
@@ -78,6 +93,9 @@ static void vlan_init(NetDev *netdev) {
|
||||
|
||||
v->id = VLANID_INVALID;
|
||||
v->gvrp = -1;
|
||||
v->mvrp = -1;
|
||||
v->loose_binding = -1;
|
||||
v->reorder_hdr = -1;
|
||||
}
|
||||
|
||||
const NetDevVTable vlan_vtable = {
|
||||
|
||||
@@ -29,6 +29,9 @@ struct VLan {
|
||||
uint16_t id;
|
||||
|
||||
int gvrp;
|
||||
int mvrp;
|
||||
int loose_binding;
|
||||
int reorder_hdr;
|
||||
};
|
||||
|
||||
DEFINE_NETDEV_CAST(VLAN, VLan);
|
||||
|
||||
Reference in New Issue
Block a user