Commit Graph

13873 Commits

Author SHA1 Message Date
Dan Winship
bddc0de51e libnm-core: call crypto_init() on the fly
Rather than requiring crypto_init() to have been called beforehand,
just have every method that depends on it call it itself.

This required adding a GError argument to crypto_is_pkcs12_data(),
which in turn required a few other changes elsewhere.
2014-12-04 08:39:54 -05:00
Dan Winship
48ff21b5bc libnm-core: reimplement crypto_md5_hash() using GChecksum
Reimplement crypto_md5_hash() using GChecksum. Remove the gboolean
return value and GError argument, since it cannot fail now.
2014-12-04 08:39:54 -05:00
Dan Winship
34519eee13 tests: add a test of libnm-core's crypto_md5_hash() 2014-12-04 08:39:54 -05:00
Dan Winship
539fac8b67 libnm-util: Note that nm_utils_deinit() is a no-op
nm_utils_deinit() is a no-op, so don't suggest that people need to
call it.
2014-12-04 08:39:54 -05:00
Dan Winship
926f4e1473 libnm: drop nm_utils_deinit()
It was a no-op anyway.
2014-12-04 08:39:54 -05:00
Dan Winship
cb025dba5b libnm-core: fix the rule for parsing 'gateway' out of 'addresses' (rh #1170199)
We were always using the gateway field of the first address in
ipv4.addresses / ipv6.addresses to set the gateway, but to be
compatible with old behavior, we should actually be using the first
non-0 gateway field (if the first one is 0).
2014-12-03 16:31:50 -05:00
Dan Williams
3cf2fbbf47 core: fix leak of generated connection if device is active
Don't generate (and add to settings) a connection if we aren't going
to use it anyway.
2014-12-03 14:25:45 -06:00
Dan Winship
5dd48f7527 devices: don't release slaves on exit (rh #1169936)
nm_device_removed() calls nm_device_release_one_slave() in order to
fix up NetworkManager's master/slave bookkeeping, but we don't want to
tell the kernel to actually unslave the device, since that would
happen automatically anyway if the device was really removed, and
shouldn't happen if the device is just being removed from NM's device
list.

(In particular, don't remove all libvirt-created virtual network
devices from virbr0 when NetworkManager exits.)
2014-12-03 13:19:48 -05:00
Thomas Haller
6d6c433bab ifcfg-rh: don't include nm-utils-private.h outside of libnm-core/ 2014-12-03 17:36:08 +01:00
Jiří Klimeš
0e727062fc cli: g_strdup(NULL) returns NULL; simplify code for that 2014-12-03 16:03:19 +01:00
Thomas Haller
09130c5693 contrib/rpm: ignore libgsystem/ repository in build_clean.sh 2014-12-03 15:01:12 +01:00
Jiří Klimeš
1a4259d23a cli: additional fix for nmcli connection down
nmcli crashed when a timeout was hit, because 'info' was used after freeing
in down_timeout_cb().

Fixes 4a7c88621d.
2014-12-03 13:22:29 +01:00
Jiří Klimeš
4a7c88621d cli: fix deactivation for multiple connections (bgo #740775) (rh #1168383)
$ nmcli connection down aa bb cc

It has been broken by commit 20566c76de.

Fixups by dcbw.

https://bugzilla.gnome.org/show_bug.cgi?id=740775
https://bugzilla.redhat.com/show_bug.cgi?id=1168383
2014-12-03 10:54:49 +01:00
Lubomir Rintel
e257744f9e device: Deal with links that vanish during initialization
nm_device_get_hw_address() may return NULL and nm_platform_link_get_type may
return NM_LINK_TYPE_NONE. While it might be a good idea to check for such cases
at the init time it seems easier to just ignore it and prevent blowing up in
subsequent deactivation.

A quick test case:

  # while :; do ip link add moo0 type veth peer moo1; ip link del moo0 ; done

Yields:

  NetworkManager:ERROR:devices/nm-device-ethernet.c:268:constructor:
    assertion failed: (link_type == NM_LINK_TYPE_ETHERNET ||
    link_type == NM_LINK_TYPE_VETH)

  nm_device_set_hw_addr: assertion 'addr != NULL' failed

https://bugzilla.gnome.org/show_bug.cgi?id=740992
2014-12-02 11:44:49 +01:00
Dan Williams
20566c76de cli: wait for "con down" to deactivate the connection (bgo #740775) (rh #1168383)
nmcli currently does not wait for the connection to fully deactivate, which
can take some time due to dispatcher scripts or cleanup operations like
DCB.  Change it to wait until the connection is deactivated, or until
a short timeout has expired.  The user can adjust the timeout with
"--wait" if they want.

https://bugzilla.gnome.org/show_bug.cgi?id=740775
https://bugzilla.redhat.com/show_bug.cgi?id=1168383
2014-12-01 10:04:50 -06:00
Thomas Haller
711c0eab5b iface-helper: disambiguate route priority for IPv4 and IPv6
https://bugzilla.gnome.org/show_bug.cgi?id=740780
2014-12-01 16:58:31 +01:00
Thomas Haller
ae2b8d6353 core: rename NM_PLATFORM_ROUTE_METRIC_DEFAULT to NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6
For IPv4, iproute for example defaults to a metric of 0.
Hence, the name NM_PLATFORM_ROUTE_METRIC_DEFAULT was misleading.

Also add a NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP4 define for completeness.

https://bugzilla.gnome.org/show_bug.cgi?id=740780
2014-12-01 16:38:05 +01:00
Thomas Haller
c3246d962d nmcli/bash-completion: complete [+-] modifier for connection modify property
Fixes
  nmcli connection modify CONNECTION +conn<TAB>
2014-12-01 15:22:10 +01:00
Thomas Haller
f6fba86984 keyfile: assert in writer to have valid connection id
Few lines above we already verify the connection. We must
have an @id.
2014-11-28 18:39:54 +01:00
Jiří Klimeš
72156ba1c5 cli: fix setting ethernet.s390-subchannels
It was not properly updated in a7c4d53d03 (when
updating stuff to ne libnm).

And allow 2 subchannels (libnm and ifcfg-rh allow it too).
2014-11-28 14:27:31 +01:00
Jiří Klimeš
313a4081b5 devices: NM_SETTING_WIRED_S390_SUBCHANNELS is now G_TYPE_STRV (rh #1168764)
Fixes crash on s390.
The type change of the property was done in 6a4127cfa0,
but we forgot to update this function.

https://bugzilla.redhat.com/show_bug.cgi?id=1168764
2014-11-28 12:20:04 +01:00
Thomas Haller
4bf04700bb core: adjust values for default route-metrics per device type
We recently changed default values for route metrics. Revise that
again and increase the space between the default values.

No strong reason to do this, but it seems better to have larger
gaps and make use of the available range.
2014-11-26 20:39:18 +01:00
Thomas Haller
3210bb93a1 vpn: don't choose route priority for VPN connections based on the parent device
The parent device is just the device that happens to be the best device.
It does not mean, that its route metric should be inherited to the VPN
connection.

This also makes the resulting route metric for VPN connections much
more predictable: now it is either ipv4.route-metric from the connection,
or it falls back to NM_VPN_ROUTE_METRIC_DEFAULT (10).
2014-11-26 19:25:12 +01:00
Jiří Klimeš
382906c391 libnm: (trivial) correct an example in NMSecretAgentOldGetSecretsFunc docs 2014-11-26 14:07:46 +01:00
Thomas Haller
94274c6fcd build: fix wrongly linking against libreadline in all applications
Every Makefile in the subtrees would include -lreadline
as part of LIBS, hence every application would link against
the library.

This was broken since we added 'm4/ax_lib_readline.m4'.

Fixes: 29297f8531
2014-11-26 11:43:23 +01:00
Thomas Haller
f32075d2fc core: merge branch 'th/bgo723178_device_route_metric'
https://bugzilla.gnome.org/show_bug.cgi?id=723178
2014-11-26 00:18:49 +01:00
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