diff --git a/libnm-core/nm-setting-ethtool.c b/libnm-core/nm-setting-ethtool.c index 6369c58ca6..29cb401290 100644 --- a/libnm-core/nm-setting-ethtool.c +++ b/libnm-core/nm-setting-ethtool.c @@ -91,6 +91,9 @@ _notify_attributes (NMSettingEthtool *self) * Gets and offload feature setting. Returns %NM_TERNARY_DEFAULT if the * feature is not set. * + * Note that @optname must be a valid name for a feature, according to + * nm_ethtool_optname_is_feature(). + * * Returns: a #NMTernary value indicating whether the offload feature * is enabled, disabled, or left untouched. * @@ -124,6 +127,9 @@ nm_setting_ethtool_get_feature (NMSettingEthtool *setting, * * Sets and offload feature setting. * + * Note that @optname must be a valid name for a feature, according to + * nm_ethtool_optname_is_feature(). + * * Since: 1.14 */ void @@ -245,6 +251,34 @@ nm_setting_ethtool_init_features (NMSettingEthtool *setting, /*****************************************************************************/ +/** + * nm_setting_ethtool_get_optnames: + * @setting: the #NMSettingEthtool instance. + * @out_length: (out) (optional): return location for the number of keys returned, or %NULL + * + * This returns all options names that are set. This includes the feature names + * like %NM_ETHTOOL_OPTNAME_FEATURE_GRO. See nm_ethtool_optname_is_feature() to + * check whether the option name is valid for offload features. + * + * Returns: (array zero-terminated=1) (transfer container): list of set option + * names or %NULL if no options are set. The option names are still owned by + * @setting and may get invalidated when @setting gets modified. + * + * Since: 1.20 + */ +const char ** +nm_setting_ethtool_get_optnames (NMSettingEthtool *setting, + guint *out_length) +{ + g_return_val_if_fail (NM_IS_SETTING_ETHTOOL (setting), NULL); + + return nm_utils_strdict_get_keys (_nm_setting_gendata_hash (NM_SETTING (setting), FALSE), + TRUE, + out_length); +} + +/*****************************************************************************/ + static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { diff --git a/libnm-core/nm-setting-ethtool.h b/libnm-core/nm-setting-ethtool.h index 3142fa16a4..09f3753243 100644 --- a/libnm-core/nm-setting-ethtool.h +++ b/libnm-core/nm-setting-ethtool.h @@ -119,6 +119,10 @@ void nm_setting_ethtool_set_feature (NMSettingEthtool *setting, NM_AVAILABLE_IN_1_14 void nm_setting_ethtool_clear_features (NMSettingEthtool *setting); +NM_AVAILABLE_IN_1_20 +const char ** nm_setting_ethtool_get_optnames (NMSettingEthtool *setting, + guint *out_length); + G_END_DECLS #endif /* __NM_SETTING_ETHTOOL_H__ */ diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 36bdacdedb..57fc7331f3 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1610,4 +1610,5 @@ global: nm_device_modem_get_apn; nm_device_modem_get_device_id; nm_device_modem_get_operator_code; + nm_setting_ethtool_get_optnames; } libnm_1_18_0;