Commit graph

11604 commits

Author SHA1 Message Date
Dan Williams
cd7207c31d merge: fix continuous router solicitation loop issue with DNS expiry (rh #1207730) (bgo #748085) 2015-05-01 16:19:13 -05:00
Dan Williams
d96b05bd36 rdisc: prevent solicitation loop for expiring DNS information (rh #1207730) (rh #1151665)
A solicitation loop could result for two cases:

1) a router sent DNS information, then removed that information without
sending it with lifetime=0
2) two routers exist, one sending DNS information and the other not, and
the first router which sends DNS information disappears

In these cases a solicitation would be generated when the DNS information
reached 1/2 its lifetime.  A router would then reply to the solicitation
without DNS information, which would then trigger another lifetime check,
which finds that the DNS info is still 1/2 lifetime.  Which triggers
another solicitation, etc.

Fix this by ensuring that a solicitation is never sent less than
rtr_solicitation_interval seconds after the last one.
2015-05-01 16:01:16 -05:00
Dan Williams
415b7b3e25 rdisc: fix double-addition of gateways & routes if priority increases
If a route or gateway's priority increased, the item would be added
to the array again without removing the older entry.  At the same time
don't bother adding an item with a zero lifetime, since it will just
be removed again by the clean_* functions.
2015-05-01 16:01:16 -05:00
Dan Williams
39fd8f7683 rdisc: split fake & linux test code; add testcases 2015-05-01 16:01:16 -05:00
Dan Williams
272943db4b rdisc: fix leak of DNS domains 2015-05-01 15:59:01 -05:00
Dan Williams
0be3678466 rdisc: move most RA processing logic into base class
Instead of having it all in the Linux implementation, move all the
timeout logic and most of the processing logic into the NMRDisc
base class so that it can be used by NMFakeRDisc as well. This
will help increase testability since now we can test the timeout
and expiry logic from the fake plugin too.
2015-05-01 15:59:01 -05:00
Dan Williams
5955f82f01 rdisc: add missing chain up to parent finalize/dispose 2015-05-01 15:59:01 -05:00
Thomas Haller
1bd99ff273 test: add nmtst_test_quick()
Utility function for long-running tests to check whether
they should run. It has the same use as g_test_quick(),
but it can also be set via NMTST_DEBUG environment variable.

You can set the compile time default via

  CFLAGS='-DNMTST_TEST_QUICK=FALSE' ./configure

and overwrite it at runtime via

  NMTST_DEBUG=no-default,quick ./tests/test-my
2015-05-01 15:59:00 -05:00
Thomas Haller
a8d3cf55c4 test: add EXIT_SKIP define 2015-05-01 15:50:20 -05:00
Thomas Haller
90d39cea24 merge branch 'logging-refact' into nm-1-0
Backport some refactoring on the logging functions
from master.
2015-04-29 15:17:27 +02:00
Thomas Haller
65b074164e logging: use _nm_log() to avoid duplicate check of whether logging is enabled
Use _nm_log() in places that already checked whether logging
is enabled. No need to check again as done by nm_log().

(cherry picked from commit 4526b55a51)

Conflicts:
	src/nm-route-manager.c
2015-04-29 15:15:39 +02:00
Thomas Haller
6d8d567444 logging: add logging macro _nm_log() that logs unconditionally
(cherry picked from commit fb9f8c69f7)
2015-04-29 15:15:19 +02:00
Thomas Haller
96c3f7b39f logging/trivial: rename _nm_log() to _nm_log_impl()
The actual logging implementation is not supposed to be called
directly, because there are macros that capture the call site
information __FILE__, __LINE__, and G_STRFUNC.

Rename the function to make clear that this is the actual
implementation.

(cherry picked from commit 211d241ab0)

Conflicts:
	src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h
2015-04-29 15:15:17 +02:00
Thomas Haller
97f9b03119 logging: ensure that the first argument of the logging statement is a C string
We don't want to pass unknown format strings to the logging
macro. Catch that by concatenating "" with the format string.

(cherry picked from commit 2458ddf5e9)
2015-04-29 15:13:59 +02:00
Thomas Haller
2f53e0dfbc logging: always pass a static format string to logging functions
(cherry picked from commit bdec5e2e53)
2015-04-29 15:13:59 +02:00
Thomas Haller
b3cae064d1 ibft/logging: don't localize logging stagements
We don't localize any other nm-logging messages either.

(cherry picked from commit b04c99da0b)
2015-04-29 15:13:50 +02:00
Thomas Haller
edeaccc9eb logging: add error argument to _nm_log() to support "%m" format specifier
A gnu extension to printf adds the format specifier "%m"
to print @errno. To preserve the error number until the
point where the logging statement is constructed, pass
it as an additional argument to _nm_log().

This is not (yet) used from NM internal code. But systemd is adding
similar functionality to its logging functions. Add the same also to
nm-logging, to support systemd's usage of "%m".

(cherry picked from commit 5162426d41)
2015-04-29 15:12:45 +02:00
Thomas Haller
6e8c5b51b1 platform: don't accept lowering IPv6 hop-limit from RA (CVE-2015-2924)
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6fd99094de2b83d1d4c8457f2c83483b2828e75a
http://seclists.org/oss-sec/2015/q2/46
https://bugzilla.redhat.com/show_bug.cgi?id=1209902
https://bugzilla.redhat.com/show_bug.cgi?id=1209903
(cherry picked from commit bdaaf9849b)

Conflicts:
	src/nm-iface-helper.c
	src/platform/nm-platform.h
2015-04-29 14:28:57 +02:00
Jiří Klimeš
a658561be9 platform: use driver name to detect IBM z-System CTC devices (rh #1212118)
We used to detect CTC devices according to the interface name. But that does
not work anymore due to systemd renaming the devices.
Let's use driver name for the detection instead. The driver is called 'ctcm'.

http://www-01.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lgdd/lgdd_r_mpc_setup.html

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

(cherry picked from commit 02c6a93343)
2015-04-29 13:28:58 +02:00
Thomas Haller
7028c8a53f utils: add nm_clear_g_source() helper
Utility function to simplify the following common code:

    if (priv->timeout_id) {
        g_source_remove (priv->timeout_id);
        priv->timeout_id = 0;
    }

to

    nm_clear_g_source (&priv->timeout_id);

(cherry picked from commit b5beaef8fa)
2015-04-28 18:39:52 +02:00
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