Commit Graph

227 Commits

Author SHA1 Message Date
Lubomir Rintel
868e1ddc07 cli: remove some dead code
Coverity points out.
2016-02-12 15:48:12 +01:00
Lubomir Rintel
1783826856 cli: sort_access_points() doesn't take a NULL argument
The device never returns NULL access point list, it only deallocates it on
dispose(). Make this clear for Coverity:

CID 59387 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking aps suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
2016-02-11 17:01:03 +01:00
Lubomir Rintel
fa6375cd8b cli: add nmcli d reapply
Client support for O.FD.NM.Device.Reapply().
2016-01-10 23:13:34 +01:00
Jiří Klimeš
629de4e689 cli: add global --show-secrets option
- it controls echoing passwords input on terminal
- it replaces --show-secrets in 'nmcli connection show', which is deprecated now
- it replaces --show-password in 'nmcli device wifi hotspot', which is deprecated now
2015-12-07 14:14:58 +01:00
Jiří Klimeš
1056408fd4 cli: use nmc_readline_echo() for asking password in 'nmcli dev wifi connect' 2015-12-07 14:14:58 +01:00
Lubomir Rintel
d03f347b9d cli: add nmcli monitor
https://bugzilla.redhat.com/show_bug.cgi?id=1034158
2015-12-05 12:16:23 +01:00
Lubomir Rintel
9b49284f0c cli,devices: add device monitor 2015-12-05 12:16:04 +01:00
Lubomir Rintel
2a646a74dd cli,devices: factor out parsing of the interface list
This is duplicated already and the monitor will use it.
2015-12-05 12:05:17 +01:00
Lubomir Rintel
225f6594c4 cli,devices: factor out device_state_to_color()
We'll use this for device status monitor too.
2015-12-05 12:05:17 +01:00
Lubomir Rintel
88ae8d2b13 cli: turn should_wait into a semaphore
Count the exit blockers. We'll want to terminate the device monitor in case all
monitored devices vanish.
2015-12-05 12:05:17 +01:00
Jiří Klimeš
579fd36566 cli: improve error messages for 'nmcli device set'
Fixes: 4dffbf8f6a
2015-11-25 16:39:00 +01:00
Jiří Klimeš
0dc48370b4 cli: print a warning if BSSID is given instead of SSID for hidden AP
$ nmcli dev wifi connect 00:22:6B:EB:1D:CA hidden yes
Warning: '00:22:6B:EB:1D:CA' should be SSID for hidden APs; but it looks like a BSSID.
Error: Failed to add/activate new connection: 802-11-wireless.ssid: connection does not match access point
2015-11-11 09:47:51 +01:00
Beniamino Galvani
5b3137984d cli: add command for displaying LLDP neighbors
The list of LLDP neighbors is available through the D-Bus interface
and libnm already provides functions to retrieve it; make the list
available through nmcli as well. Sample output:

  $ nmcli device lldp
  NEIGHBOR[0].DEVICE:                     eth0
  NEIGHBOR[0].CHASSIS-ID:                 00:13:21:58:CA:42
  NEIGHBOR[0].PORT-ID:                    1
  NEIGHBOR[0].PORT-DESCRIPTION:           1
  NEIGHBOR[0].SYSTEM-NAME:                ProCurve Switch 2600-8-PWR
  NEIGHBOR[0].SYSTEM-DESCRIPTION:         ProCurve J8762A Switch 2600-8-PWR, revision H.08.89
  NEIGHBOR[0].SYSTEM-CAPABILITIES:        20 (mac-bridge,router)
  NEIGHBOR[1].DEVICE:                     eth2
  NEIGHBOR[1].CHASSIS-ID:                 00:01:30:F8:AD:A2
  NEIGHBOR[1].PORT-ID:                    1/1
  NEIGHBOR[1].PORT-DESCRIPTION:           Summit300-48-Port 1001
  NEIGHBOR[1].SYSTEM-NAME:                Summit300-48
  NEIGHBOR[1].SYSTEM-DESCRIPTION:         Summit300-48 - Version 7.4e.1 (Build 5)
  NEIGHBOR[1].SYSTEM-CAPABILITIES:        20 (mac-bridge,router)

https://bugzilla.gnome.org/show_bug.cgi?id=757307
2015-11-10 14:06:02 +01:00
Jiří Klimeš
2f52a10be1 cli: add '--show-password' option for 'nmcli device wifi hotspot'
It is useful to show nmcli-generated hotspot password (if a user does not
provide his own password). Without the option the user would have to look into
the generated profile in order to find out the password.
2015-11-10 09:15:06 +01:00
Jiří Klimeš
781d24f1dd cli: add 'password' option for 'nmcli device wifi hotspot'
It allows user provided password to be used to secure the hotspot.
Otherwise, nmcli will generate a suitable password.
2015-11-10 09:10:48 +01:00
Jiří Klimeš
d6427d7198 cli: add 'nmcli device wifi hotspot' command
Synopsis:
nmcli device wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>]
                          [band a|bg] [channel <channel>]
2015-11-10 09:08:05 +01:00
Thomas Haller
6a82b4e2ed cli: fix nmcli device set DEV managed true
Fixes: 4dffbf8f6a
2015-11-06 14:52:11 +01:00
Jiří Klimeš
e7ed259fdc cli: print s390 subchannels for devices that have that 2015-09-29 09:31:41 +02:00
Jiří Klimeš
9294962cc4 cli: remove static width parameter from fields definition
The width is no longer needed because the actual field's width is computed
dynamically just before printing.
(as of commit e6870789b5)
2015-09-25 12:09:51 +02:00
Thomas Haller
4cb0ab5d29 cli: fix type on printed nmcli error message
Fixes: 4dffbf8f6a
2015-09-21 18:25:50 +02:00
Thomas Haller
7405d5c7b7 nmcli: extend nmcli device set command to accept explicit ifname specifier
Without it, you cannot set the properties of a device named "help".
Now you can with:

  $ nmcli device set ifname help autoconnect no
2015-09-18 13:14:44 +02:00
Lubomir Rintel
4dffbf8f6a cli: add nmcli device set command
Co-Authored-By: Thomas Haller <thaller@redhat.com>
2015-09-18 13:14:35 +02:00
Jiří Klimeš
5955a66e09 cli: fix connecting to a hidden SSID with 'nmcli dev wifi connect' (bgo #752173)
We have to set 802-11-wireless.hidden=true to be able to connect to hidden SSIDs.
nmcli user indicates hidden SSID with 'hidden yes' parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=752173
2015-08-14 12:42:56 +02:00
Jiří Klimeš
e247567d87 cli: add 'ssid' parameter for 'nmcli device wifi rescan'
'ssid' can repeat when more SSIDs should be scanned, e.g.
$ nmcli dev wifi rescan ssid "hidden cafe" ssid AP12 ssid "my home Wi-Fi"

Bash completion fixed by thaller@redhat.com
2015-08-14 12:42:15 +02:00
Jiří Klimeš
bccc1af51b cli: fix an bug when reporting an error
$ nmcli dev wifi rescan ifname eteee

(process:21211): libnm-CRITICAL **: nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed
Error: Device 'eteee' is not a Wi-Fi device.

Fixes: 823df334ed
2015-08-13 09:48:12 +02:00
Dan Winship
22e1a97e12 all: drop includes to <glib/gi18n.h> for "nm-default.h"
The localization headers are now included via "nm-default.h".

Also fixes several places, where we wrongly included <glib/gi18n-lib.h>
instead of <glib/gi18n.h>. For example under "clients/" directory.
2015-08-05 15:35:51 +02:00
Thomas Haller
19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Dan Winship
3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Beniamino Galvani
f208e7030f cli: add 'metered' property to device 2015-06-09 18:11:25 +02:00
Lubomir Rintel
29fe1abf0d cli: stop waiting for deactivation if device reaches unmanaged state
default-unmanaged devices enter unmanaged state right after they're
disconnected.
2015-04-23 10:22:26 -04:00
Jiří Klimeš
1b9c1ed6d3 cli: add NM-PLUGIN-MISSING to devices 2015-04-20 10:04:26 +02:00
Jiří Klimeš
823df334ed cli: better indicate when a Wi-Fi plugin might not be available (rh #1168573)
* print an error message indicating NM Wi-Fi plugin may be missing, for
  nmcli device wifi ifname <dev-name>
  nmcli device wifi connect ifname <dev-name>

* add NM-TYPE to 'nmcli device show' command displaying internal NM device type
  (like NMDeviceWifi, NMDeviceGeneric, ...)

https://bugzilla.redhat.com/show_bug.cgi?id=1168573
2015-04-20 09:52:31 +02:00
Dan Winship
721e917cb6 wimax: drop WiMAX support (bgo #747846)
Even Fedora is no longer shipping the WiMAX SDK, so it's likely we'll
eventually accidentally break some of the code in src/devices/wimax/
(if we haven't already). Discussion on the list showed a consensus for
dropping support for WiMAX.

So, remove the SDK checks from configure.ac, remove the WiMAX device
plugin and associated manager support, and deprecate all the APIs.

For compatibility reasons, it is still possible to create and save
WiMAX connections, to toggle the software WiMAX rfkill state, and to
change the "WIMAX" log level, although none of these have any effect,
since no NMDeviceWimax will ever be created.

nmcli was only compiling in support for most WiMAX operations when NM
as a whole was built with WiMAX support, so that code has been removed
now as well. (It is still possible to use nmcli to create and edit
WiMAX connections, but those connections will never be activatable.)
2015-04-17 12:42:23 -04:00
Jiří Klimeš
8252553615 cli: add PHYS_PORT_ID property to devices
The physical-port-id property was added to libnm (libnm-glib) in commit
47cc8b25f2.
2015-04-14 12:18:00 +02:00
Beniamino Galvani
aabc6fc57b wifi: indicate 2ghz and 5ghz wifi device capabilities
Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the
frequency bands supported by a Wifi device.

Add also CAP_FREQ_VALID, which is set when the values of the other 2
capabilities are available.

Original patch by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723295
2015-04-08 10:48:38 +02:00
Jiří Klimeš
b8a2f42a38 cli: allow multiple devices for 'nmcli device disconnect/delete' (bgo #746097)
Allow disconnecting and deleting multiple interfaces at a time. It is much
more user friendly. TAB and bash completions are supported as well.

https://bugzilla.gnome.org/show_bug.cgi?id=746097
2015-03-20 11:03:44 +01:00
Jiří Klimeš
643291bea5 cli: sort access point list
According to signal strength, frequency and rate.
2015-02-26 11:54:45 +01:00
Jiří Klimeš
fad26c286c cli: color output of 'nmcli device wifi list' 2015-02-24 15:14:13 +01:00
Jiří Klimeš
4668f2038e nmcli: show devices list in colors 2015-02-23 09:24:21 +01:00
Jiří Klimeš
fda5a4703d cli: add parent device information for VLAN devices 2014-11-24 10:33:22 +01: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
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
Lubomir Rintel
653b7e4805 cli: Watch for device as well as AC state changes when activating
The signals might be delivered in no particular order and we need to wait for
the device to reach stable state (whether it's successfully conntected or not)
as well as the active connection to leave ACTIVATING state.

https://bugzilla.gnome.org/show_bug.cgi?id=740320
2014-11-19 17:06:33 +01:00
Lubomir Rintel
7d80a17631 cli: Finish waiting for the device activation when it disconnects
The device status alone is uninteresting as its changes can be due to
deactivation of previously active connection. We should monitor the
active connection changes instead of device state changes.

However the device state changes is still interesting, as it contains the
reason for the change, let's just ignore them while the connection is
activating.

Lastly, we need to handle failures as well. It should be noted that it's
not sufficient to deal with NM_DEVICE_STATE_FAILED as the device will
quickly draverse to NM_DEVICE_STATE_DISCONNECTED. This happens in case of
a failure due to NM_DEVICE_STATE_REASON_NO_SECRETS as soon as the server
makes sure it won't reconnect automatically.
2014-11-14 16:46:40 -06:00
Lubomir Rintel
529092f035 Revert "cli: Finish waiting for device activation when they disconnect"
In case there's already a connection on the device, it traverses to
DISCONNECTED. We shouldn't cease waiting then.

This reverts commit 94a57d5e07.
2014-11-14 13:54:13 +01:00
Lubomir Rintel
94a57d5e07 cli: Finish waiting for device activation when they disconnect
When wifi secrets are missing, NM_DEVICE_STATE_FAILED due to
NM_DEVICE_STATE_REASON_NO_SECRETS is immediately followed by traversal to
NM_DEVICE_STATE_DISCONNECTED as soon as the server makes sure it won't
reconnect automatically. We sometimes aren't quick to handle the first signal
and only get the latter one.

Let's treat all states that aren't ordinarily reached upon activation as bad.
2014-11-13 18:55:37 +01:00
Jiří Klimeš
b75dfc62e8 cli: fix nmcli timeout when disconnecting a device
$ nmcli dev disconnect nm-bond
Error: Timeout 10 sec expired.

When a software device is disconnected, it will be removed. And it may not go
to NM_DEVICE_STATE_DISCONNECTED state before that. So we need to listen to
"device-removed" signal.

Fixes:Beaker:test_log-NetworkManager_Test189_bond_activate
2014-11-10 17:22:52 +01:00
Dan Winship
ca18b2d442 libnm: create NMDhcpConfig as parent of NMDhcp4Config and NMDhcp6Config
As with NMIP4Config and NMIP6Config, merge the two DHCP config classes
into one in the public API.
2014-11-07 07:49:40 -05:00
Dan Winship
d34910b128 libnm: create NMIPConfig as parent of NMIP4Config and NMIP6Config
Create NMIPConfig as the parent of NMIP4Config and NMIP6Config, and
remove the two subclasses from the public API; while it's convenient
to still have both internally, they are now identical to the outside
world.
2014-11-07 07:49:40 -05:00