From 964ae8cc391520440cf5aa13e2b9cc34850ea6c2 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Tue, 26 Feb 2019 19:01:41 +0100 Subject: New upstream version 1.14.6 --- libnm-core/nm-core-internal.h | 60 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-) (limited to 'libnm-core/nm-core-internal.h') diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index f0d4e40f..9d2d0f2c 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -101,6 +101,11 @@ #define NM_BR_MIN_AGEING_TIME 0 #define NM_BR_MAX_AGEING_TIME 1000000 +#define NM_BR_PORT_MAX_PRIORITY 63 +#define NM_BR_PORT_DEF_PRIORITY 32 + +#define NM_BR_PORT_MAX_PATH_COST 65535 + /* NM_SETTING_COMPARE_FLAG_INFERRABLE: check whether a device-generated * connection can be replaced by a already-defined connection. This flag only * takes into account properties marked with the %NM_SETTING_PARAM_INFERRABLE @@ -174,6 +179,13 @@ NMSettingPriority _nm_setting_get_setting_priority (NMSetting *setting); gboolean _nm_setting_get_property (NMSetting *setting, const char *name, GValue *value); +/* NM_CONNECTION_SERIALIZE_NO_SYNTH: This flag is passed to _nm_setting_to_dbus() + * by nm_setting_to_string() to let it know that it shouldn't serialize the + * synthetic properties. It wouldn't be able to do so, since the full connection + * is not available, only the setting alone. + */ +#define NM_CONNECTION_SERIALIZE_NO_SYNTH ((NMConnectionSerializationFlags) 0x80000000) + /*****************************************************************************/ GHashTable *_nm_setting_gendata_hash (NMSetting *setting, @@ -212,15 +224,26 @@ guint nm_setting_ethtool_init_features (NMSettingEthtool *setting, guint8 *_nm_utils_hwaddr_aton (const char *asc, gpointer buffer, gsize buffer_length, gsize *out_length); const char *nm_utils_hwaddr_ntoa_buf (gconstpointer addr, gsize addr_len, gboolean upper_case, char *buf, gsize buf_len); -char *_nm_utils_bin2str (gconstpointer addr, gsize length, gboolean upper_case); -void _nm_utils_bin2str_full (gconstpointer addr, gsize length, const char delimiter, gboolean upper_case, char *out); +char *_nm_utils_bin2hexstr_full (gconstpointer addr, gsize length, const char delimiter, gboolean upper_case, char *out); + +guint8 *_nm_utils_hexstr2bin_full (const char *hexstr, + gboolean allow_0x_prefix, + gboolean delimiter_required, + const char *delimiter_candidates, + gsize required_len, + guint8 *buffer, + gsize buffer_len, + gsize *out_len); + +#define _nm_utils_hexstr2bin_buf(hexstr, allow_0x_prefix, delimiter_required, delimiter_candidates, buffer) \ + _nm_utils_hexstr2bin_full ((hexstr), (allow_0x_prefix), (delimiter_required), (delimiter_candidates), G_N_ELEMENTS (buffer), (buffer), G_N_ELEMENTS (buffer), NULL) -guint8 *_nm_utils_str2bin_full (const char *asc, - gboolean delimiter_required, - const char *delimiter_candidates, - guint8 *buffer, - gsize buffer_length, - gsize *out_len); +guint8 *_nm_utils_hexstr2bin_alloc (const char *hexstr, + gboolean allow_0x_prefix, + gboolean delimiter_required, + const char *delimiter_candidates, + gsize required_len, + gsize *out_len); GSList * _nm_utils_hash_values_to_slist (GHashTable *hash); @@ -234,7 +257,7 @@ gboolean _nm_ip_route_attribute_validate_all (const NMIPRoute *route); const char **_nm_ip_route_get_attribute_names (const NMIPRoute *route, gboolean sorted, guint *out_length); GHashTable *_nm_ip_route_get_attributes_direct (NMIPRoute *route); -NMSriovVF *_nm_utils_sriov_vf_from_strparts (const char *index, const char *detail, GError **error); +NMSriovVF *_nm_utils_sriov_vf_from_strparts (const char *index, const char *detail, gboolean ignore_unknown, GError **error); gboolean _nm_sriov_vf_attribute_validate_all (const NMSriovVF *vf, GError **error); static inline void @@ -272,8 +295,25 @@ gboolean _nm_utils_check_module_file (const char *name, gpointer user_data, GError **error); +/*****************************************************************************/ + +typedef struct _NMUuid { + guchar uuid[16]; +} NMUuid; + +NMUuid *_nm_utils_uuid_parse (const char *str, + NMUuid *uuid); +char *_nm_utils_uuid_unparse (const NMUuid *uuid, + char *out_str /*[37]*/); +NMUuid *_nm_utils_uuid_generate_random (NMUuid *out_uuid); + +gboolean nm_utils_uuid_is_null (const NMUuid *uuid); + #define NM_UTILS_UUID_TYPE_LEGACY 0 -#define NM_UTILS_UUID_TYPE_VARIANT3 1 +#define NM_UTILS_UUID_TYPE_VERSION3 3 +#define NM_UTILS_UUID_TYPE_VERSION5 5 + +NMUuid *nm_utils_uuid_generate_from_string_bin (NMUuid *uuid, const char *s, gssize slen, int uuid_type, gpointer type_args); char *nm_utils_uuid_generate_from_string (const char *s, gssize slen, int uuid_type, gpointer type_args); -- cgit 1.3.0-6-gf8a5 From 9a6dcbf895f9da01768e64b73cec88c16157d91e Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Tue, 26 Mar 2019 23:25:23 +0100 Subject: New upstream version 1.16.0 --- libnm-core/nm-core-internal.h | 222 +++++++++++++++++++++++++++++++++--------- 1 file changed, 178 insertions(+), 44 deletions(-) (limited to 'libnm-core/nm-core-internal.h') diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 9d2d0f2c..f2332f76 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -37,6 +37,8 @@ #include "nm-connection.h" #include "nm-core-enum-types.h" +#include "nm-core-types-internal.h" +#include "nm-meta-setting.h" #include "nm-setting-6lowpan.h" #include "nm-setting-8021x.h" #include "nm-setting-adsl.h" @@ -52,7 +54,6 @@ #include "nm-setting-gsm.h" #include "nm-setting-infiniband.h" #include "nm-setting-ip-tunnel.h" -#include "nm-setting-proxy.h" #include "nm-setting-ip4-config.h" #include "nm-setting-ip6-config.h" #include "nm-setting-macsec.h" @@ -65,6 +66,7 @@ #include "nm-setting-ovs-port.h" #include "nm-setting-ppp.h" #include "nm-setting-pppoe.h" +#include "nm-setting-proxy.h" #include "nm-setting-serial.h" #include "nm-setting-sriov.h" #include "nm-setting-tc-config.h" @@ -74,8 +76,10 @@ #include "nm-setting-vlan.h" #include "nm-setting-vpn.h" #include "nm-setting-vxlan.h" +#include "nm-setting-wifi-p2p.h" #include "nm-setting-wimax.h" #include "nm-setting-wired.h" +#include "nm-setting-wireguard.h" #include "nm-setting-wireless-security.h" #include "nm-setting-wireless.h" #include "nm-setting-wpan.h" @@ -83,9 +87,7 @@ #include "nm-simple-connection.h" #include "nm-utils.h" #include "nm-vpn-dbus-interface.h" -#include "nm-core-types-internal.h" #include "nm-vpn-editor-plugin.h" -#include "nm-meta-setting.h" /* IEEE 802.1D-1998 timer values */ #define NM_BR_MIN_HELLO_TIME 1 @@ -126,11 +128,21 @@ */ #define NM_SETTING_COMPARE_FLAG_NONE ((NMSettingCompareFlags) 0) -#define NM_SETTING_SECRET_FLAGS_ALL \ - (NM_SETTING_SECRET_FLAG_NONE | \ - NM_SETTING_SECRET_FLAG_AGENT_OWNED | \ - NM_SETTING_SECRET_FLAG_NOT_SAVED | \ - NM_SETTING_SECRET_FLAG_NOT_REQUIRED) +/*****************************************************************************/ + +#define NM_SETTING_SECRET_FLAG_ALL \ + ((NMSettingSecretFlags) ( NM_SETTING_SECRET_FLAG_NONE \ + | NM_SETTING_SECRET_FLAG_AGENT_OWNED \ + | NM_SETTING_SECRET_FLAG_NOT_SAVED \ + | NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) + +static inline gboolean +_nm_setting_secret_flags_valid (NMSettingSecretFlags flags) +{ + return !NM_FLAGS_ANY (flags, ~NM_SETTING_SECRET_FLAG_ALL); +} + +/*****************************************************************************/ typedef enum { /*< skip >*/ NM_SETTING_PARSE_FLAGS_NONE = 0, @@ -151,6 +163,26 @@ gpointer _nm_connection_check_main_setting (NMConnection *connection, const char *setting_name, GError **error); +typedef enum { + /* whether the connection has any secrets. + * + * @arg may be %NULL or a pointer to a gboolean for the result. The return + * value of _nm_connection_aggregate() is likewise the boolean result. */ + NM_CONNECTION_AGGREGATE_ANY_SECRETS, + + /* whether the connection has any secret with flags NM_SETTING_SECRET_FLAG_NONE. + * Note that this only cares about the flags, not whether the secret is actually + * present. + * + * @arg may be %NULL or a pointer to a gboolean for the result. The return + * value of _nm_connection_aggregate() is likewise the boolean result. */ + NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS, +} NMConnectionAggregateType; + +gboolean _nm_connection_aggregate (NMConnection *connection, + NMConnectionAggregateType type, + gpointer arg); + /** * NMSettingVerifyResult: * @NM_SETTING_VERIFY_SUCCESS: the setting verifies successfully @@ -179,13 +211,6 @@ NMSettingPriority _nm_setting_get_setting_priority (NMSetting *setting); gboolean _nm_setting_get_property (NMSetting *setting, const char *name, GValue *value); -/* NM_CONNECTION_SERIALIZE_NO_SYNTH: This flag is passed to _nm_setting_to_dbus() - * by nm_setting_to_string() to let it know that it shouldn't serialize the - * synthetic properties. It wouldn't be able to do so, since the full connection - * is not available, only the setting alone. - */ -#define NM_CONNECTION_SERIALIZE_NO_SYNTH ((NMConnectionSerializationFlags) 0x80000000) - /*****************************************************************************/ GHashTable *_nm_setting_gendata_hash (NMSetting *setting, @@ -224,27 +249,6 @@ guint nm_setting_ethtool_init_features (NMSettingEthtool *setting, guint8 *_nm_utils_hwaddr_aton (const char *asc, gpointer buffer, gsize buffer_length, gsize *out_length); const char *nm_utils_hwaddr_ntoa_buf (gconstpointer addr, gsize addr_len, gboolean upper_case, char *buf, gsize buf_len); -char *_nm_utils_bin2hexstr_full (gconstpointer addr, gsize length, const char delimiter, gboolean upper_case, char *out); - -guint8 *_nm_utils_hexstr2bin_full (const char *hexstr, - gboolean allow_0x_prefix, - gboolean delimiter_required, - const char *delimiter_candidates, - gsize required_len, - guint8 *buffer, - gsize buffer_len, - gsize *out_len); - -#define _nm_utils_hexstr2bin_buf(hexstr, allow_0x_prefix, delimiter_required, delimiter_candidates, buffer) \ - _nm_utils_hexstr2bin_full ((hexstr), (allow_0x_prefix), (delimiter_required), (delimiter_candidates), G_N_ELEMENTS (buffer), (buffer), G_N_ELEMENTS (buffer), NULL) - -guint8 *_nm_utils_hexstr2bin_alloc (const char *hexstr, - gboolean allow_0x_prefix, - gboolean delimiter_required, - const char *delimiter_candidates, - gsize required_len, - gsize *out_len); - GSList * _nm_utils_hash_values_to_slist (GHashTable *hash); GHashTable *_nm_utils_copy_strdict (GHashTable *strdict); @@ -334,6 +338,10 @@ void _nm_dbus_errors_init (void); extern gboolean _nm_utils_is_manager_process; +gboolean _nm_dbus_typecheck_response (GVariant *response, + const GVariantType *reply_type, + GError **error); + gulong _nm_dbus_signal_connect_data (GDBusProxy *proxy, const char *signal_name, const GVariantType *signature, @@ -358,6 +366,11 @@ GVariant *_nm_dbus_proxy_call_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error); +GVariant * _nm_dbus_connection_call_finish (GDBusConnection *dbus_connection, + GAsyncResult *result, + const GVariantType *reply_type, + GError **error); + gboolean _nm_dbus_error_has_name (GError *error, const char *dbus_error_name); @@ -436,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, @@ -492,6 +510,30 @@ NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap (NMConnection * const char *nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst); +static inline char * +nm_utils_inet4_ntop_dup (in_addr_t addr) +{ + char buf[NM_UTILS_INET_ADDRSTRLEN]; + + return g_strdup (nm_utils_inet4_ntop (addr, buf)); +} + +static inline char * +nm_utils_inet6_ntop_dup (const struct in6_addr *addr) +{ + char buf[NM_UTILS_INET_ADDRSTRLEN]; + + return g_strdup (nm_utils_inet6_ntop (addr, buf)); +} + +static inline char * +nm_utils_inet_ntop_dup (int addr_family, gconstpointer addr) +{ + char buf[NM_UTILS_INET_ADDRSTRLEN]; + + return g_strdup (nm_utils_inet_ntop (addr_family, addr, buf)); +} + gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr); /*****************************************************************************/ @@ -557,13 +599,44 @@ gboolean _nm_setting_sriov_sort_vfs (NMSettingSriov *setting); /*****************************************************************************/ -typedef struct _NMSettInfoSetting NMSettInfoSetting; +typedef struct _NMSockAddrEndpoint NMSockAddrEndpoint; + +NMSockAddrEndpoint *nm_sock_addr_endpoint_new (const char *endpoint); + +NMSockAddrEndpoint *nm_sock_addr_endpoint_ref (NMSockAddrEndpoint *self); +void nm_sock_addr_endpoint_unref (NMSockAddrEndpoint *self); + +const char *nm_sock_addr_endpoint_get_endpoint (NMSockAddrEndpoint *self); +const char *nm_sock_addr_endpoint_get_host (NMSockAddrEndpoint *self); +gint32 nm_sock_addr_endpoint_get_port (NMSockAddrEndpoint *self); + +gboolean nm_sock_addr_endpoint_get_fixed_sockaddr (NMSockAddrEndpoint *self, + gpointer sockaddr); + +#define nm_auto_unref_sockaddrendpoint nm_auto(_nm_auto_unref_sockaddrendpoint) +NM_AUTO_DEFINE_FCN0 (NMSockAddrEndpoint *, _nm_auto_unref_sockaddrendpoint, nm_sock_addr_endpoint_unref) + +/*****************************************************************************/ + +NMSockAddrEndpoint *_nm_wireguard_peer_get_endpoint (const NMWireGuardPeer *self); +void _nm_wireguard_peer_set_endpoint (NMWireGuardPeer *self, + NMSockAddrEndpoint *endpoint); + +void _nm_wireguard_peer_set_public_key_bin (NMWireGuardPeer *self, + const guint8 public_key[static NM_WIREGUARD_PUBLIC_KEY_LEN]); + +/*****************************************************************************/ + +typedef struct _NMSettInfoSetting NMSettInfoSetting; +typedef struct _NMSettInfoProperty NMSettInfoProperty; typedef GVariant *(*NMSettingPropertyGetFunc) (NMSetting *setting, const char *property); -typedef GVariant *(*NMSettingPropertySynthFunc) (NMSetting *setting, +typedef GVariant *(*NMSettingPropertySynthFunc) (const NMSettInfoSetting *sett_info, + guint property_idx, NMConnection *connection, - const char *property); + NMSetting *setting, + NMConnectionSerializationFlags flags); typedef gboolean (*NMSettingPropertySetFunc) (NMSetting *setting, GVariant *connection_dict, const char *property, @@ -579,7 +652,7 @@ typedef GVariant *(*NMSettingPropertyTransformToFunc) (const GValue *from); typedef void (*NMSettingPropertyTransformFromFunc) (GVariant *from, GValue *to); -typedef struct { +struct _NMSettInfoProperty { const char *name; GParamSpec *param_spec; const GVariantType *dbus_type; @@ -591,7 +664,7 @@ typedef struct { NMSettingPropertyTransformToFunc to_dbus; NMSettingPropertyTransformFromFunc from_dbus; -} NMSettInfoProperty; +}; typedef struct { const GVariantType *(*get_variant_type) (const struct _NMSettInfoSetting *sett_info, @@ -616,15 +689,51 @@ typedef struct { struct _NMSettInfoSetting { NMSettingClass *setting_class; + + /* the properties, sorted by property name. */ const NMSettInfoProperty *property_infos; + + /* the @property_infos list is sorted by property name. For some uses we need + * a different sort order. If @property_infos_sorted is set, this is the order + * instead. It is used for: + * + * - nm_setting_enumerate_values() + * - keyfile writer adding keys to the group. + * + * Note that currently only NMSettingConnection implements here a sort order + * that differs from alphabetical sort of the property names. + */ + const NMSettInfoProperty *const*property_infos_sorted; + guint property_infos_len; NMSettInfoSettDetail detail; }; -const NMSettInfoSetting *_nm_sett_info_setting_get (NMSettingClass *setting_class); +static inline const NMSettInfoProperty * +_nm_sett_info_property_info_get_sorted (const NMSettInfoSetting *sett_info, + guint idx) +{ + nm_assert (sett_info); + nm_assert (idx < sett_info->property_infos_len); + nm_assert (!sett_info->property_infos_sorted || sett_info->property_infos_sorted[idx]); + + return sett_info->property_infos_sorted + ? sett_info->property_infos_sorted[idx] + : &sett_info->property_infos[idx]; +} + +const NMSettInfoProperty *_nm_sett_info_setting_get_property_info (const NMSettInfoSetting *sett_info, + const char *property_name); -const NMSettInfoProperty *_nm_sett_info_property_get (NMSettingClass *setting_class, - const char *property_name); +const NMSettInfoSetting *_nm_setting_class_get_sett_info (NMSettingClass *setting_class); + +static inline const NMSettInfoProperty * +_nm_setting_class_get_property_info (NMSettingClass *setting_class, + const char *property_name) +{ + return _nm_sett_info_setting_get_property_info (_nm_setting_class_get_sett_info (setting_class), + property_name); +} /*****************************************************************************/ @@ -637,4 +746,29 @@ GBytes *_nm_setting_802_1x_cert_value_to_bytes (NMSetting8021xCKScheme scheme, /*****************************************************************************/ +GVariant *_nm_connection_for_each_secret (NMConnection *self, + GVariant *secrets, + gboolean remove_non_secrets, + _NMConnectionForEachSecretFunc callback, + gpointer callback_data); + +typedef gboolean (*NMConnectionFindSecretFunc) (NMSettingSecretFlags flags, + gpointer user_data); + +gboolean _nm_connection_find_secret (NMConnection *self, + GVariant *secrets, + NMConnectionFindSecretFunc callback, + gpointer callback_data); + +/*****************************************************************************/ + +#define nm_auto_unref_wgpeer nm_auto(_nm_auto_unref_wgpeer) +NM_AUTO_DEFINE_FCN0 (NMWireGuardPeer *, _nm_auto_unref_wgpeer, nm_wireguard_peer_unref) + +gboolean nm_utils_base64secret_normalize (const char *base64_key, + gsize required_key_len, + char **out_base64_key_norm); + +/*****************************************************************************/ + #endif -- cgit 1.3.0-6-gf8a5 From 85563b7fc7ec2cd21e38debb9b28db342e2e8e7c Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sun, 21 Apr 2019 21:09:51 +0200 Subject: New upstream version 1.18.0 --- libnm-core/nm-core-internal.h | 81 ++++++++++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 25 deletions(-) (limited to 'libnm-core/nm-core-internal.h') diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index f2332f76..3e33dd93 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -88,6 +88,7 @@ #include "nm-utils.h" #include "nm-vpn-dbus-interface.h" #include "nm-vpn-editor-plugin.h" +#include "nm-libnm-core-intern/nm-libnm-core-utils.h" /* IEEE 802.1D-1998 timer values */ #define NM_BR_MIN_HELLO_TIME 1 @@ -249,6 +250,8 @@ guint nm_setting_ethtool_init_features (NMSettingEthtool *setting, guint8 *_nm_utils_hwaddr_aton (const char *asc, gpointer buffer, gsize buffer_length, gsize *out_length); const char *nm_utils_hwaddr_ntoa_buf (gconstpointer addr, gsize addr_len, gboolean upper_case, char *buf, gsize buf_len); +gboolean nm_utils_is_valid_iface_name_utf8safe (const char *utf8safe_name); + GSList * _nm_utils_hash_values_to_slist (GHashTable *hash); GHashTable *_nm_utils_copy_strdict (GHashTable *strdict); @@ -259,19 +262,11 @@ const char **_nm_ip_address_get_attribute_names (const NMIPAddress *addr, gboole gboolean _nm_ip_route_attribute_validate_all (const NMIPRoute *route); const char **_nm_ip_route_get_attribute_names (const NMIPRoute *route, gboolean sorted, guint *out_length); -GHashTable *_nm_ip_route_get_attributes_direct (NMIPRoute *route); +GHashTable *_nm_ip_route_get_attributes (NMIPRoute *route); NMSriovVF *_nm_utils_sriov_vf_from_strparts (const char *index, const char *detail, gboolean ignore_unknown, GError **error); gboolean _nm_sriov_vf_attribute_validate_all (const NMSriovVF *vf, GError **error); -static inline void -_nm_auto_ip_route_unref (NMIPRoute **v) -{ - if (*v) - nm_ip_route_unref (*v); -} -#define nm_auto_ip_route_unref nm_auto (_nm_auto_ip_route_unref) - GPtrArray *_nm_utils_copy_array (const GPtrArray *array, NMUtilsCopyFunc copy_func, GDestroyNotify free_func); @@ -284,7 +279,6 @@ char ** _nm_utils_slist_to_strv (GSList *slist, gboolean deep_copy); GPtrArray * _nm_utils_strv_to_ptrarray (char **strv); char ** _nm_utils_ptrarray_to_strv (GPtrArray *ptrarray); -gboolean _nm_utils_strv_equal (char **strv1, char **strv2); gboolean _nm_utils_check_file (const char *filename, gint64 check_owner, @@ -538,6 +532,8 @@ gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr); /*****************************************************************************/ +gboolean _nm_team_link_watchers_equal (GPtrArray *a, GPtrArray *b, gboolean ignore_order); + gboolean _nm_utils_team_config_equal (const char *conf1, const char *conf2, gboolean port); GValue *_nm_utils_team_config_get (const char *conf, const char *key, @@ -553,18 +549,6 @@ gboolean _nm_utils_team_config_set (char **conf, /*****************************************************************************/ -static inline int -nm_setting_ip_config_get_addr_family (NMSettingIPConfig *s_ip) -{ - if (NM_IS_SETTING_IP4_CONFIG (s_ip)) - return AF_INET; - if (NM_IS_SETTING_IP6_CONFIG (s_ip)) - return AF_INET6; - g_return_val_if_reached (AF_UNSPEC); -} - -/*****************************************************************************/ - guint32 _nm_utils_parse_tc_handle (const char *str, GError **error); void _nm_utils_string_append_tc_parent (GString *string, @@ -576,6 +560,9 @@ gboolean _nm_utils_string_append_tc_tfilter_rest (GString *string, NMTCTfilter *tfilter, GError **error); +GHashTable *_nm_tc_qdisc_get_attributes (NMTCQdisc *qdisc); +GHashTable *_nm_tc_action_get_attributes (NMTCAction *action); + /*****************************************************************************/ static inline gboolean @@ -596,6 +583,8 @@ gboolean _nm_utils_dhcp_duid_valid (const char *duid, GBytes **out_duid_bin); /*****************************************************************************/ gboolean _nm_setting_sriov_sort_vfs (NMSettingSriov *setting); +gboolean _nm_setting_bridge_port_sort_vlans (NMSettingBridgePort *setting); +gboolean _nm_setting_bridge_sort_vlans (NMSettingBridge *setting); /*****************************************************************************/ @@ -627,6 +616,47 @@ void _nm_wireguard_peer_set_public_key_bin (NMWireGuardPeer *self, /*****************************************************************************/ +const NMIPAddr *nm_ip_routing_rule_get_from_bin (const NMIPRoutingRule *self); +void nm_ip_routing_rule_set_from_bin (NMIPRoutingRule *self, + gconstpointer from, + guint8 len); + +const NMIPAddr *nm_ip_routing_rule_get_to_bin (const NMIPRoutingRule *self); +void nm_ip_routing_rule_set_to_bin (NMIPRoutingRule *self, + gconstpointer to, + guint8 len); + +gboolean nm_ip_routing_rule_get_xifname_bin (const NMIPRoutingRule *self, + gboolean iif /* or else oif */, + char out_xifname[static 16]); + +#define NM_IP_ROUTING_RULE_ATTR_ACTION "action" +#define NM_IP_ROUTING_RULE_ATTR_DPORT_END "dport-end" +#define NM_IP_ROUTING_RULE_ATTR_DPORT_START "dport-start" +#define NM_IP_ROUTING_RULE_ATTR_FAMILY "family" +#define NM_IP_ROUTING_RULE_ATTR_FROM "from" +#define NM_IP_ROUTING_RULE_ATTR_FROM_LEN "from-len" +#define NM_IP_ROUTING_RULE_ATTR_FWMARK "fwmark" +#define NM_IP_ROUTING_RULE_ATTR_FWMASK "fwmask" +#define NM_IP_ROUTING_RULE_ATTR_IIFNAME "iifname" +#define NM_IP_ROUTING_RULE_ATTR_INVERT "invert" +#define NM_IP_ROUTING_RULE_ATTR_IPPROTO "ipproto" +#define NM_IP_ROUTING_RULE_ATTR_OIFNAME "oifname" +#define NM_IP_ROUTING_RULE_ATTR_PRIORITY "priority" +#define NM_IP_ROUTING_RULE_ATTR_SPORT_END "sport-end" +#define NM_IP_ROUTING_RULE_ATTR_SPORT_START "sport-start" +#define NM_IP_ROUTING_RULE_ATTR_TABLE "table" +#define NM_IP_ROUTING_RULE_ATTR_TO "to" +#define NM_IP_ROUTING_RULE_ATTR_TOS "tos" +#define NM_IP_ROUTING_RULE_ATTR_TO_LEN "to-len" + +NMIPRoutingRule *nm_ip_routing_rule_from_dbus (GVariant *variant, + gboolean strict, + GError **error); +GVariant *nm_ip_routing_rule_to_dbus (const NMIPRoutingRule *self); + +/*****************************************************************************/ + typedef struct _NMSettInfoSetting NMSettInfoSetting; typedef struct _NMSettInfoProperty NMSettInfoProperty; @@ -762,13 +792,14 @@ gboolean _nm_connection_find_secret (NMConnection *self, /*****************************************************************************/ -#define nm_auto_unref_wgpeer nm_auto(_nm_auto_unref_wgpeer) -NM_AUTO_DEFINE_FCN0 (NMWireGuardPeer *, _nm_auto_unref_wgpeer, nm_wireguard_peer_unref) - gboolean nm_utils_base64secret_normalize (const char *base64_key, gsize required_key_len, char **out_base64_key_norm); /*****************************************************************************/ +void _nm_bridge_vlan_str_append_rest (const NMBridgeVlan *vlan, + GString *string, + gboolean leading_space); + #endif -- cgit 1.3.0-6-gf8a5