Commit Graph

13873 Commits

Author SHA1 Message Date
Thomas Haller
2b55de8560 libnm-core: properly handle %NULL @ip in nm_utils_ipaddr_valid()
A is_valid() function should just accept NULL as input and
return "invalid". It certainly should not crash.

Fixes: 21c8a6b20e
2015-07-22 13:49:17 +02:00
Lubomir Rintel
063677101a ip4-config: 0.0.0.0 is a valid gateway too
It makes sense for point-to point links.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
2015-07-22 13:49:17 +02:00
Lubomir Rintel
e67b52ed16 default-route-manager: pick up platform changes after NMDevice
If a default route is configured externally, we want the device to pick the
change and register it with the default-route-manager first.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
2015-07-22 13:46:28 +02:00
Thomas Haller
bebeff69e8 device: always assume default-route for generate-assumed-connections
Commit d51975e changed, that we treat assumed and non-assumed
connections the same with respect to the default route. This is
certainly wrong, if we have an nm-generated-assumed connection
at hand. In this case, NM just generated a connection based on what
was configured on the system. Looking at that result and re-enforcing
the default-route is wrong.

We want to manage the default-route for assumed, persistent connections.
If the connection was assumed and generated, we do not.

This commit reverts d51975ed for nm-generated-assumed connection and
restores the previous behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483

Fixes: d51975ed92
2015-07-22 13:45:28 +02:00
Thomas Haller
cbd246c9b0 device: move setting v4_commit_first_time/v6_commit_first_time to the end of merge_and_apply() 2015-07-22 13:33:01 +02:00
Thomas Haller
ad03cdbc73 device/trivial: rename private field in NMDevicePrivate
Rename "default_route.v4_configure_first_time" to "v4_commit_first_time".

For one, the name "commit" matches better to the @commit variable in ip4_config_merge_and_apply()
and ip6_config_merge_and_apply(). Then, we don't need this information
only for default-routes, so move the variable out of the @default_route
struct.
2015-07-22 13:33:01 +02:00
Tore Anderson
3efb6740fc device: prefer wifi over wwan by default
This makes wifi preferred to wwan (the modem and bluetooth device types
to be specific) by default, so that users that care about being
connected at all times can keep both enabled with auto-connect. As wifi
is usually unmetered and often faster than wwan, it makes sense to
prefer it. This is also how pretty much every smart-phone in the world
behaves, so it aligns better with user expectations too.

https://bugzilla.gnome.org/show_bug.cgi?id=744754
2015-07-22 10:50:23 +02:00
Dan Williams
70f5968e9c libnm: fix nm_access_point_get_last_seen() code doc after 1e85c358
Fixes: 1e85c358
2015-07-17 17:32:28 -05:00
Dan Williams
4e47d36d73 libnm-core: fix GOI annotations after 019943bb
Fixes: 019943bb
2015-07-17 17:31:17 -05:00
Jiří Klimeš
94b1b53a91 cli: fix verifying flag-based properties (rh #1244048)
Some of the properties changed from GParamSpecUInt to GParamSpecFlags, namely
NM_SETTING_VLAN_FLAGS
NM_SETTING_DCB_APP_FCOE_FLAGS
NM_SETTING_DCB_APP_ISCSI_FLAGS
NM_SETTING_DCB_APP_FIP_FLAGS
NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS
NM_SETTING_DCB_PRIORITY_GROUP_FLAGS

(commit fcfb4b40ba)

https://bugzilla.redhat.com/show_bug.cgi?id=1244048
2015-07-17 11:36:03 +02:00
Jiří Klimeš
2af10ef444 docs: fix a copy/paste error in description of VLAN flags 2015-07-17 09:20:29 +02:00
Dan Williams
f99d98b56a merge: vpn: delay quitting when a new secrets request comes in (bgo #752237)
https://bugzilla.gnome.org/show_bug.cgi?id=752237
2015-07-16 16:50:32 -05:00
Dan Williams
3272ff6fc5 libnm/libnm-glib: don't quit in the middle of asking for secrets (bgo #752237)
If the VPN plugin terminated and the user started it again, then the
quit timer will still be running and it sometimes happens that the
VPN plugin will quit while the UI is asking the user for secrets.
That's not very nice, so don't do that.

Reproducer: while connect to the VPN, suspend your laptop.  Then
resume it, and immediately re-start the VPN connection.  Watch the
secrets dialog disappear within a very short time.

https://bugzilla.gnome.org/show_bug.cgi?id=752237
2015-07-16 16:50:10 -05:00
Dan Williams
aa7ab4b056 libnm/libnm-glib: clean up VPN plugin timeouts
Use nm_clear_g_source().
2015-07-16 16:46:27 -05:00
Thomas Haller
eab32a5252 connectivity: log warning when using https:// URI
https://bugzilla.gnome.org/show_bug.cgi?id=747866
2015-07-16 17:08:55 +02:00
Dan Williams
6a81daf1cb connectivity: explicitly check for 511/Network Authentication Required (RFC6585) (bgo #670394)
If the response affirmatively indicates you're behind a portal, we might as well
use that information.

https://bugzilla.gnome.org/show_bug.cgi?id=670394
2015-07-16 10:04:44 -05:00
Thomas Haller
2a3a4eb16f config/rpm: use plain HTTP URI for connectivity checking
https://bugzilla.gnome.org/show_bug.cgi?id=747866
2015-07-16 16:44:49 +02:00
David Shea
568b4ad31f libnm: handle illegal characters in nm_utils_ssid_to_utf8() (rh #1243078)
g_convert_with_fallback() will fail if the SSID contains characters that
are not legal in the source encoding, which, if $LANG is not set, will
be ASCII. If this happens, replace all non-ASCII and non-printable
characters with '?'. It is possible that nm_utils_ssid_to_utf8() will
now return an empty string (e.g., the source string is actually
big-endian UTF-16 and g_strcanon() stops on the first byte), but it will
not return NULL.

https://bugzilla.redhat.com/show_bug.cgi?id=1243078
2015-07-16 14:22:03 +02:00
Jiří Klimeš
7b6299d8dd cli: fix a crash adding a slave connection with 'nmcli -a con add'
Valid types: [generic, 802-3-ethernet (ethernet), pppoe, 802-11-wireless (wifi), wimax, gsm, cdma, infiniband, adsl, bluetooth, vpn, 802-11-olpc-mesh (olpc-mesh), vlan, bond, team, bridge, bond-slave, team-slave, bridge-slave]
Connection type: team-slave
Interface name [*]: eth5
Master: nm-team

Program received signal SIGSEGV, Segmentation fault.
0x000000000041ae6d in normalized_master_for_slave (connections=connections@entry=0x7fffec0019a0, master=<optimized out>, master@entry=0x73b470 "nm-team",
    type=type@entry=0x72f7c0 "team", out_type=out_type@entry=0x0) at connections.c:3218
3218					*out_type = con_type;

Fixes: aa12bb353b
2015-07-15 17:16:11 +02:00
Jiří Klimeš
9856ca6058 cli: fix formating of "nmcli con add help" output 2015-07-15 16:08:31 +02:00
Jiří Klimeš
133996acbb cli: add 'slave-type' parameter for "nmcli con add" to bash completion
Fixes: 1375d9c13a
2015-07-15 16:00:18 +02:00
Jiří Klimeš
819d3c3db1 settings: call dispatcher when setting hostname with systemd
Now that we set hostname with systemd, call dispatcher in nm-settings.c.
gethostname() in nm-policy.c already sees the new hostname.

Fixes: 6dc35e66d4
Fixes: 6c3d71c431
Fixes:Beaker:NetworkManager_Test44_dispatcher_hostname
2015-07-15 15:34:56 +02:00
Lubomir Rintel
924117c144 build: fix comment for NM_MORE_LOGGING
Reported-by: Michael Biebl <biebl@debian.org>
2015-07-15 11:03:35 +02:00
Dan Horák
97cf6e47dd contrib/rpm: WEXT depends on enabled wifi 2015-07-14 19:02:35 +02:00
Thomas Haller
59ca132b3a logging: merge branch 'th/logging-sd-journal-bgo752136'
https://bugzilla.gnome.org/show_bug.cgi?id=752136
2015-07-14 15:59:13 +02:00
Thomas Haller
81f3c36f23 logging: refactor level conversion from switch() to @level_desc lookup-array 2015-07-14 15:55:14 +02:00
Thomas Haller
f7581bbedc logging: add compile time default for logging.backend configuration 2015-07-14 15:55:14 +02:00
Thomas Haller
533a08359e logging: add "journal-syslog-style" logging backend to log the old format
This mode logs the same message line as we do for "syslog".
2015-07-14 15:55:14 +02:00
Thomas Haller
96a7f3a3ba logging: make use of journal configurable 2015-07-14 15:55:14 +02:00
Thomas Haller
1b808d3b25 logging: add native systemd-journald support to nm-logging 2015-07-14 15:55:14 +02:00
Thomas Haller
cd5417ff4f build: detect systemd-journald support 2015-07-14 15:52:50 +02:00
Thomas Haller
b1b26e8049 logging: factor our construction of logging message in _nm_log_impl() 2015-07-14 15:52:50 +02:00
Thomas Haller
831a5e32fb logging: refactor @syslog_opened variable to @log_backend 2015-07-14 15:52:50 +02:00
Thomas Haller
d0345ede26 logging: allow calling nm_logging_syslog_openlog() only once 2015-07-14 15:52:50 +02:00
Thomas Haller
9020cd1aac logging: remove nm_logging_syslog_closelog()
Remove nm_logging_syslog_closelog(). The reasons are:

  - closelog() is optional according to the manual.

  - we called nm_logging_syslog_closelog() at the end of the
    main() function. But we have destructors running afterwards,
    so we were closing the log before logging the last line.
    Apparently that had no bad consequences either, so why was
    closelog() even useful?
    Also, it's hard to determine when we log the last line and
    only closelog() afterwards.

  - closelog() does not revert what openlog() did, this is ugly.
2015-07-14 15:52:50 +02:00
Thomas Haller
09ba572174 config: move debug command line option to NMConfig
Whether NM runs in debug mode is also interesting to other
components outside of "main.c". Expose global_opt.debug
via a new nm_config_get_is_debug() function.

Actually, we should move parsing of all command line options
to NMConfig, as NMConfig is the central instance to provide
such information.
2015-07-14 15:52:50 +02:00
Thomas Haller
aa54d5a36e config: add nm_config_data_get_value_cached() function
nm_config_data_get_value() returns an allocated string. This is inconvenient
for the caller. Add a utility function nm_config_data_get_value_cached() that
caches the returned value. Of course, use with care as the returned string
will be invalidated by each call to nm_config_data_get_value_cached().
2015-07-14 15:52:50 +02:00
Thomas Haller
5cc2eabe5d route-manager: merge branch 'th/route-full-sync'
Fix route manager not to delete externally added routes
but only routes that were previously added by route manager.

Also, add a test case and refactor the _exists() functions
to have them more useful.
2015-07-14 13:41:00 +02:00
Thomas Haller
ae721e7f0a route-manager/test: add test for full-sync 2015-07-14 13:36:50 +02:00
Thomas Haller
cf4b1a0c3d test: add nmtst_platform_ip4_route() utils 2015-07-14 13:36:50 +02:00
Thomas Haller
6f8fcd2f47 platform: replace addr/route exists() functions by get()
Rename exists() functions to get() and return the cached platform
object.
2015-07-14 13:36:50 +02:00
Thomas Haller
7bda970928 route-manager: align trace logging statement 2015-07-14 13:36:50 +02:00
Thomas Haller
8b015826e6 routes: fix race syncing routes by not doing full-sync
In most cases, when syncing routes, we should only remove routes
that were configured by us previously. Otherwise, there is a race
that we can remove routes added externally.

Now, when applying IP configuration for a device, only do a full-sync
at the first time when we activate the device. Later on, only remove
routes that were added by us.
2015-07-14 13:36:50 +02:00
Thomas Haller
6124f5b94a routes/trival: add argument @routes_full_sync to IP config commit
The argument is still unused, so no behavioral change yet.
2015-07-14 13:36:50 +02:00
Thomas Haller
65f2090cc2 route-manager: add argument to to only remove routes that were added by NMRouteManager
Add an argument @full_sync to the sync method of NMRouteManager.
@full_sync was what we did up to now, meaning, we removed every
route on the interface that was no on our internal list of known
routes.

Now with !@full_sync, only remove routes that were tracked previously.
This means, we will only remove routes that were added by us previously.

Don't make use of the new option yet. So there is no change of behavior
yet.
2015-07-14 13:36:50 +02:00
Thomas Haller
b9bc960e97 route-manager/trivial: fix naming of local variable 2015-07-14 13:36:50 +02:00
Lubomir Rintel
a9996c4f1d vpn-plugin-old,dispatcher: cast unchecked g_variant_lookup() calls to void
This is done to silence coverity. In the dispatcher the existence of the
key is checked before and we're fine with leaving the value untouched
in the vpn-plugin-old.
2015-07-14 13:18:07 +02:00
Lubomir Rintel
da612acc6a linux-platform: correct the lifetime conditional
Coverity detected that it was always-true:
src/platform/nm-linux-platform.c:4035: dead_error_line: Execution cannot reach the expression "preferred != 0U" inside this statement: "if (lifetime != 0U || lifet...".
2015-07-14 13:02:15 +02:00
Lubomir Rintel
421cf84343 config: fix a potential NULL dereference
Coverity:
src/nm-config.c:598: var_deref_op: Dereferencing null pointer "groups".
2015-07-14 12:41:40 +02:00
Jiří Klimeš
a418750f07 vpn: send firewall zone to firewalld also for VPN connections (rh #1065948)
https://bugzilla.redhat.com/show_bug.cgi?id=1065948
https://bugzilla.redhat.com/show_bug.cgi?id=1238124
2015-07-14 12:23:03 +02:00