Commit graph

8859 commits

Author SHA1 Message Date
Thomas Haller
b6ef165cfe core: fix NMActiveConnection to properly add/remove pending action "activation"
When a new activation request is received, NetworkManager creates a new
NMActiveConnection to track that request.  The device may already be activated,
in which case NetworkManager stops the old activation and starts the new one,
but both exist in parallel for a short period of time.  If the old
NMActiveConnection is activating and already has a pending 'activation'
action, when the new NMActiveConnection adds its own 'activating' action,
they will clash.  This is fixed by making each NMActiveConnection's activation
pending action uniquely named.

This fixes a g_warning with the following back trace:

  #0  0x000000328224edfd in g_logv () from /lib64/libglib-2.0.so.0
  #1  0x000000328224efe2 in g_log () from /lib64/libglib-2.0.so.0
  #2  0x000000328224f2e6 in g_warn_message () from /lib64/libglib-2.0.so.0
  #3  0x0000000000440aee in nm_device_add_pending_action (device=0x14002e0, action=0x50704a "activation") at devices/nm-device.c:7172
  #4  0x000000000047525c in nm_active_connection_set_device (self=0x141b3c0, device=0x14002e0) at nm-active-connection.c:364
  #5  0x0000000000475ec1 in set_property (object=0x141b3c0, prop_id=11, value=0x7fff7ff36c20, pspec=0x1405f70) at nm-active-connection.c:647
  #6  0x0000003282615d3e in g_object_newv () from /lib64/libgobject-2.0.so.0
  #7  0x00000032826162e6 in g_object_new_valist () from /lib64/libgobject-2.0.so.0
  #8  0x0000003282616654 in g_object_new () from /lib64/libgobject-2.0.so.0
  #9  0x0000000000474193 in nm_act_request_new (connection=0x13bb0e0, specific_object=0x0, subject=0x1447740, device=0x14002e0) at nm-activation-request.c:376
  #10 0x000000000048e477 in _new_active_connection (self=0x13e8060, connection=0x13bb0e0, specific_object=0x0, device=0x14002e0, subject=0x1447740, error=0x7fff7ff36f90) at nm-manager.c:2947
  #11 0x000000000048ed77 in impl_manager_activate_connection (self=0x13e8060, connection_path=0x134d590 "/org/freedesktop/NetworkManager/Settings/9", device_path=0x134d550 "/org/freedesktop/NetworkManager/Devices/1",
      specific_object_path=0x0, context=0x143a9b0) at nm-manager.c:3206
  #12 0x00000000004876c8 in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7fff7ff37220, return_value=0x0, n_param_values=5, param_values=0x1448830, invocation_hint=0x0,
      marshal_data=0x48e9dd <impl_manager_activate_connection>) at nm-manager-glue.h:189
  #13 0x0000003284a0d6a9 in object_registration_message () from /lib64/libdbus-glib-1.so.2
  #14 0x000000348ea1ce66 in _dbus_object_tree_dispatch_and_unlock () from /lib64/libdbus-1.so.3
  #15 0x000000348ea0fa31 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
  #16 0x0000003284a0acc5 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2
  #17 0x0000003282247df6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
  #18 0x0000003282248148 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0
  #19 0x000000328224854a in g_main_loop_run () from /lib64/libglib-2.0.so.0
  #20 0x000000000042c6c0 in main (argc=1, argv=0x7fff7ff379b8) at main.c:629

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 12:36:04 -06:00
Thomas Haller
813ea5995b core: allow dynamic strings for pending action names
Use a GSList of the string values, instead of an array of GQuarks.
Using GQuarks does not allow to add arbitrary strings, because they
would leak the internalized strings.  The next patch will begin
using unique, non-const action strings.

Given the rather small number of expected pending states, a singly
linked list seems appropriate.

Signed-off-by: Thomas Haller <thaller@redhat.com>

(some fixes and simplifications by dcbw based on patch reviews)
2013-12-18 12:35:44 -06:00
Thomas Haller
600763e773 man/cli: add NOTES section with disclaimer for name abbreviations
Make clear, that only full names are guaranteed to work in future
versions. The use of some abbreviations might break as new options
get added.

It would be rather complicated, to ensure, that abbreviations always
continue to work, at the additional disadvantage, that they no longer
uniquely identify an option. Instead, clearly state that using
them is not guaranteed to work in the future. Users that care about
long term compatibility should instead spell out the full names.
Abbreviations are mainly here for interactive use.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 16:50:59 +01:00
Thomas Haller
7fa79fcc5e cli: add pppoe type to nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 16:50:59 +01:00
Jiří Klimeš
107fdd6b01 cli: support PPPoE connection types in 'nmcli con add' 2013-12-18 16:45:59 +01:00
Jiří Klimeš
80851c3550 cli: consider empty value as "*" for "Interface name [*]: " prompt (rh #953397)
And, do it right this time.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 16:10:48 +01:00
Jiří Klimeš
340542a2f2 Revert "cli: consider empty value as "*" for "Interface name: " prompt"
This reverts commit 3cb0bf6bc0.
It broke 'ifname' being required as a mandatory parameter as decided in
https://bugzilla.gnome.org/show_bug.cgi?id=698113
2013-12-18 16:05:37 +01:00
Jiří Klimeš
d79b56a7e9 cli: 'id' option for 'nmcli con add type vlan' is mandatory (rh #953397)
So update documentation accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 15:49:10 +01:00
Jiří Klimeš
eac3c36bbf trivial: fix erroneous copy&paste value in libnm-glib 2013-12-18 10:06:06 +01:00
Jiří Klimeš
2131b57fbd trivial: fix erroneous copy&paste comment 2013-12-18 09:54:09 +01:00
Thomas Haller
b7f6169dbd libnm-util: minor refactoring in nm_connection_compare()
Evaluate a cheaper comparison first, to fail early

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-17 17:18:14 -06:00
Dan Winship
d988a52967 trivial: fix erroneous comment 2013-12-17 16:41:38 -05:00
William Jon McCann
74372f9f11 docs: update documentation links
Various GNOME services moved around so links need updating.
2013-12-17 12:07:51 -06:00
Dan Winship
2940ef7a63 tui: fix the "Device" entry on currently-active virtual devices
Virtual device types can only have an ifname in the "Device" entry,
but the code was accidentally filling in the MAC address too if the
device currently existed (which then made the entry value invalid).
2013-12-17 12:51:18 -05:00
Dan Winship
41ada32127 tui: hide the debugging-related command line options 2013-12-17 12:51:18 -05:00
Dan Winship
250ed1a7dd tui: fix the build so we don't install libtool wrapper scripts
The nmtui development tree didn't use libtool, and the rules that
worked to install links in those Makefiles ended up causing the
libtool wrapper scripts to get installed here. Fix.
2013-12-17 12:51:18 -05:00
Dan Williams
14227fda8b po: fix handling of not-yet-used tui/vpn-helpers.c
tui/vpn-helpers.c is not yet used, so it shouldn't be translated yet.
Having it in po/POTFILES fails distcheck because, since it is not
yet used, it's not distributed, and thus can't be found in the
distcheck build.
2013-12-17 11:50:58 -06:00
Dan Winship
7481c64ad5 systemd: add "Before=network.service" on Fedora/RHEL (rh #1034983)
On Fedora/RHEL, NetworkManager.service needs to be started before
network.service, or else network.service may try to bring up NM's
devices itself.
2013-12-17 09:45:18 -05:00
Jiří Klimeš
abaa17edb9 cli: fix compilation without WiMAX 2013-12-17 14:55:13 +01:00
Jiří Klimeš
4ef8696c77 cli: allow '--field group.field' for nmcli con show conf <bla>
That means you can display single property.

Example:
$ nmcli -f connection.id,802-3-ethernet.mtu s c my-eth-profile
connection.id:                          my-eth-profile
802-3-ethernet.mtu:                     auto
2013-12-17 13:52:11 +01:00
Jiří Klimeš
990f83b7d3 cli: allow '--field group.field' for nmcli con show active <bla>
Example:
$ nmcli -f general.name,ip4.address c s a myeth
GENERAL.NAME:                           myeth
IP4.ADDRESS[1]:                         ip = 10.34.25.228/23, gw = 10.34.25.254
2013-12-17 13:52:02 +01:00
Jiří Klimeš
94bb83a370 cli: allow specifying 'group.name' syntax for '--fields'
and use it for 'nmcli device show'.

This allows filtering output not only for whole groups, but also for individual
fields in commands that print data in groups (sections).

Example:
$ nmcli -f general.device,general.driver,ipv4,ipv6.address device show eth0
GENERAL.DEVICE:                         eth0
GENERAL.DRIVER:                         e1000e
IP4.ADDRESS[1]:                         ip = 10.0.5.228/23, gw = 10.0.5.254
IP4.ADDRESS[2]:                         ip = 5.5.5.5/32, gw = 5.5.5.1
IP4.DNS[1]:                             192.168.122.1
IP4.DNS[2]:                             8.8.8.8
IP4.DOMAIN[1]:                          mycompany.com
2013-12-17 13:51:34 +01:00
Jiří Klimeš
bec69e175c cli: fix bash-completion for nmcli connection load (rh #1036545)
https://bugzilla.redhat.com/show_bug.cgi?id=1036545
2013-12-17 13:23:38 +01:00
Dan Winship
d174825412 libnm-util: don't introspect nm_utils_inet[46]_ntop
nm_utils_inet4_ntop() and nm_utils_inet6_ntop() have arguments of
non-introspected types, so mark them (skip) to avoid warnings from
g-ir-scanner.
2013-12-16 13:06:52 -05:00
Jiří Klimeš
45da352c60 introspection: add missing GENERIC and TEAM device types to nm-device.xml 2013-12-16 10:52:58 +01:00
Thomas Haller
01c4992123 po/tui: add missing file to POTFILES.in
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-13 20:52:38 +01:00
Thomas Haller
bb9deec9ef core: fix NMDevice.ip6_use_tempaddr to avoid buffer overrun for zero char in config file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-13 20:49:27 +01:00
Thomas Haller
1f71972998 core/wimax: avoid printing wrong error message in iwmx_sdk_addremove_cb
deviceid_to_index returns -1 when the deviceid was not found.
Assiging it to an unsigned variable is wrong and would result
in printing an error message when trying to remove the non existing
index.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-13 17:09:18 +01:00
Thomas Haller
8fe613b4f0 core: reorder statements when creating fake AP in NMDeviceWifi:act_stage1_prepare
A fake AP should be the current access point. The code in act_stage1_prepare
violated this invariant for a short time by emitting signals before
setting current_ap. Reorder statements, so that
  - fake AP gets created and added to ap_list
  - fake AP gets set as current_ap (suppressing notify signals)
  - emit ACCESS_POINT_ADDED signal
  - thaw notify::NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT signal

When performing a series of actions that emit several signals, it is
often difficult to emit them in an order, so that listeners get a
consistent view. With this change, listeners will get ACCESS_POINT_ADDED
signal, and the current ap already being set to the fake_ap. Next they
get notify::NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT. There is no perfect
solution, but this way it makes slightly more sense.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-13 16:50:20 +01:00
Thomas Haller
d21775ece2 core: minor code cleanup in nm-device-wimax.c
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-13 16:39:11 +01:00
Dan Winship
3bda3fb60c nmtui: initial import of nmtui
nmtui is a TUI (curses-based Text User Interface) for NetworkManager
2013-12-13 16:00:51 +01:00
Jiří Klimeš
72922f2068 cli: fix description of connection parameters and specify some default values 2013-12-13 09:50:09 +01:00
Dan Williams
3479cefbb2 merge: fix devices not re-activating when connections are downed (rh #1033187) 2013-12-12 14:55:33 -06:00
Jiří Klimeš
0234bd4acc policy: invoke NMPolicy::device_state_changed() after other handlers (rh #1033187)
This fixes automatic activation after changes in
commit ff7e47a418.

When a connection is deactivated impl_manager_deactivate_connection() is called
and the device goes to NM_DEVICE_STATE_DISCONNECTED. nm_device_state_changed()
then issues "state-changed" signal. The signal is connected to by various
listeners. The most interesting ones for this case are NMPolicy and
NMActiveConnection.
The problem is that NMPolicy's device_state_changed() is processed first and
thus in schedule_activate_check() we still have the old active connection
present (in ACTIVATED state).

This commit fixes the issue by connecting to "state-changed" signal using
g_signal_connect_after() in NMPolicy. This ensures NMPolicy's state-changed
handler is called after active connections are processed.

https://bugzilla.redhat.com/show_bug.cgi?id=1033187
2013-12-12 14:55:26 -06:00
Jiří Klimeš
b0fb239df3 core: clear device on NMActiveConnection when the connection is DEACTIVATED 2013-12-12 14:55:26 -06:00
Jiří Klimeš
f8da87af32 policy: remove schedule_activate_check() from FAILED handler
The call is redundant, because the device will transition to DISCONNECTED
and schedule_activate_check() will be called of this state.
2013-12-12 14:55:26 -06:00
Thomas Haller
9d319e6da0 libnm-util: refactor NMSetting name and register_settings
- refactor register_settings to allow lookup by GType and
  add the settings name to SettingInfo.

- setting NM_SETTING_NAME is deprecated and should not be set anymore.
  Indeed it has always be a bug, to reset the name to a different value.
  The only valid place to set the name was in the _init() function of
  the derived class itself.
  This is now no longer needed/possible. Instead the name get's
  detected based on the registered setting types. This makes use of
  the registered metadata that is available anyway since every
  usable setting has to register itself.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 21:47:13 +01:00
Dan Williams
844b89d497 core: delay startup complete for carrier and fix startup-complete races (rh #1034921) (rh #1030583)
If NetworkManager is the first thing to bring an interface up, the interface may not
know its carrier state for a few seconds.  We need to block startup completion until
we're reasonably sure that all initial devices know their carrier state, so that we
can start the initial connection activation on those devices before startup is
complete.

Second, there was a small race between when the Policy decided to auto-activate
a device, and when the device actually added the pending action that blocked
startup completion, during which startup could be declared complete but actually
wasn't.  Fix that.
2013-12-12 11:18:37 -06:00
Dan Williams
2556aa32ed core: ensure 'activation' pending action encompasses full activation process
The NMActiveConnection class tracks the full activation request, and internal
activation requests go through the same process as external ones, including
some authentication.  Sometimes that means activation is scheduled, control
returns to the mainloop, and then the activation proceeds from an idle
handler.

Unfortunately, that means that adding a pending "activation" action from
nm-device.c doesn't always work, since there is a short window between when
the activation is started in nm-manager.c (in nm_manager_activate_connection())
and when the device actually changes state.  Inside that window, the pending
actions may drop to zero, and startup will be declared complete before the
device actually starts activating.

Instead, ensure that the pending action is added when the internal activation
is actually started (eg, when NMActiveConnection receives the NMDevice object).
2013-12-12 11:16:51 -06:00
Dan Williams
61463ed2ab core: delay startup complete until carrier is found or timeout (rh #1034921) (rh #1030583)
Carrier state is only valid if the network interface is IFF_UP, because drivers
are not required to do carrier detection if the device is not up.  Thus, if NM
is the first process to set the interface IFF_UP, there may be a short delay
while the driver performs carrier detection.  NetworkManager must suppress
"startup complete" during this delay to ensure that the carrier state is known
before making startup property decisions.

Previously, when NetworkManager set the interface IFF_UP, the interface would
not have a carrier for a few seconds until the driver's carrier detection was
done.  Since the interface had no carrier, NetworkManager could not begin
connection activation on the interface, and the interface would not suppress
the "startup complete" transition.  Thus, NetworkManager would declare that
startup was complete prematurely and anything depending on startup network
connectivity would fail as no interfaces were active.

https://bugzilla.redhat.com/show_bug.cgi?id=1034921
https://bugzilla.redhat.com/show_bug.cgi?id=1030583
2013-12-12 11:16:51 -06:00
Dan Williams
b2cec90b79 core: convert pending actions from a counter to a GArray
This lets us do two things:

1) ensure that pending actions are unique and not doubly added/removed
2) we can (eventually) print out the pending action list for debugging

However, since we cannot have two pending actions with the same name at
the same time, we need to change the queued device state actions to
include the state name.  But that makes debugging even more descriptive
so it's a bonus.
2013-12-12 11:16:51 -06:00
Dan Fruehauf
ee0f70cfd7 dbus: allow communication with NetworkManager-iodine VPN plugin 2013-12-12 10:53:34 -06:00
Krishna Babu K
7a24146fb1 po: updated Telugu (te) translation (bgo #720326)
https://bugzilla.gnome.org/show_bug.cgi?id=720326

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 15:15:17 +01:00
Jiří Klimeš
00de4a920a man: fix 'connection add' arguments descriptions in nmcli manual page 2013-12-12 13:27:09 +01:00
Jiří Klimeš
b5b49a4bc0 trivial: fix typo in pppoe::service property 2013-12-12 13:14:11 +01:00
Thomas Haller
00347f4655 core: rework AP handling in nm-device-wifi (Merge branch 'th/rh1025371_wifi_ap_rework')
This reworks and fixes the handling of current_ap in nm-device-wifi.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 11:37:52 +01:00
Thomas Haller
d0db82a19f trivial: whitespace fix
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 11:33:17 +01:00
Thomas Haller
3814179fb5 core: minor fix in find_active_ap when matching AP
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 11:33:17 +01:00
Thomas Haller
71cb57ba35 core: trivial change in nm_ap_set_ssid
Simplify check in nm_ap_set_ssid(). Note that previously there was
no bug here in case of self assignment, this just makes it more
explicit.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 11:33:17 +01:00
Thomas Haller
3c52e383f9 wifi: always assume can_scan_ssid and use ap_scan=1 for infra mode
We should use ap_scan=1 *except* for AP/IBSS/AdHoc, where ap_scan=2 is
required.  ap_scan for "infra" mode is all historical and was for old,
crappy, and proprietary drivers that we should really stop hacking stuff
for.  Those drivers did not support probe-scanning for hidden APs and
thus the supplicant just had to send all the config to the driver and
hope things worked.

All relevant and non-crappy drivers these days support at least one SSID
probe and thus is_broadcast affecting ap_scan should no longer be
something we support.  If you have an old, crappy
WEXT/proprietary/staging driver, and you use hidden APs, you're doing it
wrong.

So, in short, we must keep the ap_scan=2 logic for AP+AdHoc, but we can
remove the is_broadcast and has_scan_capa_ssid arguments and the code
where they change ap_scan.

https://bugzilla.redhat.com/show_bug.cgi?id=1025371#c18

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 11:33:17 +01:00