Commit Graph

10071 Commits

Author SHA1 Message Date
Dan Williams
5c1dee10cd mobile: only change state to NEED_AUTH during activation (rh #1058308)
Auth requests only happen during activation and there's no need to
request secrets at any other time.  Ensure that the device state
won't change to NEED_AUTH except when activating.

(There's a case in NMModemBroadband where set_mm_enabled()
when the modem is locked may cause this, but we'll solve this
a different way later.)

https://bugzilla.redhat.com/show_bug.cgi?id=1058308
2014-02-21 09:45:06 -06:00
Dan Williams
4611aec5c2 mobile: consolidate secrets requests into NMDeviceModem
Both old and new ModemManager classes were doing the same thing, so
consolidate that into the superclass and save some LoC.
2014-02-21 09:45:06 -06:00
Dan Williams
12787f8565 mobile: fix disconnection on deactivation
When c4fc72c7 began using the DEACTIVATING state, the modem code
wasn't updated to handle this.  Because it only checked for
activating or ACTIVATED states to determine whether the modem was
previously connected, and thus when an MM disconnect was needed,
when the device enters the DISCONNECTED state it was no longer
considered previously active, and not disconnected.

Also, remove the NEED_AUTH handling from the modem code's device
state switch, because it does not appear to be needed.  The
modem will only enter NEED_AUTH when it requires PAP/CHAP secrets
during the connection attempt or when a PIN is required before
enabling the modem.  In both cases the modem won't yet be connected,
so this code will never be hit.
2014-02-21 09:45:06 -06:00
Thomas Haller
f8dcab53d9 libnm-glib: take reference in NMRemoteConnection before calling DBUS
We always have to take a reference to the NMRemoteConnection
before calling to DBUS, because the connection might be deleted
in the meantime.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-21 16:20:29 +01:00
Thomas Haller
9968895e19 libnm-glib: accept omitting callback in nm_remote_connection_*
The functions nm_remote_connection_save(), nm_remote_connection_commit_changes(),
and nm_remote_connection_commit_changes_unsaved() indicate in the documentation,
that they allow omitting the callback argument. Remove invalid checks
for callback.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-21 16:20:29 +01:00
Dan Winship
932aa29026 trivial: fix configure.ac comment 2014-02-19 13:43:10 -05:00
Thomas Haller
31483e23d1 test: add valgrind suppressions
`make check` failed on fc20.armv7hl

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-18 20:33:10 +01:00
Thomas Haller
a6767f215e platform: refactor address_to_string() to return device as numeric if ifname is unknown
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-18 13:21:47 +01:00
Dan Winship
fae47c1916 tui: don't expand editor form to fullscreen horizontally
The form doesn't make use of the extra horizontal space, so it looks
bad to expand it rather than centering it.
2014-02-17 15:30:04 -05:00
Dan Winship
6ee48dc964 tui: fix flickering with large windows
Use newtPopWindowNoRefresh() rather than newtPopWindow() when
destroying a form, since often we have to destroy and then almost
immediately after re-create the same form, and we don't want that to
be visible.
2014-02-17 15:30:04 -05:00
Dan Winship
5d581b0d08 tui: handle Esc correctly from toplevel windows
The main "connect" and "edit" windows set the "escape-exits" flag, but
that just closed the form without exiting the app, leaving the user
trapped. Fix this by emitting a signal when the form quits, and
catching that. (And now we don't need to watch the "clicked" signal on
the quit buttons, since they have the "exit-on-activate" flag set.)
2014-02-17 15:30:04 -05:00
Dan Winship
12a2d64063 tui: handle Wi-Fi networks with multiple APs correctly 2014-02-17 15:30:04 -05:00
Dan Winship
62beb7a5b3 Fix NMManager:startup tracking again (rh #1030583) 2014-02-17 14:57:43 -05:00
Dan Winship
4f0c70e945 core: don't recursively schedule an autoactivate check on a device
NMPolicy's auto_activate_device() was immediately removing the device
from priv->pending_activation_checks, which meant that if
nm_manager_activate_connection() had some side effect that would cause
schedule_activation_check() to be called again, another
auto-activation check could be queued while the first was still in
progress (causing a warning). Fix this by not removing the device from
the list until the activation attempt is complete.

This requires some additional minor changes to correctly handle the
possibility of remove_device() being triggered as a side effect of
nm_manager_activate_connection().

Also merge activate_data_new() into schedule_activation_check() so
that all the "start an auto-activation" code is in one place.
2014-02-17 14:57:15 -05:00
Dan Winship
93285054ae Revert "core: fix warning about pending action "autoactivate""
This change removed the "autoactivate" pending action too soon,
creating a window where the device had no pending actions, allowing
the manager to declare startup complete while devices were still being
activated.

This reverts commit a16b7a8253.
2014-02-17 14:57:15 -05:00
Dan Winship
a217a742f1 core: remove some unused code
We never pass any delay_seconds value to schedule_activate_check()
except "0", so just remove that argument.
2014-02-17 14:57:15 -05:00
Giovanni Campagna
f6f216f0a9 manager: fix notification of the connectivity property
Notify DBus clients at the end of a connectivity check, and when
NMConnectivity reports a change.

https://bugzilla.gnome.org/show_bug.cgi?id=724550
2014-02-17 14:55:53 -05:00
Jiří Klimeš
a493cda8d6 cli: better checking of WEP key types in nmcli interactive editor (rh #1040964)
https://bugzilla.redhat.com/show_bug.cgi?id=1040964
2014-02-17 15:22:35 +01:00
Guido Günther
0e8901fbd1 core: report which option is unknown
So far NetworkManager didn't tell which option it didn't know about:

  Invalid option.  Please use --help to see a list of valid options.

Now it is a bit more informative:

  Unknown option --asdf.  Please use --help to see a list of valid options.

The "Unknown option" string is marked as translatable in glib so i18n
doesn't suffer.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-15 11:50:07 +01:00
Thomas Haller
83ff4f819f core: merge branch 'th/bgo719905_platform_caching'
Fix a bug in caching of nm-linux-platform and im do come cleanup.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:50:13 +01:00
Thomas Haller
2bc90a5f2d platform: do not check for _exists() before deleting addresses and routes
Before, nm_platform_ip4_address_exists(), et al. look into the cache to see
whether the address/route already exists and returned an error if it
did.

Change the semantic of the delete functions, to return success in case of
"nothing to delete". Also always try to delete the object in the
kernel. The reason is, that the cache might be out of date and the
caller really wants to delete it. So, to be sure, we always delete.

In most cases the object is actually in the cache (because that is
how the caller came to know that such an object might exist).
In those cases, the lookup was not useful either, because the object
was actually cached.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:41:25 +01:00
Thomas Haller
5f5c7284d1 platform: refactor delete_object() and allow deletion of objects that are not cached
- refactor delete_object() by merging with delete_kernel_object()

- allow deletion of object that we cannot find in the cache
  currently. The kernel might have such an address, even if we don't
  have it currently cached. In this case, fall back to @obj.

  Also try to work around an issue, that we cannot delete an IPv4 route without
  knowing its scope.

- suppress logging error message for NLE_NOADDR, which is a common
  failure when deleting an address. But at the same time, add some more
  debug logging, for NLE_NOADDR and NLE_OBJ_NOTFOUND.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:41:23 +01:00
Thomas Haller
d6add4de5c platform: clear host identifier before adding a route
Adding IPv4 routes, with a non-zero host identifer fails with an
error message. Adding IPv6 addresses, does not return an error,
but it seems to have no effect.

Thus we have to make sure that the host part of routes
is always zero.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:40:58 +01:00
Thomas Haller
e8775dd9fc core: add function nm_utils_ip6_address_clear_host_address()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:40:58 +01:00
Thomas Haller
ebbd6575ff platform: log the link family in event_notification() and get_kernel_object()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:40:58 +01:00
Thomas Haller
a6f9266555 platform: fix caching for link types
This bug was present since a long time, however libnl3-v3.2.23
(commit fdd1ba220dd7b780400e9d0652cde80e59f63572) changed the returned
family of bridge link objects, which breaks NetworkManager.

This resulted in error messages such as:

  DBG<4>            object.c:207  nl_object_get: New reference to object 0x19c34b0, total 2
  DBG<5>        route/link.c:895  link_keygen: link 0x19c34b0 key (dev 9 fam 7) keysz 8, hash 0x2b2
  DBG<2>         hashtable.c:127  nl_hash_table_add: Warning: Add to hashtable found duplicate...
  DBG<4>            object.c:221  nl_object_put: Returned object reference 0x19c34b0, 1 remaining
  NetworkManager[17745]: <error> [1392114373.475432] [platform/nm-linux-platform.c:1328] event_notification(): netlink cache error: Object exists

Even before the change of libnl, I saw the following error lines
 <debug> [...] [platform/nm-linux-platform.c:1216] event_notification(): netlink event (type 16) for link: virbr0 (4)
 <error> [...] [platform/nm-linux-platform.c:1265] event_notification(): netlink cache error: Object exists
Hence, the caching mechanism for libnl objects already had a bug.

For rtnl link objects, the identifier consists of family and ifindex.
Since in upper layers, we don't easily know the family, we need a way to find
the objects inside the cache. We do this, by only caching links of family
AF_UNSPEC.

Objects that we receive via event_notification() are never cached. They are only used
to trigger refetching the kernel_object. Their family is irrelevant, we
only need to know, that something about this ifindex changed.

For objects retrieved via get_kernel_object(), we only get link objects of
family AF_UNSPEC or AF_BRIDGE. In any case, we reset (coerce) their family
before caching. This way, inside the link cache, there are only objects with
(coerced) family AF_UNSPEC. We loose the information, which family the
link had, however we don't need it anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=719905
https://bugzilla.redhat.com/show_bug.cgi?id=1063290

Duplicates:
https://bugzilla.gnome.org/show_bug.cgi?id=724225
https://bugzilla.redhat.com/show_bug.cgi?id=1063800

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:40:58 +01:00
Thomas Haller
a5f3fcae29 platform: add function choose_cache_by_type()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:40:58 +01:00
Thomas Haller
dc54b2e3b2 platform: cleanup object_type_from_nl_object()
- change object_type_from_nl_object() to accept unknown object
  types.
- replace g_assert_not_reached() with g_return_if_fail().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 21:40:57 +01:00
Thomas Haller
e54a3ccaf8 platform: add debug logging when adding/deleting routes
Also, change the logging of nm_platform_ip._address_delete()
to log what we are about to do, *before* checking for existing
addresses.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 18:35:07 +01:00
Thomas Haller
e02b1a8620 platform: refactor link_get() not to use auto_nl_object
The previous implementation called nl_object_get() and nl_object_put()
each time in link_get(). As nl_object_get() and nl_object_put()
causes debug logging in libnl, this clutters the output.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 18:35:07 +01:00
Dan Williams
aeefde7513 ifcfg-rh: add testcase for empty Team port config
Add testcase for 3e70fb20d4.
2014-02-14 10:05:19 -06:00
Thomas Haller
a0e734764f core: add nm_utils_get_monotonic_timestamp_us() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-14 15:53:11 +01:00
Jiří Klimeš
3e70fb20d4 ifcfg-rh: allow missing (empty TEAM_CONFIG), which is valid configuration
When config is NULL libteam will use its own default configuration.

Commit 76c3bd9898 changed that and refused to
create 'team' setting making connection invalid. It didn't set an error as
well, which resulted in

 ifcfg-rh: parsing /etc/sysconfig/network-scripts/ifcfg-team ...
 ifcfg-rh:     error: (unknown)
 GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
2014-02-14 10:05:42 +01:00
Dan Winship
3fb13c63c3 core: don't block startup on assumed connections
If we are assuming a connection at startup, the NMManager:startup
state doesn't need to wait for that activation to complete, since the
underlying device isn't going to change its configuration as a result
of it.

(In particular, NM considers virbr0 to be stalled at
NM_DEVICE_STATE_IP_CONFIG when it assumes it, since if it has no real
slaves, it won't yet have carrier. But this shouldn't block startup.)
2014-02-13 16:40:12 -05:00
Jiří Klimeš
4401fd4ac7 tui: fix srcdir != builddir build 2014-02-13 18:28:30 +01:00
Jiří Klimeš
de15dafd1b tui: properly initialize InfiniBand transport-mode
We need to initialize transport-mode because default value is NULL,
which is not a valid mode.
2014-02-13 18:28:30 +01:00
Aleksander Morgado
3b76ae18a5 modem-manager: if building systemd support, assume it manages the MM lifecycle
We will not explicitly poke MM to start it if NetworkManager is built with
systemd support.

https://bugzilla.gnome.org/show_bug.cgi?id=703040
2014-02-13 12:06:17 -05:00
Dan Winship
64c5395cb1 build: improve our use of glib's version macros to catch more bugs
We were setting GLIB_VERSION_MAX_ALLOWED to 2.34, since we provide
reimplementations of a few 2.34 functions in nm-glib-compat.h. But
this was turning off warnings for the 2.34+ APIs we *didn't* have
compat versions of too.

Fix this by setting MAX_ALLOWED to 2.32 (same as MIN_REQUIRED), and
defining macros to wrap calls to compat-ified functions and disable
deprecation warnings around them.

This points out several places where we were accidentally using 2.34
APIs without noticing, which need to be fixed now.
2014-02-13 11:24:37 -05:00
Dan Winship
9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Dan Winship
95be722e54 libnm-util, libnm-glib: add some missing "Since: 0.9.10" tags
Based on diffing libnm-util.ver and libnm-glib.ver with their 0.9.8
versions.
2014-02-13 11:24:37 -05:00
Dan Williams
3856129158 trivial: don't open-code g_clear_pointer() 2014-02-13 09:31:48 -06:00
Dan Williams
6029ef92c2 libnm-glib: suppress warnings unless LIBNM_GLIB_DEBUG is set
Most of these warnings are things libnm-glib can't do anything
about, and they are pretty annoying when running nmcli or nmtui,
and libraries usually shouldn't print random warnings anyway.
So downgrade them to debug messages that can be enabled if we
need to see them.
2014-02-13 06:38:54 -06:00
Dan Williams
9cdbd6a401 trivial: remove unused nm-netlink-monitor
Obsoleted by the platform, no longer used.
2014-02-13 06:34:16 -06:00
Thomas Haller
71cce80f1f core: suppress error message ZONE_ALREADY_SET when adding firewalld zone
See also https://bugzilla.redhat.com/show_bug.cgi?id=886432, where
firewalld was changed, not to return ZONE_ALREADY_SET for 'changeZone'.
However, 'addInterface' can still fail with this error.

Suppress the following error lines:

  <debug> [1392290031.179280] [firewall-manager/nm-firewall-manager.c:117] nm_firewall_manager_add_or_change_zone(): (em1) firewall zone add -> (null)
  ...
  <warn> (em1) firewall zone add/change failed: (32) ZONE_ALREADY_SET

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-13 12:43:44 +01:00
Thomas Haller
c52decbfcb cli: show warning when setting band/channel for infra mode (rh #1000096)
The band/channel property is not considered when connecting to an
access point. Print a warning, when setting one of these values in edit
mode.

For now, don't forbid the user to make such setting. Also, because in
the future, wpa_supplicant might support this.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-13 12:22:52 +01:00
Thomas Haller
2ca7c89298 core: fix hanging set_logging() dbus call by returning a result
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-12 21:31:19 +01:00
Jiří Klimeš
84721804cd cli: fix crash if active connection doesn't have a device (rh #1064333)
$ nmcli dev connect wlan0

This can happen for example when some other process disconnects
the connection being connected.
Also fix printing a message on success.

https://bugzilla.redhat.com/show_bug.cgi?id=1064333
2014-02-12 16:31:39 +01:00
Jiří Klimeš
31f7558e30 trivial: fix a typo in a comment 2014-02-10 16:27:12 +01:00
Thomas Haller
507599a2d2 trivial: fix whitespace and spelling error
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-10 11:18:40 +01:00
Stanislaw Gruszka
28dfb2e4a2 wifi: do not print dump inconsistency error for get scan command
Avoid printing "nl_recvmsgs() error: (-33) Dump inconsistency detected,
interrupted".  DUMP_INTR error is harmless for scan (see in code
comments).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-10 11:18:40 +01:00