diff options
| author | Sjoerd Simons <sjoerd@luon.net> | 2014-04-26 20:55:09 +0200 |
|---|---|---|
| committer | Sjoerd Simons <sjoerd@luon.net> | 2014-04-26 20:55:09 +0200 |
| commit | 59c3714a494c3b3765657c0551ad82842d98a7d2 (patch) | |
| tree | e4dcdf9791fc40581f02bfaf870c30b102b3133a /libnm-util | |
| parent | a4256940da049f91bbbea5e53e469a59ea9c10f7 (diff) | |
Imported Upstream version 0.9.8.10 upstream/0.9.8.10
Diffstat (limited to 'libnm-util')
| -rw-r--r-- | libnm-util/Makefile.am | 13 | ||||
| -rw-r--r-- | libnm-util/Makefile.in | 16 | ||||
| -rw-r--r-- | libnm-util/nm-connection.c | 3 | ||||
| -rw-r--r-- | libnm-util/nm-setting-8021x.c | 39 | ||||
| -rw-r--r-- | libnm-util/nm-setting-bridge.c | 2 | ||||
| -rw-r--r-- | libnm-util/nm-setting-connection.c | 6 | ||||
| -rw-r--r-- | libnm-util/nm-setting-ip4-config.c | 3 | ||||
| -rw-r--r-- | libnm-util/nm-setting-ip6-config.c | 12 | ||||
| -rw-r--r-- | libnm-util/nm-setting-vlan.c | 8 | ||||
| -rw-r--r-- | libnm-util/nm-setting.c | 8 | ||||
| -rw-r--r-- | libnm-util/nm-utils.c | 71 | ||||
| -rw-r--r-- | libnm-util/tests/Makefile.am | 24 | ||||
| -rw-r--r-- | libnm-util/tests/Makefile.in | 102 | ||||
| -rw-r--r-- | libnm-util/tests/certs/Makefile.in | 2 | ||||
| -rw-r--r-- | libnm-util/tests/test-general.c | 62 |
15 files changed, 179 insertions, 192 deletions
diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index 2222ec2b..2d41164b 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -2,14 +2,18 @@ include $(GLIB_MAKEFILE) SUBDIRS = . tests -INCLUDES = -I${top_srcdir} -I${top_srcdir}/include -I${top_builddir}/include +AM_CPPFLAGS = \ + -I${top_srcdir} \ + -I${top_srcdir}/include \ + -I${top_builddir}/include lib_LTLIBRARIES=libnm-util.la libnm_util_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - $(UUID_CFLAGS) + $(UUID_CFLAGS) \ + $(AM_CPPFLAGS) libnm_util_include_HEADERS = \ nm-connection.h \ @@ -116,7 +120,8 @@ noinst_LTLIBRARIES = libtest-crypto.la libtest_crypto_la_SOURCES = crypto.c libtest_crypto_la_CPPFLAGS = \ - $(GLIB_CFLAGS) + $(GLIB_CFLAGS) \ + $(AM_CPPFLAGS) libtest_crypto_la_LIBADD = \ $(GLIB_LIBS) @@ -153,7 +158,7 @@ NetworkManager-1.0.gir: libnm-util.la NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 NetworkManager_1_0_gir_EXPORT_PACKAGES = libnm-util -NetworkManager_1_0_gir_CFLAGS = $(INCLUDES) -I$(top_srcdir)/libnm-util +NetworkManager_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/libnm-util NetworkManager_1_0_gir_LIBS = libnm-util.la NetworkManager_1_0_gir_FILES = $(introspection_sources) NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm diff --git a/libnm-util/Makefile.in b/libnm-util/Makefile.in index 7fac11bd..bde92403 100644 --- a/libnm-util/Makefile.in +++ b/libnm-util/Makefile.in @@ -353,6 +353,7 @@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ DLLTOOL = @DLLTOOL@ +DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -375,6 +376,7 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -560,10 +562,14 @@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ SUBDIRS = . tests -INCLUDES = -I${top_srcdir} -I${top_srcdir}/include -I${top_builddir}/include +AM_CPPFLAGS = \ + -I${top_srcdir} \ + -I${top_srcdir}/include \ + -I${top_builddir}/include + lib_LTLIBRARIES = libnm-util.la libnm_util_la_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(UUID_CFLAGS) \ - $(am__append_2) $(am__append_5) + $(AM_CPPFLAGS) $(am__append_2) $(am__append_5) libnm_util_include_HEADERS = \ nm-connection.h \ nm-setting.h \ @@ -649,8 +655,8 @@ libnm_util_includedir = $(includedir)/NetworkManager ########################################### noinst_LTLIBRARIES = libtest-crypto.la libtest_crypto_la_SOURCES = crypto.c $(am__append_7) $(am__append_10) -libtest_crypto_la_CPPFLAGS = $(GLIB_CFLAGS) $(am__append_8) \ - $(am__append_11) +libtest_crypto_la_CPPFLAGS = $(GLIB_CFLAGS) $(AM_CPPFLAGS) \ + $(am__append_8) $(am__append_11) libtest_crypto_la_LIBADD = $(GLIB_LIBS) $(am__append_9) \ $(am__append_12) pkgconfigdir = $(libdir)/pkgconfig @@ -665,7 +671,7 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_EXPORT_PACKAGES = libnm-util -@HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_CFLAGS = $(INCLUDES) -I$(top_srcdir)/libnm-util +@HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/libnm-util @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_LIBS = libnm-util.la @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_FILES = $(introspection_sources) @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index 15b1685f..390b2a3b 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -1006,9 +1006,8 @@ nm_connection_is_type (NMConnection *connection, const char *type) g_assert (s_con); type2 = nm_setting_connection_get_connection_type (s_con); - g_assert (type2); - return !strcmp (type2, type); + return (g_strcmp0 (type2, type) == 0); } /** diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c index 0a9a2104..914c7ea3 100644 --- a/libnm-util/nm-setting-8021x.c +++ b/libnm-util/nm-setting-8021x.c @@ -227,7 +227,7 @@ nm_setting_802_1x_get_eap_method (NMSetting8021x *setting, guint32 i) * EAP method has been added. See #NMSetting8021x:eap property for a list of * allowed EAP methods. * - * Returns: TRUE if the EAP method was successfully added, FALSE if it was + * Returns: %TRUE if the EAP method was successfully added, %FALSE if it was * not a valid method or if it was already allowed. **/ gboolean @@ -369,11 +369,11 @@ nm_setting_802_1x_get_ca_path (NMSetting8021x *setting) * Sets the #NMSetting8021x:system-ca-certs property. The * #NMSetting8021x:ca-path and #NMSetting8021x:phase2-ca-path * properties are ignored if the #NMSetting8021x:system-ca-certs property is - * TRUE, in which case a system-wide CA certificate directory specified at + * %TRUE, in which case a system-wide CA certificate directory specified at * compile time (using the --system-ca-path configure option) is used in place * of these properties. * - * Returns: TRUE if a system CA certificate path should be used, FALSE if not + * Returns: %TRUE if a system CA certificate path should be used, %FALSE if not **/ gboolean nm_setting_802_1x_get_system_ca_certs (NMSetting8021x *setting) @@ -499,7 +499,7 @@ path_to_scheme_value (const char *path) * scheme, or with the path to the certificate file if using the * %NM_SETTING_802_1X_CK_SCHEME_PATH scheme. * - * Returns: TRUE if the operation succeeded, FALSE if it was unsuccessful + * Returns: %TRUE if the operation succeeded, %FALSE if it was unsuccessful **/ gboolean nm_setting_802_1x_set_ca_cert (NMSetting8021x *self, @@ -625,12 +625,12 @@ nm_setting_802_1x_get_altsubject_match (NMSetting8021x *setting, guint32 i) * match is added, the altSubjectName of the remote authentication * server is not verified. * - * Returns: TRUE if the alternative subject name match was - * successfully added, FALSE if it was already allowed. + * Returns: %TRUE if the alternative subject name match was + * successfully added, %FALSE if it was already allowed. **/ gboolean nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting, - const char *altsubject_match) + const char *altsubject_match) { NMSetting8021xPrivate *priv; GSList *iter; @@ -644,7 +644,8 @@ nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting, return FALSE; } - priv->altsubject_matches = g_slist_append (priv->altsubject_matches, g_strdup (altsubject_match)); + priv->altsubject_matches = g_slist_append (priv->altsubject_matches, + g_strdup (altsubject_match)); return TRUE; } @@ -774,7 +775,7 @@ nm_setting_802_1x_get_client_cert_path (NMSetting8021x *setting) * when EAP-TLS is used as either the "phase 1" or "phase 2" 802.1x * authentication method. * - * Returns: TRUE if the operation succeeded, FALSE if it was unsuccessful + * Returns: %TRUE if the operation succeeded, %FALSE if it was unsuccessful **/ gboolean nm_setting_802_1x_set_client_cert (NMSetting8021x *self, @@ -1035,7 +1036,7 @@ nm_setting_802_1x_get_phase2_ca_cert_path (NMSetting8021x *setting) * %NM_SETTING_802_1X_CK_SCHEME_BLOB scheme, or with the path to the certificate * file if using the %NM_SETTING_802_1X_CK_SCHEME_PATH scheme. * - * Returns: TRUE if the operation succeeded, FALSE if it was unsuccessful + * Returns: %TRUE if the operation succeeded, %FALSE if it was unsuccessful **/ gboolean nm_setting_802_1x_set_phase2_ca_cert (NMSetting8021x *self, @@ -1162,12 +1163,12 @@ nm_setting_802_1x_get_phase2_altsubject_match (NMSetting8021x *setting, guint32 * at least one match is added, the altSubjectName of the "phase 2" * remote authentication server is not verified. * - * Returns: TRUE if the "phase 2" alternative subject name match was - * successfully added, FALSE if it was already allowed. + * Returns: %TRUE if the "phase 2" alternative subject name match was + * successfully added, %FALSE if it was already allowed. **/ gboolean nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting, - const char *phase2_altsubject_match) + const char *phase2_altsubject_match) { NMSetting8021xPrivate *priv; GSList *iter; @@ -1181,8 +1182,8 @@ nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting, return FALSE; } - priv->phase2_altsubject_matches = g_slist_append (priv->altsubject_matches, - g_strdup (phase2_altsubject_match)); + priv->phase2_altsubject_matches = g_slist_append (priv->phase2_altsubject_matches, + g_strdup (phase2_altsubject_match)); return TRUE; } @@ -1314,7 +1315,7 @@ nm_setting_802_1x_get_phase2_client_cert_path (NMSetting8021x *setting) * when EAP-TLS is used as either the "phase 1" or "phase 2" 802.1x * authentication method. * - * Returns: TRUE if the operation succeeded, FALSE if it was unsuccessful + * Returns: %TRUE if the operation succeeded, %FALSE if it was unsuccessful **/ gboolean nm_setting_802_1x_set_phase2_client_cert (NMSetting8021x *self, @@ -1603,7 +1604,7 @@ file_to_byte_array (const char *filename) * unprivileged users. Private keys should always be encrypted with a private * key password to prevent unauthorized access to unencrypted private key data. * - * Returns: TRUE if the operation succeeded, FALSE if it was unsuccessful + * Returns: %TRUE if the operation succeeded, %FALSE if it was unsuccessful **/ gboolean nm_setting_802_1x_set_private_key (NMSetting8021x *self, @@ -1896,7 +1897,7 @@ nm_setting_802_1x_get_phase2_private_key_path (NMSetting8021x *setting) * unprivileged users. Private keys should always be encrypted with a private * key password to prevent unauthorized access to unencrypted private key data. * - * Returns: TRUE if the operation succeeded, FALSE if it was unsuccessful + * Returns: %TRUE if the operation succeeded, %FALSE if it was unsuccessful **/ gboolean nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self, @@ -2286,11 +2287,13 @@ verify_identity (NMSetting8021x *self, gboolean phase2, GError **error) NM_SETTING_802_1X_ERROR, NM_SETTING_802_1X_ERROR_MISSING_PROPERTY, NM_SETTING_802_1X_IDENTITY); + return FALSE; } else if (!strlen (priv->identity)) { g_set_error (error, NM_SETTING_802_1X_ERROR, NM_SETTING_802_1X_ERROR_INVALID_PROPERTY, NM_SETTING_802_1X_IDENTITY); + return FALSE; } return TRUE; diff --git a/libnm-util/nm-setting-bridge.c b/libnm-util/nm-setting-bridge.c index c6b3f299..a763206b 100644 --- a/libnm-util/nm-setting-bridge.c +++ b/libnm-util/nm-setting-bridge.c @@ -463,7 +463,7 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) "for this bridge. Lower values are 'better'; the " "lowest priority bridge will be elected the root " "bridge.", - 0, G_MAXUINT16, 0x80, + 0, G_MAXUINT16, 0x8000, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE)); /** diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c index 4d990643..9c3f2ce2 100644 --- a/libnm-util/nm-setting-connection.c +++ b/libnm-util/nm-setting-connection.c @@ -359,8 +359,8 @@ nm_setting_connection_permissions_user_allowed (NMSettingConnection *setting, * the "user" permission type is supported, and @pitem must be a username. See * #NMSettingConnection:permissions: for more details. * - * Returns: TRUE if the permission was unique and was successfully added to the - * list, FALSE if @ptype or @pitem was invalid or it the permission was already + * Returns: %TRUE if the permission was unique and was successfully added to the + * list, %FALSE if @ptype or @pitem was invalid or it the permission was already * present in the list */ gboolean @@ -525,7 +525,7 @@ nm_setting_connection_get_slave_type (NMSettingConnection *setting) * @type: the setting name (ie #NM_SETTING_BOND_SETTING_NAME) to be matched * against @setting's slave type * - * Returns: TRUE if connection is of the given slave @type + * Returns: %TRUE if connection is of the given slave @type */ gboolean nm_setting_connection_is_slave_type (NMSettingConnection *setting, diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c index 90534c12..34f5c8fb 100644 --- a/libnm-util/nm-setting-ip4-config.c +++ b/libnm-util/nm-setting-ip4-config.c @@ -901,9 +901,6 @@ set_property (GObject *object, guint prop_id, case PROP_DHCP_HOSTNAME: g_free (priv->dhcp_hostname); priv->dhcp_hostname = g_value_dup_string (value); - /* FIXME: Is this a good idea? */ - if (priv->dhcp_hostname) - priv->dhcp_send_hostname = TRUE; break; case PROP_NEVER_DEFAULT: priv->never_default = g_value_get_boolean (value); diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c index b83e3dab..b9a0ea30 100644 --- a/libnm-util/nm-setting-ip6-config.c +++ b/libnm-util/nm-setting-ip6-config.c @@ -1292,7 +1292,8 @@ nm_ip6_address_compare (NMIP6Address *address, NMIP6Address *other) * * Gets the IPv6 address property of this address object. * - * Returns: (transfer none): the IPv6 address + * Returns: (array fixed-size=16) (element-type guint8) (transfer none): + * the IPv6 address **/ const struct in6_addr * nm_ip6_address_get_address (NMIP6Address *address) @@ -1361,7 +1362,8 @@ nm_ip6_address_set_prefix (NMIP6Address *address, guint32 prefix) * * Gets the IPv6 default gateway property of this address object. * - * Returns: (transfer none): the IPv6 gateway address + * Returns: (array fixed-size=16) (element-type guint8) (transfer none): + * the IPv6 gateway address **/ const struct in6_addr * nm_ip6_address_get_gateway (NMIP6Address *address) @@ -1509,7 +1511,8 @@ nm_ip6_route_compare (NMIP6Route *route, NMIP6Route *other) * * Gets the IPv6 destination address property of this route object. * - * Returns: the IPv6 address + * Returns: (array fixed-size=16) (element-type guint8) (transfer none): + * the IPv6 address of destination **/ const struct in6_addr * nm_ip6_route_get_dest (NMIP6Route *route) @@ -1578,7 +1581,8 @@ nm_ip6_route_set_prefix (NMIP6Route *route, guint32 prefix) * * Gets the IPv6 address of the next hop of this route. * - * Returns: the IPv6 address + * Returns: (array fixed-size=16) (element-type guint8) (transfer none): + * the IPv6 address of next hop **/ const struct in6_addr * nm_ip6_route_get_next_hop (NMIP6Route *route) diff --git a/libnm-util/nm-setting-vlan.c b/libnm-util/nm-setting-vlan.c index da1cb7f8..da6dd628 100644 --- a/libnm-util/nm-setting-vlan.c +++ b/libnm-util/nm-setting-vlan.c @@ -239,8 +239,8 @@ set_map (NMSettingVlan *self, NMVlanPriorityMap map, GSList *list) * or the #NMSettingVlan:egress_priority_map properties. The priority map maps * the Linux SKB priorities to 802.1p priorities. * - * Returns: TRUE if the entry was successfully added to the list, or it - * overwrote the old value, FALSE if error + * Returns: %TRUE if the entry was successfully added to the list, or it + * overwrote the old value, %FALSE if error */ gboolean nm_setting_vlan_add_priority_str (NMSettingVlan *setting, @@ -352,8 +352,8 @@ nm_setting_vlan_get_priority (NMSettingVlan *setting, * If @map is #NM_VLAN_EGRESS_MAP then @from is the Linux SKB priority value and * @to is the outgoing 802.1q VLAN Priority Code Point (PCP) value. * - * Returns: TRUE if the new priority mapping was successfully added to the - * list, FALSE if error + * Returns: %TRUE if the new priority mapping was successfully added to the + * list, %FALSE if error */ gboolean nm_setting_vlan_add_priority (NMSettingVlan *setting, diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index f80c72b8..a3186284 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -842,8 +842,8 @@ get_secret_flags (NMSetting *setting, * For a given secret, retrieves the #NMSettingSecretFlags describing how to * handle that secret. * - * Returns: TRUE on success (if the given secret name was a valid property of - * this setting, and if that property is secret), FALSE if not + * Returns: %TRUE on success (if the given secret name was a valid property of + * this setting, and if that property is secret), %FALSE if not **/ gboolean nm_setting_get_secret_flags (NMSetting *setting, @@ -886,8 +886,8 @@ set_secret_flags (NMSetting *setting, * For a given secret, retrieves the #NMSettingSecretFlags describing how to * handle that secret. * - * Returns: TRUE on success (if the given secret name was a valid property of - * this setting, and if that property is secret), FALSE if not + * Returns: %TRUE on success (if the given secret name was a valid property of + * this setting, and if that property is secret), %FALSE if not **/ gboolean nm_setting_set_secret_flags (NMSetting *setting, diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 16adb2ba..ef5b9781 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -228,7 +228,7 @@ static gboolean initialized = FALSE; * is performed, but calling nm_utils_deinit() to explicitly deinitialize * libnm-util can also be done. This function can be called more than once. * - * Returns: TRUE if the initialization was successful, FALSE on failure. + * Returns: %TRUE if the initialization was successful, %FALSE on failure. **/ gboolean nm_utils_init (GError **error) @@ -343,7 +343,7 @@ nm_utils_ssid_to_utf8 (const GByteArray *ssid) * AP's SSID. This function attempts to detect blank/empty SSIDs using a * number of known SSID-cloaking methods. * - * Returns: TRUE if the SSID is "empty", FALSE if it is not + * Returns: %TRUE if the SSID is "empty", %FALSE if it is not **/ gboolean nm_utils_is_empty_ssid (const guint8 * ssid, int len) @@ -405,7 +405,7 @@ nm_utils_escape_ssid (const guint8 * ssid, guint32 len) * nm_utils_same_ssid: * @ssid1: first SSID data to compare * @ssid2: second SSID data to compare - * @ignore_trailing_null: TRUE to ignore one trailing NULL byte + * @ignore_trailing_null: %TRUE to ignore one trailing NULL byte * * Earlier versions of the Linux kernel added a NULL byte to the end of the * SSID to enable easy printing of the SSID on the console or in a terminal, @@ -414,7 +414,7 @@ nm_utils_escape_ssid (const guint8 * ssid, guint32 len) * cost of some compatibility with odd SSIDs that may legitimately have trailing * NULLs, even though that is functionally pointless. * - * Returns: TRUE if the SSIDs are the same, FALSE if they are not + * Returns: %TRUE if the SSIDs are the same, %FALSE if they are not **/ gboolean nm_utils_same_ssid (const GByteArray * ssid1, @@ -1213,8 +1213,8 @@ device_supports_ap_ciphers (guint32 dev_caps, * against, determines whether the combination of device capabilities and * desired security type are valid for AP/Hotspot connections. * - * Returns: TRUE if the device capabilities are compatible with the desired - * @type, FALSE if they are not. + * Returns: %TRUE if the device capabilities are compatible with the desired + * @type, %FALSE if they are not. * * Since: 0.9.8 **/ @@ -1261,8 +1261,8 @@ nm_utils_ap_mode_security_valid (NMUtilsSecurityType type, * NOTE: this function cannot handle checking security for AP/Hotspot mode; * use nm_utils_ap_mode_security_valid() instead. * - * Returns: TRUE if the device capabilities and AP capabilties intersect and are - * compatible with the desired @type, FALSE if they are not + * Returns: %TRUE if the device capabilities and AP capabilties intersect and are + * compatible with the desired @type, %FALSE if they are not **/ gboolean nm_utils_security_valid (NMUtilsSecurityType type, @@ -1667,24 +1667,27 @@ nm_utils_ip4_routes_to_gvalue (GSList *list, GValue *value) guint32 nm_utils_ip4_netmask_to_prefix (guint32 netmask) { - guchar *p, *end; - guint32 prefix = 0; - - p = (guchar *) &netmask; - end = p + sizeof (guint32); - - while ((*p == 0xFF) && p < end) { - prefix += 8; - p++; + guint32 prefix; + guint8 v; + const guint8 *p = (guint8 *) &netmask; + + if (p[3]) { + prefix = 24; + v = p[3]; + } else if (p[2]) { + prefix = 16; + v = p[2]; + } else if (p[1]) { + prefix = 8; + v = p[1]; + } else { + prefix = 0; + v = p[0]; } - if (p < end) { - guchar v = *p; - - while (v) { - prefix++; - v <<= 1; - } + while (v) { + prefix++; + v <<= 1; } return prefix; @@ -1699,16 +1702,7 @@ nm_utils_ip4_netmask_to_prefix (guint32 netmask) guint32 nm_utils_ip4_prefix_to_netmask (guint32 prefix) { - guint32 msk = 0x80000000; - guint32 netmask = 0; - - while (prefix > 0) { - netmask |= msk; - msk >>= 1; - prefix--; - } - - return (guint32) htonl (netmask); + return prefix < 32 ? ~htonl(0xFFFFFFFF >> prefix) : 0xFFFFFFFF; } @@ -2004,8 +1998,6 @@ nm_utils_ip6_routes_to_gvalue (GSList *list, GValue *value) g_value_take_boxed (value, routes); } -/* FIXME: the Posix namespace does not exist, and thus neither does - the in6_addr struct. Marking (skip) for now */ /** * nm_utils_ip6_dns_from_gvalue: (skip) * @value: a #GValue @@ -2013,8 +2005,7 @@ nm_utils_ip6_routes_to_gvalue (GSList *list, GValue *value) * Converts a #GValue containing a #GPtrArray of IP6 DNS, represented as * #GByteArray<!-- -->s into a #GSList of #in6_addr<!-- -->s. * - * Returns: (transfer full) (element-type Posix.in6_addr): a #GSList of IP6 - * addresses. + * Returns: a #GSList of IP6 addresses. */ GSList * nm_utils_ip6_dns_from_gvalue (const GValue *value) @@ -2341,7 +2332,7 @@ out: * * Utility function to find out if the @filename is in PKCS#12 format. * - * Returns: TRUE if the file is PKCS#12, FALSE if it is not + * Returns: %TRUE if the file is PKCS#12, %FALSE if it is not **/ gboolean nm_utils_file_is_pkcs12 (const char *filename) @@ -2534,7 +2525,7 @@ nm_utils_wifi_find_next_channel (guint32 channel, int direction, char *band) * * Utility function to verify WiFi channel validity. * - * Returns: TRUE or FALSE + * Returns: %TRUE or %FALSE **/ gboolean nm_utils_wifi_is_channel_valid (guint32 channel, const char *band) diff --git a/libnm-util/tests/Makefile.am b/libnm-util/tests/Makefile.am index 98f8aad8..d49ef8c8 100644 --- a/libnm-util/tests/Makefile.am +++ b/libnm-util/tests/Makefile.am @@ -2,11 +2,13 @@ if ENABLE_TESTS SUBDIRS=certs -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util + -I$(top_builddir)/libnm-util \ + $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) noinst_PROGRAMS = \ test-settings-defaults \ @@ -18,10 +20,6 @@ noinst_PROGRAMS = \ test_settings_defaults_SOURCES = \ test-settings-defaults.c -test_settings_defaults_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) - test_settings_defaults_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(GLIB_LIBS) \ @@ -30,9 +28,6 @@ test_settings_defaults_LDADD = \ test_crypto_SOURCES = \ test-crypto.c -test_crypto_CPPFLAGS = \ - $(GLIB_CFLAGS) - test_crypto_LDADD = \ $(top_builddir)/libnm-util/libtest-crypto.la \ $(top_builddir)/libnm-util/libnm-util.la \ @@ -43,8 +38,7 @@ test_secrets_SOURCES = \ test_secrets_CPPFLAGS = \ -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-util/tests/certs/\" \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) + $(AM_CPPFLAGS) test_secrets_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ @@ -54,10 +48,6 @@ test_secrets_LDADD = \ test_general_SOURCES = \ test-general.c -test_general_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) - test_general_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(GLIB_LIBS) \ @@ -66,10 +56,6 @@ test_general_LDADD = \ test_setting_8021x_SOURCES = \ test-setting-8021x.c -test_setting_8021x_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) - test_setting_8021x_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(GLIB_LIBS) \ diff --git a/libnm-util/tests/Makefile.in b/libnm-util/tests/Makefile.in index 622f3d21..662c3161 100644 --- a/libnm-util/tests/Makefile.in +++ b/libnm-util/tests/Makefile.in @@ -106,8 +106,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am__test_crypto_SOURCES_DIST = test-crypto.c -@ENABLE_TESTS_TRUE@am_test_crypto_OBJECTS = \ -@ENABLE_TESTS_TRUE@ test_crypto-test-crypto.$(OBJEXT) +@ENABLE_TESTS_TRUE@am_test_crypto_OBJECTS = test-crypto.$(OBJEXT) test_crypto_OBJECTS = $(am_test_crypto_OBJECTS) am__DEPENDENCIES_1 = @ENABLE_TESTS_TRUE@test_crypto_DEPENDENCIES = $(top_builddir)/libnm-util/libtest-crypto.la \ @@ -118,8 +117,7 @@ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__test_general_SOURCES_DIST = test-general.c -@ENABLE_TESTS_TRUE@am_test_general_OBJECTS = \ -@ENABLE_TESTS_TRUE@ test_general-test-general.$(OBJEXT) +@ENABLE_TESTS_TRUE@am_test_general_OBJECTS = test-general.$(OBJEXT) test_general_OBJECTS = $(am_test_general_OBJECTS) @ENABLE_TESTS_TRUE@test_general_DEPENDENCIES = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @@ -132,13 +130,15 @@ test_secrets_OBJECTS = $(am_test_secrets_OBJECTS) @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__test_setting_8021x_SOURCES_DIST = test-setting-8021x.c -@ENABLE_TESTS_TRUE@am_test_setting_8021x_OBJECTS = test_setting_8021x-test-setting-8021x.$(OBJEXT) +@ENABLE_TESTS_TRUE@am_test_setting_8021x_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test-setting-8021x.$(OBJEXT) test_setting_8021x_OBJECTS = $(am_test_setting_8021x_OBJECTS) @ENABLE_TESTS_TRUE@test_setting_8021x_DEPENDENCIES = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__test_settings_defaults_SOURCES_DIST = test-settings-defaults.c -@ENABLE_TESTS_TRUE@am_test_settings_defaults_OBJECTS = test_settings_defaults-test-settings-defaults.$(OBJEXT) +@ENABLE_TESTS_TRUE@am_test_settings_defaults_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test-settings-defaults.$(OBJEXT) test_settings_defaults_OBJECTS = $(am_test_settings_defaults_OBJECTS) @ENABLE_TESTS_TRUE@test_settings_defaults_DEPENDENCIES = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @@ -284,6 +284,7 @@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ DLLTOOL = @DLLTOOL@ +DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -306,6 +307,7 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -491,19 +493,17 @@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ @ENABLE_TESTS_TRUE@SUBDIRS = certs -@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@AM_CPPFLAGS = \ @ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ @ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ @ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ -@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) @ENABLE_TESTS_TRUE@test_settings_defaults_SOURCES = \ @ENABLE_TESTS_TRUE@ test-settings-defaults.c -@ENABLE_TESTS_TRUE@test_settings_defaults_CPPFLAGS = \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ -@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) - @ENABLE_TESTS_TRUE@test_settings_defaults_LDADD = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ @@ -512,9 +512,6 @@ with_resolvconf = @with_resolvconf@ @ENABLE_TESTS_TRUE@test_crypto_SOURCES = \ @ENABLE_TESTS_TRUE@ test-crypto.c -@ENABLE_TESTS_TRUE@test_crypto_CPPFLAGS = \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) - @ENABLE_TESTS_TRUE@test_crypto_LDADD = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libtest-crypto.la \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @@ -525,8 +522,7 @@ with_resolvconf = @with_resolvconf@ @ENABLE_TESTS_TRUE@test_secrets_CPPFLAGS = \ @ENABLE_TESTS_TRUE@ -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-util/tests/certs/\" \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ -@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) +@ENABLE_TESTS_TRUE@ $(AM_CPPFLAGS) @ENABLE_TESTS_TRUE@test_secrets_LDADD = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @@ -536,10 +532,6 @@ with_resolvconf = @with_resolvconf@ @ENABLE_TESTS_TRUE@test_general_SOURCES = \ @ENABLE_TESTS_TRUE@ test-general.c -@ENABLE_TESTS_TRUE@test_general_CPPFLAGS = \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ -@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) - @ENABLE_TESTS_TRUE@test_general_LDADD = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ @@ -548,10 +540,6 @@ with_resolvconf = @with_resolvconf@ @ENABLE_TESTS_TRUE@test_setting_8021x_SOURCES = \ @ENABLE_TESTS_TRUE@ test-setting-8021x.c -@ENABLE_TESTS_TRUE@test_setting_8021x_CPPFLAGS = \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ -@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) - @ENABLE_TESTS_TRUE@test_setting_8021x_LDADD = \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ @@ -627,11 +615,11 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_crypto-test-crypto.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_general-test-general.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-crypto.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-general.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setting-8021x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-settings-defaults.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_secrets-test-secrets.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_setting_8021x-test-setting-8021x.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_settings_defaults-test-settings-defaults.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -654,34 +642,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -test_crypto-test-crypto.o: test-crypto.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_crypto_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_crypto-test-crypto.o -MD -MP -MF $(DEPDIR)/test_crypto-test-crypto.Tpo -c -o test_crypto-test-crypto.o `test -f 'test-crypto.c' || echo '$(srcdir)/'`test-crypto.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-test-crypto.Tpo $(DEPDIR)/test_crypto-test-crypto.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-crypto.c' object='test_crypto-test-crypto.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_crypto_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_crypto-test-crypto.o `test -f 'test-crypto.c' || echo '$(srcdir)/'`test-crypto.c - -test_crypto-test-crypto.obj: test-crypto.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_crypto_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_crypto-test-crypto.obj -MD -MP -MF $(DEPDIR)/test_crypto-test-crypto.Tpo -c -o test_crypto-test-crypto.obj `if test -f 'test-crypto.c'; then $(CYGPATH_W) 'test-crypto.c'; else $(CYGPATH_W) '$(srcdir)/test-crypto.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-test-crypto.Tpo $(DEPDIR)/test_crypto-test-crypto.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-crypto.c' object='test_crypto-test-crypto.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_crypto_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_crypto-test-crypto.obj `if test -f 'test-crypto.c'; then $(CYGPATH_W) 'test-crypto.c'; else $(CYGPATH_W) '$(srcdir)/test-crypto.c'; fi` - -test_general-test-general.o: test-general.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_general_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_general-test-general.o -MD -MP -MF $(DEPDIR)/test_general-test-general.Tpo -c -o test_general-test-general.o `test -f 'test-general.c' || echo '$(srcdir)/'`test-general.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_general-test-general.Tpo $(DEPDIR)/test_general-test-general.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-general.c' object='test_general-test-general.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_general_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_general-test-general.o `test -f 'test-general.c' || echo '$(srcdir)/'`test-general.c - -test_general-test-general.obj: test-general.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_general_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_general-test-general.obj -MD -MP -MF $(DEPDIR)/test_general-test-general.Tpo -c -o test_general-test-general.obj `if test -f 'test-general.c'; then $(CYGPATH_W) 'test-general.c'; else $(CYGPATH_W) '$(srcdir)/test-general.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_general-test-general.Tpo $(DEPDIR)/test_general-test-general.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-general.c' object='test_general-test-general.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_general_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_general-test-general.obj `if test -f 'test-general.c'; then $(CYGPATH_W) 'test-general.c'; else $(CYGPATH_W) '$(srcdir)/test-general.c'; fi` - test_secrets-test-secrets.o: test-secrets.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_secrets_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_secrets-test-secrets.o -MD -MP -MF $(DEPDIR)/test_secrets-test-secrets.Tpo -c -o test_secrets-test-secrets.o `test -f 'test-secrets.c' || echo '$(srcdir)/'`test-secrets.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_secrets-test-secrets.Tpo $(DEPDIR)/test_secrets-test-secrets.Po @@ -696,34 +656,6 @@ test_secrets-test-secrets.obj: test-secrets.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_secrets_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_secrets-test-secrets.obj `if test -f 'test-secrets.c'; then $(CYGPATH_W) 'test-secrets.c'; else $(CYGPATH_W) '$(srcdir)/test-secrets.c'; fi` -test_setting_8021x-test-setting-8021x.o: test-setting-8021x.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_setting_8021x_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_setting_8021x-test-setting-8021x.o -MD -MP -MF $(DEPDIR)/test_setting_8021x-test-setting-8021x.Tpo -c -o test_setting_8021x-test-setting-8021x.o `test -f 'test-setting-8021x.c' || echo '$(srcdir)/'`test-setting-8021x.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_setting_8021x-test-setting-8021x.Tpo $(DEPDIR)/test_setting_8021x-test-setting-8021x.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-setting-8021x.c' object='test_setting_8021x-test-setting-8021x.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_setting_8021x_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_setting_8021x-test-setting-8021x.o `test -f 'test-setting-8021x.c' || echo '$(srcdir)/'`test-setting-8021x.c - -test_setting_8021x-test-setting-8021x.obj: test-setting-8021x.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_setting_8021x_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_setting_8021x-test-setting-8021x.obj -MD -MP -MF $(DEPDIR)/test_setting_8021x-test-setting-8021x.Tpo -c -o test_setting_8021x-test-setting-8021x.obj `if test -f 'test-setting-8021x.c'; then $(CYGPATH_W) 'test-setting-8021x.c'; else $(CYGPATH_W) '$(srcdir)/test-setting-8021x.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_setting_8021x-test-setting-8021x.Tpo $(DEPDIR)/test_setting_8021x-test-setting-8021x.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-setting-8021x.c' object='test_setting_8021x-test-setting-8021x.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_setting_8021x_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_setting_8021x-test-setting-8021x.obj `if test -f 'test-setting-8021x.c'; then $(CYGPATH_W) 'test-setting-8021x.c'; else $(CYGPATH_W) '$(srcdir)/test-setting-8021x.c'; fi` - -test_settings_defaults-test-settings-defaults.o: test-settings-defaults.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_settings_defaults_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_settings_defaults-test-settings-defaults.o -MD -MP -MF $(DEPDIR)/test_settings_defaults-test-settings-defaults.Tpo -c -o test_settings_defaults-test-settings-defaults.o `test -f 'test-settings-defaults.c' || echo '$(srcdir)/'`test-settings-defaults.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_settings_defaults-test-settings-defaults.Tpo $(DEPDIR)/test_settings_defaults-test-settings-defaults.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-settings-defaults.c' object='test_settings_defaults-test-settings-defaults.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_settings_defaults_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_settings_defaults-test-settings-defaults.o `test -f 'test-settings-defaults.c' || echo '$(srcdir)/'`test-settings-defaults.c - -test_settings_defaults-test-settings-defaults.obj: test-settings-defaults.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_settings_defaults_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_settings_defaults-test-settings-defaults.obj -MD -MP -MF $(DEPDIR)/test_settings_defaults-test-settings-defaults.Tpo -c -o test_settings_defaults-test-settings-defaults.obj `if test -f 'test-settings-defaults.c'; then $(CYGPATH_W) 'test-settings-defaults.c'; else $(CYGPATH_W) '$(srcdir)/test-settings-defaults.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_settings_defaults-test-settings-defaults.Tpo $(DEPDIR)/test_settings_defaults-test-settings-defaults.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-settings-defaults.c' object='test_settings_defaults-test-settings-defaults.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_settings_defaults_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_settings_defaults-test-settings-defaults.obj `if test -f 'test-settings-defaults.c'; then $(CYGPATH_W) 'test-settings-defaults.c'; else $(CYGPATH_W) '$(srcdir)/test-settings-defaults.c'; fi` - mostlyclean-libtool: -rm -f *.lo diff --git a/libnm-util/tests/certs/Makefile.in b/libnm-util/tests/certs/Makefile.in index 0b70b59c..e570aafd 100644 --- a/libnm-util/tests/certs/Makefile.in +++ b/libnm-util/tests/certs/Makefile.in @@ -160,6 +160,7 @@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ DLLTOOL = @DLLTOOL@ +DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -182,6 +183,7 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 9576f05a..20a99472 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -1363,6 +1363,66 @@ test_hwaddr_aton_malformed (void) } static void +test_ip4_prefix_to_netmask (void) +{ + int i; + + for (i = 0; i<=32; i++) { + guint32 netmask = nm_utils_ip4_prefix_to_netmask (i); + int plen = nm_utils_ip4_netmask_to_prefix (netmask); + + g_assert_cmpint (i, ==, plen); + { + guint32 msk = 0x80000000; + guint32 netmask2 = 0; + guint32 prefix = i; + while (prefix > 0) { + netmask2 |= msk; + msk >>= 1; + prefix--; + } + g_assert_cmpint (netmask, ==, (guint32) htonl (netmask2)); + } + } +} + +static void +test_ip4_netmask_to_prefix (void) +{ + int i, j; + + GRand *rand = g_rand_new (); + + g_rand_set_seed (rand, 1); + + for (i = 2; i<=32; i++) { + guint32 netmask = nm_utils_ip4_prefix_to_netmask (i); + guint32 netmask_lowest_bit = netmask & ~nm_utils_ip4_prefix_to_netmask (i-1); + + g_assert_cmpint (i, ==, nm_utils_ip4_netmask_to_prefix (netmask)); + + for (j = 0; j < 2*i; j++) { + guint32 r = g_rand_int (rand); + guint32 netmask_holey; + guint32 prefix_holey; + + netmask_holey = (netmask & r) | netmask_lowest_bit; + + if (netmask_holey == netmask) + continue; + + /* create an invalid netmask with holes and check that the function + * returns the longest prefix. */ + prefix_holey = nm_utils_ip4_netmask_to_prefix (netmask_holey); + + g_assert_cmpint (i, ==, prefix_holey); + } + } + + g_rand_free (rand); +} + +static void test_setting_old_uuid (void) { GError *error = NULL; @@ -1432,6 +1492,8 @@ int main (int argc, char **argv) test_hwaddr_aton_ib_normal (); test_hwaddr_aton_no_leading_zeros (); test_hwaddr_aton_malformed (); + test_ip4_prefix_to_netmask (); + test_ip4_netmask_to_prefix (); base = g_path_get_basename (argv[0]); fprintf (stdout, "%s: SUCCESS\n", base); |