MACsec *v = MACSEC(netdev);
int r;
- if (v->port > 0) {
- r = sd_netlink_message_append_u16(m, IFLA_MACSEC_PORT, v->port);
- if (r < 0)
- return r;
- }
-
if (v->encrypt >= 0) {
r = sd_netlink_message_append_u8(m, IFLA_MACSEC_ENCRYPT, v->encrypt);
if (r < 0)
if (r < 0)
return r;
+ /* The properties below cannot be updated, and the kernel refuses the whole request if one of the
+ * following attributes is set for an existing interface. */
+ if (netdev->ifindex > 0)
+ return 0;
+
+ if (v->port > 0) {
+ r = sd_netlink_message_append_u16(m, IFLA_MACSEC_PORT, v->port);
+ if (r < 0)
+ return r;
+ }
+
+ /* Currently not supported by networkd, but IFLA_MACSEC_CIPHER_SUITE, IFLA_MACSEC_ICV_LEN, and
+ * IFLA_MACSEC_SCI can neither set for an existing interface. */
+
return 0;
}