Commit Graph

524 Commits

Author SHA1 Message Date
Thomas Haller
abdf9a3673 all: change handling of connection.type for bluetooth NAP and in general
Branch f9b1bc16e9 added bluetooth NAP
support. A NAP connection is of connection.type "bluetooth", but it
also has a "bridge" setting. Also, it is primarily handled by NMDeviceBridge
and NMBridgeDeviceFactory (with help from NMBluezManager).

However, don't let nm_connection_get_connection_type() and
nm_connnection_is_type() lie about what the connection.type is.
The type is "bluetooth" for most purposes -- at least, as far as
the client is concerned (and the public API of libnm). This restores
previous API behavior, where nm_connection_get_connection_type()
and nm_connection_is_type() would be simple accessors to the
"connection.type" property.

Only a few places care about the bridge aspect, and those places need special
treatment. For example NMDeviceBridge needs to be fully aware that it can
handle bluetooth NAP connection. That is nothing new: if you handle a
connection of any type, you must know which fields matter and what they
mean. It's not enough that nm_connection_get_connection_type() for bluetooth
NAP connectins is claiming to be a bridge.

Counter examples, where the original behavior is right:

src/nm-manager.c-        g_set_error (error,
src/nm-manager.c-                     NM_MANAGER_ERROR,
src/nm-manager.c-                     NM_MANAGER_ERROR_FAILED,
src/nm-manager.c-                     "NetworkManager plugin for '%s' unavailable",
src/nm-manager.c:                     nm_connection_get_connection_type (connection));

the correct message is: "no bluetooth plugin available", not "bridge".

src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:   if (   (   nm_connection_is_type (connection, NM_SETTING_WIRED_SETTING_NAME)
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:           && !nm_connection_get_setting_pppoe (connection))
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_WIRELESS_SETTING_NAME)
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME)
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_TEAM_SETTING_NAME)
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME))
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c-        return TRUE;

the correct behavior is for ifcfg-rh plugin to reject bluetooth NAP
connections, not proceed and store it.
2017-06-07 09:07:17 +02:00
Yuri Chornoivan
0050e8bd34 all: fix typos in documentation, translated strings and comments
https://bugzilla.gnome.org/show_bug.cgi?id=783173
2017-05-28 17:33:37 +02:00
Thomas Haller
59e31ab6ea libnm: cleanup argument types for init_if() function
We use init_if() as handler for g_list_foreach(). Since we already
cast the function pointer because it doesn't have (GFunc) signature,
we can just as well use the correct types right away.
2017-05-27 11:38:38 +02:00
Thomas Haller
e255ad2a03 libnm: move fixup_desc_string() to nm-libnm-utils.c 2017-05-19 12:45:45 +02:00
Thomas Haller
8df944c7e4 libnm: add testable libnm/nm-libnm-utils.c file
Previously, internal parts of libnm were not testable.
Instead, add "libnm/nm-libnm-utils.c" and "libnm/libnm-utils.la"
to contain code that can be statically linked with a new
test "libnm/tests/test-general".
2017-05-19 12:45:45 +02:00
Thomas Haller
72104ea10a libnm: ignore phrases in fixup device description only when delimited by space 2017-05-19 12:45:45 +02:00
Thomas Haller
12c881ad40 libnm: fix device description in fixup_desc_string()
Fixes: b9e9f76165
2017-05-19 12:45:45 +02:00
Thomas Haller
b9e9f76165 libnm: UTF-8 sanitize strings from UDev in NMDevice 2017-05-19 09:46:08 +02:00
Francesco Giudici
23bc781063 all/trivial: fix few comment typos 2017-05-15 15:52:21 +02:00
Lubomir Rintel
e6f95b50c8 setting-wireless: add wps-method property
This property will be used to decide if it makes sense to attempt a WPS
enrollment on connection activation.
2017-05-15 12:59:55 +02:00
Thomas Haller
e6744bcb65 libnm: fix type for "notify_id" source id in "nm-object.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
d6c1e565ff libnm: remove unused code reload_results and reload_error from "nm-object.c"
Fixes: 1f5b48a59e
2017-05-11 18:26:10 +02:00
Thomas Haller
65b440c9fa libnm: use CList instead of GSList for pending in "nm-object.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
35f37151df libnm: use CList instead of GSList for notify_items in "nm-object.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
c63a6772a4 libnm: use CList instead of GSList for pending_activations in "nm-manager.c" 2017-05-11 18:26:10 +02:00
Beniamino Galvani
60a3809815 libnm-core: add pmf property to wireless-security setting
Add a 'pmf' property to enable or disable Protected Management Frames
(802.11w) for the connection.
2017-04-28 09:46:05 +02:00
Beniamino Galvani
212df5cbd8 libnm: fix memory leak in DNS manager
Fixes: a8d6005256
2017-04-20 14:33:31 +02:00
Thomas Haller
d720f0955f cli: embed gtk-doc directly in property-info structure
Also mark them for translation.
2017-03-30 16:35:52 +02:00
Thomas Haller
c06308a10c libnm: fix showing UDEV properties for device
https://mail.gnome.org/archives/networkmanager-list/2017-March/msg00065.html

Fixes: c7ccdf5fc8
2017-03-29 09:42:43 +02:00
Thomas Haller
4ec7dd987e libnm: add NMSettingUser
This only adds new API for a NMSettingUser. The setting class
is still entirely unused.

The point is getting the new API into 1.8.0 release of libnm.
It's easier to backport the use of the API to a stable branch
then backporting public API.

https://bugzilla.gnome.org/show_bug.cgi?id=776276
https://bugzilla.redhat.com/show_bug.cgi?id=1421429
2017-03-28 14:58:21 +02:00
Thomas Haller
b11b603879 libnm: handle errors gracefully in nm_access_point_connection_valid()
Suppress warnings and avoid assertions in
nm_access_point_connection_valid().

https://bugzilla.gnome.org/show_bug.cgi?id=773675
2017-03-24 12:08:03 +01:00
Thomas Haller
6808bf8195 udev: add and use nm_udev_utils_property_decode() function
DRY.
2017-03-22 12:41:06 +01:00
Thomas Haller
c7ccdf5fc8 libnm/udev: cache and reuse udev instance for NMDevice
No need to create a separate NMUdevClient instance for all devices.
Instead, have one "struct udev" instance in NMClient and pass
it down during object construction.
2017-03-22 12:41:06 +01:00
Thomas Haller
e32839838e udev: drop libgudev in favor of libudev
libgudev is just a wrapper around libudev. We can
use libudev directly and drop the dependency for
libgudev.
2017-03-22 12:41:06 +01:00
Beniamino Galvani
7de4912ff0 libnm: fix emission of NMActiveConnection::state notify signal
state_changed_proxy() updates the value of @state and must also emit
the notify signal for it.

Without this, when the PropertiesChanged signal carrying the change of
'state' arrives after StateChanged, we notice that the value of @state
doesn't change and don't emit the notify, causing a loss of the state
change event.

Fixes: 40ffb962be

https://bugzilla.redhat.com/show_bug.cgi?id=1433883
2017-03-21 17:52:58 +01:00
Thomas Haller
714504faf2 libnm/nm-vpn-connection: un-deprecate the NMVpnStateReason use in a header
Otherwise merely including a header would trigger a deprecation warhing.
The signal slot is not really used anyway.
2017-03-20 14:51:11 +01:00
Thomas Haller
c033330c41 libnm: fix memleak of GUdevDevice in get_bus_name()
Fixes: f7b1b28202
2017-03-20 11:28:58 +01:00
Thomas Haller
b33b15ae76 doc: fix generate-setting-docs.py for supporting Python 3 sorted() style
Python 3 has no "cmp" argument to sorted().

Fixes: b0da972f5f
2017-03-20 11:12:40 +01:00
Thomas Haller
5022e3b8ee libnm: revert coercing NMVpnConnectionStateReason to NMActiveConnectionStateReason
NMVpnConnectionStateReason is no longer used and replaced by
NMActiveConnectionStateReason. However, the old enums should
stay in place as they were:

Otherwise:
  #define NMVpnConnectionStateReason NMActiveConnectionStateReason
causes compiler warnings:
  NMVpnConnectionStateReason x;
  x = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;             // -Wenum-conversion
  if (x == NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS) { } // -Wenum-compare

Similarly, a user who didn't upgrade shall continue to get the
old GType for NM_TYPE_VPN_CONNECTION_STATE_REASON.

In practice, old users will have no issues using the old enum
the places where it worked before.
The only use of the deprecated enum is in vpn_state_changed()
signal slot of NMVpnConnection. This makes the signal slot
itself deprecated. However, NMVpnConnection is an NMObject and commonly
created within libnm itself, not by the user. It is very unlikely that
a user of libnm subclassed NMVpnConnection and makes use of the
vpn_state_changed() signal slot. So, deprecate it without replacement.

Fixes: a91369f80d
2017-03-17 13:00:32 +01:00
Thomas Haller
fa262e3dc4 libnm: fix chaining up NMActiveConnection::constructed()
Fixes: 40ffb962be
2017-03-17 10:50:42 +01:00
Lubomir Rintel
d190ca487f vpn-connection: use NMActiveConnectionStateReason 2017-03-17 10:21:19 +01:00
Lubomir Rintel
a91369f80d libnm-core: drop NMVpnConnectionStateReason
It's now the same as NMActiveConnectionStateReason. Keep a compatibility
typedef and enum.
2017-03-17 10:21:19 +01:00
Lubomir Rintel
c61c16513e fixup! libnm/active-connection: track reason for state changes 2017-03-17 10:21:19 +01:00
Lubomir Rintel
40ffb962be libnm/active-connection: track reason for state changes
Note that the reason tracking starts as soon as the object exists (which
is immediately after GDBusObject is created), not when the asynchronous
NMObject initialization finishes. That is so that we the reason changes
in between are not lost.

The vpn-connection should probably be doing the same.
2017-03-17 10:21:19 +01:00
Lubomir Rintel
8b649a8c84 active-connection: emit a StateChanged signal on state changes
It includes a reason code that makes it possible for the clients to be
more reasonable about error messages.

The reason code is essentially copied from the VPN, plus three more
reasons that were useful for non-VPN connections.
2017-03-17 10:21:19 +01:00
Lubomir Rintel
a1c5f43501 libnm/generate-setting-docs.py: include description attribute 2017-03-17 10:15:11 +01:00
Lubomir Rintel
b0da972f5f doc: sort "connection" settings first in nm-settings manual 2017-03-17 10:15:11 +01:00
Thomas Haller
ec2681d4db all: use nm_clear_g_cancellable() 2017-03-13 12:00:23 +01:00
Thomas Haller
831286df30 include: use double-quotes to include our own headers
In practice, this should only matter when there are multiple
header files with the same name. That is something we try
to avoid already, by giving headers a distinct name.

When building NetworkManager itself, we clearly want to use
double-quotes for including our own headers.
But we also want to do that in our public headers. For example:

  ./a.c
    #include <stdio.h>
    #include <nm-1.h>
    void main() {
        printf ("INCLUDED %s/nm-2.h\n", SYMB);
    }

  ./1/nm-1.h
    #include <nm-2.h>

  ./1/nm-2.h
    #define SYMB "1"

  ./2/nm-2.h
    #define SYMB "2"

$ cc -I./2 -I./1 ./a.c
$ ./a.out
INCLUDED 2/nm-2.h

Exceptions to this are
  - headers in "shared/nm-utils" that include <NetworkManager.h>. These
    headers are copied into projects and hence used like headers owned by
    those projects.
  - examples/C
2017-03-09 14:12:35 +01:00
Thomas Haller
ab6e370195 all/trivial: unify construct-only property comments
Unify marking GObject properties that are G_PARAM_CONSTRUCT_ONLY
with a comment

    /* construct-only */
2017-03-08 13:47:00 +01:00
Thomas Haller
556b7c3b45 libnm: add assertion to NMObject that a dbus-object is set
The libnm cache types don't have public _new() functions.
However, such types can be easily created using g_object_new()
directly from user code.

Such a usage is not supported. Add an assertion that a valid
dbus-object is present.
2017-03-08 08:16:44 +01:00
Thomas Haller
9ed0e3705e libnm: chain up NMRemoteConnection::constructed() function
Fixes: 0fdd71fe6e
2017-03-07 23:47:43 +01:00
Beniamino Galvani
54e58eb96b libnm-core: define known route attribute names and validation function
This adds definition of a set of known route option attributes to
libnm-core and helper functions.

nm_ip_route_attribute_validate() performs the validation of the
attribute type and, in case of a formatted string attribute, of its
content.

nm_ip_route_get_variant_attribute_spec() returns the attribute format
specifier to be passed to nm_utils_parse_variant_attributes(). Since
at the moment NMIPRoute is the only user of NMVariantAttributeSpec and
the type is opaque to users of the library, the struct is extended to
carry some other data useful for validation.
2017-03-06 15:20:25 +01:00
Beniamino Galvani
93b3a478bb libnm-core: add attribute parsing/format helpers
Various libnm objects (addresses, routes) carry an hash table of
attributes represented as GVariants indexed by name. Add common
routines to convert to and from a string representation.

To parse a string, a knowledge of the supported attributes (and their
types) is needed: we represent it as an opaque type
NMVariantAttributeSpec that callers must query to the library for the
specific object type and pass to the parse function.
2017-03-06 15:20:25 +01:00
Lubomir Rintel
d63b67b0e0 libnm/manager: make sure the devices and acs won't notify manager after the manager is gone
https://bugzilla.redhat.com/show_bug.cgi?id=1425838
2017-02-28 10:47:21 +01:00
Beniamino Galvani
4db7890fae cli: support dummy connections 2017-02-22 21:05:04 +01:00
Beniamino Galvani
b42f780e04 core: add support for dummy devices
Add support for creating dummy devices. This commit adds a D-Bus
interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used
primarily for determining the device type but does not carry any
properties.
2017-02-22 21:05:04 +01:00
Beniamino Galvani
1bf2d3b049 libnm-core: add dummy connection setting
The setting must be present in connections with type=dummy. It does
not contain any property.
2017-02-22 21:05:04 +01:00
Beniamino Galvani
078bd7b1a9 libnm-core: add auth-timeout property to the 802.1x setting
The property can be used to tune the authentication timeout. It's
especially useful to speed up the failure in case the port doesn't
support 802.1X and make NM try a different, non-authenticated
connection.
2017-02-21 09:18:53 +01:00
Leorize
e3a9f1b32a libnm-core/8021x: add phase1-auth-flags configuration items 2017-02-20 13:45:32 +01:00