Commit Graph

7207 Commits

Author SHA1 Message Date
Lubomir Rintel
a5b6436a90 device: add possibility to reapply the ipv4 settings 2016-01-10 23:14:29 +01:00
Lubomir Rintel
1490c36bb9 device: add O.FD.NM.Device.Reapply() call
The introspection data and daemon stub. There's no settings that can be
reapplied at the moment.
2016-01-10 23:13:34 +01:00
Lubomir Rintel
21fa044df0 device: refactor the ip cleanup
Split it up and move upwards. It will be useful for runtime reconfig of
IPv4 configuration.
2016-01-10 23:12:48 +01:00
Thomas Haller
4706df11fd trivial: fix whitespace 2016-01-08 16:11:56 +01:00
Beniamino Galvani
7976edb723 manager: get rid of unused defines 2016-01-07 22:40:58 +01:00
Beniamino Galvani
92149f223f device: wait for valid MAC before making ethernet devices available
In certain situations, ethernet links first appear with a zero MAC
address and then the MAC changes some time later. Currently NM does
not deal correctly with this scenario since it initializes wrong
@initial_hwaddr and @permanent_hwaddr on the device and tries to
immediately activate it.

To fix this, initialize the device's addresses only when the MAC
becomes valid and make the device available only at that point.
2016-01-07 11:53:05 +01:00
Beniamino Galvani
2a0a9aa2e4 device/trivial: split out nm_device_update_initial_hw_address() 2016-01-07 11:52:52 +01:00
Beniamino Galvani
44789e3291 core: simplify generation of default connection for new devices
Instead of using a signal for triggering the generation of a default
connection when the device becomes managed, let the manager wait for a
transition to UNAVAILABLE or DISCONNECTED states.

This partially reverts b3b0b46250 ("device: retry creation of
default connection after link is initialized").
2016-01-07 11:52:52 +01:00
Thomas Haller
1a835ad3d0 wifi: refactor creation of NMDeviceWifi/NMDeviceOlpcMesh to initialize in constructed() method 2016-01-06 22:18:25 +01:00
Thomas Haller
044de4cea2 wifi: don't fail construction of NMDeviceWifi in constructor
We cannot abort the construction of a GLib object instance
like we did for NMDeviceWifi and NMDeviceOlpcMesh when
nm_platform_wifi_get_capabilities() failed.

Instead, check the capabilities first (in the factory method)
and only create the object instance when the device can be handled.

https://bugzilla.gnome.org/show_bug.cgi?id=760154
2016-01-06 22:18:25 +01:00
Thomas Haller
e2e22eb574 wifi-olpc: refactor NMDeviceOlpcMesh to hold pointer to NMManager
Objects that register to a signal of a singleton should own a reference
to the singleton to ensure the proper lifetime of the singleton upon shutdown.
2016-01-06 22:18:25 +01:00
Thomas Haller
a097895a65 wifi: use "bool" members instead of gboolean in NMDeviceWifiPrivate struct 2016-01-06 22:18:24 +01:00
Beniamino Galvani
c37c36e7ec core: cache pointer to private-data in NMIP{4,6}Config structure
This is the same as 04c70c76bc for the
NMIP4Config and NMIP6Config structures. The new field makes debugging
of issues related to IP configuration much easier.
2016-01-06 21:25:56 +01:00
Beniamino Galvani
24d8604637 core: use NM_PLATFORM_GET instead of nm_platform_get() in function calls
Replacement was done with command:

spatch --sp-file nm_platform_get.cocci --in-place --smpl-spacing --dir src

where nm_platform_get.cocci contains:

@@
identifier func;
expression list args;
@@
- func (nm_platform_get())
+ func (NM_PLATFORM_GET)

@@
identifier func;
expression list args;
@@
- func (nm_platform_get(), args)
+ func (NM_PLATFORM_GET, args)
2016-01-06 21:25:56 +01:00
Beniamino Galvani
ea1eb94d9b core: use nm_clear_g_signal_handler() where possible
Replacement was done with command:

spatch --sp-file nm_clear_g_signal_handler.cocci --in-place --smpl-spacing --dir src

where nm_clear_g_signal_handler.cocci contains:

@@
expression obj, id;
@@
- if (id) {
-    g_signal_handler_disconnect (obj, id);
-    id = 0;
- }
+ nm_clear_g_signal_handler (obj, &id);
2016-01-06 21:25:56 +01:00
Beniamino Galvani
f96abc8be5 core: always use gulong to store signal handler ids
We inconsistently use gulong,guint,int types to store signal handler
id, but the type returned by g_signal_connect() is a gulong.

This has no practical consequences because a int/guint is enough to
store the value, however it is better to use a consistent type, also
because nm_clear_g_signal_handler() accepts a pointer to the signal id
and thus it must be always called with the same pointer type.
2016-01-06 21:25:55 +01:00
Beniamino Galvani
fbd3286955 core,libnm: use nm_clear_g_source() where possible
Replacement was done with commands:

spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir src
spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir libnm

where nm_clear_g_source.cocci contains:

@@
expression e;
@@
- if (e) {
-    g_source_remove (e);
-    e = 0;
- }
+ nm_clear_g_source (&e);
2016-01-06 21:25:55 +01:00
Beniamino Galvani
205ae642f9 core: fix signedness of NMPolicyPrivate.reset_retries_id 2016-01-06 21:25:55 +01:00
Beniamino Galvani
272098e48b ifcfg-rh: fix utils_detect_ifcfg_path() argument
Fixes: 39e97c9339
2016-01-06 21:19:45 +01:00
Thomas Haller
39e97c9339 ifcfg-rh: only accept ifcfg base paths in impl_ifcfgrh_get_ifcfg_details()
Previously, we directly passed the @in_ifcfg path to find_by_path().
That means, @in_ifcfg must be the path to the base "ifcfg-" file,
not an alias or route file.

Add an additional pre-check, that the provided file name is really a
ifcfg base file.

This results in a more detailed error message when calling
GetIfcfgDetails not on the ifcfg base file. It's not that previously
the lookup would have succeeded.
2016-01-06 12:06:44 +01:00
Beniamino Galvani
5bf0697f65 device/infiniband: take interface down to set transport mode
With some drivers it is necessary to take the interface down to set
the transport mode.

https://bugzilla.redhat.com/show_bug.cgi?id=1281301
2016-01-05 18:53:22 +01:00
Beniamino Galvani
ed536998f9 device: update @ip_iface only if IP interface exists
If @ip_ifindex is zero, the IP interface has disappeared and
there's no point in updating @ip_iface.

Actually, unconditionally updating @ip_iface is dangerous because it
breaks the assumption used by other functions (as
nm_device_get_ip_ifindex()) that a non-NULL @ip_iface implies a valid
@ip_ifindex. This was causing the scary failure:

  devices/nm-device.c:666:get_ip_iface_identifier: assertion failed: (ifindex)

https://bugzilla.redhat.com/show_bug.cgi?id=1268617
2016-01-05 18:36:46 +01:00
Beniamino Galvani
5f93f01015 ppp-manager: clear @ppp_watch_id upon pppd termination
Set @ppp_watch_id to zero upon pppd termination, otherwise the call to
g_source_remove(priv->ppp_watch_id) in dispose() could trigger a failed
assertion.
2016-01-05 18:36:46 +01:00
Thomas Haller
0e164ac607 platform: ensure _nl_send_auto_with_seq() returns 0 on success
Just for consistency reason.
2016-01-04 18:15:17 +01:00
Thomas Haller
7102cde1ff platform/trivial: remove extra indention in constructed() 2016-01-04 18:08:04 +01:00
Beniamino Galvani
986cf3a887 ppp-manager: initialize MTU to zero when not specified
When the MTU was not specified in PPP setting, it got the value of a
previous option.

Fixes: 8f36727ac8
2016-01-04 17:10:43 +01:00
Thomas Haller
ac7a6d0206 systemd: merge branch 'systemd' into master 2016-01-04 17:03:11 +01:00
Thomas Haller
4b5352057a platform/tests: avoid test failure in test_ip6_address_general()
# Start of ipv6 tests
  # NetworkManager-FATAL-ERROR: NMPlatformSignalAssert: ../../../../../src/platform/tests/test-address.c:154, test_ip6_address_general(): failure to free non-accepted signal: ip6-address-changed-changed ifindex 11 (1 times received)
2016-01-04 17:01:18 +01:00
Thomas Haller
606ad7e62b systemd: update code from upstream
This is a direct dump from systemd git on 2016-01-04, git commit
993898a2af5bc34e600b81aafec055cc93be0b02.

======

SYSTEMD_DIR=../systemd
COMMIT=993898a2af5bc34e600b81aafec055cc93be0b02

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-port.c"
nm_copy_sd "src/libsystemd-network/lldp-port.h"
nm_copy_sd "src/libsystemd-network/lldp-tlv.c"
nm_copy_sd "src/libsystemd-network/lldp-tlv.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-01-04 15:21:19 +01:00
Lubomir Rintel
da1abaa1db device: reset the capabilities to class defaults when reseting them
Otherwise the lacking IS_SOFTWARE capability may cuase the connections not to
be available on software devices and the devices would get garbage-collected at
the end of unrealize().
2016-01-04 12:09:55 +01:00
Lubomir Rintel
48695df023 vlan: make connection available if the device is not real
Otherwise NMDevice would do and always fail a carrier check, making it
impossible to ever manually activate a vlan connection.
2016-01-04 11:57:22 +01:00
Thomas Haller
db80ec05ab build: rename directory "include" to "shared"
Up to now, the "include" directory contained (only) header files that were
used project-wide by libs, core, clients, et al.

Since the directory now also contains a non-header file, the "include"
name is misleading. Instead of adding yet another directory that is
project-wide, with non-header-only content, rename the "include"
directory to "shared".
2015-12-24 11:42:37 +01:00
Lubomir Rintel
93f1a1d461 platform: fix 32-bit build
Fixes: 6d67e6e9c4
2015-12-23 12:35:15 +01:00
Beniamino Galvani
e1d06d7a0b device/vlan: fix failed assertion in parent_hwaddr_changed()
Parent MAC can be NULL if the interface has gone, fix the following
failed assertion:

  [devices/nm-device-vlan.c:107] parent_hwaddr_changed(): (vlan1): parent hardware address changed
  nm_device_set_hw_addr: assertion 'addr != NULL' failed

While at it, improve logging by printing the new MAC address.

Fixes: e6d7fee5a6
2015-12-22 10:51:26 +01:00
Beniamino Galvani
29b93602fc tun: add support for MTU and cloned-mac-address properties
Make it possible to change ethernet.mtu and
ethernet.cloned-mac-address properties of tun/tap devices
(cloned-mac-address is meaningful only for taps).
2015-12-19 12:06:33 +01:00
Beniamino Galvani
9c837e95a3 vxlan: add support for MTU and cloned-mac-address properties
Make it possible to change ethernet.mtu and
ethernet.cloned-mac-address properties of vxlan devices.
2015-12-19 12:06:33 +01:00
Beniamino Galvani
1ff712d5d0 ip-tunnel: add a MTU property
Add a new ip-tunnel.mtu property which can be used to change the MTU
of the tunnel interface.
2015-12-19 12:06:33 +01:00
Lubomir Rintel
d830841d63 manager: return values for a non-void function
Fixes: d8e1590c50
2015-12-18 12:10:02 +01:00
Lubomir Rintel
d8e1590c50 manager: retry device creation for connection that would use a newly created device
The VLANs (unrealized) can depend on the devices that are not around yet. We
need to retry their creation when the potential parents appear.
2015-12-18 11:32:34 +01:00
Thomas Haller
793e985918 rdisc: fix regression in send_rs() (cannot create router solicitation)
Fixes: 21efcfe6b5
2015-12-17 21:26:54 +01:00
Thomas Haller
c40acf334e core: optimize NMMultiIndex by special caseing ids with one value only
When adding a very first item for a certain id, don't yet create a
hash table but store the first item inplace. This optimizes storage
for the case where we have only one item for a certain id.
2015-12-17 18:42:54 +01:00
Thomas Haller
ad1d74d142 platform: add index for links by ifname
Downsides:

  - Add some additional overhead to manage the index

  - The NMPCacheId struct grows to 16 bytes, affecting
    hashing performance for all object types.

Still do it, based on the assumption that it doesn't matter
for a low number of interfaces. But the O(1) access time matters
when having lots of interfaces.
2015-12-17 18:42:53 +01:00
Thomas Haller
88213b2e6a platform: tighten return value from do_add_addrroute()
Only return TRUE, if the netlink request was responded with success and
the object exists after adding.
2015-12-17 18:42:53 +01:00
Thomas Haller
1a501c6456 platform: check for existing link in do_add_link_with_lookup()
When adding a link, that can only make sense if no such link
exists yet. Check for that condition first, to properly return
an error.
2015-12-17 18:42:53 +01:00
Thomas Haller
cea8f1a0f0 platform: change meaning of return value for delete-function
When deleting an object, we allow failure to delete a non-existing object.
Thus, the only thing we care about is whether the object is no longer
present after deletion. Adjust the return values to reflect that.
2015-12-17 18:42:53 +01:00
Thomas Haller
690732cfed platform: drop delayed_action idle handler
The idea was allowing pending delayed-actions and process them in an
idle handler. We dont want to do that, because whenever platform code
returns, we want to have no pending actions -- because otherwise the
platform cache might be in an inconsistent state.

Just drop it.
2015-12-17 18:42:51 +01:00
Thomas Haller
a29f438294 platform/trivial: rename internal field with netlink socket 2015-12-17 18:42:01 +01:00
Thomas Haller
412a50bd30 platform: inline event_handler_read_netlink() 2015-12-17 18:42:01 +01:00
Thomas Haller
d7782b9769 platform: drop synchronous netlink socket 2015-12-17 18:42:01 +01:00
Thomas Haller
c73b9f6529 platform: change links via event netlink socket 2015-12-17 18:42:01 +01:00