Commit graph

649 commits

Author SHA1 Message Date
Thomas Haller
e96af59444 device: add flags argument to check_connection_available() 2015-02-24 11:49:03 +01:00
Thomas Haller
5a04273715 device: merge check_connection_available_wifi_hidden() into check_connection_available()
Only refactoring, no behavioral change.
2015-02-24 11:49:03 +01:00
Thomas Haller
364c4476e3 device: refactor nm_device_connection_is_available()
No functional change, but refactor the function to
return early.
2015-02-24 11:49:03 +01:00
Thomas Haller
a7e0a038bf device/trivial: rename argument in nm_device_connection_is_available()
The argument name should express what the caller wants
(he wants to know, whether the connection can be activated
for an internal or external activation request).

Whether that involves checking device-specific overrides, is
not the point -- nm_device_check_connection_compatible() is
also a virtual function with device-specific overrides.
2015-02-24 11:49:03 +01:00
Thomas Haller
b9da094da9 device: fix leaking queued NMActiveConnection
The queued activation request must transition state to
DEACTIVATED, otherwise it is not removed from the list
of active_connections in NMManager.
2015-02-24 11:47:35 +01:00
Thomas Haller
dba5e8e731 device: don't remove and re-add pending action in nm_device_bring_up() 2015-02-24 11:35:22 +01:00
Thomas Haller
3cb5d20c34 device: don't add dummy value to @available_connections hash
GHashTable is optimized for usage of a set, where the key equals
the value. Don't add a dummy value.
2015-02-24 11:35:22 +01:00
Thomas Haller
5c2e1afd1b core: support "except:" spec to negate match
Extend nm_match_spec_*() to support an "except:" prefix to negate
the result of a match. "except:" only works when followed by
an exact match type, for example "except:interface-name:vboxnet0",
but not "except:vboxnet0".

A matching "except:" spec always wins, regardless of other positive
matchings.
2015-02-24 10:35:24 +01:00
Thomas Haller
2051944333 core: remove nm_match_spec_string()
It was only used to match against "*", in a case-insensitive
way.
2015-02-24 10:35:24 +01:00
Thomas Haller
a82d94a64e device: refactor dispose/cleanup of NMDevice to free members in finalize
NMTestDevice does not invoke dispose(), hence it leaks memory which causes
false warnings in testing.
Some minor refactring to let dispose() clear the fields, but free it
later in finalize(). This avoids memleaks in the NMTestDevice stub.
2015-02-09 11:51:07 +01:00
Thomas Haller
ddac52a61e device: schedule queued_ip_config_change() after constructing device
During queued_ip_config_change(), we eventually call update_ip_config()
and ip4_config_merge_and_apply(). These functions read the IP configuration
from platform and setup the private ip4_config instance.

Trigger this initialization after constructing the device to setup
the IP configuration.

Before, for unmanaged devices we would not call ip4_config_merge_and_apply()
until the first platform change event.

Note that in the worst case we do some unnecessary work due to this,
because queued_ip_config_change() must already be robust to be called
at any time.
2015-01-26 17:56:03 +01:00
Lubomir Rintel
24e7ea7860 core: Use tokenized identifiers when constructing an address
We trigger a new solicitation upon seeing the new token. Kernel triggers one
too, but that one is of no use to us, since the advertisement might arrive sooner
than we learn about the token change.
2015-01-26 13:05:06 +01:00
Thomas Haller
da708059da device: always pickup externally configured default routes for a device
Even more eagerly pickup external default routes from the device.
For assumed devices we already picked up the default route.

(a) For assumed devices we already did not enforce the default route at all.
Instead it was always picked up by from the actualy system
configuration. Note that this is the case for assumed-generated
connections and for assuming existing connections.
That means that when NM assumes a connection at startup, it will never
actively manage the default route on that interface. It will only react
on what is present.

(b) For managed devices that have by configuration no default route, still pick up
the default route. That means, that even a device that is managed and
never-default=yes, can have the default route -- if configured externally.

(c) Only during a commit phase (i.e. when we have new configuraiton to be
applied), we enforce the default route or its absence.

(d) During any IP change event from platform, we again pickup whatever
is present. That means if you remove the default route from a managed
interface, NM will not re-add it until anything triggers (c).

This also means, that during the commit phase, we add default routes as
'synced' to the default-route-manager, but the following event from platform,
will change the route entry immediately to 'non-synced'. That is
expected and correct.
2015-01-24 18:27:12 +01:00
Thomas Haller
557667df12 device: better accept external IP changes
When receiving IP changes via platform event, remove all missing
addresses and routes from our internal configurations (such as
wwan, vpn, dhcp).

The effect is that on the next commit, those addresses and routes will
not be re-added as they were explicitly removed by the user.

However on a new DHCP lease or similar events, the addresses will
be added anew.

Another important improvement is that the NMIPxConfig of the active
device reflects when addresses or routes get removed externally. Before
we would continue to expose those entires although they were not
actually configured on the device.

https://bugzilla.gnome.org/show_bug.cgi?id=740443
2015-01-24 18:27:12 +01:00
Thomas Haller
2c06449085 device: require a direct route for IPv6 gateway
In the IPv4 case, we check whether we have a direct route to the gateway
also by looking at the configured addresses/subnets. That is correct,
because every IPv4 address also implies a subnet route.

For IPv6, we explicitly add all subnet routes manually (noprefixroute),
hence, we have a direct route exactly if we have it in our list.
Regardless of the configured IPv6 prefixes.
2015-01-24 18:27:12 +01:00
Thomas Haller
4a83afd530 device: refactor ipx_config_merge_and_apply()
No functional change, but restructure code to make it clearer(?).
2015-01-24 18:27:12 +01:00
Thomas Haller
8dce71be74 device: adjust default route metric for BRIDGE device type
We forgot to include the BRIDGE, so that bridge
devices got a default priority (route-metric) of 950
Add it between VLAN and MODEM type.

Also return a different metric for UNKNOWN
device types, but these priorities are not
actually expected.
2015-01-22 18:56:37 +01:00
Aleksander Morgado
f3efdbcdf2 device: new deactivate_async() method to be run during DEACTIVATING phase
This method isn't run if NM is quitting; so the deactivate() method still needs
to be implemented to handle sync disconnection requests.
2015-01-21 17:58:50 -06:00
Thomas Haller
32625f604b core: use nm_utils_modprobe()
https://bugzilla.gnome.org/show_bug.cgi?id=740651
2015-01-19 12:07:27 -06:00
Dan Winship
fb792af7cb core: add nm_utils_setpgid(), and use it
Add nm_utils_setpgid() as a g_spawn*() child setup function for
calling setpgid(), and use it where appropriate rather than
reimplementing it every time.
2015-01-19 11:29:13 -05:00
Dan Winship
c22e3f327a core, dispatcher: drop unnecessary setpgid() calls
There's no point in calling setpgid() on short-lived processes, so
remove the setpgid() calls when spawning dispatcher scripts, iptables,
iscsiadmin, and netconf.
2015-01-19 11:29:13 -05:00
Dan Winship
c5b3e93792 core: use GUnixSignalWatchSource to simplify signal handling
Replace the pthread_sigwait()-based signal handling with
g_unix_signal_add()-based handling, and get rid of all the
now-unnecessary calls to nm_unblock_posix_signals() when spawning
subprocesses.

As a bonus, this also fixes the "^C in gdb kills NM too" bug.
2015-01-19 11:29:13 -05:00
Dan Williams
984b0763d9 core: force disable_ipv6=0 when turning on userspace IPv6LL (bgo #741773)
If a device assumes a connection without activating a user-requested or
NM-requested connection, then disable_ipv6 is not touched.  When the device
is deactivated, it still isn't touched even though userspace IPv6LL
is enabled.  This could lead to an user-requested activation with
IPv6 configuration, but disable_ipv6=1.

Whenever userspace IPv6LL is turned on, we should also set disable_ipv6=0
to ensure IPv6 can function.  Userspace IPv6LL will ensure that the
interface does not have an address until the user/connection requests
it, which was the only reason that NM touched disable_ipv6 anyway.

fixes:NetworkManager_Test203_testcase_286589
fixes:NetworkManager_Test204_testcase_286590

https://bugzilla.gnome.org/show_bug.cgi?id=741773
2015-01-09 13:56:40 -06:00
Dan Williams
711a05965b core: fix re-activation of connections on EXTERNAL_DOWN interfaces (bgo #741742)
When userspace IPv6LL capability is compiled into NetworkManager,
during deactivation NM will toggle userspace IPv6LL in some cases.
This causes link change events in the platform, which show up
in nm-device.c::device_link_changed().

When an EXTERNAL_DOWN interface was activated, the EXTERNAL_DOWN
flag was never cleared even if the device was set IFF_UP or if
a connection was activated via D-Bus (which explicitly sets the
device up).

Second, the device_link_changed() code changed device state
whether or not IFF_UP had actually changed, it simply looked at
the current value.

Together, this caused the first activation of an EXTERNAL_DOWN
device to succeed, but the EXTERNAL_DOWN flag was never cleared
even though the activation set the device IFF_UP.  When a second
activation request came in, the device was moved to DISCONNECTED
state and IPv6LL genmode was reset, causing device_link_changed()
to run.  Since the device had EXTERNAL_DOWN and IFF_UP were still
set, nm_device_set_unmanaged_flag() code was triggered to clear
EXTERNAL_DOWN, which resulted in a state transition to UNAVAILABLE
with a reason of CONNECTION_ASSUMED.  This caused the second
activation request to fail because UNAVAILABLE devices cannot
activate connections by definition.

The fix has three parts:

1) Only change EXTERNAL_DOWN if IFF_UP actually changes, to prevent
spurious changes when something other than IFF_UP changes

2) Only clear EXTERNAL_DOWN when IFF_UP changes while the device
is UNMANAGED, since any state higher than UNMANAGED implies that
either an activation request was received (and thus the device
should be managed) or IFF_UP was set

3) Clear EXTERNAL_DOWN (without triggering state changes) when
any state higher than UNAVAILABLE is entered, since this implies
that a connection is activating or the device is no longer
IFF_UP

fixes:NetworkManager_Test108_testcase_303655

https://bugzilla.gnome.org/show_bug.cgi?id=741742
2014-12-19 11:04:46 -06:00
Thomas Haller
3ea9169c81 device: fix assertion in nm_device_slave_notify_release() logging the master device
#0  0x00007f6c3aed34e9 in g_logv (log_domain=0x7f6c3ea7341c "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff0a33fb60) at gmessages.c:989
    #1  0x00007f6c3aed363f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
    #2  0x00007f6c3e8ead4f in nm_device_get_iface (self=0x0) at devices/nm-device.c:502
    #3  0x00007f6c3e904f59 in nm_device_slave_notify_release (self=0x7f6c3fb48e60, reason=NM_DEVICE_STATE_REASON_REMOVED) at devices/nm-device.c:1618
    #4  0x00007f6c3e8ed69f in nm_device_release_one_slave (self=0x7f6c3fb22670, slave=0x7f6c3fb48e60, configure=1, reason=NM_DEVICE_STATE_REASON_REMOVED) at devices/nm-device.c:968
    #5  0x00007f6c3e904bf7 in slave_state_changed (slave=0x7f6c3fb48e60, slave_new_state=NM_DEVICE_STATE_UNMANAGED, slave_old_state=NM_DEVICE_STATE_ACTIVATED, reason=NM_DEVICE_STATE_REASON_REMOVED, self=0x7f6c3fb22670)
        at devices/nm-device.c:1368
    #6  0x00007f6c39829d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #7  0x00007f6c398296bc in ffi_call (cif=cif@entry=0x7fff0a340070, fn=0x7f6c3e9049d0 <slave_state_changed>, rvalue=0x7fff0a33ffe0, avalue=avalue@entry=0x7fff0a33ff60) at ../src/x86/ffi64.c:522
    #8  0x00007f6c3b1bfad8 in g_cclosure_marshal_generic (closure=0x7f6c3fb5c8c0, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at gclosure.c:1454
    #9  0x00007f6c3b1bf298 in g_closure_invoke (closure=0x7f6c3fb5c8c0, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7fff0a340270, invocation_hint=invocation_hint@entry=0x7fff0a340210)
        at gclosure.c:777
    #10 0x00007f6c3b1d135d in signal_emit_unlocked_R (node=node@entry=0x7f6c3faf5d10, detail=detail@entry=0, instance=instance@entry=0x7f6c3fb48e60, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff0a340270) at gsignal.c:3586
    #11 0x00007f6c3b1d90f2 in g_signal_emit_valist (instance=instance@entry=0x7f6c3fb48e60, signal_id=signal_id@entry=64, detail=detail@entry=0, var_args=var_args@entry=0x7fff0a3404a8) at gsignal.c:3330
    #12 0x00007f6c3b1d98f8 in g_signal_emit_by_name (instance=0x7f6c3fb48e60, detailed_signal=0x7f6c3ea70f83 "state-changed") at gsignal.c:3426
    #13 0x00007f6c3e8f894f in _set_state_full (self=0x7f6c3fb48e60, state=NM_DEVICE_STATE_UNMANAGED, reason=NM_DEVICE_STATE_REASON_REMOVED, quitting=0) at devices/nm-device.c:7486
    #14 0x00007f6c3e8f0706 in nm_device_state_changed (self=0x7f6c3fb48e60, state=NM_DEVICE_STATE_UNMANAGED, reason=NM_DEVICE_STATE_REASON_REMOVED) at devices/nm-device.c:7623
    #15 0x00007f6c3e8f808b in nm_device_set_unmanaged (self=0x7f6c3fb48e60, flag=NM_UNMANAGED_INTERNAL, unmanaged=1, reason=NM_DEVICE_STATE_REASON_REMOVED) at devices/nm-device.c:6652
    #16 0x00007f6c3e9943d0 in remove_device (manager=0x7f6c3fb20150, device=0x7f6c3fb48e60, quitting=0, allow_unmanage=1) at nm-manager.c:752
    #17 0x00007f6c3e995c29 in platform_link_cb (platform=0x7f6c3fa7a870, ifindex=73, plink=0x7fff0a341260, change_type=NM_PLATFORM_SIGNAL_REMOVED, reason=NM_PLATFORM_REASON_EXTERNAL, user_data=0x7f6c3fb20150) at nm-manager.c:2182
    #18 0x00007f6c39829d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #19 0x00007f6c398296bc in ffi_call (cif=cif@entry=0x7fff0a340bc0, fn=0x7f6c3e995b60 <platform_link_cb>, rvalue=0x7fff0a340b30, avalue=avalue@entry=0x7fff0a340ab0) at ../src/x86/ffi64.c:522
    #20 0x00007f6c3b1bfad8 in g_cclosure_marshal_generic (closure=0x7f6c3fb14cf0, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at gclosure.c:1454
    #21 0x00007f6c3b1bf298 in g_closure_invoke (closure=0x7f6c3fb14cf0, return_value=return_value@entry=0x0, n_param_values=5, param_values=param_values@entry=0x7fff0a340dc0, invocation_hint=invocation_hint@entry=0x7fff0a340d60)
        at gclosure.c:777
    #22 0x00007f6c3b1d135d in signal_emit_unlocked_R (node=node@entry=0x7f6c3fa76f00, detail=detail@entry=0, instance=instance@entry=0x7f6c3fa7a870, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff0a340dc0) at gsignal.c:3586
    #23 0x00007f6c3b1d90f2 in g_signal_emit_valist (instance=instance@entry=0x7f6c3fa7a870, signal_id=signal_id@entry=2, detail=detail@entry=0, var_args=var_args@entry=0x7fff0a341018) at gsignal.c:3330
    #24 0x00007f6c3b1d98f8 in g_signal_emit_by_name (instance=0x7f6c3fa7a870, detailed_signal=0x7f6c3ea5f1fa "link-changed") at gsignal.c:3426
    #25 0x00007f6c3e92412a in announce_object (platform=0x7f6c3fa7a870, object=0x7f6c3fbb6fd0, change_type=NM_PLATFORM_SIGNAL_REMOVED, reason=NM_PLATFORM_REASON_EXTERNAL) at platform/nm-linux-platform.c:1625
    #26 0x00007f6c3e92b0f9 in event_notification (msg=0x7f6c3fa946f0, user_data=0x7f6c3fa7a870) at platform/nm-linux-platform.c:1986
    #27 0x00007f6c3c35812f in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:141
    #28 recvmsgs (cb=0x7f6c3fa7a620, sk=0x7f6c3fa7a710) at nl.c:952
    #29 nl_recvmsgs_report (sk=0x7f6c3fa7a710, cb=0x7f6c3fa7a620) at nl.c:1003
    #30 0x00007f6c3c3584f9 in nl_recvmsgs (sk=<optimized out>, cb=<optimized out>) at nl.c:1027
    #31 0x00007f6c3e929dca in event_handler (channel=0x7f6c3fa78810, io_condition=G_IO_IN, user_data=0x7f6c3fa7a870) at platform/nm-linux-platform.c:4127
    #32 0x00007f6c3aecc2a6 in g_main_dispatch (context=0x7f6c3fa68490) at gmain.c:3066
    #33 g_main_context_dispatch (context=context@entry=0x7f6c3fa68490) at gmain.c:3642
    #34 0x00007f6c3aecc628 in g_main_context_iterate (context=0x7f6c3fa68490, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
    #35 0x00007f6c3aecca3a in g_main_loop_run (loop=0x7f6c3fa68550) at gmain.c:3907
    #36 0x00007f6c3e8e9fff in main (argc=1, argv=0x7fff0a341c88) at main.c:483

https://bugzilla.gnome.org/show_bug.cgi?id=741651
2014-12-18 17:36:57 +01:00
Dan Williams
5f47182534 core: fix setting initial EXTERNAL_DOWN unmanaged flag (bgo #725647) (rh #1030947) (bgo #740702)
Broken by 5fb20d8038.
2014-12-18 10:26:46 -06:00
Dan Williams
894ca75f3a trivial: add some debug messages on device destruction/removal 2014-12-18 10:23:06 -06:00
Dan Williams
27c1a73ae0 core: don't bounce disable_ipv6 if NM IPv6LL wasn't enabled (bgo #740702)
If NM IPv6LL wasn't enabled then there is no need to bounce disable_ipv6
to tell the kernel to re-enable kernel IPv6LL, because kernel IPv6LL
is already enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=740702
2014-12-17 11:34:55 -06:00
Dan Williams
b86c511db5 core: don't bring up devices using assumed connections (bgo #725647) (rh #1030947)
We want to export the IP configuration of interfaces when they have some, but
the kernel doesn't care if they are IFF_UP or not.  Neither should NetworkManager,
so don't force devices IFF_UP just because we're assuming their IP config.
2014-12-16 16:07:50 -06:00
Dan Williams
5fb20d8038 core: don't manage externally created software devices until IFF_UP (rh #1030947) (bgo #725647)
Externally created software devices would be managed/assumed immediately
upon creation, which includes setting them IFF_UP and possibly turning
on NM-managed IPv6LL.

With this commit, expected behavior for external software devices is:

1) created: unmanaged state, no further action
2) IP address added but !IFF_UP: connection assumed, but device is not set IFF_UP
3) slave attached but !IFF_UP: connection assumed, but master is not set IFF_UP
3) set IFF_UP: connection assumed (if any), if not -> DISCONNECTED

This branch ensures that external software devices are not set IFF_UP
by NetworkManager when they are discovered.  It additionally ensures that
they are not set IFF_UP during connection assumption.  They may be set
IFF_UP later through specific user action.

https://bugzilla.gnome.org/show_bug.cgi?id=725647
https://bugzilla.redhat.com/show_bug.cgi?id=1030947
2014-12-16 16:07:49 -06:00
Jiří Klimeš
4da19b8981 device: mute coverity CHECKED_RETURN (CWE-252)
Error: CHECKED_RETURN (CWE-252): [#def20]
NetworkManager-0.9.11.0/src/devices/nm-device.c:5037: check_return: Calling "g_spawn_async" without checking return value (as is done elsewhere 12 out of 13 times).
2014-12-15 14:11:03 +01:00
Dan Williams
1172178ce6 core: better handle DHCP expiry/nak during initial lease acquisition (bgo #739482)
When dhclient trieds to request a previous lease and the server NAKs that
lease, dhclient emits the EXPIRE state.  dhcpcd has also been known to emit
the 'nak' state for the same reason.

(systemd's DHCP client code does not push a NAK up to NetworkManager, but
jumps to the REBOOT state instead, so it is unaffected by this issue.)

NetworkManager saw the expire during IP configuration and treated that as
full activation failure.  The connection would be restarted, the same lease
requested, and the same NAK delivered, over and over.  Before a lease is
acquired, there is (by definition) no lease to expire, so these events
should be ignored.

We do, however, still want to handle abnormal failures, which is why
this patch splits the EXPIRE case from the FAIL case and handles them
separately.

https://bugzilla.gnome.org/show_bug.cgi?id=739482
2014-12-12 11:00:00 -06:00
Dan Williams
9337a13a87 core: fix attaching managed slaves to master devices (rh #1141266)
Broken by 25387cd1ff

When an activation request comes in via D-Bus for a slave, the
slave device's priv->master is set in stage1 in master_ready_cb().
Then nm_device_bring_up() is called on the slave, which triggers
link_changed_cb() and device_link_changed().  That then executes
this code:

if (priv->master)
	nm_device_enslave_slave (priv->master, self, NULL);

which enslaves the slave, but due to the NULL will not configure
the slave.

This code was only meant to be run for externally triggered
master/slave changes.
2014-12-11 17:56:04 -06:00
Dan Williams
7d5c0db53a core: fix warning when releasing slaves on exit (rh #1169936)
NetworkManager[30304]: <info>  (virbr0): bridge port virbr0-nic was detached
NetworkManager[30304]: (devices/nm-device.c:962):nm_device_release_one_slave: runtime check failed: (reason == NM_DEVICE_STATE_REASON_NONE)
NetworkManager[30304]: <info>  (virbr0-nic): released from master virbr0

If the slave is removed, then the master is already cleaned up so NM
doesn't need to do anything.  5dd48f fixed that but forgot to update
the !configure case, causing the warning but no other problems.

Fixes: 5dd48f7527
2014-12-11 16:22:32 -06:00
Dan Williams
a1f4794c86 core: clean up half-done IP operations when re-entering NEED_AUTH state (bgo #741342)
When the device decides it needs re-auth during IP config and returns
to the NEED_AUTH state, make sure we clean up any half-done IP operations
since they will be re-started after auth is completed and the
IP_CONFIG state is re-entered.

https://bugzilla.gnome.org/show_bug.cgi?id=741342
2014-12-11 09:24:48 -06:00
Lubomir Rintel
62ad694421 device: assume connections for device with slaves
If a bridge/team/bond has slaves, assume it's connected. Recheck as devices
appear.

https://bugzilla.redhat.com/show_bug.cgi?id=1141266
2014-12-11 11:49:29 +01:00
Lubomir Rintel
25387cd1ff device: set the master on device addition
Otherwise we won't notice the device is a slave on NM startup until someone
changes the link or tries to activate the device.
2014-12-11 11:49:29 +01:00
Lubomir Rintel
81553b6978 device: release and enslave an interface if its master changed
In case of an atomic master change, we'd not notice that the master changed:

  ip link set dummy0 master bridge0
  ip link set dummy0 master bridge1
2014-12-11 11:49:29 +01:00
Lubomir Rintel
4b3ad7709d device: don't fail activation when IP config is unavailable and unneeded
If we didn't start IPv4 and IPv6, but they're allowed to fail, progress
the activation without failing it. Also, progress assumed connections to
check-ip with whatever configuration that is available.

https://bugzilla.redhat.com/show_bug.cgi?id=1141264
2014-12-11 11:46:43 +01:00
Lubomir Rintel
55af4add90 device: don't disconnect assumed connections
Transition them to activated status when they fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1141264
2014-12-11 11:46:43 +01:00
Lubomir Rintel
063ab8da5c device: turn nm_d_ip_config_should_fail to get_ip_config_may_fail
Has a cleaner semantics and will be useful later on. Also, make it static --
it's not used outside nm-device.c.
2014-12-11 11:46:42 +01:00
Jiří Klimeš
9a6e1e86cc core: don't bounce disable_ipv6 when assuming connections (rh #1170530)
Don't call set_nm_ipv6ll(self, TRUE) on any assumed connection since it
would bounce disable_ipv6, which would break IPv6 connectivity.
That is critical, for example, for installations via NFS.

Fixes: d37b7bed30

https://bugzilla.redhat.com/show_bug.cgi?id=1170530
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1052157
2014-12-04 15:50:36 +01:00
Dan Winship
5dd48f7527 devices: don't release slaves on exit (rh #1169936)
nm_device_removed() calls nm_device_release_one_slave() in order to
fix up NetworkManager's master/slave bookkeeping, but we don't want to
tell the kernel to actually unslave the device, since that would
happen automatically anyway if the device was really removed, and
shouldn't happen if the device is just being removed from NM's device
list.

(In particular, don't remove all libvirt-created virtual network
devices from virbr0 when NetworkManager exits.)
2014-12-03 13:19:48 -05:00
Thomas Haller
711c0eab5b iface-helper: disambiguate route priority for IPv4 and IPv6
https://bugzilla.gnome.org/show_bug.cgi?id=740780
2014-12-01 16:58:31 +01:00
Thomas Haller
ae2b8d6353 core: rename NM_PLATFORM_ROUTE_METRIC_DEFAULT to NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6
For IPv4, iproute for example defaults to a metric of 0.
Hence, the name NM_PLATFORM_ROUTE_METRIC_DEFAULT was misleading.

Also add a NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP4 define for completeness.

https://bugzilla.gnome.org/show_bug.cgi?id=740780
2014-12-01 16:38:05 +01:00
Thomas Haller
4bf04700bb core: adjust values for default route-metrics per device type
We recently changed default values for route metrics. Revise that
again and increase the space between the default values.

No strong reason to do this, but it seems better to have larger
gaps and make use of the available range.
2014-11-26 20:39:18 +01:00
Thomas Haller
34124296c0 core: fix route metrics for subnet routes
For IPv4 addresses, the kernel automatically adds a route when
configuring an IP address. Unfortunately, there is no way to control
this behavior or to set the route metric.

Fix this, by adding our own route and removing the kernel provided
one.

Note that this adds a major change in that we no longer call
nm_ip4_config_commit() for assumed devices.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 22:30:38 +01:00
Thomas Haller
13d9b28323 dhcp: pass device specific route metric to nm_dhcp_systemd_get_lease_ip_configs()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 10:52:56 -05:00
Lubomir Rintel
c83b40aca7 device: Remove unmanaged slaves from master when they disappear
We've previously been just watching for state changes into UNMANAGED state. No
state change is emitted upon removal of a device which is already unmanaged.

https://bugzilla.gnome.org/show_bug.cgi?id=737659
2014-11-20 14:43:17 +01:00
Thomas Haller
308a5e7953 policy: fix handling managed devices without default route
Before, we would only track a device in NMDefaultRouteManager
if it had a default route. Otherwise the entry for the device
was removed.

That was wrong, because having no entry meant that the interface
is assumed and hence we would not touch the interface. Instead we must
esplicitly track devices without default route to know when an interface
has no default route.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-19 22:55:33 +01:00