Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
3aa41c6e17 libnm: merge hwaddr_aton() and nm_utils_hexstr2bin()
Have nm_utils_hexstr2bin() take over the allocated buffer
via g_bytes_new_take().
2016-11-28 10:06:27 +01:00
Thomas Haller
d7e535aee5 libnm/trivial: rename internal function _bin2str() 2016-11-28 08:50:35 +01:00
Thomas Haller
4cc2f8906c libnm: drop _bin2str() util
It was only used by two places, inline it.
2016-11-27 13:57:13 +01:00
Thomas Haller
542d1c257d libnm: implement nm_utils_bin2hexstr() via _bin2str_buf() 2016-11-27 13:54:23 +01:00
Thomas Haller
5ea2fc776c libnm/trivial: move code 2016-11-27 13:54:23 +01:00
Thomas Haller
8aead609b3 main: fix compiler warning about uninitialized auto variable in _init_nm_debug()
Fixes: c7d2e1f3bc
2016-11-25 20:17:58 +01:00
Francesco Giudici
0af0f167dd libnm-core: make normalizable ethernet_link properties _VERIFY_NORMALIZABLE
declassify bad combinations of auto-negotiate, duplex and speed
properties values from _VERIFY_NORMALIZABLE_ERRORS to
_VERIFY_NORMALIZABLE. This would preserve compatibility with legacy
nm-connection-editors.
2016-11-25 18:42:11 +01:00
Thomas Haller
9fce5ae0eb config: merge branch 'th/config-rh1397938'
https://bugzilla.redhat.com/show_bug.cgi?id=1397938
2016-11-25 18:04:35 +01:00
Thomas Haller
c7d2e1f3bc config: drop nm_config_get_debug() and access config directly 2016-11-25 18:02:38 +01:00
Thomas Haller
61c6ccaad4 config: drop nm_config_get_dhcp_client() and access config directly
Also, ifnet plugin would read the configuration value, which is just wrong
because:

  - the configuration might not be set and ifnet would fail to fallback
    to the compile time default.
  - the configuration only is in effect if the plugin is also available.
    Otherwise, we fallback to the next plugin.

Only the dhcp-manager knows which DHCP plugin is in use.
2016-11-25 18:02:38 +01:00
Thomas Haller
ff4cb2a1fc config: drop nm_config_get_auth_polkit() and access value directly 2016-11-25 18:02:38 +01:00
Thomas Haller
afcfa7be2b config/trivial: unify name of compile time config defaults 2016-11-25 18:02:38 +01:00
Thomas Haller
03f35e96de config: fix config merging default value for main.plugins
Since commit fb2ca0ce3d we would no longer pre-set the main.plugins
value in NMConfig's keyfile to recognize unset default settings.

This breaks with

  [main]
  plugins+=foo

which now results in

  main.plgin=foo

while previously it would have extended the compile time default.

https://bugzilla.redhat.com/show_bug.cgi?id=1397938

Fixes: fb2ca0ce3d
2016-11-25 18:02:38 +01:00
Thomas Haller
6689d0bf71 config: optionally let nm_config_get_plugins() return compile time default
Instead of having the caller do the fallback to the compile time default
plugins, let it be handled by nm_config_get_plugins().

The knowledge of fallback to a compile time default (and how to do that
properly) should be inside NMConfig/NMConfigData alone.

Also, as this function is only called once, let NMConfig not cache
the string list but create it once as needed.
2016-11-25 15:26:30 +01:00
Jiří Klimeš
544f7d3683 agent: don't clear "error", g_simple_async_result_take_error() overtakes it
From valgrind:
==21921== Invalid free() / delete / delete[] / realloc()
==21921==    at 0x4C2CD5A: free (vg_replace_malloc.c:530)
==21921==    by 0x81C4F2D: g_free (gmem.c:189)
==21921==    by 0x81AB021: g_error_free (gerror.c:491)
==21921==    by 0x81AB325: g_clear_error (gerror.c:674)
==21921==    by 0x767B555: reg_request_cb (nm-secret-agent-old.c:616)
==21921==    by 0x7A211F2: g_task_return_now (gtask.c:1107)
==21921==    by 0x7A21228: complete_in_idle_cb (gtask.c:1121)
==21921==    by 0x81BF6B9: g_main_dispatch (gmain.c:3154)
==21921==    by 0x81BF6B9: g_main_context_dispatch (gmain.c:3769)
==21921==    by 0x81BFA6F: g_main_context_iterate.isra.29 (gmain.c:3840)
==21921==    by 0x81BFB1B: g_main_context_iteration (gmain.c:3901)
==21921==    by 0x7A4748C: g_application_run (gapplication.c:2381)
==21921==    by 0x118AEF: main (main.c:81)

It caused memory corruption and may result in strange nm-applet crashes.
2016-11-25 14:31:47 +01:00
Francesco Giudici
5da352c5e8 ifupdown/trivial: whitespace fixup 2016-11-24 18:31:02 +01:00
Francesco Giudici
b029e92569 libnm-core: normalize ethernet_link properties when auto-negotiate is off
If auto-negotiate is switched off, enforce that both speed and duplex
are set or unset (which would mean "ignore"): if only one is set, reset
both silently and ignore link configuration.
2016-11-24 17:51:52 +01:00
Thomas Haller
d61c2264d4 build: merge branch 'th/build-cleanup' 2016-11-24 16:56:36 +01:00
Thomas Haller
a4224b9882 build: combine targets for nm-settings*.xml via pattern rule in Makefile.am 2016-11-24 16:55:17 +01:00
Thomas Haller
7864435c3c build: fix out-of-tree build to find common.ent for documentation
Need to pass --path to xsltproc to find common.ent in the
build-directory.

  $ git clean -fdx && NMTST_MAKE='V=1 -d' ./tools/test-build.sh man/nm-settings-ifcfg-rh.xml
2016-11-24 16:55:17 +01:00
Thomas Haller
5701febb16 build: avoid specifying man/nm-settings.xml paths multiple times
Don't repeat yourself. Aim to specify paths at few places.
2016-11-24 16:55:17 +01:00
Thomas Haller
020f4fb5ba build: combine pattern rule for makefiles 2016-11-24 16:55:17 +01:00
Thomas Haller
ab208d69da build: fix lookup "nm-settings-docs-overrides.xml" for out-of-tree build
When building "libnm/nm-settings-docs.xml", we require
"nm-settings-docs-overrides.xml". As we dist the overrides files,
we must consult VPATH to locate the proper version of the file.
2016-11-24 16:55:00 +01:00
Thomas Haller
2ac6c5a981 build: rename intermediate doc xmls
Allows to use pattern rules by making the
related files having a common naming scheme.

This commit only renames files.
2016-11-24 16:54:17 +01:00
Thomas Haller
ec4a1b7540 build: avoid some uses of BUILT_SOURCES in Makefile.am
BUILT_SOURCES only matters during `make all`, `make check`
and `make install`.

It would be nice to be able to build every target specifically
from an empty git-tree.

Drop the use of BUILT_SOURCES where we already have the explicit
dependencies declared.
2016-11-24 16:52:27 +01:00
Thomas Haller
99bf51d3c7 build: add explicit dependency objects to generated source files
BUILT_DIR only matters during `make all` and `make check`.
2016-11-24 15:59:27 +01:00
Thomas Haller
53496b3bb7 build: don't use $(top_*dir) in Makefile.am
It's the same as the current directory. For consistency
don't use the "top_" prefix.
2016-11-24 15:59:27 +01:00
Thomas Haller
a332e17f6b build: consistently use $() instead of ${} in Makefile.am 2016-11-24 15:59:27 +01:00
Thomas Haller
063bacdb84 build: drop $(top_builddir) for referring to libnm/libnm.la 2016-11-24 15:59:27 +01:00
Thomas Haller
d38e5c3b38 tools: add test script to build various configurations
Script to schedule out-of-tree builds
2016-11-24 15:59:27 +01:00
Thomas Haller
33e8da438e build: enable --with-introspection in default configure options of autogen.sh 2016-11-24 15:59:19 +01:00
Lubomir Rintel
743d372d72 libnm/vpn-service-plugin: transition to STOPPED state from INIT too
We may want to stop the plugin before we started connecting e.g. when the
plugin NeedsSecrets but we can't supply them.
2016-11-24 14:13:13 +01:00
Thomas Haller
7729d85c8c contrib/rpm: let RPM package own %{systemd_dir}/network-online.target.wants
# rpm -qf /usr/lib/systemd/system/network-online.target.wants/NetworkManager-wait-online.service
  NetworkManager-1.5.2-16352.e0c50a9703.fc24.x86_64
  # rpm -qf /usr/lib/systemd/system/network-online.target.wants
  file /usr/lib/systemd/system/network-online.target.wants is not owned by any package
2016-11-24 12:57:27 +01:00
Lubomir Rintel
88f3f29882 build: install the D-Bus introspection data
This would make it easier to develop against NetworkManager D-Bus API.
2016-11-23 15:43:42 +01:00
Lubomir Rintel
972e0d2803 all: rename the introspection data to use the interface paths in names
This makes it easier to install the files with proper names.
Also, it makes the makefile rules slightly simpler.

Lastly, the documentation is now generated into docs/api, which makes it
possible to get rid of the awkward relative file names in docbook.
2016-11-23 15:43:42 +01:00
Francesco Giudici
0ce7da1e22 libnm-core: remove INFERRABLE flag from dhcp-hostname property
When assuming a dhcp connection don't consider the DHCP "Host Name"
Option (12) passed in the DHCP request for the match of the available
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1393997
2016-11-23 09:13:35 +01:00
Francesco Giudici
e0c50a9703 merge: branch 'fg/802-3-prop_rh1353612_II'
https://bugzilla.redhat.com/show_bug.cgi?id=1353612
2016-11-22 15:28:23 +01:00
Thomas Haller
d5a743a619 core: merge NM_PLATFORM_LINK_DUPLEX_UNSET and UNKNOWN
They have basically the same use, except that certain places handled
one but not the other.
2016-11-22 15:24:47 +01:00
Thomas Haller
417f5ad6ed libnm-core: refactor NMSettingWired:verify() to use NM_IN_STRSET() 2016-11-22 15:24:47 +01:00
Francesco Giudici
3bcca564c7 ifcfg-rh/tests: add tests for link negotiation options
Thanks to Thomas Haller for making test code much more compact taking
advantage of the nmtst_create_minimal_connection function.
2016-11-22 15:24:47 +01:00
Francesco Giudici
173819b73d device/ethernet: check and apply link negotiation properties
This will allow to enforce link mode (autonegotiation, speed and duplex)
as specified in 802-3-ethernet properties.
2016-11-22 15:24:47 +01:00
Francesco Giudici
61faa5080e nm-device-ethernet: refactor act_stage1_prepare code
Refactored the code a bit without changing functionality: let the function
immediately return on error.
2016-11-22 15:24:47 +01:00
Francesco Giudici
16fdef33dd nmcli: add get functions for 802-3.speed and 802-3.duplex properties 2016-11-22 15:24:47 +01:00
Francesco Giudici
e196137f3a nmcli: enable set on 802-3 properties 2016-11-22 15:24:47 +01:00
Francesco Giudici
12b9d30ae6 ifcfg-rh: add support to 802-3.[auto-negotiate,speed,duplex] properties
NOTE: changed the default value for auto-negotiate from TRUE to FALSE.

Normalization enforces that no values for speed and duplex are there
when autonegotiation is on. This is required as autoneg on with specific
speed and duplex set means to ethtool to use autonegotiation but
advertise that specific speed and duplex only.

autoneg off, speed 0 and duplex NULL means to ignore link negotiation.
2016-11-22 15:24:47 +01:00
Francesco Giudici
de88a46775 ifcfg-rh: rework ETHTOOL_OPT parsing function
This would allow to make easier adding support to more ETHTOOL options.
2016-11-22 15:24:47 +01:00
Francesco Giudici
ab0954b0e5 platform: add APIs to allow link negotiation management
Added platform functions to retrieve device link mode status and to
switch from auto to manual link negotiation:
nm_platform_ethtool_get_link_settings
nm_platform_ethtool_set_link_settings
2016-11-22 15:24:47 +01:00
Thomas Haller
7b16b28a62 build: merge branch 'th/build-cleanup' 2016-11-22 11:04:37 +01:00
Thomas Haller
f1017b7f69 build: move setting install_manpages variable 2016-11-22 11:00:49 +01:00
Thomas Haller
269c2afee8 build: don't consider clients/cli/settings-docs.c for SETTING_DOCS_AVAILABLE
"clients/cli/settings-docs.c" is only required for nmcli. Makefile.am will
check for the existance of the file during the build.

It doesn't matter for SETTING_DOCS_AVAILABLE.
2016-11-22 11:00:49 +01:00