Commit Graph

992 Commits

Author SHA1 Message Date
Dan Winship
b9fef07fff libnm-util: remove NM_UTIL_PRIVATE_CALL, NMSettingIP4Config:address-labels
Since libnm-util is no longer used from within NM, its copy of
NM_UTIL_PRIVATE_CALL is now useless, and the internal-only
NMSettingIP4Config:address-labels property is no longer needed.
2014-08-01 14:34:05 -04:00
Thomas Haller
b835111129 libnm-util, core: fix warning about signed integer overflow (-Wstrict-overflow)
gcc warns:

    make[4]: Entering directory `./NetworkManager/libnm-util'
      CC       nm-value-transforms.lo
    nm-value-transforms.c: In function '_nm_utils_convert_op_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^
    nm-value-transforms.c: In function '_nm_utils_convert_string_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^

    make[7]: Entering directory `./NetworkManager/src/settings/plugins/ifcfg-rh'
      CC       reader.lo
    reader.c: In function 'make_wired_setting':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^
    reader.c: In function 'wireless_connection_from_ifcfg':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Thomas Haller
22ca469011 libnm-util: fix warning converting between enum types in nm-setting-8021x.c
clang warns:

    make[4]: Entering directory `./NetworkManager/libnm-util'
      CC       nm-setting-8021x.lo
    nm-setting-8021x.c:1824:17: error: implicit conversion from enumeration type 'NMCryptoFileFormat' to different enumeration type 'NMSetting8021xCKFormat' [-Werror,-Wenum-conversion]
                    *out_format = format;
                                ~ ^~~~~~
    nm-setting-8021x.c:2135:17: error: implicit conversion from enumeration type 'NMCryptoFileFormat' to different enumeration type 'NMSetting8021xCKFormat' [-Werror,-Wenum-conversion]
                    *out_format = format;
                                ~ ^~~~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:16:59 +02:00
Dan Williams
fa809c2636 build: clean nm-version.h
Now that nm-version.h.in lives in libnm-util/, a stale nm-version.h
from include/ messes up the build with errors about NM_VERSION_*.
Clean both old & new nm-version.h on 'make clean' so that we can
switch branches between nm-0-9-8, nm-0-9-10, and git master and
just run 'make clean' and get things to work.
2014-07-31 21:31:20 -05:00
Dan Winship
1c7e3d85fc libnm-util: fix enum member names in a gtk-doc comment 2014-07-23 17:18:03 -04:00
Dan Winship
7d1e0c3781 libnm-util: fix gtk-doc syntax in nm-version.h to avoid a warning 2014-07-23 17:18:03 -04:00
Thomas Haller
ac4fafe7a4 platform: assert against the maximum length of link_get_address()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-23 12:42:45 -05:00
Jiří Klimeš
4c36ff7062 include: add NM_DEVICE_CAP_IS_SOFTWARE capability
for marking software devices.
2014-07-22 14:24:42 +02:00
Thomas Haller
2fdaa29f08 libnm-util: fix leak in _nm_connection_verify()
Regression introduced by commit 2570c5a17c.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-15 21:57:34 +02:00
Dan Winship
30c74c6007 build: more srcdir!=builddir fixes
nm-version.h was getting disted, making srcdir!=builddir work for
tarball builds, but not for git builds.

Also, remove "-I${top_builddir}/include" from all Makefile.ams, since
there's nothing generated in include/ any more.
2014-07-15 11:37:19 -04:00
Dan Winship
6e51e460df libnm-util: NetworkManager.h/NetworkManagerVPN.h doc fixups
Add gtk-docs for enum types that previously didn't have them.

Explicitly note the relationship between NetworkManager.h /
NetworkManagerVPN.h types and the corresponding introspection/*.xml
types.
2014-07-15 09:44:55 -04:00
Dan Winship
2570c5a17c libnm-util, libnm-glib: whitespace fixes
Fix indentation, kill trailing whitespace, split some long lines.
2014-07-15 09:44:55 -04:00
Dan Winship
cb7e1893e7 libnm-util, libnm-glib: standardize copyright/license headers
- Remove list of authors from files that had them; these serve no
  purpose except to quickly get out of date (and were only used in
  libnm-util and not libnm-glib anyway).

- Just say "Copyright", not "(C) Copyright" or "Copyright (C)"

- Put copyright statement after the license, not before

- Remove "NetworkManager - Network link manager" from the few files
  that contained it, and "libnm_glib -- Access network status &
  information from glib applications" from the many files that
  contained it.

- Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
  to files that were missing it.
2014-07-15 09:44:54 -04:00
Dan Winship
4223fa47e4 libnm-util, libnm-glib: tweak (element-type) annotations in docs
g-i allows you to specify types in annotations using either their
fully-qualified introspected names (eg, "NMClient.Device") or their
plain C names ("NMDevice"). Switch from the former to the latter (so
that they'll still be correct when migrated to libnm later).
2014-07-15 09:44:54 -04:00
Dan Winship
7eb0288aa0 libnm-util: move NetworkManager.h, etc, from include/ to here
NetworkManager.h, NetworkManagerVPN.h, and nm-version.h are part of
the libnm-util API, so move them to libnm-util.

include/ still contains headers that are strictly NM-internal (eg,
nm-glib-compat.h).
2014-07-15 09:44:54 -04:00
Dan Winship
09da178639 libnm-util: fix build with --with-crypto=gnutls
The non-"_t"-suffixed type names in gnutls have been deprecated since
1.x, and in recent versions will trigger deprecation warnings. Fix by
using "gnutls_datum_t" instead of "gnutls_datum".
2014-07-11 12:09:39 -04:00
Dan Winship
da25a788fa trivial: add a missing word to documentation 2014-07-07 14:04:51 -04:00
Thomas Haller
63070fff02 build: call generate-setting-docs.py directly instead of through strace
This was added for debugging, but is no longer necessary.
Also, strace might not be installed on any system so don't depend on it.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-04 13:43:59 +02:00
Dan Williams
6cb6d39725 libnm-util: merge nm-util-private and nm-utils-private
No reason to have two differently named files for the
same general purpose.
2014-07-02 13:33:58 -05:00
Dan Williams
2428401f5e docs: fix multi-line Since notation 2014-07-01 15:47:54 -05:00
Thomas Haller
29d538239f libnm-util: normalize IP settings in connection
This is the same behaviour as nm_utils_normalize_connection(),
which will soon be removed in favor of nm_connection_normalize().

This takes care, that normal connections always have an IP4 and IP6 setting,
and that slave connections never have it.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 18:35:46 +02:00
Thomas Haller
794ed1c9ef libnm-util: validate master/slave-type property in NMSettingConnection::verify()
- Before, when setting the slave-type to an invalid type, the setting
  was silently accepted. Now verification fails with "Unknown slave type '%s'"

- Before, the @master property was not checked. So you could have a @slave-type,
  without having @master set. And similarly, you could have @master, but
  no @slave-type. Fix both issues.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 18:35:46 +02:00
Thomas Haller
2deaa5397a libnm-util: normalize virtual_iface_name in NMSettings
Some type-specific NMSetting implementations (bond, bridge, team, vlan)
have their own 'interface-name' property. This property will be
deprecated in favour of 'interface-name' in NMSettingConnection.

Change verify() and normalize() to check that the redundant
values match and repair/normalize the properties.

Force the virtual interface name of the type-specific setting to be
equal to NMSettingConnection:interface_name. This way, the depreacted
field stays valid and backward compatible.

NMSettingInfiniband is special, because it does not have a backing
property for the interface name, although it implements
get_virtual_iface_name(). To account for this, some special handling
is needed in order not to change the behaviour of get_virtual_iface_name().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 18:35:46 +02:00
Thomas Haller
de5656a570 libnm-util: add function nm_connection_normalize
This function behaves like verify(), but it also performs some
normalization/fixing of inconsistent connections.

Contrary to verify(), this function might modify the settings.
This will be mainly used, to repair connections from older versions
and to fix deprecated options.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 18:35:46 +02:00
Thomas Haller
542f1fe3c9 test: nm_connection_verify() sets the interface-name to virtual_iface_name.
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 18:35:16 +02:00
Thomas Haller
28169725d7 libnm-util: add function nm_connection_get_interface_name()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 18:35:16 +02:00
Thomas Haller
2469601a0e build: 'nm-setting-docs.xml' must depend on 'NetworkManager-1.0.typelib'
Build of 'nm-setting-docs.xml' must depend on 'NetworkManager-1.0.typelib', otherwise
'NetworkManager-1.0.typelib' is not yet created and './generate-setting-docs.py'
fails.

  g-ir-scanner: compile: gcc -Wall -Wno-deprecated-declarations -pthread -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -std=gnu89 -g -Og -Wshadow -Wmissing-declarations -Wmiss
  g-ir-scanner: link: /bin/sh ../libtool --mode=link --tag=CC gcc -o /NetworkManager/libnm-util/tmp-introspectEda05I/NetworkManager-1.0 -export-dynamic -Wall -std=gnu89 -g -Og -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wdeclarat
  libtool: link: gcc -o /NetworkManager/libnm-util/tmp-introspectEda05I/.libs/NetworkManager-1.0 -Wall -std=gnu89 -g -Og -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wformat-security -Wfloat-equal -Wn
  export GI_TYPELIB_PATH=/NetworkManager/libnm-util${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}; \
  export LD_LIBRARY_PATH=/NetworkManager/libnm-util/.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}; \
  strace -o /tmp/strace.out ./generate-setting-docs.py \
          --gir ./NetworkManager-1.0.gir \
          --output nm-setting-docs.xml
  ERROR:root:Could not find any typelib for NetworkManager
  Traceback (most recent call last):
    File "./generate-setting-docs.py", line 19, in <module>
      from gi.repository import NetworkManager, GObject
  ImportError: cannot import name NetworkManager
  make[4]: *** [nm-setting-docs.xml] Error 1

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-30 17:42:08 +02:00
Dan Winship
9f82c16557 libnm-util: build nm-setting-docs.xml against uninstalled libnm-util
Set GI_TYPELIB_PATH and LD_LIBRARY_PATH so that we build
nm-setting-docs.xml against the just-built typelib and .so, not the
installed ones.
2014-06-27 17:24:58 -04:00
Dan Winship
377f72a66f build: fix nm-setting-docs build in various configurations
Certain build configurations (like --enable-gtk-doc
--disable-introspection) were broken with respect to nm-setting-docs.
Fix this. Also, we don't require just gobject-introspection, we need
pygobject specifically as well.
2014-06-27 17:24:57 -04:00
Dan Williams
c3e8ddf075 build: fix multiple definitions of DISTCLEANFILES
Multiple definitions added by dcc109516d
2014-06-26 11:38:30 -05:00
Jiří Klimeš
214f523f3f libnm-util: document "address-labels" property as for internal use only 2014-06-26 14:56:22 +02:00
Dan Winship
aa1dce6da2 all: remove remaining GParamSpec name/blurb strings
Remove all remaining GParamSpec name and blurb strings (and fix
indentation while we're there), and add G_PARAM_STATIC_STRINGS to all
paramspecs that were lacking it.
2014-06-19 17:45:03 -04:00
Dan Winship
cdc15cb2a6 libnm-util: remove NMSetting* GParamSpec docs
Remove all the GParamSpec docs, since everything now uses the gtk-doc
docs instead, so there's no point in having two copies of each (which
are often out of sync anyway).

Since we're touching so many lines anyway, also fix up the indentation
of the remaining property-installing lines, and add
G_PARAM_STATIC_STRINGS to each paramspec (so the nick strings don't
get strduped). Also, be consistent about starting a new line between
"g_object_class_install_property" and its opening parenthesis.
2014-06-19 17:45:03 -04:00
Dan Winship
dcc109516d libnm-util: build nm-setting-docs.xml from gtk-doc and GParamSpecs
Add generate-setting-docs.py, based on tools/generate-settings-spec.c,
which generates a simple XML file describing all libnm setting
properties (still getting the default values via GParamSpec
introspection like generate-settings-spec.c does, but getting the
documentation out of the gtk-doc strings in the GIR file instead).
2014-06-19 17:45:02 -04:00
Dan Winship
e8577083ca libnm-util: various NMSetting* property doc fixes/improvements
Fix up various issues with the docs for the NMSetting properties, and
pull in text from the GParamSpec docs where the GParamSpec docs were
better (or contained information that is necessary in the context of
nm-settings.5).

Also, consistently wrap all of the doc comments to the same width (80
columns).
2014-06-19 17:45:02 -04:00
Dan Winship
9de24b16e8 libnm-util: fix gtk-doc bugs in NMSetting* properties
Fix misused gtk-doc annotations and incorrectly-identified properties.

In particular, the upcoming introspection-based generate-settings-spec
expands macro and enum values, so if you use '%' where you should have
used '#', it will fail to find an expansion, and error out.
2014-06-19 17:45:02 -04:00
Dan Winship
8487a4490c libnm-util, libnm-glib: be consistent about "Wi-Fi", "Ethernet", "InfiniBand" in docs
We made the UIs consistent last year, but missed the documentation.
Fix the docs to also consistently use "Wi-Fi" rather than "WiFi",
"Wifi", "wifi", or "WiFI"; "Ethernet" rather than "ethernet"; and
"InfiniBand" rather than "Infiniband".
2014-06-19 17:45:01 -04:00
Dan Winship
3c13d9e3fd misc: remove some dead code
The G_DISABLE_CHECKS version of g_return_if_reached() still returns,
it just doesn't log. So don't include a manual return after a
return-if-reached.
2014-06-12 17:13:56 -04:00
Jiří Klimeš
1b55014468 libnm-util: don't append NULL in g_string_append() 2014-06-09 10:36:54 +02:00
Dan Williams
5e9904f451 libnm-util: bump soname (2.5.0 -> 2.6.0) for added API 2014-06-06 18:28:20 -05:00
Dan Williams
9433a0bfe0 libnm-util: fix an error noticed by coverity 2014-06-06 17:25:36 -05:00
Thomas Haller
48b5ba7cea nmtst: add NMTST_DEBUG=no-expect-message for debugging assert_message tests
Some tests want to assert against the messages logged using g_test_expect_message().
In this mode, nmtst will not log anything itself.

Interpret the option no-expect-message which turns g_test_expect_message()
into a NOP and turns logging on. The use of this is for debugging such
tests, without asserting against the messages but printing them instead.

For tests that are not in the assert_message mode, the option has no
effect.

Example:
  NMTST_DEBUG=debug,no-expect-message make -C src/settings/plugins/keyfile/tests/ check

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:58 +02:00
Thomas Haller
ed868a388b core: add compatibility wrapper for g_test_skip() to nm-glib-compat.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Thomas Haller
8af001eae4 nmtst: combine files nm-test-helpers.h and nm-test-utils.h
Move the content of nm-test-helpers.h to nm-test-utils.h
which completly replaces the older file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
a268b825d7 nmtst: move header file to include/ directory
https://bugzilla.gnome.org/show_bug.cgi?id=706293

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
d2ac129d65 nmtst: g_type_init() has been deprecated in GLib 2.35.0
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Dan Winship
d47b749a75 libnm-utils: remove INFERRABLE flag from properties we don't actually infer
ipv4.never-default, ipv4.may-fail, and ipv6.privacy were marked
INFERRABLE, but NMIP4Config / NMIP6Config didn't actually infer them,
so they could cause connections to not match themselves after a
restart.

(Found while debugging https://bugzilla.redhat.com/show_bug.cgi?id=1086237,
though this is not actually the problem there.)

Related: rh#1086237
2014-06-04 11:23:54 -04:00
Thomas Haller
891eb83f45 libnm-util: add property NM_SETTING_BRIDGE_MAC_ADDRESS to NMSettingBridge
https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:02:31 +02:00
Thomas Haller
fedf7ca303 libnm-util: optimize nm_utils_hwaddr_ntoa_len()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:20 +02:00
Thomas Haller
3cda194b44 libnm-util: make hwaddr functions more robust against invalid arguments
- nm_utils_hwaddr_len() and nm_utils_hwaddr_type() no longer assert
  against known input types/lengths. Now they can be used to detect the
  hwaddr type, returning -1 on unknown.
- more checking of input arguments in nm_utils_hwaddr_aton() and
  related. Also note, that nm_utils_hwaddr_aton_len() has @len of type
  gsize, so we cannot pass on the output of nm_utils_hwaddr_len()
  without checking for -1.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-29 19:00:59 +02:00