diff options
Diffstat (limited to 'src/libnm-client-impl')
-rw-r--r-- | src/libnm-client-impl/libnm.ver | 35 | ||||
-rw-r--r-- | src/libnm-client-impl/meson.build | 1 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-client.c | 4 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-6lowpan.c | 23 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-macsec.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-tun.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-veth.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-vxlan.c | 4 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-wifi-p2p.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-device-wpan.c | 19 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-remote-connection.c | 2 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-vpn-plugin-old.c | 22 | ||||
-rw-r--r-- | src/libnm-client-impl/nm-vpn-service-plugin.c | 30 | ||||
-rw-r--r-- | src/libnm-client-impl/tests/meson.build | 12 | ||||
-rwxr-xr-x | src/libnm-client-impl/tests/test-gir.py | 153 |
15 files changed, 247 insertions, 66 deletions
diff --git a/src/libnm-client-impl/libnm.ver b/src/libnm-client-impl/libnm.ver index 5c7890f01b..6d706dff4a 100644 --- a/src/libnm-client-impl/libnm.ver +++ b/src/libnm-client-impl/libnm.ver @@ -1845,11 +1845,44 @@ global: nm_setting_ip6_config_get_mtu; } libnm_1_38_0; +libnm_1_40_4 { +global: + nm_device_6lowpan_get_parent; + nm_device_macsec_get_parent; + nm_device_veth_get_peer; + nm_device_vxlan_get_carrier; + nm_device_vxlan_get_rsc; + nm_device_wifi_p2p_get_peer_by_path; + nm_setting_6lowpan_get_parent; + nm_setting_6lowpan_new; + nm_setting_connection_get_mptcp_flags; + nm_setting_hostname_new; + nm_setting_ip4_config_get_link_local; + nm_setting_ip_config_get_dhcp_iaid; + nm_setting_ip_tunnel_get_encapsulation_limit; + nm_setting_ip_tunnel_get_flow_label; + nm_setting_ovs_bridge_get_datapath_type; + nm_setting_vpn_get_persistent; + nm_setting_wpan_get_channel; + nm_setting_wpan_get_mac_address; + nm_setting_wpan_get_page; + nm_setting_wpan_get_pan_id; + nm_setting_wpan_get_short_address; + nm_setting_wpan_new; + nm_sriov_vf_attribute_validate; + nm_tc_tfilter_get_action; + nm_tc_tfilter_set_action; + nm_utils_ip_addresses_from_variant; + nm_utils_ip_addresses_to_variant; + nm_utils_ip_routes_from_variant; + nm_utils_ip_routes_to_variant; + nm_vpn_plugin_info_supports_multiple; +} libnm_1_40_0; + libnm_1_42_0 { global: nm_client_wait_shutdown; nm_client_wait_shutdown_finish; - nm_setting_ip_config_get_dhcp_iaid; nm_setting_ovs_interface_get_ofport_request; nm_utils_ensure_gtypes; } libnm_1_40_0; diff --git a/src/libnm-client-impl/meson.build b/src/libnm-client-impl/meson.build index 46464a6328..d72ed545b4 100644 --- a/src/libnm-client-impl/meson.build +++ b/src/libnm-client-impl/meson.build @@ -236,5 +236,4 @@ if enable_introspection ], depends: libnm_gir, ) - endif diff --git a/src/libnm-client-impl/nm-client.c b/src/libnm-client-impl/nm-client.c index 686c02c93c..0e7d957c80 100644 --- a/src/libnm-client-impl/nm-client.c +++ b/src/libnm-client-impl/nm-client.c @@ -5396,6 +5396,8 @@ nm_client_add_and_activate_connection2(NMClient *client, * * Returns: (transfer full): the new #NMActiveConnection on success, %NULL on * failure, in which case @error will be set. + * + * Since: 1.16 **/ NMActiveConnection * nm_client_add_and_activate_connection2_finish(NMClient *client, @@ -9115,7 +9117,7 @@ nm_client_wait_shutdown(NMClient *client, * Returns: %TRUE if waiting is complete successfully. In that case, all resources of the * nmclient are wrapped up and released. This can only fail by user cancellation. * - * Since: 1.42. + * Since: 1.42 */ gboolean nm_client_wait_shutdown_finish(GAsyncResult *result, GError **error) diff --git a/src/libnm-client-impl/nm-device-6lowpan.c b/src/libnm-client-impl/nm-device-6lowpan.c index 39558f2542..4e649a6bbf 100644 --- a/src/libnm-client-impl/nm-device-6lowpan.c +++ b/src/libnm-client-impl/nm-device-6lowpan.c @@ -39,7 +39,7 @@ G_DEFINE_TYPE(NMDevice6Lowpan, nm_device_6lowpan, NM_TYPE_DEVICE) * * Returns: (transfer none): the device's parent device * - * Since: 1.14 + * Since: 1.42 **/ NMDevice * nm_device_6lowpan_get_parent(NMDevice6Lowpan *device) @@ -49,27 +49,6 @@ nm_device_6lowpan_get_parent(NMDevice6Lowpan *device) return nml_dbus_property_o_get_obj(&NM_DEVICE_6LOWPAN_GET_PRIVATE(device)->parent); } -/** - * nm_device_6lowpan_get_hw_address: (skip) - * @device: a #NMDevice6Lowpan - * - * Gets the hardware (MAC) address of the #NMDevice6Lowpan - * - * Returns: the hardware address. This is the internal string used by the - * device, and must not be modified. - * - * Since: 1.14 - * - * Deprecated: 1.24: Use nm_device_get_hw_address() instead. - **/ -const char * -nm_device_6lowpan_get_hw_address(NMDevice6Lowpan *device) -{ - g_return_val_if_fail(NM_IS_DEVICE_6LOWPAN(device), NULL); - - return nm_device_get_hw_address(NM_DEVICE(device)); -} - /*****************************************************************************/ static void diff --git a/src/libnm-client-impl/nm-device-macsec.c b/src/libnm-client-impl/nm-device-macsec.c index 525d32d0b7..fc07640221 100644 --- a/src/libnm-client-impl/nm-device-macsec.c +++ b/src/libnm-client-impl/nm-device-macsec.c @@ -65,7 +65,7 @@ G_DEFINE_TYPE(NMDeviceMacsec, nm_device_macsec, NM_TYPE_DEVICE) * * Returns: (transfer none): the device's parent device * - * Since: 1.6 + * Since: 1.42 **/ NMDevice * nm_device_macsec_get_parent(NMDeviceMacsec *device) diff --git a/src/libnm-client-impl/nm-device-tun.c b/src/libnm-client-impl/nm-device-tun.c index 353b4bdc0c..2e75c860e1 100644 --- a/src/libnm-client-impl/nm-device-tun.c +++ b/src/libnm-client-impl/nm-device-tun.c @@ -124,7 +124,7 @@ nm_device_tun_get_group(NMDeviceTun *device) } /** - * nm_device_tun_get_pi: + * nm_device_tun_get_no_pi: * @device: a #NMDeviceTun * * Returns whether the #NMDeviceTun has the IFF_NO_PI flag. diff --git a/src/libnm-client-impl/nm-device-veth.c b/src/libnm-client-impl/nm-device-veth.c index d9fc325bb7..9c82545581 100644 --- a/src/libnm-client-impl/nm-device-veth.c +++ b/src/libnm-client-impl/nm-device-veth.c @@ -44,7 +44,7 @@ G_DEFINE_TYPE(NMDeviceVeth, nm_device_veth, NM_TYPE_DEVICE_ETHERNET) * * Returns: (transfer none): the device's peer device * - * Since: 1.30 + * Since: 1.42 **/ NMDevice * nm_device_veth_get_peer(NMDeviceVeth *device) diff --git a/src/libnm-client-impl/nm-device-vxlan.c b/src/libnm-client-impl/nm-device-vxlan.c index d81b551601..f3027a5205 100644 --- a/src/libnm-client-impl/nm-device-vxlan.c +++ b/src/libnm-client-impl/nm-device-vxlan.c @@ -99,7 +99,7 @@ nm_device_vxlan_get_hw_address(NMDeviceVxlan *device) * This property is not implemented yet, and the function always returns * FALSE. * - * Since: 1.2 + * Since: 1.42 **/ gboolean nm_device_vxlan_get_carrier(NMDeviceVxlan *device) @@ -325,7 +325,7 @@ nm_device_vxlan_get_proxy(NMDeviceVxlan *device) * * Returns: whether route short circuit is turned on * - * Since: 1.2 + * Since: 1.42 **/ gboolean nm_device_vxlan_get_rsc(NMDeviceVxlan *device) diff --git a/src/libnm-client-impl/nm-device-wifi-p2p.c b/src/libnm-client-impl/nm-device-wifi-p2p.c index 6e667ac61a..2b3b82f81d 100644 --- a/src/libnm-client-impl/nm-device-wifi-p2p.c +++ b/src/libnm-client-impl/nm-device-wifi-p2p.c @@ -100,7 +100,7 @@ nm_device_wifi_p2p_get_peers(NMDeviceWifiP2P *device) * * Returns: (transfer none): the peer or %NULL if none is found. * - * Since: 1.16 + * Since: 1.42 **/ NMWifiP2PPeer * nm_device_wifi_p2p_get_peer_by_path(NMDeviceWifiP2P *device, const char *path) diff --git a/src/libnm-client-impl/nm-device-wpan.c b/src/libnm-client-impl/nm-device-wpan.c index 30c1ea16ea..337e3de003 100644 --- a/src/libnm-client-impl/nm-device-wpan.c +++ b/src/libnm-client-impl/nm-device-wpan.c @@ -24,25 +24,6 @@ struct _NMDeviceWpanClass { G_DEFINE_TYPE(NMDeviceWpan, nm_device_wpan, NM_TYPE_DEVICE) /*****************************************************************************/ -/** - * nm_device_wpan_get_hw_address: (skip) - * @device: a #NMDeviceWpan - * - * Gets the active hardware (MAC) address of the #NMDeviceWpan - * - * Returns: the active hardware address. This is the internal string used by the - * device, and must not be modified. - * - * Deprecated: 1.24: Use nm_device_get_hw_address() instead. - **/ -const char * -nm_device_wpan_get_hw_address(NMDeviceWpan *device) -{ - g_return_val_if_fail(NM_IS_DEVICE_WPAN(device), NULL); - - return nm_device_get_hw_address(NM_DEVICE(device)); -} - static gboolean connection_compatible(NMDevice *device, NMConnection *connection, GError **error) { diff --git a/src/libnm-client-impl/nm-remote-connection.c b/src/libnm-client-impl/nm-remote-connection.c index 0810e540dc..fe7e0712dc 100644 --- a/src/libnm-client-impl/nm-remote-connection.c +++ b/src/libnm-client-impl/nm-remote-connection.c @@ -125,6 +125,8 @@ nm_remote_connection_update2(NMRemoteConnection *connection, * * Returns: (transfer full): on success, a #GVariant of type "a{sv}" with the result. On failure, * %NULL. + * + * Since: 1.12 **/ GVariant * nm_remote_connection_update2_finish(NMRemoteConnection *connection, diff --git a/src/libnm-client-impl/nm-vpn-plugin-old.c b/src/libnm-client-impl/nm-vpn-plugin-old.c index 19ba2bb094..8898f09a29 100644 --- a/src/libnm-client-impl/nm-vpn-plugin-old.c +++ b/src/libnm-client-impl/nm-vpn-plugin-old.c @@ -281,13 +281,8 @@ schedule_fail_stop(NMVpnPluginOld *plugin, guint timeout_secs) priv->fail_stop_id = g_idle_add(fail_stop, plugin); } -/** - * nm_vpn_plugin_old_set_config: - * - * Deprecated: 1.2: Replaced by NMVpnServicePlugin. - */ -void -nm_vpn_plugin_old_set_config(NMVpnPluginOld *plugin, GVariant *config) +static void +set_config(NMVpnPluginOld *plugin, GVariant *config) { NMVpnPluginOldPrivate *priv = NM_VPN_PLUGIN_OLD_GET_PRIVATE(plugin); @@ -382,13 +377,8 @@ nm_vpn_plugin_old_set_ip4_config(NMVpnPluginOld *plugin, GVariant *ip4_config) nm_vpn_plugin_old_set_state(plugin, NM_VPN_SERVICE_STATE_STARTED); } -/** - * nm_vpn_plugin_old_set_ip6_config: - * - * Deprecated: 1.2: Replaced by NMVpnServicePlugin. - */ -void -nm_vpn_plugin_old_set_ip6_config(NMVpnPluginOld *plugin, GVariant *ip6_config) +static void +set_ip6_config(NMVpnPluginOld *plugin, GVariant *ip6_config) { NMVpnPluginOldPrivate *priv = NM_VPN_PLUGIN_OLD_GET_PRIVATE(plugin); @@ -721,7 +711,7 @@ impl_vpn_plugin_old_set_config(NMVpnPluginOld *plugin, GVariant *config, gpointer user_data) { - nm_vpn_plugin_old_set_config(plugin, config); + set_config(plugin, config); g_dbus_method_invocation_return_value(context, NULL); } @@ -741,7 +731,7 @@ impl_vpn_plugin_old_set_ip6_config(NMVpnPluginOld *plugin, GVariant *config, gpointer user_data) { - nm_vpn_plugin_old_set_ip6_config(plugin, config); + set_ip6_config(plugin, config); g_dbus_method_invocation_return_value(context, NULL); } diff --git a/src/libnm-client-impl/nm-vpn-service-plugin.c b/src/libnm-client-impl/nm-vpn-service-plugin.c index 3493d1db10..d26a4ff59f 100644 --- a/src/libnm-client-impl/nm-vpn-service-plugin.c +++ b/src/libnm-client-impl/nm-vpn-service-plugin.c @@ -136,6 +136,11 @@ nm_vpn_service_plugin_set_state(NMVpnServicePlugin *plugin, NMVpnServiceState st } } +/** + * nm_vpn_service_plugin_set_login_banner: + * + * Since: 1.2 + */ void nm_vpn_service_plugin_set_login_banner(NMVpnServicePlugin *plugin, const char *banner) { @@ -160,6 +165,11 @@ _emit_failure(NMVpnServicePlugin *plugin, NMVpnPluginFailure reason) nmdbus_vpn_plugin_emit_failure(priv->dbus_vpn_service_plugin, reason); } +/** + * nm_vpn_service_plugin_failure: + * + * Since: 1.2 + */ void nm_vpn_service_plugin_failure(NMVpnServicePlugin *plugin, NMVpnPluginFailure reason) { @@ -169,6 +179,11 @@ nm_vpn_service_plugin_failure(NMVpnServicePlugin *plugin, NMVpnPluginFailure rea nm_vpn_service_plugin_disconnect(plugin, NULL); } +/** + * nm_vpn_service_plugin_disconnect: + * + * Since: 1.2 + */ gboolean nm_vpn_service_plugin_disconnect(NMVpnServicePlugin *plugin, GError **err) { @@ -326,6 +341,11 @@ schedule_fail_stop(NMVpnServicePlugin *plugin, guint timeout_secs) priv->fail_stop_id = g_idle_add(fail_stop, plugin); } +/** + * nm_vpn_service_plugin_set_config: + * + * Since: 1.2 + */ void nm_vpn_service_plugin_set_config(NMVpnServicePlugin *plugin, GVariant *config) { @@ -364,6 +384,11 @@ nm_vpn_service_plugin_set_config(NMVpnServicePlugin *plugin, GVariant *config) nm_vpn_service_plugin_set_state(plugin, NM_VPN_SERVICE_STATE_STARTED); } +/** + * nm_vpn_service_plugin_set_ip4_config: + * + * Since: 1.2 + */ void nm_vpn_service_plugin_set_ip4_config(NMVpnServicePlugin *plugin, GVariant *ip4_config) { @@ -422,6 +447,11 @@ nm_vpn_service_plugin_set_ip4_config(NMVpnServicePlugin *plugin, GVariant *ip4_c nm_vpn_service_plugin_set_state(plugin, NM_VPN_SERVICE_STATE_STARTED); } +/** + * nm_vpn_service_plugin_set_ip6_config: + * + * Since: 1.2 + */ void nm_vpn_service_plugin_set_ip6_config(NMVpnServicePlugin *plugin, GVariant *ip6_config) { diff --git a/src/libnm-client-impl/tests/meson.build b/src/libnm-client-impl/tests/meson.build index 3f2e78a74f..0c0e188b77 100644 --- a/src/libnm-client-impl/tests/meson.build +++ b/src/libnm-client-impl/tests/meson.build @@ -44,3 +44,15 @@ foreach test_unit: test_units args: test_args + [exe.full_path()], ) endforeach + +if enable_introspection + test( + 'check-local-libnm-gir', + python, + args: [ + join_paths(meson.source_root(), 'src', 'libnm-client-impl', 'tests', 'test-gir.py'), + '--gir', libnm_gir[0], + '--ver', join_paths(meson.source_root(), 'src', 'libnm-client-impl', 'libnm.ver'), + ], + ) +endif diff --git a/src/libnm-client-impl/tests/test-gir.py b/src/libnm-client-impl/tests/test-gir.py new file mode 100755 index 0000000000..d91849b8fe --- /dev/null +++ b/src/libnm-client-impl/tests/test-gir.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Copyright (C) 2022 Red Hat, Inc. +# + +from __future__ import print_function +import xml.etree.ElementTree as ET +import argparse +import sys + +C_NS = "http://www.gtk.org/introspection/c/1.0" +CORE_NS = "http://www.gtk.org/introspection/core/1.0" +GLIB_NS = "http://www.gtk.org/introspection/glib/1.0" + + +def syms_from_gir(girfile): + def xml_symbols(xml, types): + ret = [] + for t in types: + ret += xml.findall("./{%s}namespace/{%s}%s" % (CORE_NS, CORE_NS, t)) + ret += xml.findall("./{%s}namespace/*/{%s}%s" % (CORE_NS, CORE_NS, t)) + return ret + + girxml = ET.parse(girfile) + c_syms = {} + for sym in xml_symbols(girxml, ("constructor", "function", "method")): + c_syms[sym.get("{%s}identifier" % C_NS)] = sym.get("version") + + for sym in xml_symbols( + girxml, ("bitfield", "class", "enumeration", "interface", "record") + ): + get_type = sym.get("{%s}get-type" % GLIB_NS) + if get_type is None: + continue + version = sym.get("version") + + if version is None: + # FIXME: The get_type() functions should be exported in the same + # version the type itself appeared. However, a large number of + # classes lack Since: tags in their doc blocks. Fall back to using + # the tag on _new() method for the test to be able to proceed + # reasonably. This should be fixed eventually. + constructor = sym.find("./{%s}constructor" % CORE_NS) + if constructor is not None: + version = constructor.get("version") + + c_syms[get_type] = version + return c_syms + + +# Older Python doesn't have str.removesuffix() +def str_removesuffix(string, suffix): + try: + return string.removesuffix(suffix) + except AttributeError: + if string.endswith(suffix): + return string[: -len(suffix)] + else: + return string + + +# Older Python doesn't have str.removeprefix() +def str_removeprefix(string, prefix): + try: + return string.removeprefix(prefix) + except AttributeError: + if string.startswith(prefix): + return string[len(prefix) :] + else: + return string + + +def syms_from_ver(verfile): + c_syms = {} + for line in open(verfile).readlines(): + line = line.strip() + + if line.endswith("{"): + line = str_removesuffix(line, " {") + line = str_removeprefix(line, "libnm_") + (major, minor, micro) = line.split("_") + if int(major) > 1 or int(minor) > 0: + if int(micro) > 0: + # Snap to next major version. Perhaps not + # exactly correct, but good for all symbols + # we export but nm_ethtool_optname_is_feature(). + minor = str(int(minor) + 2) + version = major + "." + minor + else: + version = None + elif ( + line.endswith(";") + and not line.startswith("}") + and not line.startswith("#") + and not line == "*;" + ): + c_syms[str_removesuffix(line, ";")] = version + + # This one is... messy. + c_syms["nm_ethtool_optname_is_feature"] = "1.20" + + return c_syms + + +parser = argparse.ArgumentParser() +parser.add_argument( + "--gir", + metavar="FILE", + help="NM-1.0.gir file", + required=True, +) +parser.add_argument( + "--ver", + metavar="FILE", + help="libnm.ver file", + required=True, +) + +args = parser.parse_args() + +gir_syms = syms_from_gir(args.gir) +ver_syms = syms_from_ver(args.ver) + +exit_code = 0 + +for (gir_sym, gir_ver) in gir_syms.items(): + if gir_sym not in ver_syms: + exit_code = 1 + print( + 'FAIL: "%s" found in "%s", but is not exported. Needs adding to "%s"?' + % (gir_sym, args.gir, args.ver), + file=sys.stderr, + ) + continue + if gir_ver != ver_syms[gir_sym]: + exit_code = 1 + print( + 'FAIL: "%s" exported in version "%s" but documented as available since "%s"' + % (gir_sym, ver_syms[gir_sym], gir_ver), + file=sys.stderr, + ) + +# In python2, dict.keys() returns lists, not sets. Cast them. +for sym in set(ver_syms.keys()) - set(gir_syms.keys()): + exit_code = 1 + print( + 'FAIL: "%s" found in "%s", but not in "%s". Maybe the doc comment is wrong or g-ir-scanner messed up?' + % (sym, args.ver, args.gir), + file=sys.stderr, + ) + +sys.exit(exit_code) |