]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/ipvlan: do not try to update MAC address 34937/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Oct 2024 16:36:10 +0000 (01:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Oct 2024 16:06:25 +0000 (01:06 +0900)
src/network/netdev/ipvlan.c

index 892678b4addbca17211802e03ac11679453ef2ca..5cfae1eb6432a51b2f11617dcadeba06a9c3c66d 100644 (file)
@@ -37,6 +37,13 @@ static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netl
         return 0;
 }
 
+static bool ipvlan_can_set_mac(NetDev *netdev, const struct hw_addr_data *hw_addr) {
+        assert(netdev);
+
+        /* MAC address cannot be updated. Even unchanged, IFLA_ADDRESS attribute cannot be set in the message. */
+        return netdev->ifindex <= 0;
+}
+
 static void ipvlan_init(NetDev *netdev) {
         IPVlan *m = ASSERT_PTR(netdev)->kind == NETDEV_KIND_IPVLAN ? IPVLAN(netdev) : IPVTAP(netdev);
 
@@ -50,6 +57,7 @@ const NetDevVTable ipvlan_vtable = {
         .sections = NETDEV_COMMON_SECTIONS "IPVLAN\0",
         .fill_message_create = netdev_ipvlan_fill_message_create,
         .create_type = NETDEV_CREATE_STACKED,
+        .can_set_mac = ipvlan_can_set_mac,
         .iftype = ARPHRD_ETHER,
         .generate_mac = true,
 };
@@ -60,6 +68,7 @@ const NetDevVTable ipvtap_vtable = {
         .sections = NETDEV_COMMON_SECTIONS "IPVTAP\0",
         .fill_message_create = netdev_ipvlan_fill_message_create,
         .create_type = NETDEV_CREATE_STACKED,
+        .can_set_mac = ipvlan_can_set_mac,
         .iftype = ARPHRD_ETHER,
         .generate_mac = true,
 };