Commit Graph

15260 Commits

Author SHA1 Message Date
Dan Williams
d99171d700 wwan: use modem basename as NM device name
NM_MODEM_UID is used as the modem device name, and the device name
cannot contain path-like characters.

Ofono has a bluez plugin that detects paired DUN/PAN capable
Bluetooth devices, and these devices are created with a multi-component
object path like "/hfp/org/bluez/hci0/dev_00_26_E2_AB_68_66".
The NM ofono plugin cannot use these paths as NM device names.

Instead, strip off any path components and use the last part
of the object path as the NM device name.
2016-06-28 17:34:42 +02:00
Thomas Haller
e06e1d4691 wwan: cleanup clearing ofono proxy instance 2016-06-28 17:34:42 +02:00
Thomas Haller
44ce13c786 wwan: don't compile ofono support by default and mark as experimental
At least, there are assertions that fail and must be fixed.
Still, let's merge the (incomplete) ofono patches early
to have something that can be incrementally improved.

However, for now mark it as experimental and disable it by
default.
2016-06-28 17:34:42 +02:00
Thomas Haller
521133d456 core: revert asserts to NM_ASSERT_VALID_PATH_COMPONENT() and _get_property_path()
If ofono violates these asserts, then the bug must be fixed somewhere
else, not by silently doing something wrong.
2016-06-28 17:34:42 +02:00
Thomas Haller
5a740d323e wwan: fix memleaks
And use gs_free in ofono_check_name_owner()
2016-06-28 17:34:42 +02:00
Thomas Haller
5cdb2b1520 wwan: cleanup includes 2016-06-28 17:34:42 +02:00
Thomas Haller
3ef0641674 wwan: some minor refactorings 2016-06-28 17:34:42 +02:00
Thomas Haller
4e00e7a15f wwan: remove unused code 2016-06-28 17:34:42 +02:00
Thomas Haller
735bb933f6 wwan: fix building for !WITH_OFONO 2016-06-28 17:34:42 +02:00
Thomas Haller
acac97f818 wwan: fix compilation error about wrong field name 2016-06-28 17:34:42 +02:00
Thomas Haller
9e63ada7e2 wwna: fix compiler error about wrong prototype 2016-06-28 17:34:42 +02:00
Thomas Haller
8621b0aba9 wwan: fix using wrong enum type for flags for g_dbus_proxy_new() 2016-06-28 17:34:42 +02:00
Thomas Haller
1b570723b4 trivial: style issues and indention 2016-06-28 17:34:42 +02:00
Mathieu Trudel-Lapierre
a6e81af87f wwan: add support for using oFono as a modem manager
This patch adds core wwan support for ofono, as used by Ubuntu Touch.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00089.html
2016-06-28 17:34:42 +02:00
Thomas Haller
13b2253df6 wwan: cleanup clearing modem-manager instance 2016-06-28 17:34:42 +02:00
Beniamino Galvani
88637dee66 vpn,dns: merge branch 'bg/vpn-dns-rh1348901' 2016-06-28 16:39:17 +02:00
Beniamino Galvani
df48628a48 vpn: don't merge DNS properties into parent device's configuration
DNS properties should not be copied to parent device's configuration
otherwise they will be applied twice, possibly with two different DNS
priorities.
2016-06-28 16:24:28 +02:00
Beniamino Galvani
a5d1db08f8 dns: log DNS servers at TRACE level
Be more verbose at TRACE level and log the DNS servers associated to
configurations. This will help to debug issues like [0].

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1348887
2016-06-28 16:24:28 +02:00
Beniamino Galvani
641e8b00fe vpn: reuse existing ip_config objects when config gets updated
Previously we created a new NMIP[46]Config object to replace the
previous one every time the plugin reported a new IP configuration
through the Ip[46]Config signal, but the old configuration was not
removed from the DNS manager and would become stale.

The interaction with DNS manager is handled by NMPolicy, which only
reacts to changes in connection status, so it's not easy to have the
configuration removed from DNS while keeping the connection state
ACTIVATED.

A cleaner solutions is to avoid creating a new IP configuration object
and reuse the existing one if possible. The side effect is that the
D-Bus path of the object will not change, which seems also positive.

https://bugzilla.redhat.com/show_bug.cgi?id=1348901
2016-06-28 16:24:16 +02:00
Beniamino Galvani
19133b08da vpn: dispatch pre-up scripts only once
If the plugin sends a new configuration when the connection is already
activated the state should not go back to PRE_UP since this causes
dispatcher scripts to run again.
2016-06-28 16:24:16 +02:00
Francesco Giudici
fdecb6b669 cli: option autocompletion should not match words without trailing '-'
This would fix for example:
nmcli e <TAB>
(e interpreted as --escape, would allow autocompletion to work... but
when the command is executed an error is reported)

Moreover, we will now have:
nmcli c <TAB>
autocompletion work correctly, i.e., c is correctly interpreted  as
"connection" instead of "--colors"
2016-06-28 12:12:39 +02:00
Francesco Giudici
fd4a8a202e bond/trivial: fix typo 2016-06-28 11:47:50 +02:00
Beniamino Galvani
bf7b9c60b6 cli: initialize connection list in do_device_connect()
The connection list may be required in nmc_secrets_requested() if
secrets are needed.

Fixes: 45fc268890

https://bugzilla.gnome.org/show_bug.cgi?id=767987
2016-06-27 13:09:20 +02:00
Beniamino Galvani
f2d5c8d7f8 tun,vxlan: add the CAP_IS_SOFTWARE capability
Software devices must report the NM_DEVICE_CAP_IS_SOFTWARE capability
in order to be properly activated. Add the flag to NMDeviceTun and
NMDeviceVxlan.

https://bugzilla.gnome.org/show_bug.cgi?id=767846
2016-06-27 13:08:57 +02:00
Francesco Giudici
18cd265b2d nmcli: when adding a vpn store the full service name in vpn-type
When NM looks for vpn plugins, it would expect the full service name
otherwise it will not be able to retrieve the correct plugin.
Fixes VPN configurations generated with "nmcli connection add".
2016-06-27 12:13:46 +02:00
Beniamino Galvani
4c7f609d51 cli: autocompletion: add missing log level and domains
Add KEEP level and DHCP, IP, AUDIT, SYSTEMD, VPN_PLUGIN domains.
2016-06-27 11:40:39 +02:00
Thomas Haller
8e07ea351d wifi: fix stalls in scanning
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00055.html
2016-06-25 10:33:28 +02:00
Tony Espy
899d7e5cb1 wifi: clear WiFi requested_scan if suppl exits
It's possible for wpa_supplicant to exit with an
outstanding requested_scan pending.  This can lead
to a stall condition where scanning no longer occurs.

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00117.html
2016-06-25 10:32:24 +02:00
Tony Espy
eed8fd2e43 wifi: clear WiFi requested_scan if suppl goes INACTIVE
It's possible for wpa_supplicant to transition to INACTIVE
state with an outstanding requested_scan pending.  This can
lead to a stall condition where scanning no longer occurs.

[thaller@redhat.com: added break statement to avoid fall-through]

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00116.html
2016-06-25 10:31:38 +02:00
Thomas Haller
66715515dc platform: avoid crash after calling nl_recv() for old libnl3 version
nl_recv() in libnl3 before version 3.2.15 would return dangling pointers
if nl_recv() fails or has nothing to read [1].

Workaround that by explicitly clearing @buf and @creds.

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

[1] 69468517d0
2016-06-24 19:10:03 +02:00
Francesco Giudici
aed19ff12a nmcli: fix ambiguous properties check for autocompletion
Re-enable the check on ambiguos properties but this time manage perfect
matches (i.e., the full property name has been typed) that are prefix
of other properties.

Test case:
nmcli --complete-args connection add type wifi wifi.

Here "wifi" is a property alias that is also prefix of the property
alias "wifi-sec".
2016-06-23 17:37:37 +02:00
Francesco Giudici
ea9dcd08fa nmcli: manage autocompletion of "nmcli connection add" when no args are passed
This enables back "help" "--help" "-help" in autocompletion.
2016-06-23 17:35:08 +02:00
Lubomir Rintel
1f6d060008 po: sync translations from Zanata 2016-06-22 15:03:22 +02:00
Thomas Haller
171554d073 device: clearify behavior of NM_UNMANAGED_USER_SETTINGS in comment 2016-06-22 14:07:24 +02:00
Francesco Giudici
93e1e65467 nmcli: manage "--ask connection add" with no args
When parsing arguments of "connection add" we first read the available
property-value pairs and then check if the --ask option was passed in
order to aid in the fill process of a new connection.
Anyway, if there are no property-value tuples at all, we don't even
check the --ask option, returning with error.
Fix this just checking if any arg is there (argc) before invoking
read_connection_properties().
2016-06-22 12:34:01 +02:00
Lubomir Rintel
0172c1ed2d cli: don't free the completion string when a setting name is unambiguous
If we found that setting name prefix is in fact unambiguous and return
the completion string for that setting we were freeing the string upon
the return. That looks like a typo.

Fixes "nmcli --complete-args add type wifi wifi."
                                           ^^^^ not ambiguous
2016-06-22 09:29:03 +02:00
Lubomir Rintel
67905347b2 merge: branch 'lr/connection-add'
https://bugzilla.gnome.org/show_bug.cgi?id=766427
2016-06-21 19:05:28 +02:00
Lubomir Rintel
8b39090597 cli: use --complete-args for connection add completion
And make it incredibly slow at the same time.
2016-06-21 18:40:22 +02:00
Lubomir Rintel
c3422e917d man: update the nmcli manual for new connection add syntax
It allows us to clean up the nmcli "c add" section considerably.

We list the old-fashioned aliases in a separate section that applies to both
"nmcli c add" and "nmcli c modify".

The section is now nicely cross-linked with nm-settings in HTML
rendering.
2016-06-21 18:40:22 +02:00
Lubomir Rintel
c5324ed285 nmcli: streamline connection addition
This is a huge refactoring in attempt to 1.) reduce the horrible redundancy in
the connection addition path and 2.) reduce confusion between various sources
of property value (command line, properties, interactive mode).

* The conversions from the strings was done all over the place:
  settings.c already does for all sensible properties.
  The rest is removed.

* The validations are done randomly and redundantly:
  server does some validation, and per-property client validations
  useful for interactive mode are done in settings.c
  The rest is removed.

* The information about defaults and required options was redundantly
  scattered in per-type completion functions and interactive mode
  questionnaries. This is now driven by the option_info[] table.

In general, we do our best to just map the command line options to
properties and allow mixing them. For the rest there's the
check_and_set() callbacks (basically to keep compatibility with previous
nmcli versions). This this is now all possible:

$ nmcli c add type ethernet ifname '*'
  This always worked

$ nmcli c add type bond-slave save no -- connection.autoconnect no
  The "save" and "--" still work

$ nmcli c add connection.type ethernet ifname eth0
  Properties can now be used

$ nmcli c add type ethernet ip4 1.2.3.4 mac 80:86:66:77:88:99 con-name whatever
  There's no implementation mandated order of the properties (the type
  still must be known to determine which properties make sense)

$ nmcli --ask c add type ethernet ip4 1.2.3.4 mac 80:86:66:77:88:99 con-name whatever
  The interactive mode asks only for properties that weren't specified
  on command line
2016-06-21 18:40:13 +02:00
Lubomir Rintel
057d477b2a man: turn the manual page cross-references into links
This improves the HTML rendering.

But it also causes a lot of non-resolvable linkends warning when rendering a
separate manual pages into roff/mman. The messages are harmless, but still
a bit ugly.
2016-06-21 18:40:13 +02:00
Dan Williams
fdf5b6941a libnm/libnm-glib: use Bluetooth device name as description (bgo #592819)
Abuse the 'name' property for this, for now, so we don't have to grab
a free slot from NMDeviceClass.

https://bugzilla.gnome.org/show_bug.cgi?id=592819
2016-06-21 10:35:53 -05:00
Francesco Giudici
68d48fa507 nmlci merge branch 'fg/autocomplete_fix_rh1301226_with_LR_patches'
https://bugzilla.gnome.org/show_bug.cgi?id=724860
https://bugzilla.redhat.com/show_bug.cgi?id=1301226
2016-06-21 16:30:07 +02:00
Francesco Giudici
00b362bcf2 nmcli: add support to shortnames for connection properties autocompletion 2016-06-21 16:28:48 +02:00
Lubomir Rintel
3aff650e22 nmcli: improve connection autocompletion (2/2)
Complete the property as we parse the list of properties. This makes it
possible to actually complete an unfinished property.  E.g:

  $ nmcli --complete c modify enp0s25 +ipv6.addr
  +ipv6.addresses +ipv6.addr-gen-mode
2016-06-21 16:28:48 +02:00
Lubomir Rintel
5aec1a3928 nmcli: improve connection autocompletion (1/2)
Make property autocompletion take a prefix and modifier flags.

This will make it easier to complete an unfinished property name
(possibly accompanied by a modifier) without shell trickery.
2016-06-21 16:28:48 +02:00
Lubomir Rintel
7046e806d1 cli: streamline complete_connection_by_type() arguments
Will be useful to pass around the complete flag.
2016-06-21 16:28:48 +02:00
Francesco Giudici
cd4395a261 nmcli: enable connection autocompletion for 802.1x properties
nmcli bash autocompletion leveraged on "nmcli connection edit", "print"
to retrieve the specific properties of a connection. Anyway, the
interactive editor is smart and just prints the used components, so in a
connection where 802.1x is not enabled we had no autocompletion.
Solved adding an "hidden" command "nmcli --complete connection modify"
as suggested in bgo #724860 in order to retrieve ALL the available
properties for use in autocompletion.
Here patch from L.Rintel has been merged to make che --complete option
global to nmcli (first version was local to "connection modify").

https://bugzilla.gnome.org/show_bug.cgi?id=724860
https://bugzilla.redhat.com/show_bug.cgi?id=1301226
2016-06-21 16:28:48 +02:00
Francesco Giudici
fbaaf51f52 nmcli autocompletion cleanups
* no need to check HELP_ONLY_AS_FIRST var as when --help option is passed
  _nmcli_compl_OPTIONS will return 0, falling in the general case that
  will trigger end of autocompletion

* clanup local var declaration in _nmcli func:
  - remove dupliated OPTIONS_MANDATORY declaration
  - init HELP_ONLY_AS_FIRST on declaration
  - order vars for common prefix
2016-06-21 16:28:39 +02:00
Beniamino Galvani
072358dad0 team: check return value of g_dbus_connection_call_sync()
The call can fail; in such case assume that an existing teamd died and
our instance will be able to continue.

https://bugzilla.redhat.com/show_bug.cgi?id=1347015
2016-06-21 14:58:55 +02:00