Commit Graph

13873 Commits

Author SHA1 Message Date
Dan Winship
04ef74b16f tui: tweak NmtEditorGrid column rules
If an NmtEditorGrid row has a widget, but no label, then we make the
widget span both the label and widget columns. But previously we
weren't doing the same for rows with labels but no widgets. (In fact,
we didn't even allow rows with no widgets; label-only rows had to
specify dummy widgets.)

Fix it so that labels will span into an empty widget column. (This
ensures that a long section name won't force the entire grid to have
an overwide label column).

Also, in both the "no label" and "no widget" cases, still show the
"extra" column if it's present.
2014-11-21 09:01:01 -05:00
Dan Winship
5f6b0be525 tui: simplify DSL page handling
Rather than having NmtEditor need to know that DSL requires a DSL
page, and Ethernet page, and a PPP page, just have the DSL page itself
return multiple sections.
2014-11-21 09:01:01 -05:00
Dan Winship
2afb1acb2d tui: rework how editor pages work
Instead of having NmtEditorPage be a widget itself, have it just be an
object that returns a list of NmtEditorSections, where
NmtEditorSection is a subclass of NmtNewtSection.

(This will be important when adding VPN pages, which will be split up
into multiple sections, but with the different sections needing to
cooperate on updating the NMSettingVpn. This reorganization lets us
have an NMPageVpn containing multiple sections, with the NMPageVpn
object handling the coordination between the sections.)
2014-11-21 09:01:01 -05:00
Dan Winship
84d875546b tui: merge NmtPageMain into NmtEditor
All page types except NmtPageMain are displayed as collapsible
sections. NmtPageMain behaved quite differently from everything else.
So merge it into its container, NmtEditor.
2014-11-21 09:00:16 -05:00
Dan Winship
277ed5bec0 tui: rename two classes
Rename NmtPageDevice to NmtEditorPageDevice, and rename NmtPageGrid to
NmtEditorGrid.

Now all types with names starting with "NmtPage" are instantiable page
types, not abstract classes or low-level widgets.
2014-11-21 08:58:31 -05:00
Dan Winship
b5ef91775d libnm-core: merge branch 'cert-apis-bgo719768'
Misc updates to libnm-core certificate handling. (Prologue to nmtui
vpn editing work.)

https://bugzilla.gnome.org/show_bug.cgi?id=719768
2014-11-21 08:55:22 -05:00
Dan Winship
1c4f41c610 libnm-core: add nm_utils_file_is_certificate() and _file_is_private_key()
Add nm-utils methods to check if a file is a certificate or private
key file.

nm-applet currently has its own internal versions of these, but they
ended up having to duplicate a bunch of logic that we already have in
crypto.c.
2014-11-21 08:46:07 -05:00
Dan Winship
7c74e71e91 libnm-core: tweak crypto.c APIs
Update crypto_verify_private_key() and
crypto_verify_private_key_data() to indicate whether the key was
encrypted or not.

Rename crypto_decrypt_private_key() and
crypto_decrypt_private_key_data() to
crypto_decrypt_openssl_private_key*, since that's the only private key
format they deal with, and the old names made them sound more generic
than they were. Also, update the openssl private key parsing code to
recognize unencrypted private keys as well. (Previously we accepted
unencrypted PKCS#8 keys, but not unencrypted openssl-style keys.)
2014-11-21 08:46:07 -05:00
Dan Winship
1313658829 libnm-core, libnm-util: move test cert files to libnm-core/
Move the certificate files used by the libnm-util and libnm-core tests
from libnm-util/tests/certs/ to libnm-core/tests/certs/.
2014-11-21 08:40:09 -05:00
Dan Winship
98da2ae72c libnm-core: port test-crypto to g_assert* macros
And in particular, add some g_assert_error() checks
2014-11-21 08:40:09 -05:00
Dan Williams
4b7a736c40 build: update NEWS 2014-11-20 15:15:10 -06:00
Jiří Klimeš
4b799db1d3 cli: add support for secret agent to 'nmcli dev connect' too
And move secrets getting code to common.c (without changes).
2014-11-20 16:36:29 +01:00
Jiří Klimeš
a1f16d255d clients: fix processing a secret agent request 2014-11-20 16:28:45 +01:00
Lubomir Rintel
224acba8f6 cli,vpn: merge branch 'lr/nm-1-0-fixes'
Fixes for various issues identified during 1.0 testing.

https://bugzilla.gnome.org/show_bug.cgi?id=740135
2014-11-20 16:12:21 +01:00
Lubomir Rintel
991df80408 cli: Process secret agent request for a connection only if we know its path
If we're activating the device without knowing the connection in advance, defer
servicing the requests for the secrets until we set the path.

[lkundrak@fedora20-2 ~]$ nmcli --ask c ifname wlan0

(process:18405): libnm-CRITICAL **: nm_object_get_path: assertion 'NM_IS_OBJECT (object)' failed
Error: Connection activation failed: The device has no connections available.
[lkundrak@fedora20-2 ~]$
2014-11-20 16:00:58 +01:00
Dan Winship
1706bd0308 docs: fix build-from-tarball (again) 2014-11-20 09:40:47 -05:00
Lubomir Rintel
c83b40aca7 device: Remove unmanaged slaves from master when they disappear
We've previously been just watching for state changes into UNMANAGED state. No
state change is emitted upon removal of a device which is already unmanaged.

https://bugzilla.gnome.org/show_bug.cgi?id=737659
2014-11-20 14:43:17 +01:00
Jiří Klimeš
e2f489ebda docs: fix a typo in ifcfg-rh documenation 2014-11-20 13:18:32 +01:00
Thomas Haller
943db815ee translations: avoid preprocessor strings inside translation macro
https://bugzilla.gnome.org/show_bug.cgi?id=740381

Reported-by: Yuri Chornoivan <yurchor@ukr.net>
2014-11-20 12:42:15 +01:00
Lubomir Rintel
01ca15993b dispatcher: Fix tests
IP4_GATEWAY variable was added to the environment.

Fixes: 9a13378753
2014-11-20 11:59:56 +01:00
Dan Williams
5de8a0d3a7 platform: stop using private kernel tun device flags (bgo #740380)
The TUN_* flags are going to be deprecated upstream in the kernel
so we might as well stop using them.

https://lkml.org/lkml/2014/11/19/460

https://bugzilla.gnome.org/show_bug.cgi?id=740380
2014-11-19 18:39:08 -06:00
Thomas Haller
5338178d81 policy: merge branch 'th/bgo735512_route_metric_v2'
Further fixes to NMDefaultRouteManager.

https://bugzilla.gnome.org/show_bug.cgi?id=735512
2014-11-19 23:01:51 +01:00
Thomas Haller
a0f81f266b policy: enforce absence of default route on never-default VPN connections
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:33 +01:00
Thomas Haller
308a5e7953 policy: fix handling managed devices without default route
Before, we would only track a device in NMDefaultRouteManager
if it had a default route. Otherwise the entry for the device
was removed.

That was wrong, because having no entry meant that the interface
is assumed and hence we would not touch the interface. Instead we must
esplicitly track devices without default route to know when an interface
has no default route.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:33 +01:00
Thomas Haller
815e67a61f policy: sort default routes by metrics before adding them
It's better to add the more important routes first. Otherwise there
might be a short time when a lower priority route has precedence.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
1f5f576c33 policy: pick up externally configured default routes for managed interfaces
The previous commit made NM enforce the default route on interfaces for
which NM manages a default route.

For interfaces that are configured never-default, NM will now pick up
any externally configured default route, as if it was managed by NM.
This is important, because NMDefaultRouteManager needs a notion of which
is the best device. Without this change, it was agnostic to default routes
on managed, never-default interfaces.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
16b0ddb66d policy: resync routes on platform change events
Monitor default routes from platform, and resync the default routes
on changes.

For one, this fixes the following use-case: have an assumed device em1
with two routes of metric 20 and 21. Activate em2, which will get effective
metric 22.
When externally removing route em1/20, em2 would resync the effective metric to
20. This is correct and already worked before. However, when deleting em1/21,
nothing happened. With this change, em2 would resync to metric 21 to fill the gap.

However this commit has much bigger effects: whenever the user externally adds
a default route to an interface for which NM manages an default route, NM will
delete it.
Also, when deleting the default route (managed by NM), NM would readd
it. Effectivly, the user can no longer mess with the default route on
interfaces for which it manages the default route.

If the connection is configured never-default, the user still can add
default routes and NM will not touch them.

Obviously, this has no effect for assumed devices either and the user
can externally add and remove default routes as he wishes.

https://bugzilla.gnome.org/show_bug.cgi?id=735512

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
b4b67c47f1 policy: consider additional assumed routes when synchronizing the default route
Don't only consider the best route of assumed devices when syncing the route
metrics. This fixes the following scenario:

Have em1 assumed, with two default routes (metric 20 and 21).
When activating em2, NMDefaultRouteManager would  have determined
21 as the effective metric, thus replacing the assumed route of em1.

Since we don't want to touch assumed interfaces, it is wrong to
replace their default routes.

Instead, keep track of all the assumed default routes and consider their
metrics when choosing effective_metric.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
6d4bb29781 policy: minor refactoring in NMDefaultRouteManager to access routes generically
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
57dd4a125b device: only add default route when having any addresses
This fixes the failure to add a default route because no
addresses are configured yet.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
462456f255 policy: remove redundant remove_default_route() functions from NMDefaultRouteManager
When calling update_default_route(), NMDefaultRouteManager will look at the
source, and determine whether it has a default route or not. For example
for device sources, this means calling nm_device_get_ip4_default_route().

If the source indicates that it has no default route, the effect of
calling update_default_route() is the same as calling
remove_default_route() (hence, remove() can be replaced by update()).

If the source however still indicates a default route, the behavior
would be different. This case would be an undesired inconsistancy,
because source and NMDefaultRouteManager would disagree of whether
the source has a default route.
Source must always properly indicate whether it has a default route
or not, hence this situation does not arise.

Hence it is always better to call update().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
393f213c3b policy: remove unused @do_sync argument from NMDefaultRouteManager functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
825885d5b1 policy: minor fix when having multiple default routes with metric MAXUINT32
The case of having a metric MAXUINT32 is special, because in face of
multiple default routes with the same metric, NMDefaultRouteManager
cannot reduce the effective metric (because there is no lower priority
value).

This case works already correct, just when adding such a default route,
ensure that we add it to the *first* entry.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:32 +01:00
Thomas Haller
a43ed6cb80 policy: refactor NMDefaultRouteManager to use union type NMPlatformIPXRoute
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:31 +01:00
Lubomir Rintel
d4240ad04c cli: Abort when given name of a non-existent connection for nmcli up
Even when ifname is present: nmcli c up name Nonexistent ifname wlan0
2014-11-19 19:51:44 +01:00
Lubomir Rintel
75f767ca23 libnm: Don't expect VPN connections to attach to the device 2014-11-19 19:51:44 +01:00
Lubomir Rintel
282d9b0e10 vpn: Propagate daemon exec error correctly
NetworkManager[31624]: <warn>  VPN service 'openvpn': could not launch the VPN service. error: (8) Failed to execute child process "/usr/local/libexec/nm-openvpn-service" (No such file or directory).
**
NetworkManager:ERROR:nm-manager.c:3094:_activation_auth_done: assertion failed: (error)
2014-11-19 19:51:44 +01:00
Lubomir Rintel
51974196f9 cli: Only escape VPN banner if it's present
If the connection is in ACTIVATING state, the banner is still NULL.
2014-11-19 19:51:44 +01:00
Thomas Haller
81446b5ad3 platform: add typedef for unions NMPlatformIPXAddress and NMPlatformIPXRoute
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 19:51:36 +01:00
Dan Winship
9f5cff0bb3 Merge branch 'dhcp-fixes' 2014-11-19 12:03:24 -05:00
Dan Winship
93799e68ba man: document the "internal" DHCP client 2014-11-19 12:03:03 -05:00
Dan Winship
4f2c553172 dhcp: Simplify nm-dhcp-systemd lease-handling code
An sd_dhcp_lease will always have an associated address, netmask, and
lifetime, so we don't have to check for errors when fetching them.
(The systemd code will fill in a default netmask if the server didn't
provide one; nm-dhcp-systemd's code to do that itself was redundant
and unused.)

Also, log the expiration time and NTP servers, for consistency with
everything else.
2014-11-19 12:03:03 -05:00
Dan Winship
7bf7ebc470 dhcp: fix startup warnings with dhcp=internal
If asked to read a file that doesn't exist, sd_dhcp_lease_load()
returns 0 (success) without setting the out lease argument. So we need
to check both the return status and the lease before proceeding.
2014-11-19 12:03:03 -05:00
Dan Winship
71b676590c dhcp: fix systemd-dhcp's writing of routes in lease file
inet_ntoa() uses a static buffer, so you can't call it twice in the
same fprintf() call.

https://bugs.freedesktop.org/show_bug.cgi?id=86438
2014-11-19 12:03:03 -05:00
Dan Winship
44eb50d12f dhcp: update system-dhcp code from upstream 2014-11-19 12:02:36 -05:00
Dan Winship
e30b07149f dhcp: update nm-dhcp-systemd code for system-dhcp re-import
Some of the patches we proposed were committed in slightly different
form.
2014-11-19 12:02:17 -05:00
Dan Winship
74678cf56b dhcp: re-fix system-dhcp code after re-import 2014-11-19 12:02:12 -05:00
Dan Winship
1ea0dd41b0 Merge branch 'master' into dhcp-merge
Conflicts:
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
	src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
	src/dhcp-manager/systemd-dhcp/src/shared/util.c
	src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-client.h
	src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-lease.h
2014-11-19 12:02:00 -05:00
Jiří Klimeš
af525e8a18 trivial: fix a comment typo in generate-plugin-docs.pl 2014-11-19 17:54:03 +01:00
Dan Winship
e2e4637cf4 dhcp: update systemd DHCP code
This is a direct dump from systemd git on 2014-11-19, git commit
a4962513.  Only relevant files were included.

    SYSTEMD_DIR=../systemd
    COMMIT=a4962513c555fe3ac4b5bebf97a71701361a45b0

    (
       cd "$SYSTEMD_DIR"
       git checkout "$COMMIT"
       git clean -fdx
    )
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-packet.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-packet.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/async.h ./src/dhcp-manager/systemd-dhcp/src/shared/async.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.c ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.h ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/list.h ./src/dhcp-manager/systemd-dhcp/src/shared/list.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/dhcp-manager/systemd-dhcp/src/shared/macro.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/refcnt.h ./src/dhcp-manager/systemd-dhcp/src/shared/refcnt.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.c ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.h ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/socket-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/socket-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/sparse-endian.h ./src/dhcp-manager/systemd-dhcp/src/shared/sparse-endian.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.c ./src/dhcp-manager/systemd-dhcp/src/shared/strv.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.h ./src/dhcp-manager/systemd-dhcp/src/shared/strv.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.c ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.h ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.c ./src/dhcp-manager/systemd-dhcp/src/shared/util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.h ./src/dhcp-manager/systemd-dhcp/src/shared/util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/unaligned.h ./src/dhcp-manager/systemd-dhcp/src/shared/unaligned.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/_sd-common.h ./src/dhcp-manager/systemd-dhcp/src/systemd/_sd-common.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-event.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-event.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-id128.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-id128.h
2014-11-19 11:34:52 -05:00