Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
e36f6a7e52 libnm: add nm_utils_uuid_generate_buf() util 2016-11-09 12:07:33 +01:00
Thomas Haller
37bf643213 libnm: don't initialize buffer for uuid_unparse_lower() with zeros 2016-11-09 12:07:33 +01:00
Thomas Haller
fedee13c37 libnm: refactor loop in crypto_md5_hash()
Break the loop in the middle and avoid g_checksum_reset() call.
In many cases, we only want one MD5 sum, not a longer digest.
2016-11-09 12:07:33 +01:00
Thomas Haller
30c66b6f79 libnm: disable assertions in crypto_md5_hash() in non-debug builds 2016-11-09 11:42:56 +01:00
Thomas Haller
e028edd1c5 libnm/trivial: fix code comment for internal header libnm/nm-manager.h 2016-11-08 14:27:07 +01:00
Beniamino Galvani
7aa936109f dhcp: merge branch 'bg/dhclient-dup-reqlist-bgo773571'
https://bugzilla.gnome.org/show_bug.cgi?id=773571
2016-11-08 13:41:26 +01:00
Beniamino Galvani
2049e97d9e dhcp: refactor parsing of 'request' and 'also request' options
Refactor the code to be simpler and use a single list for both
'request' and 'also request' statements. This also has the advantage
that we can properly handle 'request' statements and reset the list of
options instead of appending to it.
2016-11-08 13:40:12 +01:00
trulyliu
bbc28a2f97 dhcp: do not add 'also request' DHCP option to generated dhclient config file
if the option already exists in original config file 'request' section.

https://bugzilla.gnome.org/show_bug.cgi?id=773571
2016-11-08 13:40:12 +01:00
Thomas Haller
c9209093b4 contrib/rpm: put translations in NetworkManager-libnm and NetworkManager-glib packages
One can install the libraries without NetworkManager. Thus, the
translations should be there.

Doing this increases the package size of the libraries significantly.

For a user who only has libnm without NetworkManager installed, this
is acceptable, because the whole point of the change is to ensure such
a user also gets translations.

For a user who requires libnm and libnm-glib packages, this
unfortunately increases the additional package size as the translations
are now present twice.

What would be better is if NetworkManager-libnm would only contain
translations for libnm/NetworkManager, and NetworkManager-glib only
translations for libnm-util/libnm-glib.
2016-11-08 10:21:44 +01:00
Beniamino Galvani
084da69a30 manager: force connectivity check when there is a default active connection
The interaction between the manager state and connectivity check code
is tricky. When there is an active connection with a default route and
NMConnectivity reports full connectivity, we set the CONNECTED_GLOBAL
state. However, if the connectivity check hasn't run yet, we stay in
CONNECTED_SITE state. If there are also other connections that are
activating, the state is set to CONNECTING.

This is a problem, because in CONNECTING we never run the connectivity
check and thus we fail to recognize that there is full connectivity
until a periodic check is run.

To solve this, schedule the connectivity check every time there is an
active connection with default route, even if other connection are
still activating, so that the check result can make the state progress
to CONNECTED_GLOBAL.
2016-11-07 14:22:14 +01:00
Beniamino Galvani
948a183d48 device: merge branch 'bg/sw-devices-cloned-mac-rh1386872'
Honor the ethernet.cloned-mac-address property for bond and bridge
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1386872
2016-11-07 14:12:24 +01:00
Beniamino Galvani
06418b2034 bond: support the ethernet.cloned-mac-address property 2016-11-07 14:06:50 +01:00
Beniamino Galvani
f1d595d129 bridge: support the ethernet.cloned-mac-address property 2016-11-07 14:06:50 +01:00
Beniamino Galvani
67ea41f0a0 device: add @set_permanent argument to nm_device_hw_addr_set()
In a later commit the function will be used to restore a MAC address
without changing its type.
2016-11-07 14:06:44 +01:00
Lubomir Rintel
1cc4ff3716 tools: fix the create-exports script on 32-bit 2016-11-06 15:36:24 +01:00
Lubomir Rintel
9d31cc916f Revert "contrib/rpm: regenerate the linker version script NetworkManager.ver while building the package"
Back this out. It breaks i686 build unnecessarily now and also is
something that proabably that should run on distcheck and not package
build.

This reverts commit cf678811b5.
2016-11-06 15:19:16 +01:00
Lubomir Rintel
af96d0bf82 release: bump version to 1.5.2 (development) 2016-11-06 14:12:11 +01:00
Beniamino Galvani
f37af130c1 build: remove spurious trailing comma from configure.ac
Fixes the following message when running configure:

./configure: line 26830: ,: command not found

Fixes: cd98705d21
2016-11-05 16:13:49 +01:00
Lubomir Rintel
9e4232dbe6 build: set correct path to common.ent for out-of-tree builds
Otherwise the docbook files won't be able to expand the macros such as
version or build-time configurable paths.
2016-11-04 12:29:55 +01:00
Lubomir Rintel
9bd0ea7954 contrib/rpm: drop dhclient requirement
We fall back to the internal client for the very minimal installations.
Based on: 209b5a57fd
2016-11-03 17:56:38 +01:00
Lubomir Rintel
bcb158e1bc NEWS: update for a development snapshot 2016-11-03 17:56:13 +01:00
Lubomir Rintel
bcad38ac31 man: use /run instead of /var/run
/var/run is just a compatibility symlink, according to file-hierarchy(7).
2016-11-03 17:56:13 +01:00
Lubomir Rintel
b8785c8c3c Revert "contrib/rpm: add NetworkManager-config-dhcp-dhclient package"
This probably needs more discussion, maybe there's a better solution
than a separate RPM package for a single line of configuration.

Related: https://pagure.io/fedora-comps/pull-request/62

This reverts commit 209b5a57fd.
2016-11-03 17:56:13 +01:00
Thomas Haller
7491e51ac0 config: print default value of main.dhcp with --print-config 2016-11-03 17:50:13 +01:00
Lubomir Rintel
dcc13cfcd8 contrib/rpm: drop udev dependency
We happily run in containers without udev.
2016-11-03 16:01:23 +01:00
Lubomir Rintel
ef0a68b942 contrib/rpm: drop iptables and dnsmasq dependencies
We just fail ipv4.method=shared without it, no need to drag it in for
configurations that don't share IPv4.
2016-11-03 16:01:23 +01:00
Lubomir Rintel
64770ee518 contrib/rpm: drop explicit readline dependency
RPM auto-generates a SONAME dependency.
2016-11-03 16:01:23 +01:00
Lubomir Rintel
5f4be85742 contrib/rpm: drop iproute dependency
We don't actually ever need it.
2016-11-03 16:01:23 +01:00
Thomas Haller
4be9b4a2cb build: move policy file from "policy/" to "data/" 2016-11-03 14:18:23 +01:00
Thomas Haller
e2b93beb83 build: fix vala build of libnm.vapi
make[2]: Entering directory './NetworkManager/NetworkManager-1.5.1/_build/sub'
     VAPIGEN vapi/libnm.vapi
    Gio-2.0.gir:62318.7-62318.47: warning: Virtual method `G.Resolver.lookup_service_async' conflicts with method of the same name
    Gio-2.0.gir:64704.7-64704.31: warning: Signal `G.Settings.change_event' conflicts with method of the same name
    Gio-2.0.gir:84847.7-84851.24: error: `UnixSocketAddress' already contains a definition for `abstract'
    Gio-2.0.gir:84690.7-84692.21: note: previous definition of `abstract' was here
    Makefile:16410: recipe for target 'vapi/libnm.vapi' failed

Fixes: 0fa2cf19e5
2016-11-03 14:18:23 +01:00
Thomas Haller
3be57bfba1 build: fix dist-ing vapi/NM-1.0.metadata
Fixes: 0fa2cf19e5
2016-11-03 14:00:21 +01:00
Thomas Haller
5058c49a83 build: fix dist-ing vapi/libnm.deps
Fixes: 0fa2cf19e5
2016-11-03 13:49:13 +01:00
Thomas Haller
0fa2cf19e5 vapi: add vapi NM-1.0 for libnm
Initial vala API for libnm. Consider it unstable, it probably needs
improvements.

https://bugzilla.gnome.org/show_bug.cgi?id=773588
2016-11-03 10:15:42 +01:00
Thomas Haller
207c855348 man: clarify behavior of "ip4"/"ip6" alias to nmcli 2016-11-02 18:31:12 +01:00
Thomas Haller
64ed277380 libnm-core: minor cleanups in nm-setting-vlan.c
Don't g_warn() from within the library. It's not clear
that the caller did something wrong, we shouldn't issue
glog warnings.
2016-11-02 15:22:59 +01:00
Thomas Haller
f23320478d libnm-core: fix memleak in nm-setting-vlan.c (priority_strv_to_maplist()) 2016-11-02 15:21:25 +01:00
Thomas Haller
5789bfa5d9 shared: minor cleanup in _nm_utils_ascii_str_to_int64() using const pointer 2016-11-02 12:04:49 +01:00
Beniamino Galvani
bc26f94d1e ppp: add counter to D-Bus object path for PPP manager instances
There can be multiple PPP connections active, each with its own PPP
manager.

Fixes: c1dd3b6eed
2016-11-02 11:21:49 +01:00
Thomas Haller
354fc51bc6 tools: improve handling arguments to run-nm-test.sh
- add _is_true function so that user can set argument
  environment variables to yes|y|1 etc.

- fix NMTST_CHANGE_DIRECTORY
2016-11-01 18:51:30 +01:00
Thomas Haller
a412ee419b tools: improve --make-first option of test runner to handle relative test paths
With --make-first|-m we first call `make` on the test.
However, the make path must be a relative path rooted
in the top directory.

Make sure we `cd` into the parent directory first and pass
the proper make path.

  cd src
  ../tools/run-nm-test.sh -m settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
2016-11-01 18:29:42 +01:00
Thomas Haller
d35a6fe524 tools: add option to test runner to build test before running it
./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
2016-11-01 16:51:43 +01:00
Thomas Haller
dbafd2ce50 tools: improve controlling whether to run run-nm-test.sh with valgrind
Use new environment variable NMTST_USE_VALGRIND. It works both
from `make check` and during explicit invocation of the test
runner.
2016-11-01 16:46:40 +01:00
Beniamino Galvani
58482a8fec team: fix wrong g_object_set() when updating connections
Fixes: 16a6991b90

https://bugzilla.redhat.com/show_bug.cgi?id=1390106
2016-10-31 10:12:08 +01:00
Thomas Haller
e2b7da7b82 device: merge branch 'th/preserve-fake-perm-hwaddr-bgo772880'
https://bugzilla.gnome.org/show_bug.cgi?id=772880
https://bugzilla.redhat.com/show_bug.cgi?id=1388286
2016-10-28 17:17:03 +02:00
Thomas Haller
0e0018c801 device: suppress log message in nm_device_update_hw_address() when no MAC address
For example for tun devices we get a lot of

  (tun7): hw-addr: failed reading current MAC address

warnings. Just be silent about it. We log when something
changes, we don't need to log when we fail to obtain
a MAC address.

Thereby, refactor nm_device_update_hw_address() to return early.
2016-10-28 17:06:13 +02:00
Thomas Haller
31ca7962f8 device: don't evaluate IP config changes until device is initialized
The unmanaged flags PLATFORM_INIT indicates whether UDEV is done
initializing the device. We should not handle IP config changes
before that pointer.

This avoids codepaths that require the permanent MAC address of the
device. We should not freeze the permanent MAC address before
UDEV initialized the device, for two reasons:

- getting the permanent MAC address using ethtool is racy as
  UDEV might still rename the interface.
- freezing a fake permanent MAC address should only happen after
  UDEV is done configuring the MAC address of software devices.

    #0  0x000055555568bc7a in nm_device_update_permanent_hw_address (self=self@entry=0x555555f0fb70 [NMDeviceVeth], force_freeze=force_freeze@entry=1) at src/devices/nm-device.c:11817
    #1  0x000055555568c443 in nm_device_get_permanent_hw_address_full (self=self@entry=0x555555f0fb70 [NMDeviceVeth], force_freeze=force_freeze@entry=1, out_is_fake=out_is_fake@entry=0x0)
        at src/devices/nm-device.c:12227
    #2  0x000055555568cb06 in nm_device_get_permanent_hw_address (self=self@entry=0x555555f0fb70 [NMDeviceVeth]) at src/devices/nm-device.c:12237
    #3  0x000055555568cb50 in spec_match_list (self=0x555555f0fb70 [NMDeviceVeth], specs=0x555555a5c000 = {...}) at src/devices/nm-device.c:12294
    #4  0x00005555556a4ee6 in spec_match_list (device=0x555555f0fb70 [NMDeviceVeth], specs=0x555555a5c000 = {...}) at src/devices/nm-device-ethernet.c:1461
    #5  0x00005555556978db in nm_device_spec_match_list (self=self@entry=0x555555f0fb70 [NMDeviceVeth], specs=0x555555a5c000 = {...}) at src/devices/nm-device.c:12277
    #6  0x000055555558e187 in _match_section_infos_lookup (match_section_infos=0x555555a5d500, keyfile=0x555555a46f80, property=property@entry=0x555555793123 "ipv4.route-metric", device=device@entry=0x555555f0fb70 [NMDeviceVeth], out_value=out_value@entry=0x7fffffffe018) at src/nm-config-data.c:1169
    #7  0x00005555555922ca in nm_config_data_get_connection_default (self=0x555555a548c0 [NMConfigData], property=property@entry=0x555555793123 "ipv4.route-metric", device=device@entry=0x555555f0fb70 [NMDeviceVeth]) at src/nm-config-data.c:1234
    #8  0x00005555556790cd in _get_ipx_route_metric (self=self@entry=0x555555f0fb70 [NMDeviceVeth], is_v4=is_v4@entry=1) at src/devices/nm-device.c:1142
    #9  0x000055555567912e in nm_device_get_ip4_route_metric (self=self@entry=0x555555f0fb70 [NMDeviceVeth]) at src/devices/nm-device.c:1161
    #10 0x000055555567da6c in ip4_config_merge_and_apply (self=self@entry=0x555555f0fb70 [NMDeviceVeth], config=config@entry=0x0, commit=commit@entry=0, out_reason=out_reason@entry=0x0)
        at src/devices/nm-device.c:4787
    #11 0x000055555567e0fb in update_ip4_config (self=self@entry=0x555555f0fb70 [NMDeviceVeth], initial=initial@entry=0) at src/devices/nm-device.c:9532
    #12 0x0000555555693acd in queued_ip4_config_change (user_data=0x555555f0fb70) at src/devices/nm-device.c:9651
    #13 0x00007ffff4c966ba in g_main_context_dispatch (context=0x555555a46af0) at gmain.c:3154
    #14 0x00007ffff4c966ba in g_main_context_dispatch (context=context@entry=0x555555a46af0) at gmain.c:3769
    #15 0x00007ffff4c96a70 in g_main_context_iterate (context=0x555555a46af0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3840
    #16 0x00007ffff4c96d92 in g_main_loop_run (loop=0x555555a47400) at gmain.c:4034
    #17 0x000055555558372a in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:411
2016-10-28 16:44:57 +02:00
Thomas Haller
c0d249b733 device: delay evaluating unmanaged-by-user-settings flags until link initialized
Before the link is initialized, that is before UDEV completed
initializing the device, we should not evaluate the user-settings
unmanaged flags.

The reason is, that evaluating it likely involves looking at the
permanent MAC address, which might use the wrong fake MAC address
(before UDEV set the right one). Also, it might use the wrong ifname
to lookup the permanent MAC address via ethtool.
2016-10-28 16:44:57 +02:00
Thomas Haller
7b7c653c4f device: delay capturing permanent MAC address until UDEV is settled
The permanent MAC address of an NMDevice shall not change as
long as the device is realized. That is, we read it only once
and don't change it afterwards.

There are two issues that this commit tries to mitigate:

(1) users are advised to use UDEV to rename interfaces. As we lookup
  the permenent MAC address using ethtool (which uses the interface
  name), there is a race where we could read the permanent MAC
  address using the wrong interface name. We should wait until
  UDEV finished initializing the device and until the interface
  name is stable (see rh#1388286).
  This commit still cannot avoid the race of ethtool entirely. It only
  tries to avoid ethtool until UDEV has done its work. That is, until we
  expect the interface name no longer to change.

(2) some device types, don't have a permanent MAC address so we fall
  back to use the currently set address (fake). Again, users are advised
  to use UDEV to configure the MAC addresses on such software devices.
  Thus, we should not get the fake MAC address until UDEV initialized
  the device.

This patch actually doesn't solve the problem at all yet.
The reason is that a regular caller of nm_device_get_permanent_hw_address() can
not afford to wait until UDEV settled. Thus, any user who requests the
permanent MAC address before the link is initialized, runs into the
problems above.

In a next step, we shall revisit such calls to nm_device_get_permanent_hw_address()
and delay them until the link is initialized.
2016-10-28 16:44:57 +02:00
Thomas Haller
cbea1f9f23 device: don't allow mutating the device's hardware address length
We repeatedly call nm_device_update_hw_address() to reset the cached
MAC address of the device. However, we don't allow changing the address
length once it is set.

Multiple entities (initial, current and permanent MAC address) are all
checked to have the same address length. Changing the length would be a
very strange thing (and probably indicate a bug somewhere else).

Just don't allow that.
2016-10-28 16:44:56 +02:00
Thomas Haller
416164aa29 device: treat fake permanent MAC address mostly like a real one
Now that we persist the fake permanent address across
restart of NetworkManager, we want to consider fake
addresses as good enough in most cases.
2016-10-28 16:44:56 +02:00