Commit Graph

209 Commits

Author SHA1 Message Date
Thomas Haller
2856fcb3de libgsystem: add local copy of gsystem-local-alloc.h
Taken from libgsystem:src/gsystem-local-alloc.c
(commit de2619271ee3ab42971fc770cae110f23e330c30).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-15 22:50:32 +02:00
Dan Winship
2570c5a17c libnm-util, libnm-glib: whitespace fixes
Fix indentation, kill trailing whitespace, split some long lines.
2014-07-15 09:44:55 -04:00
Dan Winship
cb7e1893e7 libnm-util, libnm-glib: standardize copyright/license headers
- Remove list of authors from files that had them; these serve no
  purpose except to quickly get out of date (and were only used in
  libnm-util and not libnm-glib anyway).

- Just say "Copyright", not "(C) Copyright" or "Copyright (C)"

- Put copyright statement after the license, not before

- Remove "NetworkManager - Network link manager" from the few files
  that contained it, and "libnm_glib -- Access network status &
  information from glib applications" from the many files that
  contained it.

- Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
  to files that were missing it.
2014-07-15 09:44:54 -04:00
Dan Winship
7eb0288aa0 libnm-util: move NetworkManager.h, etc, from include/ to here
NetworkManager.h, NetworkManagerVPN.h, and nm-version.h are part of
the libnm-util API, so move them to libnm-util.

include/ still contains headers that are strictly NM-internal (eg,
nm-glib-compat.h).
2014-07-15 09:44:54 -04:00
Thomas Haller
362c4fe188 nmtst: ensure call to nm_utils_get_monotonic_timestamp_s() in nmtst_init()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-10 13:27:12 +02:00
Thomas Haller
87c48023f1 libnm-util, libnm-glib: add NM_VERSION_1_0, NM_DEPRECATED_IN_1_0, and NM_DEPRECATED_IN_1_0 macros
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-27 20:39:05 +02:00
Thomas Haller
48b5ba7cea nmtst: add NMTST_DEBUG=no-expect-message for debugging assert_message tests
Some tests want to assert against the messages logged using g_test_expect_message().
In this mode, nmtst will not log anything itself.

Interpret the option no-expect-message which turns g_test_expect_message()
into a NOP and turns logging on. The use of this is for debugging such
tests, without asserting against the messages but printing them instead.

For tests that are not in the assert_message mode, the option has no
effect.

Example:
  NMTST_DEBUG=debug,no-expect-message make -C src/settings/plugins/keyfile/tests/ check

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:58 +02:00
Thomas Haller
9114794f65 nmtst: turn on g_debug() messages in nmtst_init() when debug logging is enabled
In tests nm-logging will directly write using g_log. Also, non-core components
use g_log() for logging. glib will not print messages with level
G_LOG_LEVEL_INFO or G_LOG_LEVEL_DEBUG unless G_MESSAGES_DEBUG is set.

When the user specifies NMTST_DEBUG turning on 'debug' or
'log-level=DEBUG' it can be reasonably assumed that he wants to see
debug messages. nmtst_init() now sets G_MESSAGES_DEBUG=all.

The user can disable this behaviour, by setting instead G_MESSAGES_DEBUG='',
because nmtst_init() will not reset an existing G_MESSAGES_DEBUG.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:58 +02:00
Thomas Haller
8ce1eb3837 nmtst: add new mode where tests assert against logged messages (assert_messages)
In this mode, nmtst itself will not log anything and not set the logging
level. Also, it will set g_log_set_always_fatal().

This is for tests that want to assert against all logged messages via
g_test_expect_message().

In this mode also setting the logging level via NMTST_DEBUG variable has
no effect. The test is expected to manage the logging level itself and
changing the logging level might interfere with the test.

As a showcase, move keyfile/tests/test-keyfile.c to nmtst.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:58 +02:00
Thomas Haller
ed868a388b core: add compatibility wrapper for g_test_skip() to nm-glib-compat.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Thomas Haller
284ef00d16 nmtst: call nm_utils_init() in nmtst_init()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Thomas Haller
5d3bef5d3f nmtst: add nmtst_spawn_sync()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Thomas Haller
7a7dd9203d nmtst: add nmtst_reexec_sudo() function
Interpret environment variable NMTST_DEBUG which allows
to specify 'sudo-cmd=CMD'. If the test program calls
nmtst_reexec_sudo(), it will `exec CMD "$0" "$@"`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Thomas Haller
9df3a23d26 nmtst: add nmtst_free()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:57 +02:00
Thomas Haller
8af001eae4 nmtst: combine files nm-test-helpers.h and nm-test-utils.h
Move the content of nm-test-helpers.h to nm-test-utils.h
which completly replaces the older file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
0e9cd4f6fc nmtst: add functions nmtst_platform_ip[46]_routes_equal
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
be56b26c7d nmtst: add functions nmtst_static_SIZE_NUM() to create a copy of a string returned from an internal buffer
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
5a58afcec9 nmtst: add nmtst_is_debug() and interpret environment NMTST_DEBUG
Also enable "DEBUG" logging conditionally depending on is_debug().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
64d09e5afe nmtst: add nmtst_initialized()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
86693d2378 nmtst: add parameter to nmtst_init to setup nm-logging
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
17c300b816 nmtst: include missing header file glib-object.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
d29cd00d2b nmtst: return const address from nmtst_inet6_from_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
237ee05887 nmtst: make all test functions "inline static"
'inline' is needed to avoid compiler warnings about unused
functions.
Marking them only as 'inline' was simply wrong and leads to
linker errors when including the header in different translation
units.

By making them "inline static" we also don't need to foward declare the
function prototype to avoid another compiler warning.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Thomas Haller
a268b825d7 nmtst: move header file to include/ directory
https://bugzilla.gnome.org/show_bug.cgi?id=706293

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-05 18:12:56 +02:00
Dan Williams
d043094195 wwan: disable autoconnect if the given SIM PIN was wrong
If the given PIN was wrong, we really don't want to try that PIN
again automatically because it might lock the SIM.  To ensure that
doesn't happen, disable autoconnect so that the user must manually
request reconnection.

(this doesn't fix auto-connect-with-a-wrong-PIN completely, as
autoconnect is reset when resuming from sleep, but it's a start)
2014-05-06 21:51:24 -05:00
Dan Williams
6080425088 wwan: use modem states instead of enabled/connected properties
Determining when the NMDeviceModem is available and when different
connections are available is easier if the modem's state is tracked,
instead of using the separate Enabled and Connected properties.
These properties could not accurately represent the SIM lock state
and prevented NetworkManager from making the modem available for
auto-activation when locked, even if a PIN was available.

In this new scheme, the NMDeviceModem is UNAVAILABLE when the
ModemManager modem state is FAILED, UNKNOWN, or INITIALIZING.  It
transitions to the NM DISCONNECTED state when the modem has finished
initializing and has not failed.

Once the NMDeviceModem is in DISCONNECTED state it can be activated
even if the SIM is locked and a PIN is required; the PIN will be
requested when starting activation, either from the connection itself
or via a secrets request.  This makes auto-activation of WWAN
connections possible.

This also allows us to consolidate code dealing with modem enable/disable
into the base NMModem class using the modem state, and to log more modem
information for debugging purposes.
2014-05-06 21:48:55 -05:00
Dan Winship
42df06e575 platform, devices: add support for vxlan devices
Since vxlan is new-ish, and vxlan IPv6 support in particular has only
been in the kernel since 3.11, we include our own copy of the vxlan
netlink constants rather than depending on the installed headers.
2014-03-06 09:48:15 -05:00
Thomas Haller
d3a2219cee replace snprintf by g_snprintf
Use the glib wrapper for snprintf.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-24 21:35:33 +01: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 Williams
ab586236e3 core: implement update_connection() for Team 2013-11-08 16:35:18 -06:00
Dan Williams
2e9fde3c28 core: set up and tear down DCB/FCoE when DCB is enabled 2013-10-31 13:29:22 -05:00
Thomas Haller
e670528778 dispatcher: fix memory leak in nm-dispatcher-action
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:46 +02:00
Jiří Klimeš
282b9df60d vpn: fix VPN plugin D-Bus errors
The errors were documented as org.freedesktop.NetworkManager.VPN.Error.*,
but the actual values were org.freedesktop.NetworkManager.VPN.Plugin.*

Also update the errors documentation.
2013-09-27 13:26:29 +02:00
Jiří Klimeš
9dff830692 vpn: fix connecting to VPN (bgo #708255)
The ConnectInteractive() -> Connect() fallback code doesn't work, because
_connect_internal() changes the state to NM_VPN_SERVICE_STATE_STARTING before
checking if it can implement ConnectInteractive(), and then when the Connect()
call comes in, the VPN is not in STOPPED or INIT, so it returns an error.

The commit moves setting state to STARTING after the ConnectInteractive() check
availability, in the plugin. We introduce new plugin error and set it when the
the plugin does not implement ConnectInteractive(). NetworkManager uses this
error for ConnectInteractive() -> Connect() fallback.

https://bugzilla.gnome.org/show_bug.cgi?id=708255
2013-09-27 13:26:09 +02:00
Dan Winship
26544f3148 libnm-glib: change "Since: 0.9.10" to "Since: 0.9.8.6" for backported API 2013-09-11 14:10:55 -04:00
Dan Winship
07521da591 core: provide additional network connectivity information
NM_STATE_CONNECTED_SITE doesn't distinguish between "behind a captive
portal" and "limited network connectivity" (ie, connected to a router
that has lost its upstream connection). Add a new NMManager
:connectivity property to provide this information.

Also add a CheckConnectivity method, which can be used to force NM to
re-check the connectivity state, which could be called by a client
after it completed a portal login, or fixed a network problem.
2013-08-28 10:54:08 -04:00
Jiri Pirko
23836e8146 core: add support for team device
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Dan Winship
a7068f48c5 Revert "platform, devices: add support for vxlan devices"
This requires a very recent kernel to even compile, and the kernel
code is still rapidly changing (eg, adding IPv6 support). So take it
out for now, until it stabilizes.

This reverts commit 7f0f04d106.
2013-06-04 10:30:30 -03:00
Dan Winship
d9e0a7cbd6 platform, devices: add support for gre and gretap devices 2013-06-04 10:01:14 -03:00
Dan Winship
7f0f04d106 platform, devices: add support for vxlan devices 2013-06-04 10:01:14 -03:00
Dan Winship
e9f364548a platform, devices: add support for macvlan and macvtap devices 2013-06-04 10:01:13 -03:00
Dan Winship
add316a403 platform, devices: add support for tun and tap devices 2013-06-04 10:01:13 -03:00
Dan Winship
4416155bea platform, devices: add support for veth devices
https://bugzilla.gnome.org/show_bug.cgi?id=687254
2013-05-24 16:10:03 -03:00
Dan Winship
ce4f2a4bd6 core, libnm-glib: add NMDeviceGeneric
Add NMDeviceGeneric, to provide generic support for unknown device
types, and create NMDeviceGenerics for those devices that NM
previously was ignoring. Allow NMSettingGeneric connections to be
activated on (managed) NMDeviceGenerics.
2013-05-07 12:46:56 -04:00
Dan Winship
e58d86450d core: fix build with glib < 2.34
Using g_clear_pointer() didn't trigger G_UNAVAILABLE warnings because
it's a macro. Fix the build on older glibs by just pulling in the
definition.
2013-04-03 13:11:31 -04:00
Dan Winship
be89197214 core: remove remaining pre-2.32 GLib compat / deprecated usage 2013-02-26 13:07:33 +01:00
Dan Winship
ed9e2d8377 build: avoid GValueArray deprecation warnings
Avoid warnings about GValueArray being deprecated by adding macros
that wrap G_GNUC_BEGIN_IGNORE_DEPRECATIONS /
G_GNUC_END_IGNORE_DEPRECATIONS around the GValueArray calls.
2013-02-26 13:07:33 +01:00
Dan Winship
fc700e9213 core: add NM_WIFI_DEVICE_CAP_ADHOC
Some wireless devices don't support Ad-Hoc mode. Expose this fact in
the wireless capabilities so that clients can disable the hot-spot
option if neither CAP_ADHOC nor CAP_AP is available.

https://bugzilla.gnome.org/show_bug.cgi?id=692869
2013-02-11 12:39:28 -05:00
Jiří Klimeš
d9c1fb176d include: document NM_DEVICE_TYPE_BRIDGE device type 2013-02-11 12:55:05 +01:00