Commit graph

11584 commits

Author SHA1 Message Date
Thomas Haller
7dfd7801e9 platform: ignore routes with non-zero TOS
The identifying properties of a route are (in libnl)

    .o_id_attrs = (ROUTE_ATTR_FAMILY | ROUTE_ATTR_TOS |
                   ROUTE_ATTR_TABLE | ROUTE_ATTR_DST |
                   ROUTE_ATTR_PRIO),

NM ignores routes other then in table RT_TABLE_MAIN and considers
only the tuple 'family,network/plen,metric' as identifying for a route.

We must also ignore routes with TOS non-zero as we cannot
handle those, i.e. we cannot distinguish between them.

(cherry picked from commit af2c0ef771)
2015-04-28 18:06:43 +02:00
Lubomir Rintel
0d07de4f96 libnm: set error when failing registration of old secret agent
We return FALSE, we ought to return a meaningful error.

(cherry picked from commit 0ea1fb4e5e)
2015-04-28 12:29:32 +02:00
David Ward
c17b08ea3c nm-iface-helper: set last_config properly
Update last_config outside of the conditional; otherwise it will
always remain set to NULL.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-By: Thomas Haller <thaller@redhat.com>
(cherry picked from commit db4d83d5a4)

Conflicts:
	src/nm-iface-helper.c
2015-04-27 22:21:43 +02:00
Lubomir Rintel
c0833d13c1 release: update NEWS
[danw@redhat.com: turned it into proper English]
2015-04-24 14:26:00 +02:00
Dan Williams
46242ae881 dbus-manager: harden registering/unregistering object
Saw some g_warning() about g_object_weak_unref() trying to unref a non
registed reference. While this does not fix it, let's assert that
situation a step earlier to ease debugging.

Also, move g_object_weak_ref() closer to adding the object into the
@exported hash.

[thaller@redhat.com: rewrote commit message, change to register_object()]

(cherry picked from commit 9b07ea77b8)
2015-04-23 19:51:42 +02:00
Lubomir Rintel
e951abe6d0 ifcfg-rh: don't try to read DEVTIMEOUT from file for in-memory connections
#0  0x00007ffff4a2c970 in g_logv (log_domain=0x7fffe9201115 "NetworkManager-ifcfg-rh", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd710) at gmessages.c:1046
  #1  0x00007ffff4a2cbaf in g_log (log_domain=log_domain@entry=0x7fffe9201115 "NetworkManager-ifcfg-rh", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7ffff4a9bc1d "%s: assertion '%s' failed") at gmessages.c:1079
  #2  0x00007ffff4a2cbe9 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fffe9201115 "NetworkManager-ifcfg-rh", pretty_function=pretty_function@entry=0x7fffe9204b70 <__FUNCTION__.30626> "devtimeout_from_file", expression=expression@entry=0x7fffe9202d97 "filename != NULL") at gmessages.c:1088
  #3  0x00007fffe91fbfa2 in devtimeout_from_file (filename=<optimized out>) at reader.c:4884
  #4  0x00007fffe91ef845 in nm_ifcfg_connection_new (self=0x8d2200 [NMIfcfgConnection]) at nm-ifcfg-connection.c:159
  #5  0x00007fffe91ef845 in nm_ifcfg_connection_new (source=source@entry=0x83ba40, full_path=full_path@entry=0x0, error=error@entry=0x7fffffffd980) at nm-ifcfg-connection.c:240
  #6  0x00007fffe91ec7e6 in update_connection (self=self@entry=0x80c2a0 [SCPluginIfcfg], source=source@entry=0x83ba40, full_path=0x0, connection=connection@entry=0x0, protect_existing_connection=protect_existing_connection@entry=0, protected_connections=protected_connections@entry=0x0, error=0x7fffffffd980) at plugin.c:225
  #7  0x00007fffe91eddf2 in add_connection (config=<optimized out>, connection=0x83ba40, save_to_disk=<optimized out>, error=0x7fffffffd980) at plugin.c:715
  #8  0x000000000048fc1d in nm_settings_add_connection (self=<optimized out>, connection=0x83ba40, save_to_disk=0, error=<optimized out>) at settings/nm-settings.c:1045
  #9  0x0000000000490858 in pk_add_cb (chain=0x8b1fc0, chain_error=<optimized out>, context=<optimized out>, user_data=<optimized out>) at settings/nm-settings.c:1151
  #10 0x00000000004ca98c in auth_chain_finish (user_data=0x8b1fc0) at nm-auth-utils.c:82
  #11 0x00007ffff4a257fb in g_main_context_dispatch (context=0x7cd3e0) at gmain.c:3111
  #12 0x00007ffff4a257fb in g_main_context_dispatch (context=context@entry=0x7cd3e0) at gmain.c:3710
  #13 0x00007ffff4a25b98 in g_main_context_iterate (context=0x7cd3e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #14 0x00007ffff4a25ec2 in g_main_loop_run (loop=0x7cd4a0) at gmain.c:3975
  #15 0x0000000000444c81 in main (argc=<optimized out>, argv=<optimized out>) at main.c:486

(cherry picked from commit 72f264ad9b)
2015-04-23 17:14:19 +02:00
Thomas Haller
91925416fb core: refactor nm_ethernet_address_is_valid() and reject invalid addresses
nm_ethernet_address_is_valid() did not check whether @addr was a valid
address in the first place. It only checked whether the address was not
equal to a few notorious MAC addresses.

At the same time, be more forgiving and accept %NULL as argument.
This fixes an assertion nm_ap_match_in_hash().

(cherry picked from commit 842ec6163d)
2015-04-23 16:40:14 +02:00
Thomas Haller
5fd1c12569 core/test: add test for nm_ethernet_address_is_valid()
(cherry picked from commit dbb3b44ca6)

Conflicts:
	src/tests/test-general-with-expect.c
2015-04-23 16:40:12 +02:00
Thomas Haller
1e5d009367 wifi: avoid assertion in request_wireless_scan() passing NULL to nm_utils_ssid_to_utf8()
(cherry picked from commit 7f8149bdb7)
2015-04-23 16:39:27 +02:00
Thomas Haller
fe6889f7b1 platform: remove wrong assertion
This is a well known issue that we cannot convert some libnl
objects to NMPlatformObject. The to-string function for libnl
objects is only used for debug logging. No need to assert.

(cherry picked from commit 8f080747c6)
2015-04-23 16:39:27 +02:00
Lubomir Rintel
b05c9d67e7 cli: stop waiting for deactivation if device reaches unmanaged state
default-unmanaged devices enter unmanaged state right after they're
disconnected.

(cherry picked from commit 29fe1abf0d)
2015-04-23 10:24:25 -04:00
Lubomir Rintel
1fff1a3d36 libnm,core: don't mix up enum types
Touches a weak spot on clang's soul.

(cherry picked from commit fd41aa451b)
2015-04-23 13:48:51 +02:00
Jiří Klimeš
d727e25663 cli: fix allowed slave-types
(cherry picked from commit 7271e168b0)
2015-04-22 09:01:13 +02:00
Thomas Haller
365f20e35f core: add "fatal-warnings" option to NM_DEBUG
NM already understands the command line argument --g-fatal-warnings
which causes setting of g_log_set_always_fatal().

Also interpret the "fatal-warnings" token in NM_DEBUG environment
variable and in main.debug configuration setting.

Usage hint: either set

  $ export NM_DEBUG=RLIMIT_CORE,fatal-warnings

or add the following section to NetworkManager.conf

    [main]
    debug=RLIMIT_CORE,fatal-warnings

https://mail.gnome.org/archives/networkmanager-list/2015-March/msg00093.html
(cherry picked from commit 10cde91f10)
2015-04-21 14:53:13 +02:00
Jiří Klimeš
34d87a7603 platform: load libnl-3.so.200, not libnl-3.so (rh #1205195)
libnl-3.so link is only present in devel package (libnl3-devel).

https://bugzilla.redhat.com/show_bug.cgi?id=1205195
(cherry picked from commit d767fb160c)
2015-04-21 14:46:55 +02:00
Jiří Klimeš
70f375b532 cli: better indicate when a Wi-Fi plugin might not be available (rh #1168573)
* print an error message indicating NM Wi-Fi plugin may be missing, for
  nmcli device wifi ifname <dev-name>
  nmcli device wifi connect ifname <dev-name>

* add NM-TYPE to 'nmcli device show' command displaying internal NM device type
  (like NMDeviceWifi, NMDeviceGeneric, ...)

https://bugzilla.redhat.com/show_bug.cgi?id=1168573
(cherry picked from commit 823df334ed)
2015-04-20 10:29:42 +02:00
Jiří Klimeš
dd0dde169f cli: add PHYS_PORT_ID property to devices
The physical-port-id property was added to libnm (libnm-glib) in commit
47cc8b25f2.

(cherry picked from commit 8252553615)
2015-04-20 10:29:35 +02:00
Thomas Haller
b6bc5641ed valgrind: fix suppressions for glib for Fedora 21
(cherry picked from commit b97a45957f)
2015-04-17 12:19:43 +02:00
Thomas Haller
aa725e3abf valgrind: add comment to suppressions file
(cherry picked from commit 40fbb36aad)
2015-04-17 12:19:43 +02:00
Dan Williams
256f11e6fc dispatcher: fix memleak in construct_device_dhcp4_items()
When iterating over a container variant, the children values
must be unrefed when no longer used.

(cherry picked from commit acd6226e8a)
2015-04-17 12:19:43 +02:00
Dan Winship
e7c1900b60 dispatcher: remove "old" from the test names
There's no reason the dispatcher test files should have "old" in their
names, since they're testing the current dispatcher interface.

(cherry picked from commit 9cfd9d376f)
2015-04-17 12:19:43 +02:00
Thomas Haller
ab9e4deb2d contrib/rpm: add comment to NetworkManager.conf file
https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00036.html
(cherry picked from commit 36fc5cac83)
2015-04-17 10:44:01 +02:00
Lubomir Rintel
3ba297eeac device: use "new-activation" reason when deactivating for another activation
"user-requested" has a side effect of disabling autoconnect.

Fixes: 600489003f
(cherry picked from commit d78f4614a0)
2015-04-14 17:04:31 +02:00
Lubomir Rintel
994136e142 device,libnm,cli: add "new-activation" reason for device state change
It will be used when the device is disconnected for new connection activation.

(cherry picked from commit 1ad193a017)
2015-04-14 17:04:31 +02:00
Lubomir Rintel
5eec0818a1 device: translate NM_DEVICE_STATE_REASON_UNKNOWN to "unknown"
(cherry picked from commit c1c3d7e145)
2015-04-14 17:04:31 +02:00
Thomas Haller
7f7c8acbae test: print NMTST_SEED_RAND value with g_print()
For tests with assert-logging enabled, we already printed
the message with g_print(), instead of g_message().

We always want to print this value, because it is important
to reproduce a test failure. Hence, just (always) print
directly to stdout.

Also, add a leading newline, because the output was attached
to the previous line.

(cherry picked from commit 4ab540939c)
2015-04-10 18:35:42 +02:00
Thomas Haller
636c8592ce test: fix compiler warning in g_test_assert_expected_messages_internal()
-Wformat of gcc determines that the string arguments are NULL.

Fixes: 373d09b042
(cherry picked from commit 0aca44c857)
2015-04-10 18:30:24 +02:00
Thomas Haller
fd10ed1e71 test: log message at g_test_assert_expected_messages()
When disabling assert-logging with no-expect-message,
print a line at every g_test_assert_expected_messages()
invocation.

(cherry picked from commit 373d09b042)
2015-04-10 18:30:24 +02:00
Thomas Haller
fec4e68f4d tests: check for no pending expected_messages on exit of tests
On the end of the test there should be no unchecked expected
messages. Register a destructor function in nmtst to assert
against that.

Also call nmtst_free() in the destructor. That way, we always release
the allocated data without requiring the test to do it explicitly.

(cherry picked from commit bb90127c2a)
2015-04-10 18:30:09 +02:00
Thomas Haller
0074bf032b test: add description of test behavior to nm-test-utils.h
(cherry picked from commit 745f2aceac)
2015-04-10 18:25:41 +02:00
Beniamino Galvani
d2e5e648d4 wifi: indicate 2ghz and 5ghz wifi device capabilities
Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the
frequency bands supported by a Wifi device.

Add also CAP_FREQ_VALID, which is set when the values of the other 2
capabilities are available.

Original patch by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723295
(cherry picked from commit aabc6fc57b)
2015-04-09 09:20:48 -05:00
Thomas Haller
06e8841d9d default-route-manager: cleanup logging macros
(cherry picked from commit 3179b45412)
2015-04-09 11:21:08 +02:00
Thomas Haller
7916dc0f4a default-route-manager: use NMPlatformVTableRoute
(cherry picked from commit 110200d5d4)
2015-04-09 11:21:08 +02:00
Thomas Haller
1ff6f6c304 platform: add VTable to handle IPv4 and IPv6 routes generically
(cherry picked from commit 290faa003d)
2015-04-09 11:21:08 +02:00
Thomas Haller
897ac18bbb test: add option in nmtst_platform_ip4_routes_equal() to ignore ordering
Same for nmtst_platform_ip6_routes_equal().

It's useful to check for equal routes ignoring the ordering.

(cherry picked from commit 57453189e0)

Conflicts:
	src/tests/test-route-manager.c
2015-04-09 11:21:08 +02:00
Thomas Haller
d0172aa4d6 platform/test: use g_print() in platform tests to indicate skip/fail
Don't use g_message() in platform tests for test messages.

This is a partial backport of commit 5fd3827,
  "route-manager/test: fix usage of g_assert_expect_message()"

(cherry picked from commit 5fd3827e49)
2015-04-09 11:21:03 +02:00
Thomas Haller
3b014ddef8 platform/test: split initialization of platform tests out
test-route-manager soon wants a different initialization

(cherry picked from commit 24288f713a)
2015-04-09 08:22:28 +02:00
Thomas Haller
643d412688 test: setup logging during nmtst_init_assert_logging()
Before, when having a test with nmtst_init_assert_logging(),
the caller was expected to setup logging separately according
to the log level that the test asserts against.

Since 5e74891b58, the logging
level can be reset via NMTST_DEBUG also for tests that
assert logging. In this case, it would be useful, if the test
would not overwrite the logging level that is set externally
via NMTST_DEBUG.

Instead, let the test pass the logging configuration to
nmtst_init_assert_logging(), and nmtst will setup logging
-- either according to NMTST_DEBUG or as passed in.

This way, setting the log level works also for no-expect-message
tests:

  NMTST_DEBUG="debug,no-expect-message,log-level=TRACE" $TEST

(cherry picked from commit b6d3b98655)
2015-04-09 08:22:28 +02:00
Thomas Haller
8eefbce9fa platform: don't write debug message to stderr
Use nm-logging instead.

(cherry picked from commit 07f95c371c)
2015-04-09 08:22:28 +02:00
Thomas Haller
c0534e9a6d test: fix enabling DEBUG logging for tests
For glog messages to print any debug messages, we must set G_MESSAGES_DEBUG.
nmtst does this for us if we set @is_debug. But fix the condition to
also set G_MESSAGES_DEBUG if set set c_log_level to DEBUG or TRACE.

(cherry picked from commit 3abeb7f2b9)
2015-04-09 08:22:28 +02:00
Thomas Haller
ad5159156a test: fix parsing of NMTST_SEED_RAND
(cherry picked from commit 0a2c0d12e8)
2015-04-09 08:22:28 +02:00
Thomas Haller
ba43bfc0b7 test: change message about random seed in nmtst
Make it clear, that you can overwrite the seed by setting the
environment variable NMTST_SEED_RAND.

(cherry picked from commit 44a963c894)
2015-04-09 08:22:28 +02:00
Lubomir Rintel
a34961ec70 build: fix clang + glib 2.43 build
Known glib issue. Fixes Fedora 22 build.

(cherry picked from commit 5206a9b28d)
2015-04-09 08:19:47 +02:00
Lubomir Rintel
474ac6c528 build: disable warnings that trigger known clang problems
Fixes build with clang 3.5 on Fedora 21.

(cherry picked from commit f0740aff88)
2015-04-09 08:19:47 +02:00
Lubomir Rintel
53b51b307f build: disable warnings where macros expand to tautological comparisons
(cherry picked from commit 3ccc6f290d)
2015-04-09 08:19:47 +02:00
Dan Winship
2b08803a2e libnm-core: fix VPN error domain (bgo #745997)
In theory, NM_VPN_PLUGIN_ERROR should have names under
org.freedesktop.NetworkManager.VPN.Plugin, but for historical reasons,
it's actually org.freedesktop.NetworkManager.VPN.Error.

(cherry picked from commit 773f047eef)
2015-04-07 12:53:34 -04:00
Dan Williams
4f4e570a7d team: respawn teamd instead of exiting (rh #1145988) (bgo #745903) 2015-04-02 15:03:25 -05:00
Dan Williams
7ad0e83b4a team: ratelimit teamd spawning 2015-04-02 15:00:39 -05:00
Dan Williams
57c3e8fd25 team: respawn teamd when it exits instead of failing activation (rh #1145988)
teamd can recover interface state on its own, so if it died unexpectedly
we don't need to fail the device.  Also, if for some reason a teamd is
already up and running when activating the interface, we can ask for
its configuration and if it has the same configuration we are about to
use, just talk to the existing copy instead of killing it.
2015-04-02 14:59:59 -05:00
Bernd Edlinger
4903c127e1 wifi: clear WPAS_REMOVED_TAG when scanning Wi-Fi AP
(cherry picked from commit 47c505523c72b6454dec4681c0edda535c3a2e91)
(cherry picked from commit 1282b468bd)

https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-04-02 17:48:31 +02:00