Commit Graph

12256 Commits

Author SHA1 Message Date
Lubomir Rintel
b9b7bb1958 tests: avoid calling GLib.IOChannel.unix_new()
The Ubuntu 12.04 introspection data don't contain it. However, the default
constructor works just well and even looks a bit more Python-y.
2015-06-02 12:30:03 +02:00
Lubomir Rintel
ccb0ca4493 libnm-core,libnm-util: avoid calling a constructor
It yields completely unpredictable results on Ubuntu 12.04 (the global variable
successfully comparing to NULL despite demonstrably not NULL). Possibly a
toolchain bug.
2015-06-02 12:30:03 +02:00
Lubomir Rintel
3811a68389 systemd-dhcp: fix build with Linux 3.2.0 headers
Fixes build on Ubuntu 12.04.

systemd/src/libsystemd-network/dhcp-network.c: In function '_bind_raw_socket':
systemd/src/libsystemd-network/dhcp-network.c:75:17: error: 'BPF_XOR' undeclared (first use in this function)
systemd/src/libsystemd-network/dhcp-network.c:75:17: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [libsystemd_nm_la-dhcp-network.lo] Error 1
2015-06-02 12:30:03 +02:00
Lubomir Rintel
22b99e3bbb ppp-manager: fix build with Linux 3.2.0 headers
Fixes build with Ubuntu 12.04.

In file included from ppp-manager/nm-ppp-manager.c:42:0:
/usr/include/linux/if_ppp.h:103:16: error: field 'b' has incomplete type
/usr/include/linux/if_ppp.h:108:21: error: field 'b' has incomplete type
2015-06-02 12:30:03 +02:00
Lubomir Rintel
eb2b8c2798 build: use compat version of g_clear_pointer()
Ubuntu 12.04 has an ancient version of glib, which we nevertheless support.
2015-06-02 12:30:03 +02:00
Lubomir Rintel
36f7669a4c core: don't assume the loopback interface is called "lo"
I did a "ip link set lo name yolo" and now my NetworkManager triggers an
assertion failure. :( Nevertheless, the loopback interface is always ifindex=1.
2015-06-01 17:30:24 +00:00
Lubomir Rintel
ef295ddeef platform-linux: allow netlink messages from non-privileged user namespaces
Just check they're from kernel.
2015-06-01 17:30:20 +00:00
Thomas Haller
b8b1a01d96 build: rename file "include/nm-utils-internal.h" to "nm-macros-internal.h"
We already have "nm-utils*.h" and "NetworkManagerUtils.h" headers. Rename
"include/nm-utils-internal.h" to "nm-macros-internal.h". I think that
name is better, because this file is header-only, internal, and
repository-wide.

Also, it will never contain non-header-only declarations because
there is no backing object file under "include/".
It will only contain macros and inline functions.
2015-06-01 14:47:08 +02:00
Thomas Haller
dce00f0d10 utils: move NM_FLAGS_*() macros to header file "include/nm-utils-internal.h" 2015-05-29 16:28:33 +02:00
Thomas Haller
2297333bb1 default-route: merge branch 'th/default-route-fixes-rh1205405'
Two improvements for handling default-routes.

https://bugzilla.redhat.com/show_bug.cgi?id=1224291
https://bugzilla.redhat.com/show_bug.cgi?id=1205405
2015-05-29 11:50:10 +02:00
Thomas Haller
d51975ed92 default-route: also configure default-routes for assumed connections
Previously for assumed connections we would never configure a default route.
That has serious problems for example in the following two scenarios:

  - the default-route might have a limited lifetime from a previous
    SLAAC/accept_ra setting. In this case, once we assume the connection
    we must also ensure that we extend the lifetime of the default
    route.
  - the gateway could be received via DHCP/RA and it might change.
    If we ignore default-routes for assumed connection we miss that
    change.

The problem is that the notion of "assumed connection" wrongly combines
two conflicting goals (related bug bgo#746440):
  a) have an external device that is entirely unmanged by NM.
  b) do a seamless takeover of a previously managed connection at start,
     but still fully manage.

This patch changes the handling of default-routes towards meaning b).

https://bugzilla.redhat.com/show_bug.cgi?id=1224291
2015-05-29 11:48:57 +02:00
Thomas Haller
98e50e358b default-route: for devices with 'never-default' enforce the default-route only once
Since da708059da, we would pickup the
default-route as configured externally, except at those moments when
NM re-applys the IP configuration of the interface, such as during a
DHCP lease.

That allows the user to add/remove the default-route externally (iproute).
But still, at random times (DHCP lease), we will revert those external
changes.

Extend this, that if the connection is explicitly configured as
'never-default=yes', that it tells NM not to interfere with externally
added default-routes on this device. That means, NM will only remove
any preexisting default-routes when configuring the device a first
time.
On any later attempts, NM will assume whatever is configured there.
That makes sense because the user indicated not wanting NM to
manage a default-route on that device, so if something externally
added a default-route, assume that is what the user wants.

This only affects non-assumed connections, with 'never-default=yes'.

https://bugzilla.redhat.com/show_bug.cgi?id=1205405
2015-05-29 11:45:48 +02:00
Thomas Haller
49227a07f3 default-route: add @out_is_never_default argument to has_default_route()
Also accept a NULL connection in
nm_default_route_manager_ip4_connection_has_default_route() and
nm_default_route_manager_ip6_connection_has_default_route().
2015-05-29 11:43:58 +02:00
Jiří Klimeš
242fe0bfb0 merge: increase 'max_replies_per_connection' limit in D-Bus configuration
The limit seems to be too low and causes problems in libnm-glib. We increase
the limit and warn in libnm-glib if it was exceeded.
2015-05-29 08:09:53 +02:00
Jiří Klimeš
91a5f4ceb9 libnm-glib: print a bold warning about reaching a D-Bus limit
This causes incorrect application behaviour, so libnm-glib should warn
at least.
2015-05-29 08:04:26 +02:00
Jiří Klimeš
2c299ba65c dbus: increase 'max_replies_per_connection' limit in D-Bus configuration
D-Bus default limit of replies per connection has been lowered to 128 due to
CVE-2014-3638, see:
http://cgit.freedesktop.org/dbus/dbus/commit/?id=5bc7f9519ebc6117ba300c704794b36b87c2194b
https://bugs.freedesktop.org/show_bug.cgi?id=81053

The limit seems to be too low and causes problems in libnm-glib, that will not
return all NetworkManager connection profiles if there are too many of them
(roughly more than the limit). As a consequence, libnm-glib based clients will
not work properly.

Lets increase the limit in our D-Bus org.freedesktop.NetworkManager.conf
configuration as we had it before.

See also older commit d5b31d55fa that did the
opposite thing (removing the limit because the default D-Bus limit was 8192 at
that time).
2015-05-29 08:04:26 +02:00
Lubomir Rintel
c47c06470a builds: only enable TAP driver for glib >= 2.37.6
No TAP support for previous versions and --tap argument is silently ignored,
confusing the TAP driver.
2015-05-28 12:51:24 +02:00
Jiří Klimeš
a5e43ab510 nm-import-openvpn: import 'float' OpenVPN option
https://bugzilla.gnome.org/show_bug.cgi?id=737108

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
2015-05-28 12:04:58 +02:00
Pavel Šimerda
cd3c52a24d build: support runstatedir configure option
https://bugzilla.gnome.org/show_bug.cgi?id=737139

[thaller@redhat.com: modified original patch]
2015-05-28 11:46:11 +02:00
Jiří Klimeš
98abf9dc30 merge: offer valid values for enum-style properties in nmcli (rh #1034126)
Values for enumeration-style properties are displayed when setting a property,
and also TAB-completion offers the values.

Later, we plan to improve the handling even more by adding meta-data to libnm.
That would enable offering yes/no values, for example.

https://bugzilla.redhat.com/show_bug.cgi?id=1034126
2015-05-28 10:14:09 +02:00
Jiří Klimeš
79bc271685 cli: TAB-completion for enum-style property values (rh #1034126)
Valid values for enumeration-style properties are offered in TAB-completion in
the editor. Thus the user has a quick overview of the possible values and can
edit properties more easily.

Example:
$ nmcli con edit type wifi
nmcli> set wifi-sec.group <TAB>
ccmp    tkip    wep104  wep40
nmcli> ...

https://bugzilla.redhat.com/show_bug.cgi?id=1034126
2015-05-28 10:13:52 +02:00
Jiří Klimeš
bf01da1a08 cli: add missing nmc_property_802_1X_allowed_eap() function 2015-05-28 10:13:52 +02:00
Jiří Klimeš
188d6cbaf3 cli: change function for allowed values to return array of strings 2015-05-28 10:13:51 +02:00
Jiří Klimeš
5e1a7ffb39 cli: add @brackets parameter to nmc_util_strv_for_display 2015-05-28 10:13:51 +02:00
Jiří Klimeš
db0f5b3b4c cli: print valid-values hint in property menu for empty "set" command
nmcli 802-11-wireless.mode> set
Allowed values for 'mode' property: infrastructure, adhoc, ap
Enter 'mode' value:
2015-05-28 10:13:51 +02:00
Jiří Klimeš
bfd502a9b1 core/cli: add missing device state-reason to string conversions
for NM_DEVICE_STATE_REASON_PARENT_CHANGED
and NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED

Fixes: cd3df12c8f
2015-05-27 11:11:47 +02:00
Jiří Klimeš
7fe250f51d device: log the device we were searching in udev 2015-05-27 10:07:57 +02:00
Dan Williams
6baca260d1 Partially revert "dhcp: gracefully recover from failed DHCP BOUND state transitions (bgo #743700)"
This reverts commit 7daf63461de4195b1626ca15f835fc7cbc56e847.

Turns out the removal of the second set of [] in configure.ac causes the command
to be wrong in 'configure' and the test to be incorrect.
2015-05-26 18:23:26 -05:00
Thomas Haller
fb623df747 ifnet/test: rename test check_ifnet to test-ifnet
All our other test binaries are named "test-*" so rename this
one too. Also we gitignore "test-*.log" files, but didn't ignore
"check_ifnet.log".
2015-05-26 16:35:00 +02:00
Jiří Klimeš
f46eb1fc20 libnm-glib: do not access NULL GError variable (rh #1224819)
dbus_g_proxy_call() should set GError if returning FALSE. But apparently there
is a bug in dbus-glib and the error can be NULL.

https://bugzilla.redhat.com/show_bug.cgi?id=1224819
2015-05-26 15:59:11 +02:00
Thomas Haller
ce3d1533cc test: fix running valgrind tests with NMTST_NO_VALGRIND
Fixes: 6463ce5dd9
2015-05-26 15:34:19 +02:00
Beniamino Galvani
90a7ad8dec ifnet/tests: convert to GLib test functions 2015-05-26 14:47:22 +02:00
Beniamino Galvani
fe765d30da ifnet/tests: fix GCC 5 warning about possible misuse of logical not
With GCC 5, -Wlogical-not-parentheses is enabled by -Wall and warns
about suspicious code like:

  int a;
  ...
  if (!a > 1) { ... }

Fix the following warning:

test_all.c: In function ‘test_is_static’:
test_all.c:114:32: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
  ASSERT (!is_static_ip6 ("eth0") == TRUE, "is static",
                                  ^
2015-05-26 14:47:22 +02:00
Lubomir Rintel
4a4f703c94 libnm,dbus-helpers: include glib-compat for g_test_initialized() 2015-05-26 14:17:31 +02:00
Lubomir Rintel
defe992a10 merge: branch 'lr/tap-tests' (bgo #749375)
https://bugzilla.gnome.org/show_bug.cgi?id=749375
2015-05-26 13:52:54 +02:00
Lubomir Rintel
02e3d6c286 tests: don't try to connect to the private socket
Even if we're running the tests as root we still want to use the mock
service instead of whatever version of daemon runs on the test host.
2015-05-26 13:51:45 +02:00
Lubomir Rintel
dd959087a2 tests: be a bit more helpful when valgrind tests fail 2015-05-26 13:51:45 +02:00
Lubomir Rintel
6463ce5dd9 tests: use the TAP formatter
The test results in standard format are easily integrated into CI systems.
2015-05-26 13:51:45 +02:00
Lubomir Rintel
380ed63318 build: switch to parallel test harness
This will make it possible to use the TAP formatter.
2015-05-26 13:51:45 +02:00
Lubomir Rintel
14f4674f64 tests: call g_test_run() even when skipping the test
It will return the 77 exit code itself. For TAP output it will also generate
the proper test skip marker.
2015-05-26 13:51:44 +02:00
Lubomir Rintel
d0e25ac8be tests: always spawn private d-bus
Parallel test runs would not be possible without this.
2015-05-26 13:51:44 +02:00
Lubomir Rintel
f627d6db8e tests: move all asserts into tests
Otherwise the TAP formatter would produce a plan-less output.
2015-05-26 13:51:44 +02:00
Beniamino Galvani
a6f5aeeb28 dns: fall back to writing resolv.conf when other methods are not available
After commits:

de0d623680 dns: don't fall back to other methods when resolvconf or netconfig fail
e573977b80 dns: allow runtime selection of resolv.conf manager

the method used to write /etc/resolv.conf is specified by a
configuration parameter and NM doesn't try other methods if the chosen
one has not success.

Restore the fallback to the 'none' method if resolvconf or netconfig
executables are not available, so that when the value of 'rc-manager'
is misconfigured the system continues to work properly.

https://bugzilla.gnome.org/show_bug.cgi?id=749286
2015-05-26 13:33:47 +02:00
Cédric Valmary
58ed063c71 po: update Occitan (oc) translation (bgo #749754)
https://bugzilla.gnome.org/show_bug.cgi?id=749754
2015-05-25 11:58:22 +02:00
Thomas Haller
e0d103b1a2 test: include "nm-keyfile-internal.h" for tests under src/
Including "nm-keyfile-internal.h" before "nm-test-utils.h" enables
a few useful utilities. If we know that our test uses NetworkManagerUtils.h,
we can always include it -- as we have libnm-core available.
2015-05-20 19:03:47 +02:00
Thomas Haller
89c6abc7ab libnm/test: include "nm-keyfile-internal.h" in test-general.c
This enables special code in "nm-test-utils.h" that is useful
for tests.
2015-05-20 18:39:04 +02:00
Thomas Haller
a915b57876 libnm: fix libnm.ver by putting new symbols into appropriate section
Fixes: 019943bb5d
2015-05-20 15:01:11 +02:00
Thomas Haller
d43be83aaa libnm: enforce that "nm-utils-private.h" header is not used inside src/
Let "nm-utils-private.h" and "nm-types.h" conflict.
2015-05-20 12:42:19 +02:00
Thomas Haller
670ca44721 libnm: rename DNSOptionDesc and @dns_option_descs to have an "nm"-prefix
Declarations in header files should always have an "nm" related
prefix.

Fixes: 019943bb5d
2015-05-20 12:42:19 +02:00
Thomas Haller
533f9fa2d2 libnm: move internal dns-option helpers to "nm-core-internal.h"
"nm-utils-private.h" should not be used outside of libnm-core/.
core/ should only use public API or "nm-core-internal.h".

Also, "nm-setting-ip-config.h" is a public header and should
not contain internal defines. Move them to "nm-core-internal.h"
too.

Fixes: 019943bb5d
2015-05-20 12:42:14 +02:00