Commit Graph

13873 Commits

Author SHA1 Message Date
Dan Williams
e27034fb34 merge: create internal device types with factories too (bgo #736289)
https://bugzilla.gnome.org/show_bug.cgi?id=736289
2014-09-11 12:51:04 -05:00
Dan Williams
3deb3ff683 tun: port to internal device factory 2014-09-11 12:50:17 -05:00
Dan Williams
11eb99e9a7 gre: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
51aa432283 vxlan: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
1cf7b6d3dd macvlan: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
15db28e74b vlan: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
1553b3e223 bond: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
097eb3a6af bridge: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
6d190f92d5 infiniband: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
2a55c450bd ethernet: port to internal device factory 2014-09-11 12:50:16 -05:00
Dan Williams
388e53b180 veth: port to internal device factory
We must port NMDeviceVeth before NMDeviceEthernet because veth is
an ethernet subclass and uses symbols from nm-device-ethernet.c.
2014-09-11 12:50:16 -05:00
Dan Williams
0bc1b5138a core: add support for internal device factories 2014-09-11 12:50:15 -05:00
Dan Williams
38b076de8f build: ensure device source file constructors can be linked and called
gcc's linker does not add constructors from object files to the main
executable if they are built into a convenience library and then the
library is linked to the executable, unless something outside of the
object file with the constructor references a symbol from the object
file.

http://osdir.com/ml/libtool-gnu/2011-06/msg00003.html

"Yes, when convenience libraries are used to create a shared library, all the
objects are included in the output, when the output is an application they are
used like a normal archive library.

Either use them to create a shared library or, if creating an application,
don't use them, use the objects instead."

Further patches will remove all references to the NMDevice subclasses
from nm-manager.c, and have each NMDevice subclass register itself
with a factory through a constructor.  But due to the above issue,
we need to somehow ensure the constructor in each nm-device-*.c file
gets added to the executable.  This is accomplished by explicitly
linking each NMDevice subclass' object file into the main executable.

(Note that we cannot use -Wl,-whole-archive here because libtool only
supports this option for linking a convenience library to a shared
library, but not to an executable, and will actively prevent using
-whole-archive in LDFLAGS)
2014-09-11 12:48:17 -05:00
Dan Williams
706b9d2056 core: pass parent to device factories when creating devices for connections
We'll use it later for InfiniBand and VLAN.
2014-09-11 12:47:23 -05:00
Dan Williams
560fe126b5 core: split out device factory registration function
We'll soon use it for both shared-library-based plugins, and internal
device factories.
2014-09-11 12:47:23 -05:00
Dan Williams
00fe31f5cd core: move device factory type function into factory object
In preparation for internal device types exposing factories too, it's
easier to have the device type that the factory creates be returned
by the factory object instead of the plugin, because internal device
types don't have plugins.

This requires that we create the factory objects earlier, which
further requires that any operations that trigger signals must be
moved out of each factory's construction path to a separate start()
function.
2014-09-11 12:47:23 -05:00
Dan Williams
beb18050b5 settings: create default wired connection from NMDeviceEthernet
Instead of creating it in NMSettings, where we must use
NM_IS_DEVICE_ETHERNET() (not NM_DEVICE_TYPE_ETHERNET because various generic
devices masquerade as NM_DEVICE_TYPE_ETHERNET too), push knowledge
of which device types create default wired connections into the device
types themselves.  This solves a problem with testcases where
libNetworkManager.a (which testcases link to) requires the symbol
nm_type_device_ethernet().
2014-09-11 12:47:07 -05:00
Dan Williams
56e2915536 trivial: spacing and code cleanups in nm-manager.h
Remove some dead code and a redundant function.
2014-09-11 12:40:08 -05:00
Dan Williams
3382d3e1a2 merge: consolidate searching for helper programs (bgo #734131)
https://bugzilla.gnome.org/show_bug.cgi?id=734131
2014-09-11 12:28:12 -05:00
Dan Williams
005cb2fc35 core: search for arping binary too (bgo #734131) 2014-09-11 12:11:57 -05:00
Dan Williams
544fc82aa7 core: consolidate helper progam searching (bgo #734131)
Instead of having basically the same code in a bunch of different
place to find helper programs, just have one place do it.  Yes, this
does mean that the same sequence of paths is searched for all helpers
(so for example, dnsmasq will no longer be found first in /usr/local)
but I think consistency is the better option here.

https://bugzilla.gnome.org/show_bug.cgi?id=734131
2014-09-11 12:11:56 -05:00
Jiří Klimeš
053c8fa5df libnm-core: allow G_TYPE_STRV to be NULL
Otherwise we assert in _nm_utils_strv_to_slist() when setting a property,
using the code like:
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (param_spec));
g_param_value_set_default (param_spec, &value);
g_object_set_property (G_OBJECT (setting), prop, &value);

e.g:
nmcli con mod my_profile eth.mac-address-blacklist "02:14:20:e6:16:83"

(changed by commit 6a4127cfa0)
2014-09-10 15:00:49 +02:00
Jiří Klimeš
8657b4229c ifcfg-rh: fix reading HWADDR_BLACKLIST
Adding GSList to the property may crash NetworkManager. Also check MAC
addresses and filter out the invalid ones.

(broken by commit 6a4127cfa0)
2014-09-10 15:00:49 +02:00
Jiří Klimeš
112c53be32 nm-utils: add a wrapper for g_strsplit_set() removing empty strings from array
g_strsplit_set() puts empty strings ("") into the resulting string array when
a delimiter character appears as the first or last character in the string or
when there are adjacent delimiter characters. However, this is not what is
useful in most cases.
2014-09-10 15:00:49 +02:00
Jiří Klimeš
9197d76e96 libnm: use g_return_if_fail() in a function returning void 2014-09-10 15:00:49 +02:00
Dan Winship
a098c8789b libnm: add test-secret-agent, glib-ify NMSecretAgent APIs (bgo #735916) 2014-09-09 12:16:46 -04:00
Dan Winship
d3b53b707a libnm: start glib-ifying NMSecretAgent APIs
Make register() and unregister() have cancellable sync and async
variants. And make NMSecretAgent implement GInitable/GAsyncInitable,
and do the initial auto-registration as part of initialization rather
than doing it asynchronously and emitting a signal.
2014-09-09 12:16:38 -04:00
Dan Winship
c9fb96e02e libnm: add test-secret-agent
Implement some basic secret agent functionality in
test-networkmanager-service.py, and add test-secret-agent to test that
NMSecretAgent works as expected.
2014-09-09 12:16:38 -04:00
Dan Winship
79093c655b libnm: NMSecretAgent shouldn't check peer UID on session bus
If an NMSecretAgent is attached to the session bus rather than the
system bus, then it's presumably a test program, and so we don't want
to check that the peer is root.
2014-09-09 12:16:37 -04:00
Dan Winship
8723bbd3e8 libnm: drop NMObject:dbus-connection (bgo #735916) 2014-09-09 12:15:54 -04:00
Dan Winship
b732380d1e libnm: drop NMObject:dbus-connection
The only plausible use case for the NMObject:dbus-connection property
is for using the session bus in test programs. So just drop it and use
an environment variable to decide which bus to use instead.
2014-09-09 12:10:13 -04:00
Dan Winship
a874e0beac libnm: assert that dbus_connection_allocate_data_slot() doesn't fail
dbus_connection_allocate_data_slot() can only fail on ENOMEM, in which
case the immediately-following call to g_set_error() would also get
ENOMEM and abort. So just simplify and assert that the libdbus call
didn't fail.
2014-09-09 12:10:13 -04:00
Jiří Klimeš
c6a932a2ce cli: fix ssid parameter processing in 'nmcli con add'
(broken by commit c43f88907b)
2014-09-09 16:54:32 +02:00
Dan Winship
730d096fe1 cli: fix MAC address validation (bgo #736275)
nm_utils_hwaddr_valid() accepts length while check_mac() mistakenly passes
type.

(broken by 3a54d05098)

https://bugzilla.gnome.org/show_bug.cgi?id=736275
2014-09-09 11:13:00 +02:00
Jiří Klimeš
886c3d7586 libnm-core: fix DCB's _nm_setting_dcb_uint_array_from_dbus()
and rename functions to be clearer:
set_uint_array()  -> set_array_from_gvalue()
take_uint_array() -> set_gvalue_from_array()
2014-09-08 17:56:51 +02:00
Jiří Klimeš
ac46435f2c Revert "libnm-core: fix NMSettingDcb"
This reverts commit b4bebbd02d.
2014-09-08 10:51:36 +02:00
Jiří Klimeš
aee8eb837b contrib/rpm: use HTTPS for connectivity check URL (rh #1135777)
https://bugzilla.redhat.com/show_bug.cgi?id=1135777
2014-09-05 23:24:08 +02:00
Dan Winship
d50795efd0 trivial: alphabetize the nm-*.xml files in introspection/Makefile.am 2014-09-05 14:18:15 -04:00
Dan Winship
b4bebbd02d libnm-core: fix NMSettingDcb
This got broken in the libnm-props changes (specifically 22b92a75).
2014-09-05 09:59:21 -04:00
Thomas Haller
6325c596c0 libnm: handle all-default settings in nm_setting_to_hash() properly
Before, _nm_setting_to_dbus() would return NULL instead of an empty
hash. This would be the case, if all properties are default.

When exporting connections via DBUS, we eventually call
_nm_setting_to_dbus() to convert the connection into a hash of hashes.
By _nm_setting_to_hash() converting empty hashes to NULL, the setting
is missing. Not returning empty hashes means that to_dbus() and
new_from_dbus() don't make a valid round-trip conversion.

Fix that by always returning a hash from _nm_setting_to_dbus()

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

See-also: 4d32618264
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-05 09:35:56 -04:00
Jiří Klimeš
85909d080f examples: fix python GI examples to work after libnm changes 2014-09-05 13:48:56 +02:00
Jiří Klimeš
2f3b45b76e libnm: add missing (transfer) annotations for return values 2014-09-05 13:46:00 +02:00
Jiří Klimeš
5d982b3810 utils: use gssize (signed) 'len' parameter in nm_ethernet_address_is_valid()
Fix copyright statement too.
2014-09-05 11:11:01 +02:00
Jiří Klimeš
01d0d37615 dhcp: fix g_error_free() called with a bad argument 2014-09-05 10:25:03 +02:00
Dan Winship
00695f1939 Port non-libnm*-based code to GDBus (bgo #622927) 2014-09-04 18:20:33 -04:00
Dan Winship
9e5ddb5830 examples: port dbus-glib-based examples to gdbus
Port the dbus-glib-based examples to GDBus.

Also, don't use libnm in them at all; there's not much point in
examples that use the D-Bus API directly if they're just going to fall
back to libnm for the hard stuff... (And also, this avoids the problem
that GDBus uses GVariant, while the libnm-core APIs currently still
use GHashTables.)

Also fix up some comment grammar and copyright style, and add emacs
modelines where missing.

Also rename the existing GDBus-based examples to have names ending in
"-gdbus", not "-GDBus", since there's no reason to gratuitously
capitalize here.
2014-09-04 18:19:22 -04:00
Dan Winship
89228569f8 ppp-manager: port nm-pppd-plugin from dbus-glib to gdbus 2014-09-04 18:19:21 -04:00
Dan Winship
66c238e7b2 dhcp-manager: port nm-dhcp-helper from dbus-glib to gdbus 2014-09-04 18:19:21 -04:00
Dan Williams
4e530adf60 merge: handle IPv6 link-local addresses from userspace when possible (bgo #734149) 2014-09-04 15:11:55 -05:00
Dan Williams
5e4761a3a9 core: take over IPv6LL address management if kernel supports it (bgo #734149)
NM keeps interfaces IFF_UP when possible to receive link layer
events like carrier changes.  Unfortunately, the kernel also
uses IFF_UP as a flag to assign an IPv6LL address to the interface,
which results in IPv6 connectivity on the link even if the interface
is not supposed to be activated/connected.

NM sets disable_ipv6=1 to ensure that the kernel does not set up
IPv6LL connectivity on interfaces when they are not supposed to
be active and connected.  Unfortunately, that prevents users from
manually adding IPv6 addresses to the interface, since they expect
previous kernel behavior where IPv6 is enabled whenever the
interface is IFF_UP.

Furthermore, interfaces like PPP and some WWAN devices provide
misleading information to the kernel which causes the kernel to
create the wrong IPv6LL address for the interface.  The IPv6LL
address for these devices is obtained through control channels
instead (IPV6CP for PPP, proprietary protocols for WWAN devices)
and should be used instead of the kernel address.  So we'd like
to suppress kernel IPv6LL address generation on these interfaces
anyway.

This patch makes use of the netlink IFLA_INET6_ADDR_GEN_MODE
attribute to take over assignment of IPv6LL addresses while
keeping the interface IFF_UP, to ensure there is only IPv6
connectivity when the user requests it.

To remain compliant with standards, if a user adds IPv6 addresses
externally, NetworkManager must also immediately add an IPv6LL
address for that interface too.

https://bugzilla.gnome.org/show_bug.cgi?id=734149
2014-09-04 15:11:04 -05:00