Commit graph

5765 commits

Author SHA1 Message Date
Lubomir Rintel
5359322b6d bond: allow overriding the MTU
Set the MTU if 802-3-ethernet.mtu is present and non-zero. The ifcfg-rh writer
sets it if there's a MTU key.

https://bugzilla.redhat.com/show_bug.cgi?id=1177582
(cherry picked from commit a169a79a7d)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
6a8a4d0c28 nm-device: avoid improper IPv6 MTU configuration
Ensure it's always (before address configuration starts and on updates) >= 1280
and not higher than the device MTU.

(cherry picked from commit fbf3a93c6bb88632ca4c8480ddbd04ca1dee151a)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
9b79e6c732 nm-device: move device MTU setting from IP4Config to NMDevice
Just a refactoring, no functional change. This will make it easier to
coordinate the device MTU with IPv6 MTU.

(cherry picked from commit 86696e17fd205de91e36998d524584335163d32b)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
777482aa82 nm-device: set ipv6 mtu at config commit time
Just a refactoring, doesn't make any actual difference. It is consistent with
IPv4 and will make it easier to implement a policy to recover from incorrect
MTUs settings.

(cherry picked from commit f77784b0fdf8abb1e3c796ffc4c2b6c624f17b18)
2015-05-05 16:37:06 +02:00
Thomas Haller
4c9f0fc2ab platform: fix memleak in build_rtnl_addr() using wrong put() method
'struct nl_addr' and 'struct nl_object' have non-compatible put()
functions.

(cherry picked from commit 76ba548959)
2015-05-05 04:20:22 +02:00
Yuri Chornoivan
1588a14a8b fix typo and do not translate an empty string
https://bugzilla.gnome.org/show_bug.cgi?id=748906
(cherry picked from commit f851a741a6)

Conflicts:
	libnm-core/nm-keyfile-reader.c
2015-05-04 18:39:50 +02: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
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
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
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
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
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
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
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
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
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 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
Lubomir Rintel
c9910b35bd device: use UNMANAGED reason instead of REMOVED when unmanaging devices upon quit
Since f85513b (device: do not touch sysctls after the device was removed) the
device is not unconfigured/cleaned up when it's removed. When we're quitting
the device is not actually removed, we're just unmanaging it -- let's just
use a different reason so that the cleanup runs.

Fixes: f85513b8e4
(cherry picked from commit 0f71335d52)
2015-04-02 17:22:54 +02:00
Beniamino Galvani
398681e794 build: fix compile warnings in DNS manager
Fixes the following warnings in nm-dns-manager.c with NETCONFIG_PATH set:

  dns-manager/nm-dns-manager.c: In function 'dispatch_netconfig':
  dns-manager/nm-dns-manager.c:313:2: warning: implicit declaration of function 'waitpid' [-Wimplicit-function-declaration]
    ret = waitpid (pid, NULL, 0);
    ^
  dns-manager/nm-dns-manager.c:271:14: warning: unused variable 'tmp' [-Wunused-variable]
    char *str, *tmp;
                ^
  dns-manager/nm-dns-manager.c:329:13: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
    return ret > 0;
               ^
2015-04-01 16:01:26 +02:00