Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
b2a3cf4f1d firewall: allow passing NULL callback to nm_firewall_manager_add_or_change_zone()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 12:58:36 +01:00
Thomas Haller
c5cbe91e60 core: move content of src/firewall-manager directory to src/
The directory firewall-manager/ only contained one source and one
header file. Move them to the parent src/ directory.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 12:58:36 +01:00
Jiří Klimeš
6fd8afd39f cli: fix showing secrets in nmcli editor (bgo #737415)
Put secrets into the local connection.

https://bugzilla.gnome.org/show_bug.cgi?id=737415
2014-11-19 11:47:58 +01:00
Jiří Klimeš
86fd678e4e merge: add a flag for ignoring timestamp and use it in nmcli (rh #1122995)
NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP can be used to ignore timestamp
while comparing connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1122995
2014-11-19 10:59:44 +01:00
Jiří Klimeš
265b827ddd cli: ignore timestamp when comparing connections in the editor 2014-11-19 10:58:58 +01:00
Jiří Klimeš
093a3c88d0 libnm-core: add NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP flag
for ignoring timestamp when comparing settings or connections.
2014-11-19 10:58:58 +01:00
Jiří Klimeš
20814094eb libnm-core: (trivial) indent NMSettingCompareFlags description for readibility 2014-11-19 10:58:58 +01:00
Dan Winship
fac424b030 core: fix IP4Config.RouteData and IP6Config.RouteData
NMIP4Config/NMIP6Config have their own NMIPRoute->D-Bus conversion
code since the code in libnm-core is gdbus-specific. But they were
doing it wrong, resulting in clients seeing a next hop of 0.0.0.0/::
for all routes.
2014-11-18 08:30:16 -05:00
Dan Williams
3c1187adb9 trivial: remove leftover NM_IFACE_HELPER references
Left over from a previous version of the iface helper patches and was
never removed when NM_IFACE_HELPER was removed.  Since NM_IFACE_HELPER
wasn't defined, this code was already always compiled.
2014-11-17 12:04:11 -06:00
Dan Williams
70f227f552 core: bounce disable_ipv6 when setting userspace IPv6 link-local (bgo #740096)
The kernel does not terminate an ongoing IPv6LL address process when
the IPv6LL address generation mode is set to 'none' (indicating that
userspace wishes to handle IPv6LL).  Next, NetworkManager does not
expose IPv6 addresses internally until they have completed DAD.  This
means that the kernel may still be performing DAD for an IPv6LL
address when NetworkManager turns userspace IPv6LL on, and when
DAD is complete NetworkManager will finally pay attention to the
address.  If the device is in the DISCONNECTED state, NetworkManager
will then generate and assume an IPv6LL-only connection on the device.

Unfortunately, that behavior happens if the following is true:

1) IPv6LL addressing takes a while (eg, dad_transmits is high or
the kernel takes a while for some reason)

2) the activated connection fails quickly (dhclient fails or some
other fatal error terminates the activation attempt)

3) the activated connection has ipv6.method=ignore

In this case, when the device was brought up and ipv6.method=ignore,
NetworkManager re-enabled kernel IPv6LL and reset the IPv6 sysctl
properties.  The kernel then generated an IPv6LL address and began
DAD.  dhclient failed quickly, and NM deactivated the device.  NM
then turned off kernel IPv6LL when deactivating the device, but the
kernel does not terminate the ongoing DAD.  Some time after the device
entered the DISCONNECTED state, the kernel finished DAD and that
allowed NetworkManager to internally see the address, which caused
NetworkManager to emit the 'recheck-assume' signal.  This
generated a new IPv6LL-only connection which was then assumed.

Bouncing 'disable_ipv6' when re-enabling userspace IPv6LL during
device deactivation flushes the tentative kernel IPv6LL address,
thus preventing the address from being announced after userspace
IPv6LL is re-enabled.  The other alternative is to expose
tentative addresses (eg those still doing DAD) in NMPlatform so
they would be flushed when the device deactivates, but that is a
larger & riskier set of changes.

Reproducer:
- ifconfig eth0 down
- prepare a DHCPv4 connection with ipv6.method=ignore
- set /proc/sys/net/ipv6/conf/all/dad_transmits to "15"
- ensure that DHCPv4 will fail (replace dhclient with a script
    that exits after 2 seconds or something)
- run NetworkManager
- activate the DHCP connection and watch it immediately fail
- wait for the kernel to announce the IPv6LL address after DAD finishes
- watch NM "assume" the new IPv6LL connection

https://bugzilla.gnome.org/show_bug.cgi?id=740096
2014-11-17 10:20:37 -06:00
Dan Williams
d1295b12e9 dhcp: wait for an IPv6LL address before starting DHCPv6 (bgo #740147)
For ipv6.method=dhcp NM was not waiting for an IPv6LL address, which
caused the DHCP client to exit early because it had no local address
to bind to.

https://bugzilla.gnome.org/show_bug.cgi?id=740147
2014-11-17 09:52:12 -06:00
Dan Williams
45bfb653f3 wifi: don't query nl80211 for non-WiFi devices (bgo #740131)
The upstream kernel added module aliases for nl80211 in commit
fb4e156886ce6e8309e912d8b370d192330d19d3, so querying nl80211
now auto-loads the module.  Previously NM was doing this to
determine whether an ethernet-like device was a Wi-Fi device
that supported nl80211, but this leads to the nl80211 loading
on platforms that will never have or use Wi-Fi.

Since every nl80211-capable device will already have
DEVTYPE=wlan set (from /sys/class/net/wlan0/uevent), we can use
that as an indicator that the ethernet-like device is WiFi
instead of asking nl80211.

https://bugzilla.gnome.org/show_bug.cgi?id=740131
2014-11-17 09:45:08 -06:00
Dan Winship
eeb4306111 libnm-core: change how new and legacy properties are serialized (bgo 740140) 2014-11-15 09:53:00 -05:00
Dan Winship
c785a7dfcd libnm-core: change how new and legacy properties are serialized
Although libnm filters out properties received from the daemon that it
doesn't understand, there may be other clients that do not. In
particular, a client might call GetSettings() on a connection, update
the ipv4.addresses property in the returned dictionary, and then pass
the dictionary to Update(). In that case, the updated dictionary would
contain ipv4.address-data, but it would not reflect the changes the
client intended to make.

Fix this by changing the daemon side to prefer the legacy properties
to the new ones if both are set, and changing the client side to not
send the legacy properties (since we don't support new clients talking
to old servers anyway).
2014-11-15 09:52:29 -05:00
Dan Winship
543416e5f6 libnm-core: add _nm_utils_is_manager_process
Add a variable indicating whether the process is the NetworkManager
daemon.
2014-11-15 09:48:42 -05:00
Dan Winship
fb773f6b2f libnm, examples: fix some annotations and update python examples (bgo 740145) 2014-11-15 09:31:49 -05:00
Dan Winship
66936decfa examples: update python examples
Update the raw D-Bus python examples to use newer APIs where
appropriate (and split the add-connection example into 1.0-only and
0.9-compatible versions). Update the gi-based python examples for the
various API changes since they were last updated.

Also add a comment to the ruby add-connection example pointing out
that it's still using the old settings APIs.
2014-11-15 09:31:49 -05:00
Dan Winship
94157ce900 libnm-core: add some missing array length annotations
A bunch of nm-utils methods that used to take GByteArray now take
array+length, but weren't annotated to indicate that.
2014-11-15 09:31:49 -05:00
Dan Winship
a41aff37c8 libnm: add some missing (transfer) annotations
All the old "const GByteArray" methods got changed to return a GBytes
instead, but since they aren't declared "const" any more, we need to
explicitly annotate them "(transfer none)".

Also, the scanner apparently doesn't recognize that an (out)
"const char **" is "(transfer none)", so annotate that in two places
too
2014-11-15 09:31:49 -05:00
Dan Williams
0d6d793644 merge: nmcli device activation behavior fixes (bgo #740136) 2014-11-14 16:48:04 -06:00
Lubomir Rintel
7d80a17631 cli: Finish waiting for the device activation when it disconnects
The device status alone is uninteresting as its changes can be due to
deactivation of previously active connection. We should monitor the
active connection changes instead of device state changes.

However the device state changes is still interesting, as it contains the
reason for the change, let's just ignore them while the connection is
activating.

Lastly, we need to handle failures as well. It should be noted that it's
not sufficient to deal with NM_DEVICE_STATE_FAILED as the device will
quickly draverse to NM_DEVICE_STATE_DISCONNECTED. This happens in case of
a failure due to NM_DEVICE_STATE_REASON_NO_SECRETS as soon as the server
makes sure it won't reconnect automatically.
2014-11-14 16:46:40 -06:00
Lubomir Rintel
ba2722004a libnm: Watch for AC removal in case of AddAndActivateConnection() as well
This does the very same thing as 42b9e8283 does for plain ActivateConnection().
2014-11-14 16:46:40 -06:00
Dan Williams
264c0f162c core: fix return type of addrconf6_start()
It returned a boolean and the caller expected a boolean, but the
return type was NMActStageReturn.
2014-11-14 16:15:35 -06:00
Dan Winship
16a9fc49dd docs: make the settings docs work from tarball builds
docs/api/settings-spec.xml was accidentally not getting disted,
because gtk-doc.make explicitly removes all DISTCLEANFILES from
distdir. However, it doesn't actually make sense for the settings docs
files to be in DISTCLEANFILES anyway; they were put there rather than
CLEANFILES (IIRC) so that "make clean" in a tarball build wouldn't
delete them and break things. But the right fix is to just make them
only be in CLEANFILES when BUILD_SETTING_DOCS is true, and not ever
get deleted otherwise.

Also adjust the build rules to ensure that the generated docs don't
get rebuilt in tarball builds, since that can cause problems when
building from a read-only source tree, etc.

Meanwhile, in an unrelated but also fatal bug, configure.ac's check
for if the generated docs were already present never got updated for
the cli/src -> clients/cli move, and so even if we had been disting
settings-spec.xml, configure would still think that the tarball didn't
have all of the generated docs in it, so SETTING_DOCS_AVAILABLE would
be set false and none of the generated docs would get used.

https://bugzilla.gnome.org/show_bug.cgi?id=740035
2014-11-14 17:14:18 -05:00
Dan Winship
d1faee9228 core: fix a spurious warning with non-kernel network devices
NMDevice was warning about not being able to set ifindex even on
devices that we know don't have an ifindex.

https://bugzilla.gnome.org/show_bug.cgi?id=739889
2014-11-14 15:36:31 -05:00
Lubomir Rintel
529092f035 Revert "cli: Finish waiting for device activation when they disconnect"
In case there's already a connection on the device, it traverses to
DISCONNECTED. We shouldn't cease waiting then.

This reverts commit 94a57d5e07.
2014-11-14 13:54:13 +01:00
Lubomir Rintel
3d9d30df58 dhcp: Fix the DHCP client lookup by gtype 2014-11-14 13:54:13 +01:00
Dan Winship
2fa1b7f2a3 libnm*: fix library gettext usage (bgo 740071) 2014-11-13 17:20:27 -05:00
Dan Winship
53f5e9afa4 libnm*: fix library gettext usage
Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _()
will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than
"gettext (string)" (which will use the program's default domain, which
works fine for programs in the NetworkManager tree, but not for
external users). Likewise, we need to call bindtextdomain() so that
gettext can find the translations if the library is installed in a
different prefix from the program using it (and
bind_textdomain_codeset(), so it will know the translations are in
UTF-8 even if the locale isn't).

(The fact that no one noticed this was broken before is because the
libraries didn't really start returning useful translated strings much
until 0.9.10, and none of the out-of-tree clients have been updated to
actually show those strings to users yet.)
2014-11-13 17:18:42 -05:00
Dan Winship
3bfb163a74 all: consistently include config.h
config.h should be included from every .c file, and it should be
included before any other include. Fix that.

(As a side effect of how I did this, this also changes us to
consistently use "config.h" rather than <config.h>. To the extent that
it matters [which is not much], quotes are more correct anyway, since
we're talking about a file in our own build tree, not a system
include.)
2014-11-13 17:18:42 -05:00
Thomas Haller
125f7c4d40 dhcp: log the configured DHCP client
Also move enumerating the installed DHCP plugins to the beginning
of nm_dhcp_manager_init().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-13 20:10:07 +01:00
Lubomir Rintel
ae829a88ce contrib: Enable PolicyKit agent in RPM 2014-11-13 18:57:04 +01:00
Lubomir Rintel
84c8558622 contrib: Require libselinux for RPM build
It ensures ifcfg-rh doesn't mess up the labels.
2014-11-13 18:57:04 +01:00
Lubomir Rintel
94a57d5e07 cli: Finish waiting for device activation when they disconnect
When wifi secrets are missing, NM_DEVICE_STATE_FAILED due to
NM_DEVICE_STATE_REASON_NO_SECRETS is immediately followed by traversal to
NM_DEVICE_STATE_DISCONNECTED as soon as the server makes sure it won't
reconnect automatically. We sometimes aren't quick to handle the first signal
and only get the latter one.

Let's treat all states that aren't ordinarily reached upon activation as bad.
2014-11-13 18:55:37 +01:00
Dan Winship
749cc84a95 tui: fix unsetting Gateway (rh #1163896)
When the Gateway field is empty, we need to set the property to NULL,
not "".
2014-11-13 11:30:57 -05:00
Lubomir Rintel
46c869b295 merge: wifi bssid handling fixes
Avoid passing NULL bssid where it does not make sense, fix a couple of bad
asserts.

https://bugzilla.gnome.org/show_bug.cgi?id=739258
2014-11-13 16:42:45 +01:00
Jiří Klimeš
beec6c87ff libnm-util: fix typos in libnm-util documentation 2014-11-13 10:21:34 +01:00
Dan Winship
955f41d5f4 tui: fix alignment of pop-up menus
Pop-up menus were slightly mis-aligned in the main window, and even
more mis-aligned in slave-editing windows. Fix that.

Also add a bit of padding to the pop-up window, because it just looks
better that way.
2014-11-12 17:34:24 -05:00
Dan Williams
c0c90fa65d build: fix configure formatting of IN6_ADDR_GEN_MODE check
Print the result, and make the m4 formatting consistent with the
other kernel checks.
2014-11-12 15:13:33 -06:00
Dan Winship
29ed625fea tui: fix gateway editing
Since adding NMSettingIPConfig:gateway, we were just binding that
property to the Gateway entry as a string. But this caused two
different problems: first, we were trying to set the :gateway property
from the entry even when the IP address in the entry was incomplete
(causing warnings), and second, we were no longer enforcing the rule
that the gateway can only be set when there are static addresses
configured.

Fix this by adding back nm_editor_bind_ip_gateway_to_string(), but
with new semantics reflecting the new way NMSettingIPConfig:addresses
and :gateway work. (Besides just fixing the new bugs, this also makes
the Gateway entry insensitive when there are no addresses; before,
nmtui would allow you to type there, but the value would not be
saved.)

Fixes: Test263_nmtui_ipv4_addresses_delete_ip_and_back_to_auto

https://bugzilla.gnome.org/show_bug.cgi?id=740017
2014-11-12 16:04:59 -05:00
Thomas Haller
dd9bb5f376 man: fix make uninstall to remove the nmtui manual pages
Fixes: 1e8b681d4f
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 17:40:05 +01:00
Lubomir Rintel
4edab14e73 bluez: Another bluez5 build fix
Fixes the "unused declaration" warning with -Werror and no bluez-libs.

Fixes: f1c9595311
Fixes: 751b52e50b
2014-11-12 17:13:03 +01:00
Thomas Haller
e40fc7bb17 bluez: fix build without bluez5-dun
make[5]: Entering directory `./NetworkManager/_build/src/devices/bluetooth'
      CC       nm-bluez-device.lo
    ../../../../src/devices/bluetooth/nm-bluez-device.c: In function 'nm_bluez_device_disconnect':
    ../../../../src/devices/bluetooth/nm-bluez-device.c:430:5: error: "WITH_BLUEZ5_DUN" is not defined [-Werror=undef]
     #if WITH_BLUEZ5_DUN

Fixes: f1c9595311
Fixes: 751b52e50b
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 16:51:14 +01:00
Lubomir Rintel
751b52e50b bluetooth: Don't call into bluez5 DUN code when it's not enabled
It is conditionally compiled depending on presence of bluez-libs.
Results in undefined symbols:

NetworkManager[19346]: <warn>  (/libnm-device-plugin-bluetooth.so): failed to
    load plugin: /usr/lib64/NetworkManager/libnm-device-plugin-bluetooth.so:
    undefined symbol: nm_bluez5_dun_cleanup
2014-11-12 16:15:20 +01:00
Thomas Haller
66b05c94c0 platform: assert against expected lifetime values of NMPlatformIPAddress
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 15:58:47 +01:00
Jiří Klimeš
0391c8b161 trivial: fix description of route-metric 2014-11-12 15:30:54 +01:00
Jiří Klimeš
a928ce89ef clients: only handle secret requests for connection being explicitly activated
When a connection is being activated, nmcli could ask for secrets for another
connection, which might confuse users. We check the request now and only ask
for secrets of connection being activated.

Test case:
$ nmcli con up my-ethernet0
Passwords or encryption keys are required to access the wireless network 'Red Hat'.
Warning: password for '802-1x.identity' not given in 'passwd-file' and nmcli cannot ask without '--ask' option.
2014-11-12 13:41:49 +01:00
Thomas Haller
dcb25a37a5 glib-compat: sync local definition of g_clear_pointer() with upstream glib and remove atomic operations
Upstream glib changed g_clear_pointer() not to use atomic functions.
Update or local definition to b1dd594a22e3499caafdeccd7fa223a032b9e177
glib/gmem.h (glib 2.41.3).

(fixup whitespace to match our style).

See also the related bug https://bugzilla.gnome.org/show_bug.cgi?id=733969
from glib.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 11:11:41 +01:00
Dan Williams
12f2f09e55 core: remove unused variable 2014-11-11 17:28:50 -06:00
Dan Williams
38b6037f33 vpn: update DefaultRouteManager before sending state change signal
The DRM now affects DNS too, since it determines the "best" IPv4
and IPv6 configs based on it's idea of the default route.  The
Policy is also still updating DNS from a state-change handler for
VPN connections.

This led to a situation where the Policy would remove the VPN's
IP config from the DNS manager in vpn_connection_deactivated() and
call update_ip4_dns(), whereupon get_best_ip4_config()  returned
the just-removed VPN IPv4 config as "best" because the VPN connection
hadn't yet told the DefaultRouteManager to remove it.

Which meant VPN nameservers stuck around in resolv.conf for a long
time after the VPN was disconnected.

Fixes: a39a3ae4cd
2014-11-11 16:14:47 -06:00