diff options
author | Adrian Freihofer <adrian.freihofer@siemens.com> | 2022-05-12 19:43:54 +0200 |
---|---|---|
committer | Adrian Freihofer <adrian.freihofer@siemens.com> | 2022-05-12 23:28:46 +0200 |
commit | 4b9d0316274a9d0fc06052c72684143887ba8b14 (patch) | |
tree | ca12307885d9c39e233abec1b513821c619bfae9 | |
parent | 06c741b00f5af3652663b951ee4d1bc4bddda002 (diff) |
ifcfg-rh: add support for ipv4.link-local
5 files changed, 29 insertions, 1 deletions
diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index e62c02277f..62f3a20984 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -1786,6 +1786,7 @@ make_ip4_setting(shvarFile *ifcfg, int priority; const char *const *item; guint32 route_table; + int ipv4_link_local; nm_assert(out_has_defroute && !*out_has_defroute); @@ -1858,6 +1859,14 @@ make_ip4_setting(shvarFile *ifcfg, route_table = 0; } + ipv4_link_local = NM_SETTING_IP4_LL_DEFAULT; + if (!svGetValueEnum(ifcfg, + "IPV4_LINK_LOCAL", + nm_setting_ip4_link_local_get_type(), + &ipv4_link_local, + NULL)) + PARSE_WARNING("invalid IPV4_LINK_LOCAL setting"); + g_object_set(s_ip4, NM_SETTING_IP_CONFIG_METHOD, method, @@ -1873,6 +1882,8 @@ make_ip4_setting(shvarFile *ifcfg, svGetValueInt64(ifcfg, "IPV4_ROUTE_METRIC", 10, -1, G_MAXUINT32, -1), NM_SETTING_IP_CONFIG_ROUTE_TABLE, (guint) route_table, + NM_SETTING_IP4_CONFIG_LINK_LOCAL, + ipv4_link_local, NULL); if (nm_streq(method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c index 15e01ba99a..36d82aa970 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c @@ -960,6 +960,7 @@ const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = { _KEY_TYPE("IPV4_DHCP_TIMEOUT", NMS_IFCFG_KEY_TYPE_IS_PLAIN), _KEY_TYPE("IPV4_DNS_PRIORITY", NMS_IFCFG_KEY_TYPE_IS_PLAIN), _KEY_TYPE("IPV4_FAILURE_FATAL", NMS_IFCFG_KEY_TYPE_IS_PLAIN), + _KEY_TYPE("IPV4_LINK_LOCAL", NMS_IFCFG_KEY_TYPE_IS_PLAIN), _KEY_TYPE("IPV4_REQUIRED_TIMEOUT", NMS_IFCFG_KEY_TYPE_IS_PLAIN), _KEY_TYPE("IPV4_ROUTE_METRIC", NMS_IFCFG_KEY_TYPE_IS_PLAIN), _KEY_TYPE("IPV4_ROUTE_TABLE", NMS_IFCFG_KEY_TYPE_IS_PLAIN), diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h index d7a1cfc6c1..0b3b884bb8 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h @@ -33,7 +33,7 @@ typedef struct { NMSIfcfgKeyTypeFlags key_flags; } NMSIfcfgKeyTypeInfo; -extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[253]; +extern const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[254]; const NMSIfcfgKeyTypeInfo *nms_ifcfg_well_known_key_find_info(const char *key, gssize *out_idx); diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 551f2b912e..7b6f11feab 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -2733,6 +2733,7 @@ write_ip4_setting(NMConnection *connection, gboolean has_netmask; NMDhcpHostnameFlags flags; const char *const *strv; + NMSettingIP4LinkLocal ipv4_link_local; NM_SET_OUT(out_route_content_svformat, NULL); NM_SET_OUT(out_route_content, NULL); @@ -2839,6 +2840,14 @@ write_ip4_setting(NMConnection *connection, value = nm_setting_ip_config_get_dhcp_hostname(s_ip4); svSetValueStr(ifcfg, "DHCP_HOSTNAME", value); + ipv4_link_local = nm_setting_ip4_config_get_link_local(NM_SETTING_IP4_CONFIG(s_ip4)); + if (ipv4_link_local != NM_SETTING_IP4_LL_DEFAULT) { + svSetValueEnum(ifcfg, + "IPV4_LINK_LOCAL", + nm_setting_ip4_link_local_get_type(), + ipv4_link_local); + } + value = nm_setting_ip4_config_get_dhcp_fqdn(NM_SETTING_IP4_CONFIG(s_ip4)); svSetValueStr(ifcfg, "DHCP_FQDN", value); diff --git a/src/libnm-core-impl/nm-setting-ip4-config.c b/src/libnm-core-impl/nm-setting-ip4-config.c index 95483111a6..715d243962 100644 --- a/src/libnm-core-impl/nm-setting-ip4-config.c +++ b/src/libnm-core-impl/nm-setting-ip4-config.c @@ -924,6 +924,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) * * Since 1.40 */ + /* ---ifcfg-rh--- + * property: link-local + * variable: IPV4_LINK_LOCAL(+) + * description: Configure link-local IP address in interaction with method + * example: IPV4_LINK_LOCAL=auto + * ---end--- + */ _nm_setting_property_define_direct_int32(properties_override, obj_properties, NM_SETTING_IP4_CONFIG_LINK_LOCAL, |