Commit Graph

13873 Commits

Author SHA1 Message Date
Thomas Haller
0555df65d3 core: minor fix to ensure safe boolean comparison in have_ip6_address()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 17:12:00 +01:00
Lubomir Rintel
653b7e4805 cli: Watch for device as well as AC state changes when activating
The signals might be delivered in no particular order and we need to wait for
the device to reach stable state (whether it's successfully conntected or not)
as well as the active connection to leave ACTIVATING state.

https://bugzilla.gnome.org/show_bug.cgi?id=740320
2014-11-19 17:06:33 +01:00
Jiří Klimeš
9503d35d1e man: fix formatting leftover from man -> xml migration 2014-11-19 16:53:30 +01:00
Jiří Klimeš
3c8dfb91f6 man: update version reference to 1.0 in manual pages 2014-11-19 16:53:30 +01:00
Jiří Klimeš
9a13378753 dispatcher: introduce new env variables for gateway address (bgo #740363)
IP4_GATEWAY
VPN_IP4_GATEWAY
IP6_GATEWAY
VPN_IP6_GATEWAY

We still put gateway into IP[46]_ADDRESS_N for backward compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=740363
2014-11-19 16:52:25 +01:00
Lubomir Rintel
c30379e0fd libnm-core: Add missing type cast
Fixes testing on 32-bit arches:

/core/general/test_setting_compare_timestamp:
(./test-general:29331): GLib-GObject-WARNING **: g_object_set_valist: object class `NMSettingConnection' has no property named `$?\xff\xff\x89t$0\x89|$4\xe8\u001c\x98\xff\xff\x85\xc0tM\x83\xf8\xfft3\x8dT$(\xc7D$\u0008'
/bin/sh: line 5: 29331 Trace/breakpoint trap   ${dir}$tst
FAIL: test-general

Fixes: 093a3c88d0
2014-11-19 16:04:41 +01:00
Dan Winship
8473bb310d tui: refresh the "nmtui connect" list when connections are added/removed
We were refreshing the list when the set of available devices changed,
or the set of active connections changed, but not when the set of
available connections changed.

https://bugzilla.gnome.org/show_bug.cgi?id=740333
2014-11-19 10:03:57 -05:00
Dan Winship
11c1cad8ae docs: update setting/plugin docs, and build them from libnm (bgo 740224) 2014-11-19 09:24:10 -05:00
Jiří Klimeš
485edd52a7 libnm-core: update ip6-privacy ifcfg-rh description 2014-11-19 09:24:10 -05:00
Jiří Klimeš
a4d4fa04b5 libnm-core: document AUTOCONNECT_PRIORITY for ifcfg-rh 2014-11-19 09:24:10 -05:00
Jiří Klimeš
3bcba5ddf9 libnm-core: update BAND and CHANNEL ifcfg-rh description
We support BAND variable now.
2014-11-19 09:24:10 -05:00
Jiří Klimeš
a244e61688 libnm-core: update documentation of addresses and gateway properties 2014-11-19 09:24:10 -05:00
Jiří Klimeš
07bd9a1b76 man: ifcfg-rh manual page text update 2014-11-19 09:24:10 -05:00
Dan Winship
c7341c982d man, docs: add the secret flags notes non-hackishly
Since libnm-core secret-flags properties are now enum-typed rather
than just being uints, we can now actually recognize them when
generating docs, rather than just assuming that every property whose
name ends in '-flags', but isn't in NMSettingDcb, is a secret-flags
property.
2014-11-19 09:24:10 -05:00
Dan Winship
e43ba45f2f cli, libnm: don't use D-Bus-specific documentation in nmcli
Now that nm-setting-docs.xml is more D-Bus-specific, it's less
appropriate for nmcli's internal documentation. So generate a second
copy of the docs without using the overrides file, and use that one
for nmcli's documentation.
2014-11-19 09:24:10 -05:00
Dan Winship
36156b70dc libnm: Override parts of nm-setting-docs.xml
Add "---dbus---" sections to the NMSetting property docs, in the same
style as the plugin docs, parse them out into a file
"nm-setting-docs-overrides.xml", and use them to override the GObject
property docs in nm-setting-docs.xml.

This lets us put more D-Bus-specific information in the setting docs,
without cluttering up the property docs, and it also lets us document
dbus-only properties.
2014-11-19 09:24:10 -05:00
Dan Winship
780d8bf2fe libnm: fix nm-setting-docs.xml property types
Add nm_setting_get_dbus_property_type(), and use this to get the
correct type for properties in nm-seting-docs.xml, in situations where
the D-Bus and GObject property types don't match.

In the case of enum/flags-valued properties, give both the enum name
and the underlying D-Bus type.
2014-11-19 09:24:10 -05:00
Dan Winship
2f81a8bcbe libnm-core: make GBytes D-Bus marshalling be built-in to NMSetting
Each GBytes-valued property was using
_nm_setting_class_transform_property() to register a GBytes<->'ay'
transform. So just build that rule into the generic machinery in
nm-setting.c.
2014-11-19 09:24:10 -05:00
Dan Winship
c14486984e libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.

With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).

The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...

(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-11-19 09:24:09 -05:00
Jiří Klimeš
3889ff864c man: update nmcli-examples manual page 2014-11-19 15:21:34 +01:00
Jiří Klimeš
3595bef178 man: fix a typo in nmtui manual page 2014-11-19 13:22:28 +01:00
Thomas Haller
d638ccdeca firewall: merge branch 'th/rh1098281_firewall_assumed_device'
https://bugzilla.redhat.com/show_bug.cgi?id=1098281

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 13:08:15 +01:00
Thomas Haller
06a45fdcaf firewall: don't set firewall zone for assumed devices
https://bugzilla.redhat.com/show_bug.cgi?id=1098281

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 12:59:42 +01:00
Thomas Haller
1141727690 firewall: always complete callbacks asynchronously
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 12:59:42 +01:00
Thomas Haller
90a3332199 firewall: invoke FwAddToZoneFunc callback also when cancelling
Not invoking a callback when cancelling the operation is counter
intuitive.

Note that NMPolicy refs the device, cancelling the call would leave
the reference hanging. That was not an issue because the call was
never cancelled. But still the behavior of NMFirewallManager is
unexpected.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 12:58:36 +01:00
Thomas Haller
b0b7473af1 firewall: make call handle an opaque pointer type
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 12:58:36 +01:00
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