diff options
author | Alvin Šipraga <alsi@bang-olufsen.dk> | 2020-07-08 15:52:23 +0200 |
---|---|---|
committer | Alvin Šipraga <alsi@bang-olufsen.dk> | 2020-07-08 18:01:52 +0200 |
commit | 0d0de133f04d3870273970cfa4d61aac1ae06098 (patch) | |
tree | 911c536fc8cebdb40cb85b787641057c54e568f4 /src/libsystemd/sd-netlink/netlink-types.c | |
parent | 24e2494407cb5a88ee81fc238195687e5e0b8a09 (diff) | |
download | systemd-0d0de133f04d3870273970cfa4d61aac1ae06098.tar.gz |
network: add support for MACVLAN source mode
Add support for creating a MACVLAN interface in "source" mode by
specifying Mode=source in the [MACVLAN] section of a .netdev file.
A list of allowed MAC addresses for the corresponding MACVLAN can also
be specified with the SourceMACAddress= option of the [MACVLAN] section.
An example .netdev file:
[NetDev]
Name=macvlan0
Kind=macvlan
MACAddress=02:DE:AD:BE:EF:00
[MACVLAN]
Mode=source
SourceMACAddress=02:AB:AB:AB:AB:01 02:CD:CD:CD:CD:01
SourceMACAddress=02:EF:EF:EF:EF:01
The same keys can also be specified in [MACVTAP] for MACVTAP kinds of
interfaces, with the same semantics.
Diffstat (limited to 'src/libsystemd/sd-netlink/netlink-types.c')
-rw-r--r-- | src/libsystemd/sd-netlink/netlink-types.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c index a1e4ec9f27..060458a534 100644 --- a/src/libsystemd/sd-netlink/netlink-types.c +++ b/src/libsystemd/sd-netlink/netlink-types.c @@ -93,9 +93,20 @@ static const NLType rtnl_link_info_data_ipvlan_types[] = { [IFLA_IPVLAN_FLAGS] = { .type = NETLINK_TYPE_U16 }, }; +static const NLType rtnl_macvlan_macaddr_types[] = { + [IFLA_MACVLAN_MACADDR] = { .type = NETLINK_TYPE_ETHER_ADDR }, +}; + +static const NLTypeSystem rtnl_macvlan_macaddr_type_system = { + .count = ELEMENTSOF(rtnl_macvlan_macaddr_types), + .types = rtnl_macvlan_macaddr_types, +}; + static const NLType rtnl_link_info_data_macvlan_types[] = { [IFLA_MACVLAN_MODE] = { .type = NETLINK_TYPE_U32 }, [IFLA_MACVLAN_FLAGS] = { .type = NETLINK_TYPE_U16 }, + [IFLA_MACVLAN_MACADDR_MODE] = { .type = NETLINK_TYPE_U32 }, + [IFLA_MACVLAN_MACADDR_DATA] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_macvlan_macaddr_type_system }, }; static const NLType rtnl_link_info_data_bridge_types[] = { |