From 02964c22a6986266d06e3ffff79765d306e2be05 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 2 Mar 2019 22:17:49 +0100 Subject: [PATCH] libnm-core: add nm_connection_get_setting_ip_config() helper --- libnm-core/nm-connection.c | 12 ++++++++++++ libnm-core/nm-core-internal.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index e958aff06d..a43e71258f 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -230,6 +230,18 @@ nm_connection_get_setting (NMConnection *connection, GType setting_type) return _connection_get_setting_check (connection, setting_type); } +NMSettingIPConfig * +nm_connection_get_setting_ip_config (NMConnection *connection, + int addr_family) +{ + nm_assert_addr_family (addr_family); + + return NM_SETTING_IP_CONFIG (_connection_get_setting (connection, + (addr_family == AF_INET) + ? NM_TYPE_SETTING_IP4_CONFIG + : NM_TYPE_SETTING_IP6_CONFIG)); +} + /** * nm_connection_get_setting_by_name: * @connection: a #NMConnection diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index b737e747f8..168ae9978e 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -449,6 +449,11 @@ gboolean _nm_utils_generate_mac_address_mask_parse (const char *value, /*****************************************************************************/ +NMSettingIPConfig *nm_connection_get_setting_ip_config (NMConnection *connection, + int addr_family); + +/*****************************************************************************/ + typedef enum { NM_BOND_OPTION_TYPE_INT, NM_BOND_OPTION_TYPE_STRING,