Commit graph

10454 commits

Author SHA1 Message Date
Dan Winship bc003f6273 tools: fix test-networkmanager-service Settings.Connections
The test settings service wasn't exporting a Connections property.
2014-09-18 11:51:07 -04:00
Dan Winship 5f5a89b98a Port callouts to gdbus (bgo #622927) 2014-09-18 11:50:23 -04:00
Dan Winship 8d26c45184 dispatcher: make test-dispatcher-envp not take an argument
Compile srcdir into test-dispatcher-envp rather than passing it on the
command-line, to make it easier to run by hand, and so we can use
automake's TESTS support.
2014-09-18 11:34:21 -04:00
Dan Winship 1a5cfc1f45 dispatcher: port to GDBus
Port nm-dispatcher to GDBus, mostly, using dbus-glib's GVariant
utilities to translate the return value of nm_connection_to_dbus().
2014-09-18 11:26:59 -04:00
Dan Winship 408e86dd35 dispatcher: trivial code rearrangement
Reorganize some code in preparation for the GDBus port. (Most of the
diff is actually just reindentation.)

This also makes explicit something that was probably a bug;
IP4_NUM_ROUTES is always set, even if it's "0" (while the same is not
true of IP6_NUM_ROUTES). (This behavior is preserved for
compatibility.)
2014-09-18 11:04:26 -04:00
Dan Winship ab4199c785 libnm-core: add GVariant-based versions of IP structure-manipulating utilities 2014-09-18 11:04:25 -04:00
Dan Winship 4fab71b466 callouts: port nm-avahi-autoipd.action to GDBus 2014-09-18 11:04:25 -04:00
Jiří Klimeš b99b632b47 libnm-core: fix crash while converting permissions to list
Accept NULL as equivalent to a 0-length array from set_property().
2014-09-18 12:51:28 +02:00
Dan Winship b40dc506a1 libnm-core: fix nm_connection_replace_settings()
The rewrite mistakenly used nm_connection_add_setting() rather than
_nm_connection_add_setting(), causing it to emit the "changed" signal
while the connection was only partially rebuilt.
2014-09-17 08:36:56 -04:00
Dan Winship ca5f23a8b6 tui: fix an out-of-date comment
nmtui-connect.c claimed that it didn't implement deactivation yet, but
that was implemented long ago.
2014-09-17 08:27:15 -04:00
Dan Winship 831a70d10d Misc libnm-core fixes (bgo #736700) 2014-09-17 08:23:59 -04:00
Dan Winship f9f9d297f8 libnm: fix race conditions when creating the same object twice
If two code paths try to asynchronously create the same object at the
same time (eg, because it shows up in two different properties), we
are supposed to deal with that. But at some point a race condition
appeared where we could end up returning a partially-initialized
object for one of the properties in the async case. Fix that.

Also add comments to both the sync and async cases explaining why they
work the way they do.
2014-09-17 08:21:22 -04:00
Dan Winship f3c02058d4 libnm: drop two unnecessary NM_IS_OBJECT() checks
Now that NMRemoteConnection is an NMObject, the code only creates
NMObjects, so we don't need that check.
2014-09-17 08:21:22 -04:00
Dan Winship a59136878a libnm: fix object-creation-failure code
If _nm_object_create() hit an error, it would return the
(half-initialized) object anyway. If _nm_object_create_async() hit an
error, it would return NULL, but leak the half-initialized object. Fix
both cases.
2014-09-17 08:21:21 -04:00
Dan Winship ad8b13091b libnm-core: fix up connection deserialize/copy/replace semantics
libnm-util's connection deserializing/copying/replacing functions have
odd semantics where sometimes they both modify a connection AND return
an error. libnm-core tried to improve things by guaranteeing that the
connection would not be modified if the new settings were invalid, but
this ended up breaking a bunch of places that needed to be able to
work with invalid connections. So re-fix the functions by reverting
back to the old semantics, but having return values that clearly
distinguish whether the connection was modified or not.

For comparison:

  - nm_connection_new_from_hash() / nm_simple_connection_new_from_dbus():

      - libnm-util: returns a valid connection or NULL.

      - OLD libnm-core: returned a valid connection or NULL.

      - NEW libnm-core: returns a valid connection or NULL.

  - nm_connection_duplicate() / nm_simple_connection_new_clone():

      - libnm-util: always succeeds, whether or not the connection is
        valid.

      - OLD libnm-core: returned a valid connection or NULL

      - NEW libnm-core: always succeeds, whether or not the connection
        is valid.

    - nm_connection_replace_settings_from_connection():

      - libnm-util: always replaces the settings, but returns FALSE if
        the connection is now invalid.

      - OLD libnm-core: either replaced the settings and returned TRUE
        (if the settings were valid), or else left the connection
        unchanged and returned FALSE (if not).

      - NEW libnm-core: always replaces the settings, and has no
        return value. (The modified connection is valid if and only if
        the replaced-from connection was valid; just like with the
        libnm-util version.)

    - nm_connection_replace_settings():

      - libnm-util: returns TRUE if the new settings are valid, or
        FALSE if either (a) the new settings could not be deserialized
        and the connection is unchanged, or (b) the new settings were
        deserialized, and the connection was updated, but is now not
        valid.

      - OLD libnm-core: either replaced the settings and returned TRUE
        (if the settings were valid), or else left the connection
        unchanged and returned FALSE (if not).

      - NEW libnm-core: returns TRUE if the connection was updated
        (whether or not it is valid), or FALSE if the new settings
        could not be deserialized and the connection is unchanged.
2014-09-17 08:21:21 -04:00
Dan Winship c47165081a libnm-core: drop the ability to verify settings from property overrides
It needs to be possible to deserialize a connection hash into an
invalid NMConnection; in particular, AddAndActivateConnection()
explicitly allows this.

Previously, the SetFunc and NotSetFunc passed to
_nm_setting_class_override_property() could return a verification
error immediately, but this functionality has to go away if we're
going to be able to deserialize invalid connections.

That functionality was only used in the handling of invalid virtual
interface names; reorganize how that code works so that
NMSettingConnection does all of the verification itself. (The code to
make sure that it returned the "correct" error domain in that case
turned out to be irrelevant, since the setting error domains don't get
serialized over D-Bus correctly anyway.)
2014-09-17 08:21:21 -04:00
Dan Winship 6c6cec0366 libnm-core: fix getting/setting 0-length array properties
Empty array-valued properties should return a 0-length array from
get_property(), but should also accept NULL as equivalent to a
0-length array from set_property().
2014-09-17 08:21:21 -04:00
Dan Winship b9f9fd39ab Revert "tui: fix a crash"
This reverts commit c0ecd2f628.
2014-09-17 08:21:21 -04:00
Lubomir Rintel b05c8dbda5 core: fix casting of factory type (bgo #736780)
UINT is just 32bit, truncating the GType on 64-bit platforms. We do already use
cast to SIZE, which is as wide as a pointer, when we need a GType in another
place (nmtui); let's do it here as well.

Broken by [0bc1b5138] core: add support for internal device factories

https://bugzilla.gnome.org/show_bug.cgi?id=736780
2014-09-17 11:19:41 +02:00
Nilamdyuti Goswami 579ceea931 po: update Assamese (as) translation (bgo #736753)
https://bugzilla.gnome.org/show_bug.cgi?id=736753
2014-09-16 18:26:17 +02:00
Jiří Klimeš b81175f4ca tui: fix error: ‘return’ with no value, in function returning non-void 2014-09-16 18:26:17 +02:00
Dan Winship c1cf2b06e5 po: update POTFILES.in for nmtui PPPoE files 2014-09-16 08:38:47 -04:00
Dan Winship 35eb538282 tui: add support for editing DSL connections (rh #1105753) 2014-09-16 08:00:23 -04:00
Dan Winship 054bf2bb74 tui: add support for editing DSL connections (rh #1105753) 2014-09-16 07:58:38 -04:00
Dan Winship 030dace710 tui: reorganize page-creation code a bit
Allow each page type to specify whether it should be shown by default,
letting us simplify NmtPageMain.
2014-09-16 07:58:37 -04:00
Dan Winship b05b342ceb tui: add support for borderless NmtNewtSections 2014-09-16 07:58:37 -04:00
Christian Hesse c668297257 core: only set IPv6 hop_limit for values greater than zero
A "Cur Hop Limit" field value of 0 in a router advertisement means
"unspecified by this router" and should not be set in the kernel.
2014-09-15 12:10:24 -05:00
Dan Winship c0ecd2f628 tui: fix a crash
NMSettingIP4Config:dns is NULL if no DNS servers are set
2014-09-15 09:31:21 -04:00
Jiří Klimeš e47235b38d dhcp: log DHCP client exit status better 2014-09-12 12:51:18 +02:00
Jiří Klimeš b27669612e dhcp: fix dhclient abnormal exit due to SIGPIPE (bgo #735962)
DHCP client may be killed by SIGPIPE when attempting to write to a broken pipe.
This can be observed, for example, when journald is restarted.

Fix that by redirecting both stdout and stderr to /dev/null. The client logs
into syslog anyway. When NetworkManager is run with '--debug' we duplicate
syslog to stderr, so the messages goes to terminal as well.

Testcase:
- start a NetworkManager service by systemd
- activate an DHCP ethernet connection
- sudo systemctl restart systemd-journald.service
- reactive the ethernet connection (nmcli con up <my-eth>)
- DHCP client is killed by SIGPIPE right after its startup:
    <info> (enp0s25): DHCPv4 client pid 13959 exited with status -1
    <warn> DHCP client died abnormally

Another possible fix would be ignoring SIGPIPE in the DHCP client as it is not
useful in most cases. E.g. systemd ignores SIGPIPE for its services, by
default:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=353e12c2f4a9e96a47eb80b80d2ffb7bc1d44a1b

https://bugzilla.gnome.org/show_bug.cgi?id=735962
2014-09-12 12:49:16 +02:00
Dan Williams 6d659ab2cd build: fix build after "settings: create default wired connection..."
Fix build broken by beb18050b5
2014-09-11 17:14:27 -05:00
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