diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-23 04:27:12 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-28 15:45:35 +0200 |
commit | daf0f8ca87284b847c40102dbaca0890fec2f971 (patch) | |
tree | 7fab5776a413943e6fd34c3de6268da085d7f2b5 /src/network/netdev | |
parent | Merge pull request #12437 from poettering/chmod-and-chown-rewrite (diff) | |
download | systemd-daf0f8ca87284b847c40102dbaca0890fec2f971.tar.xz systemd-daf0f8ca87284b847c40102dbaca0890fec2f971.zip |
network: add NetDevVTable::generate_mac flag
Diffstat (limited to 'src/network/netdev')
-rw-r--r-- | src/network/netdev/bond.c | 1 | ||||
-rw-r--r-- | src/network/netdev/dummy.c | 1 | ||||
-rw-r--r-- | src/network/netdev/geneve.c | 1 | ||||
-rw-r--r-- | src/network/netdev/ipvlan.c | 2 | ||||
-rw-r--r-- | src/network/netdev/macsec.c | 1 | ||||
-rw-r--r-- | src/network/netdev/macvlan.c | 2 | ||||
-rw-r--r-- | src/network/netdev/netdev.c | 2 | ||||
-rw-r--r-- | src/network/netdev/netdev.h | 3 | ||||
-rw-r--r-- | src/network/netdev/netdevsim.c | 1 | ||||
-rw-r--r-- | src/network/netdev/tunnel.c | 10 | ||||
-rw-r--r-- | src/network/netdev/vcan.c | 1 | ||||
-rw-r--r-- | src/network/netdev/veth.c | 1 | ||||
-rw-r--r-- | src/network/netdev/vrf.c | 1 | ||||
-rw-r--r-- | src/network/netdev/vxcan.c | 1 | ||||
-rw-r--r-- | src/network/netdev/vxlan.c | 1 | ||||
-rw-r--r-- | src/network/netdev/wireguard.c | 1 |
16 files changed, 29 insertions, 1 deletions
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c index 240cfe34e2..a85c9e33ec 100644 --- a/src/network/netdev/bond.c +++ b/src/network/netdev/bond.c @@ -592,4 +592,5 @@ const NetDevVTable bond_vtable = { .sections = "Match\0NetDev\0Bond\0", .fill_message_create = netdev_bond_fill_message_create, .create_type = NETDEV_CREATE_MASTER, + .generate_mac = true, }; diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c index aded1c589f..091a54ff39 100644 --- a/src/network/netdev/dummy.c +++ b/src/network/netdev/dummy.c @@ -6,4 +6,5 @@ const NetDevVTable dummy_vtable = { .object_size = sizeof(Dummy), .sections = "Match\0NetDev\0", .create_type = NETDEV_CREATE_INDEPENDENT, + .generate_mac = true, }; diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c index 3dc8f083cc..611f9b2f6d 100644 --- a/src/network/netdev/geneve.c +++ b/src/network/netdev/geneve.c @@ -355,4 +355,5 @@ const NetDevVTable geneve_vtable = { .create = netdev_geneve_create, .create_type = NETDEV_CREATE_INDEPENDENT, .config_verify = netdev_geneve_verify, + .generate_mac = true, }; diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c index f48cb0231a..45dfe17777 100644 --- a/src/network/netdev/ipvlan.c +++ b/src/network/netdev/ipvlan.c @@ -77,6 +77,7 @@ const NetDevVTable ipvlan_vtable = { .sections = "Match\0NetDev\0IPVLAN\0", .fill_message_create = netdev_ipvlan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, + .generate_mac = true, }; const NetDevVTable ipvtap_vtable = { @@ -85,6 +86,7 @@ const NetDevVTable ipvtap_vtable = { .sections = "Match\0NetDev\0IPVTAP\0", .fill_message_create = netdev_ipvlan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, + .generate_mac = true, }; IPVlanMode link_get_ipvlan_mode(Link *link) { diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c index c82a6fd0ac..740d885339 100644 --- a/src/network/netdev/macsec.c +++ b/src/network/netdev/macsec.c @@ -1246,4 +1246,5 @@ const NetDevVTable macsec_vtable = { .done = macsec_done, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_macsec_verify, + .generate_mac = true, }; diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c index 871f0201a8..e13c3af9fd 100644 --- a/src/network/netdev/macvlan.c +++ b/src/network/netdev/macvlan.c @@ -61,6 +61,7 @@ const NetDevVTable macvtap_vtable = { .sections = "Match\0NetDev\0MACVTAP\0", .fill_message_create = netdev_macvlan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, + .generate_mac = true, }; const NetDevVTable macvlan_vtable = { @@ -69,4 +70,5 @@ const NetDevVTable macvlan_vtable = { .sections = "Match\0NetDev\0MACVLAN\0", .fill_message_create = netdev_macvlan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, + .generate_mac = true, }; diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c index 3968ab5495..1c307a3125 100644 --- a/src/network/netdev/netdev.c +++ b/src/network/netdev/netdev.c @@ -734,7 +734,7 @@ int netdev_load_one(Manager *manager, const char *filename) { if (!netdev->filename) return log_oom(); - if (!netdev->mac && !IN_SET(netdev->kind, NETDEV_KIND_VLAN, NETDEV_KIND_BRIDGE)) { + if (!netdev->mac && NETDEV_VTABLE(netdev)->generate_mac) { r = netdev_get_mac(netdev->ifname, &netdev->mac); if (r < 0) return log_netdev_error_errno(netdev, r, diff --git a/src/network/netdev/netdev.h b/src/network/netdev/netdev.h index dcf072ce94..8295ba1966 100644 --- a/src/network/netdev/netdev.h +++ b/src/network/netdev/netdev.h @@ -131,6 +131,9 @@ typedef struct NetDevVTable { /* verify that compulsory configuration options were specified */ int (*config_verify)(NetDev *netdev, const char *filename); + + /* Generate MAC address or not When MACAddress= is not specified. */ + bool generate_mac; } NetDevVTable; extern const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX]; diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c index 8caba67600..3b9d875183 100644 --- a/src/network/netdev/netdevsim.c +++ b/src/network/netdev/netdevsim.c @@ -7,4 +7,5 @@ const NetDevVTable netdevsim_vtable = { .object_size = sizeof(NetDevSim), .sections = "Match\0NetDev\0", .create_type = NETDEV_CREATE_INDEPENDENT, + .generate_mac = true, }; diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c index e69a009c31..1572836b69 100644 --- a/src/network/netdev/tunnel.c +++ b/src/network/netdev/tunnel.c @@ -778,6 +778,7 @@ const NetDevVTable ipip_vtable = { .fill_message_create = netdev_ipip_sit_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable sit_vtable = { @@ -787,6 +788,7 @@ const NetDevVTable sit_vtable = { .fill_message_create = netdev_ipip_sit_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable vti_vtable = { @@ -796,6 +798,7 @@ const NetDevVTable vti_vtable = { .fill_message_create = netdev_vti_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable vti6_vtable = { @@ -805,6 +808,7 @@ const NetDevVTable vti6_vtable = { .fill_message_create = netdev_vti_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable gre_vtable = { @@ -814,6 +818,7 @@ const NetDevVTable gre_vtable = { .fill_message_create = netdev_gre_erspan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable gretap_vtable = { @@ -823,6 +828,7 @@ const NetDevVTable gretap_vtable = { .fill_message_create = netdev_gre_erspan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable ip6gre_vtable = { @@ -832,6 +838,7 @@ const NetDevVTable ip6gre_vtable = { .fill_message_create = netdev_ip6gre_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable ip6gretap_vtable = { @@ -841,6 +848,7 @@ const NetDevVTable ip6gretap_vtable = { .fill_message_create = netdev_ip6gre_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable ip6tnl_vtable = { @@ -850,6 +858,7 @@ const NetDevVTable ip6tnl_vtable = { .fill_message_create = netdev_ip6tnl_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; const NetDevVTable erspan_vtable = { @@ -859,4 +868,5 @@ const NetDevVTable erspan_vtable = { .fill_message_create = netdev_gre_erspan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, + .generate_mac = true, }; diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c index 574d1cad31..f6a4dbb098 100644 --- a/src/network/netdev/vcan.c +++ b/src/network/netdev/vcan.c @@ -6,4 +6,5 @@ const NetDevVTable vcan_vtable = { .object_size = sizeof(VCan), .sections = "Match\0NetDev\0", .create_type = NETDEV_CREATE_INDEPENDENT, + .generate_mac = true, }; diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c index a0a0b8e39e..e996b49b0a 100644 --- a/src/network/netdev/veth.c +++ b/src/network/netdev/veth.c @@ -92,4 +92,5 @@ const NetDevVTable veth_vtable = { .fill_message_create = netdev_veth_fill_message_create, .create_type = NETDEV_CREATE_INDEPENDENT, .config_verify = netdev_veth_verify, + .generate_mac = true, }; diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c index 5efab537cc..596a91453c 100644 --- a/src/network/netdev/vrf.c +++ b/src/network/netdev/vrf.c @@ -30,4 +30,5 @@ const NetDevVTable vrf_vtable = { .sections = "Match\0NetDev\0VRF\0", .fill_message_create = netdev_vrf_fill_message_create, .create_type = NETDEV_CREATE_MASTER, + .generate_mac = true, }; diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c index c5dd5df51c..79f47690ad 100644 --- a/src/network/netdev/vxcan.c +++ b/src/network/netdev/vxcan.c @@ -70,4 +70,5 @@ const NetDevVTable vxcan_vtable = { .fill_message_create = netdev_vxcan_fill_message_create, .create_type = NETDEV_CREATE_INDEPENDENT, .config_verify = netdev_vxcan_verify, + .generate_mac = true, }; diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index e24537083b..bba58e8aaf 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -380,4 +380,5 @@ const NetDevVTable vxlan_vtable = { .fill_message_create = netdev_vxlan_fill_message_create, .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_vxlan_verify, + .generate_mac = true, }; diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c index 91fcee1401..154ca3b7a4 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -978,4 +978,5 @@ const NetDevVTable wireguard_vtable = { .done = wireguard_done, .create_type = NETDEV_CREATE_INDEPENDENT, .config_verify = wireguard_verify, + .generate_mac = true, }; |