Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
5dfad33823 iface-helper: make priority variable guint32
Also read the command line argument as G_OPTION_ARG_INT64 type. Otherwise, on
32-bit integers, you could not enter any number larger then G_MAXINT32.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 22:30:38 +01:00
Thomas Haller
34124296c0 core: fix route metrics for subnet routes
For IPv4 addresses, the kernel automatically adds a route when
configuring an IP address. Unfortunately, there is no way to control
this behavior or to set the route metric.

Fix this, by adding our own route and removing the kernel provided
one.

Note that this adds a major change in that we no longer call
nm_ip4_config_commit() for assumed devices.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 22:30:38 +01:00
Thomas Haller
0b50940f43 platform: add paramter to ip4_route_add to set src (RTA_PREFSRC)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 22:30:38 +01:00
Jiří Klimeš
ad73a7a1e9 libnm-util: return empty hash, not NULL in nm_setting_to_hash() (bgo #740681)
The function was changed to return NULL instead of empty hash by commit
ad56cfa914. Later, the condition had to be
relaxed for NMSettingGeneric (commit 4d32618264).
Unforfunately, it shows up that there are other use cases that require
presence of a setting (that might have all properties default), such as
NMSettingBridgePort for bridge slave connections.

libnm already behaves this way, since commit
6325c596c0.

https://bugzilla.gnome.org/show_bug.cgi?id=740681
2014-11-25 18:35:41 +01:00
Dan Winship
61f8ed9c2a tui: fix a bug that hid the IP method popup (rh #1167710) 2014-11-25 08:19:25 -05:00
Jiří Klimeš
78068d6bae libnm: add missing (transfer) annotation for nm_device_vlan_get_parent() 2014-11-25 12:48:11 +01:00
Thomas Haller
a2e93f2de4 libnm: allow zero prefix length for NMIPRoute
NMIPRoute is used by NMSettingIPConfig, but also
NMIPConfig. In the former case, default routes are (still)
disallowed. But in the NMIPConfig use-case, it can make sense
to expose default routes as NMIPRoute instances.

Relax the restriction on the NMIPRoute API to allow this
future change.

No code actually supports having NMIPRoute instances with
prefix length zero (default routes). Up to now, all such uses
would be a bug.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:02:46 +01:00
Thomas Haller
0b59752512 dhcp: fix printf format string for printing guint32 variable
Fixes: 9013fd42d6
2014-11-24 17:26:54 +01:00
Thomas Haller
13d9b28323 dhcp: pass device specific route metric to nm_dhcp_systemd_get_lease_ip_configs()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 10:52:56 -05:00
Dan Winship
9013fd42d6 dhcp: fix expiry time logging/exporting
The previous nm-dhcp-systemd code for logging the lease expiry time,
and exporting that value to D-Bus was clamping the value to
G_MAXUINT32-1, but that's unnecessary on x86_64, and incorrect on x86
(since time_t is signed).

Correctly adding a value to the current time and not overflowing seems
to be more-or-less impossible without having separate cases for 4- and
8-byte time_t. Since this was basically just for logging purposes
anyway, just log the number of seconds rather than the timestamp, and
then we don't have to worry about sizeof(time_t).
2014-11-24 10:52:56 -05:00
Jiří Klimeš
67d030a4f5 merge: reflect parent device manage/unmanage state for VLANs (rh #1114681)
VLAN device watches the parent and reacts to its state change. However, on
creation, the device was made managed, even if the parent was unmanaged. Fix
that and export VLAN parent device property too. The property is added to
libnm/libnm-glib and nmcli as well.

https://bugzilla.redhat.com/show_bug.cgi?id=1114681
2014-11-24 10:42:03 +01:00
Jiří Klimeš
fda5a4703d cli: add parent device information for VLAN devices 2014-11-24 10:33:22 +01:00
Jiří Klimeš
21fd88c43d libnm: add :parent property for VLAN devices 2014-11-24 10:33:22 +01:00
Jiří Klimeš
922a78d120 libnm-glib: add :parent property for VLAN devices 2014-11-24 10:33:22 +01:00
Jiří Klimeš
4e105c5012 core: add NM_UNMANAGED_PARENT flag for a dependency on parent device
VLAN device depends on its parent, for instance. If the parent is not managed,
then the VLAN can't be either.
2014-11-24 10:33:21 +01:00
Jiří Klimeš
fa325dca5a vlan: export parent device for VLANs as D-Bus property
and use the internal construct-time parent property for VLAN creation.
2014-11-24 10:33:13 +01:00
Yuri Chornoivan
5b75e00d43 po: updated Ukranian translation (bgo #740533)
https://bugzilla.gnome.org/show_bug.cgi?id=740533
2014-11-23 13:55:23 +01:00
Dan Winship
2dc8daf6b8 libnm: merge branch 'secret-agent-old-bgo740345'
Rename NMSecretAgent to NMSecretAgentOld, to leave the name
"NMSecretAgent" open for a new-and-improved version in NM 1.2.

Also, a handful of NMSecretAgentSimple fixups.

https://bugzilla.gnome.org/show_bug.cgi?id=740345
2014-11-21 12:23:36 -05:00
Dan Winship
71b4c05fca libnm: rename NMSecretAgent to NMSecretAgentOld
As with NMVpnPluginOld, rename NMSecretAgent to NMSecretAgentOld, to
leave the name "NMSecretAgent" open for a new-and-improved version in
NM 1.2.
2014-11-21 12:17:41 -05:00
Dan Williams
88c9c6a6ac clients: merge nm_secret_agent_simple_set_connection_path() into nm_secret_agent_simple_enable()
set_connection_path() is almost always called right before enable(),
and it's unclear why it would be called anywhere else.  So just
merge the two methods.
2014-11-21 12:14:48 -05:00
Dan Winship
a1f746351a clients: NMSecretAgentSimple API fixups
nm_secret_agent_simple_*() functions should take an
NMSecretAgentSimple, not an NMSecretAgent.

The type macros were incorrectly validating against
NM_TYPE_SECRET_AGENT rather than NM_TYPE_SECRET_AGENT_SIMPLE.
2014-11-21 12:08:35 -05:00
Lubomir Rintel
abcb3184b3 libnm-core: Add a missing initializer
/libnm/crypto/PKCS#8: OK
/libnm/crypto/cert/pem: ==16241== Conditional jump or move depends on uninitialised value(s)
==16241==    at 0x121967: crypto_load_and_verify_certificate (crypto.c:605)
==16241==    by 0x12512E: nm_utils_file_is_certificate (nm-utils.c:2279)
==16241==    by 0x1201F1: test_cert (test-crypto.c:113)
2014-11-21 16:00:19 +01:00
Lubomir Rintel
13beedc83f nmtui: Add a not reached assert to make compiler happy
nmt-editor.c: In function ‘nmt_editor_constructed’:
nmt-editor.c:365:2: error: ‘page’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  add_sections_for_page (editor, grid, page);
  ^
2014-11-21 15:32:37 +01:00
Dan Winship
c955070ca6 tui: merge branch 'tui-sections-bgo719768'
Various code reorganizations inside nmtui; should have no
externally-visible effect.

https://bugzilla.gnome.org/show_bug.cgi?id=719768
2014-11-21 09:08:00 -05:00
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