Commit Graph

357 Commits

Author SHA1 Message Date
Dan Williams
94ae8449c9 cli: let libnm-glib create our bus connection
libnm-glib handles connecting to the bus automatically if NULL
is passed for the bus object.  Do that; plus this lets us use
the private bus connection if present.
2013-04-08 11:30:32 -05:00
Dan Winship
5fec30d98e Revert :carrier-detect properties and associated code
Ignoring carrier is generally something you want at the machine level
(eg, for a server), not at the connection level.
2013-04-03 10:23:49 -04:00
Dan Winship
9e71bb3cd5 cli: add property get functions - returning property value for presentation
Simplify code by using property get functions, with most of them
autogenerated based on GObject properties and GValue transforms.

Based on a patch from Jiří Klimeš
2013-03-26 12:15:49 -04:00
Jiří Klimeš
113d358ce5 cli: make 'value' in NmcOutputField non const 2013-03-26 12:15:49 -04:00
Jiří Klimeš
82fb1978a4 all: use G_VALUE_INIT to initialize GValue variables
It makes the initializations more explicit.
G_VALUE_INIT is available since glib 2.30, and NM now require glib >= 2.32
2013-03-25 08:41:18 +01:00
Jiří Klimeš
3c98c2798f cli: show connection:interface-name property for connections 2013-03-14 12:18:38 +01:00
Jiří Klimeš
5e17df86f4 cli: fix a crash in 'nmcli d l' when no connections available for a device
The regression caused by 1dca1e3c3d
2013-02-26 11:44:22 +01:00
Michael Biebl
1556a19c3e Add bash-completion file for nmcli
Based on work by Guillaume Rousse <guillomovitch@gmail.com>
2013-02-19 21:20:59 +01:00
Jiří Klimeš
1dca1e3c3d cli: print NMDevice's 'available-connections' property in CONNECTIONS section
of 'nmcli device list'

Example:
nmcli -f connections d l iface wlan5
2013-02-18 13:31:00 +01:00
Jiří Klimeš
18609641a0 cli: add CARRIER-DETECT properties for wired, infiniband, vlan settings 2013-02-18 10:09:33 +01:00
Jiří Klimeš
32b38693f1 cli: show AP and ADHOC support in WIFI-PROPERTIES for Wi-Fi devices 2013-02-12 10:01:31 +01:00
Jiří Klimeš
17aff29082 cli: add NM_ACTIVE_CONNECTION_STATE_DEACTIVATED state-to-string translation 2013-02-11 13:00:02 +01:00
Jiří Klimeš
b3edc86e78 cli: prevent possible crash if removing devices while nmcli running (bgo #693158) 2013-02-05 10:00:58 +01:00
Jiří Klimeš
609b2d1782 cli: add missing properties (mainly secrets flags, and some others) 2013-01-30 15:27:06 +01:00
Jiří Klimeš
7881cb3252 cli: add missing 'dhcp-hostname' property to 'ipv6' setting 2013-01-30 12:27:13 +01:00
Jiří Klimeš
0215ad40f0 cli: use setting_details() to simplify printing connection details 2013-01-30 12:27:13 +01:00
Jiří Klimeš
0c7bf6ba67 cli: add generic setting_details() for printing NMSetting 2013-01-30 12:27:13 +01:00
Jiří Klimeš
0f05bfb01f cli: fix a possible crash on missing SSID 2013-01-21 14:49:24 +01:00
Thomas Graf
789f8c730d cli: add bridge support 2012-11-30 13:21:51 -06:00
Jiří Klimeš
35689c7bd0 cli: allow next_arg() to move arguments past the last one 2012-11-20 15:20:38 +01:00
Jiří Klimeš
e9e2c5645f cli: replace 'dev' and 'con' OBJECTs by 'device', resp. 'connection'
Shorter forms work as previously. Thus, all of these commands are valid:
nmcli device, nmcli devic, nmcli devi, nmcli dev, nmcli de, nmcli d
nmcli connection, nmcli connectio, ..., nmcli conn, nmcli con, ..., nmcli c
2012-11-13 15:41:20 +01:00
Jiří Klimeš
c8974bc32d cli: allow more forms of "help" command showing OBJECTs' description
allow "-[h]elp" and "--[h]elp" in addition to "help"
2012-11-13 15:41:20 +01:00
Marc Ruiz
811c87f8ae typo: replace all misstyped 'seconadary' strings with 'secondary' 2012-11-04 23:08:02 +01:00
Jiří Klimeš
8a0e928aed cli/examples: NM_802_11_MODE_AP mode is not valid for NMAccessPoint objects 2012-11-01 15:40:27 +01:00
Colin Walters
59f2cd0f8d build: remove G_DISABLE_DEPRECATED
This functionality is (mostly) obsoleted by the newer
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED defines.  With
this, your build doesn't all of a sudden blow up if we deprecate
something in GLib - you have to explicitly opt-in to the newer
version.

G_DISABLE_DEPRECATED does still apply for macros and things that can't
take __attribute__((deprecated)), but it's not really worth the pain
and cargo culting around just for that.
2012-10-31 19:41:07 +01:00
Jiří Klimeš
16edfae11a cli: add VLAN section to 'nmcli dev list' for VLAN devices
Now, it just contains one item - ID showing VLAN ID of the device.
2012-10-22 15:18:34 +02:00
Jiří Klimeš
65fc99911d cli: add BOND section to 'nmcli dev list' for bond devices
Now, it just contains one item - SLAVES listing all slave devices of the bond
device.
2012-10-22 14:31:11 +02:00
Jan Luebbe
f9c72dee3e wifi: support ap-mode with wpa_supplicant
A new value for NM80211Mode is introduced (NM_802_11_MODE_AP) and the
new mode is passed to wpa_supplicant analogous to adhoc-mode.
The places which need to know the interface mode have been extended to
handle the new mode.

If the configuration does not contain a fixed frequency, a channel is
selected the same way as with adhoc-mode before.
2012-10-17 12:08:11 -05:00
Jiří Klimeš
07fc3dcb90 api: add NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED reason and use that 2012-09-24 10:38:26 +02:00
Jiří Klimeš
dc3b2a4c81 cli: print 'secondaries' property of 'connection' setting
nmcli -f connection con list id "my connection"
2012-09-24 10:38:17 +02:00
Jiří Klimeš
004ea8166a cli: add NM_DEVICE_STATE_REASON_SSID_NOT_FOUND reason-to-string mapping 2012-09-21 10:04:28 +02:00
Mick Boldon
d8b2e8c64a cli: fix "etc." typo (bgo #681173)
https://bugzilla.gnome.org/show_bug.cgi?id=681173
2012-09-10 13:09:09 +02:00
Jiří Klimeš
bafd97b087 cli: add missing properties of 'connection' setting
zone
master
slave-type
2012-09-05 16:14:37 +02:00
Jiří Klimeš
c4bb7f26a8 cli: add NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE reason-to-string mapping 2012-08-30 14:14:27 +02:00
Jiří Klimeš
de763a42ec cli: put indexes into [] for AP and NSP in 'nmcli dev list' output
AP1 -> AP[1]
NSP1 -> NSP[1]
It's more readable (section names are AP an NSP) and it makes indexing
format conform to other data, like IP4.DNS[1].
2012-08-29 10:39:09 +02:00
Jiří Klimeš
853803c2f0 cli: use an error quark for domain in g_set_error() instead of 0 (rh #842975)
glib 2.32 makes a runtime check that domain is not NULL:
GLib-WARNING **: (gerror.c:390):g_error_new_valist: runtime check failed: (domain != 0)
2012-07-25 13:57:45 +02:00
Jiří Klimeš
05a83b909d cli: add 'ip6-privacy' property of ipv6 setting 2012-07-18 12:56:31 +02:00
Jiří Klimeš
2efeac8c5f cli: add DRIVER-VERSION and FIRMWARE-VERSION fields to driver properties listing 2012-06-08 13:44:43 +02:00
Jiří Klimeš
5903392887 cli: free strings when printing adsl setting 2012-06-07 12:28:06 +02:00
Jiří Klimeš
56d5a57728 cli: add NM_DEVICE_STATE_REASON_BR2684_FAILED reason-to-string mapping 2012-06-07 12:08:22 +02:00
Jiří Klimeš
716a09d7ac cli: use "--" instead of "no set" for NULL strings 2012-06-04 12:25:43 +02:00
Jiří Klimeš
29a8fbaca3 cli: list 'autoconnect' property in 'nmcli dev list' 2012-05-23 13:25:43 +02:00
Jiří Klimeš
a8076f0d9d cli: fill active connections' data even if we can't get NMConnection
This can happen e.g. when D-Bus limits number of replies and there's
a lot of connections. Then nm_remote_settings_list_connections() won't
return all connections and the connection that was activated can be among
the missing connections.
2012-05-22 17:05:34 +02:00
Pantelis Koukousoulas
8039dd30d8 adsl: add libnm-glib and nmcli code
For the finale, this is the libnm-glib and nmcli part of the support,
with this you can now make a full pppoatm connection from NetworkManager
by configuring it in system scope in a keyfile.

As an example, here is mine:
(password and username snipped for obvious reasons)

[connection]
id=MYISP
uuid=34d04e69-fdd9-4231-af2c-25ed1f34dc1e
type=adsl
timestamp=1304621332

[adsl]
username=user@myisp.com
password=mypassword
vpi=8
vci=35
encapsulation=vcmux
protocol=pppoa

[ipv6]
method=ignore

[ipv4]
method=auto

Extract from logs:
NetworkManager[29155]: <info> Activation (ueagle-atm0) starting connection 'MYISP'
NetworkManager[29155]: <info> (ueagle-atm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) starting...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: prepare -> config (reason 'none') [40 50 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) successful.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: config -> ip-config (reason 'none') [50 70 0]
NetworkManager[29155]: <info> starting PPP connection
NetworkManager[29155]: <debug> [1304671146.590156] [nm-ppp-manager.c:1047] nm_ppp_manager_start(): command line: /usr/sbin/pppd nodetach lock nodefaultroute user user@myisp.com plugin pppoatm.so 8.35 noipdefault noauth usepeerdns lcp-echo-failure 0 lcp-echo-interval 0 ipparam /org/freedesktop/NetworkManager/PPP/0 plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so
NetworkManager[29155]: <info> pppd started with pid 29175
NetworkManager[29155]: <debug> [1304671146.591235] [NetworkManagerUtils.c:816] nm_utils_get_proc_sys_net_value(): (ueagle-atm0): error reading /proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra: (4) Failed to open file '/proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra': No such file or directory
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) complete.
Plugin pppoatm.so loaded.
Plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so loaded.
** Message: nm-ppp-plugin: (plugin_init): initializing
** Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
NetworkManager[29155]: <debug> [1304671146.612937] [nm-udev-manager.c:621] handle_uevent(): UDEV event: action 'add' subsys 'net' device 'ppp0'
NetworkManager[29155]: <debug> [1304671146.613134] [nm-udev-manager.c:525] net_add(): ignoring interface with type 512
NetworkManager[29155]: <debug> [1304671146.617308] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x1090
Using interface ppp0
Connect: ppp0 <--> 8.35
** Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
** Message: nm-ppp-plugin: (nm_phasechange): status 6 / phase 'authenticate'
** Message: nm-ppp-plugin: (get_credentials): passwd-hook, requesting credentials...
NetworkManager[29155]: <debug> [1304671149.639511] [nm-agent-manager.c:1044] nm_agent_manager_get_secrets(): Secrets requested for connection /org/freedesktop/NetworkManager/Settings/0 (adsl)
NetworkManager[29155]: <debug> [1304671149.639684] [nm-settings-connection.c:717] nm_settings_connection_get_secrets(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets requested flags 0x1 hint 'password'
NetworkManager[29155]: <debug> [1304671149.640950] [nm-agent-manager.c:959] get_start(): (0x9b4ad10/adsl) system settings secrets sufficient
NetworkManager[29155]: <debug> [1304671149.641332] [nm-settings-connection.c:573] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) existing secrets returned
NetworkManager[29155]: <debug> [1304671149.641541] [nm-settings-connection.c:579] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets request completed
NetworkManager[29155]: <debug> [1304671149.643074] [nm-settings-connection.c:618] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) new agent secrets processed
** Message: nm-ppp-plugin: (get_credentials): got credentials from NetworkManager
PAP authentication succeeded
** Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
local  IP address 94.70.90.201
remote IP address 80.106.108.12
primary   DNS address 195.170.0.1
secondary DNS address 195.170.2.2
** Message: nm-ppp-plugin: (nm_phasechange): status 9 / phase 'running'
** Message: nm-ppp-plugin: (nm_ip_up): ip-up event
** Message: nm-ppp-plugin: (nm_ip_up): sending Ip4Config to NetworkManager...
NetworkManager[29155]: <debug> [1304671150.607440] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x110D1
NetworkManager[29155]: <info> PPP manager(IP Config Get) reply received.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager[29155]: <debug> [1304671150.608918] [nm-system.c:222] sync_addresses(): (ppp0): syncing addresses (family 2)
NetworkManager[29155]: <info> (ueagle-atm0): device state change: ip-config -> activated (reason 'none') [70 100 0]
NetworkManager[29155]: <info> Policy set 'MYISP' (ppp0) as default for IPv4 routing and DNS.
NetworkManager[29155]: <info> Activation (ueagle-atm0) successful, device activated.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) complete.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:56 -05:00
Jiří Klimeš
c5d75dcdfa cli: fix 'nm -nocheck con up'
When '-nocheck' option was used, NMClient object was created later in the
operation process.
This caused that the callback in nm_client_activate_connection() was not
called. It's fixed by creating NMClient early.
2012-05-09 14:19:11 +02:00
Jiří Klimeš
191da673a8 cli: show progress in --pretty mode for 'nmcli con up'
We need to use a workaround for VPN connection state. There is a bug somewhere
causing that vpn-state-changed signal is not issued on active VPN connection.
Debugging showed that D-Bus PropertiesChanged and VpnStateChanged signals are
not processed properly. That's why libnm-glib's VPN connection object is not
updated. The issue may lie in libnm-glib or even in dbus-glib.
I wasn't able to get VpnStateChanged signal via dbus-glib
(dbus_g_proxy_add_signal() and dbus_g_proxy_connect_signal()), however received
the signal successfully using GDBus.

Until the issue is analyzed and fixed, we need to ask for VPN state of active
VPN connection every second in order to show progress and exit correctly.
2012-05-09 14:19:03 +02:00
Jiří Klimeš
d58c32d214 cli: show progress in --pretty mode for 'nmcli dev disconnect' 2012-05-09 13:37:28 +02:00
Jiří Klimeš
0a98d14e48 cli: add a command for listing permissions - nmcli nm permissions 2012-04-30 13:32:55 +02:00
Jiří Klimeš
c878ad8214 cli: trivial, fix up spacing 2012-04-28 22:54:02 +02:00
Jiří Klimeš
38a988cb5e cli: add 'connect to SSID' feature: nmcli dev wifi connect <SSID> ...
This is similar to clicking a Wi-Fi network's SSID in a GUI applet.
The command does this:
- creates new connection (fills the user data specified via options, the
  connection is then completed with default parameters by NM)
- and then activates the connection on a Wi-Fi device.

WPA-Enterprise is not supported as it requires a plethora of parameters and
they can't be obtained automatically.
Also, the created connection uses 'auto' IP method, which means that if the
Wi-Fi network doesn't support DHCP, the connection will albeit be created,
however the activation will fail (IP configuration won't be available).
2012-04-28 22:33:30 +02:00