Commit graph

379 commits

Author SHA1 Message Date
Dan Winship
0a30843caa core: don't try to create VLANs on devices that don't support them
VLANs are only supported on certain kinds of devices, so don't try to
create them on other devices. (In fact, NM currently assumes that
VLANs are only created on Ethernet devices, so we need to be even more
picky than that.)
2012-09-27 13:57:47 -04:00
Pavel Šimerda
3ada5b5a6a distro: remove nm_backend_ipv6_use_tempaddr()
This function was *not* distribution specific and was used only in one place.
2012-09-25 16:44:12 -05:00
Pavel Šimerda
110888c782 device: remove useless ipv6 route addition
Link-local multicast routes are handled by kernel. Just try pinging
ff02::1%eth0 on a clean system without IP configuration.
2012-09-25 15:03:32 -05:00
Jiří Klimeš
07fc3dcb90 api: add NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED reason and use that 2012-09-24 10:38:26 +02:00
Jiří Klimeš
ece5e209cd core: VPN autoconnect feature (bgo #560471) (rh #483120)
We go through the SECONDARIES state where we check if there are some secondary
(VPN or other) UUIDs that are to be activated before progressing to ACTIVATED.
In case of an error with a secondary UUID or its activation, the base connection
can't activate successfully.
2012-09-24 10:38:26 +02:00
Dan Williams
29fe6ec830 wifi: add SSID_NOT_FOUND reason and use it when we can
When the supplicant starts connecting, or gets disconnected, track
whether it ever starts talking to an AP.  Then if the connection fails
as a result of an initial connection timeout or a link timeout, we
can use SSID_NOT_FOUND when we're reasonably sure the AP doesn't
exist.  Clients can use this to show better error messages.

Note that SSID_NOT_FOUND may only be reported when using nl80211
drivers, as WEXT drivers don't provide the status necessary to
determine whether the network exists or not.
2012-09-20 10:11:36 -05:00
Dan Williams
1966aba8e9 core: determine whether connection timestamps are set or not
Currently there's no way to differentiate between a connection that has
never been activated, and a connection that has never been *successfully*
activated.  In both cases nm_settings_connection_get_timestamp() returns
zero.  But it's useful to know whether a connection hasn't even been
tried yet, so enhance the timestamp code to return whether or not the
timestamp has been found in the timestamp cache or not, and make the
NMDevice core set an explict timestamp of 0 if the connection failed
on the first attempt.

We'll use this later to conditionally autoconnect WiFi connections
depending on whether they've ever successfully connected or not, but
still allow preloaded connections without a timestamp to autoconnect
as they always have.
2012-09-20 10:11:36 -05:00
Dan Williams
15ca7cd56c core: add dispatcher callbacks and simplify dispatcher function prototypes
Remove unused args for the non-VPN cases to cut down on the NULL NULL NULL
stuff since we're also adding two more arguments.  Add the ability for
callers to give a callback that should be called when the dispatcher is
done.
2012-09-11 17:06:16 -05:00
Dan Williams
cf255aa83b core: split dispatcher into its own file 2012-09-11 17:06:16 -05:00
Jiří Klimeš
ddc3f727d0 core: fix a regression causing that driver and firmware versions are not set
Regression caused by 6ba93343e6
2012-09-03 16:18:54 +02:00
Dan Williams
2318b3c525 wired: ensure carrier changes clear queued state where appropriate
Buggy kernel drivers sometimes default the carrier to ON when they
are capable of link-detection but the carrier is actually off, and
they quickly switch the carrier OFF when they determine actual
carrier state (cdc-ether, for example).

The initial carrier ON event would trigger a queued state change
from UNAVAILABLE to DISCONNECTED, which may auto-activate the
device.  But before that state change happens, if a carrier OFF
event comes in, that queued state was not getting cleared and
the device would transition to DISCONNECTED even though the
carrier was off.

To ensure that never happens, and that we don't enter states that
aren't valid when the carrier is off, we need to clear any queued
state changes that wouldn't be valid in the new carrier state.
2012-08-30 16:04:13 -05:00
Dan Williams
e6061a1e96 api: add a "ModemManager unavailable" device state reason
To be used when MM quits unexpectedly, or isn't running and the
device needs MM.
2012-08-29 17:39:33 -05:00
Dan Williams
6ba93343e6 core: fix possible uninitialized memory usage 2012-08-24 12:06:22 -05:00
Jiří Klimeš
b39804ae6b trivial: use dashes in "br2684-bridge-failed" to match other reason strings 2012-08-22 13:40:46 +02:00
Nathanael D. Noblet
808136ac02 core: add AvailableConnections property for NMDevice objects
Implements a new property that provides a list of currently
available connections a device could connect to. For example
if a connection for a particular wireless connection exists and
that wireless network appears in the scan list it would show in the
AvailableConnections property of the device.

(dcbw: found a slightly cleaner way to do this; it's a lot like the
check_connection_compatible class method, except it deals with
live network data too.  So convert the subclass methods to
just check additional live network data, and have the base
device class handle adding the connection to the hash and all
the associated signalling.  Also fix a bug where the available
connections were not updated when a device moved from UNAVAILABLE
to available, its available connections were not updated)
2012-08-15 16:50:49 -05:00
Dan Williams
346a1dc957 core: suppress a warning when a connection is assumed
When NM takes over a device's existing connection, it'll jump right
from "unavailable" to "ip-config" states, thus leading to the
warning.
2012-07-24 12:12:18 -05:00
Pavel Šimerda
a1659adec0 ip4: fix connection assumption 2012-07-24 10:17:47 -05:00
Dan Williams
c2e25dfedc core: move failure logging to device superclass 2012-06-28 16:34:08 -05:00
Pavel Šimerda
e88aa72e6a ip6: rename defgw to gateway
This was suggested by Dan Winship but it didn't get to commit
8a059b1 by mistake.
2012-06-26 23:50:19 -05:00
Dan Williams
5003153297 core: move DNS change handling to the policy and optimize DNS updates (bgo #676778)
Consolidate all the DNS handling in the policy instead of sprinkling
it around in the device and vpn code.  This allows us to batch the
updates and thus reduce the number of times resolv.conf needs to
be written.  It's also easier to follow when and why the changes
occur.
2012-06-12 10:00:03 -05:00
Dan Williams
e48c681bb0 core: add device IPv4 and IPv6 config change signals
We'll use these later to pull the DNS manager code out of the device
class and into the policy.
2012-06-12 10:00:03 -05:00
Jiří Klimeš
af0eb9e7ad core: don't default to IPv6 temp addr while completing connection (bgo #633233)
Enabling NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR in
nm_device_complete_connection() made IPv6 temp address enabled for connections
created via AddAndActivateConnection() D-Bus call. But it is disabled for other
connections. That is not much consistent. So, do not enable IPv6 privacy when
completing connections and leave it up to users, who would like to use IPv6
Privacy Extensions, to enable it manually.
2012-06-11 09:32:49 +02:00
Jiří Klimeš
25592950e9 core: add driver-version, firmware-version properties to NMDevice (bgo #636124)
The info is extracted via SIOCETHTOOL ioctl() syscall using ETHTOOL_GDRVINFO.
This works for most drivers but not all, e.g. for modems. We may figure out how
to get the info for specific devices, and enhance the solution by implementing
specific functions for particular device types later.
2012-06-08 08:55:15 +02:00
Dan Williams
4692c00be2 core: re-implement device disconnect using generic auth request signal 2012-06-01 17:05:00 -05:00
Dan Williams
0ab9c25646 core: add generic device authorization request signal
Allows devices to generically request authorization from the manager
for whatever operation they want, and allows us to keep the devices
from including the auth code directly.
2012-06-01 17:05:00 -05:00
Pavel Šimerda
70f64fbc42 ip6: don't 'assume' IPv6 connections (bgo #676740)
The bug report describes a testing scenario where device is down
and no IPv4 or IPv6 addresses are set up. Then NetworkManager
is started and it decides not to configure DHCPv6 address. This
is caused by code copied from IPv4 that does not work here at
all (and I wonder if it does in IPv4).

In any case, when NetworkManager starts a DHCP client and recieves
an IPv6 address (no addresses are configured at the time), it
*must* send this new IPv6 address to the kernel.

(dcbw)
We should fix the connection takeover code for IPv6 but it's not
a quick fix so in the mean time disable the buggy code and we'll
fix IPv6 takeover cleanly soon.
2012-05-31 15:37:49 -05:00
Pavel Šimerda
8a059b1496 ip6: add default gateway to NMIP6Config (bgo #676317)
Bug #676317 describes the following error:

  NetworkManager[30151]: <error> [1337348764.559121] [nm-system.c:1121]
  nm_system_replace_default_ip6_route(): (eth1): failed to set IPv6 default
  route: -7

The above error is caused by NetworkManager assuming default gateways
belong to addresses but failing to setup default gateways for addresses
learned through DHCPv6.

This commit doesn't fix the fundamental issue but can be viewed as an ugly
workaround that gets IPv6 connection up and running. It doesn't fix
the fundamental flaw of binding gateways to IP addresses. They are
configured separately in IPv6 and NM should use lifetimes and allow
default gateway reconfiguration.
2012-05-31 15:37:49 -05:00
Jiří Klimeš
1e49a9e0cc core: initialize 'autoconnect' member variable in nm_device_init() 2012-05-23 13:09:22 +02:00
Jiří Klimeš
6d9338f2c6 core: add "Autoconnect" property to NMDevice
It is bound to autoconnect_inhibit private variable (has opposite meaning).
While 'Autoconnect' is TRUE (default value) the device can automatically
activate a connection. If it is changed to FALSE, the device will not
auto-activate until 'Autoconnect' is TRUE again.
Disconnect() method sets 'Autoconnect' to FALSE. NMPolicy monitors the property
and schedules auto activation when FALSE->TRUE transition is made.
2012-05-22 17:11:44 +02:00
Jiří Klimeš
78dda3b093 core: unblock signals for child processes we spawn out of NM (rh #739836)
Commit 217c5bf6ac fixed processing of unix
signals: signals are blocked in all threads and a dedicated thread handles the
signals using sigwait().
However, the commit forgot that child processes inherit signal mask as well.
That is why we have to unblock signals for child processes we spawn from NM, so
that they can receive signals.
2012-05-21 15:00:51 +02:00
Dan Williams
eefda8aa7d core: clarify device routing priority
Instead of using the device's type number, which is a poor measure of
routing priority since it has nothing to do with routing priority,
let's make the decision more explicit.
2012-05-18 15:42:56 -05:00
Pantelis Koukousoulas
d125296eb1 adsl: initial PPPoE support for ADSL devices 2012-05-18 15:42:56 -05:00
Dan Williams
4dc5e6c92a core: fix ifindex value checks
Kernel ifindexes are always greater than zero (see dev_new_index()
in net/core/dev.c).  Also don't bother warning about ifindex
lookup failures for devices we know aren't kernel network interfaces.
2012-05-17 13:23:39 -05:00
Dan Williams
4980a6882b core: pass connection provider to devices 2012-05-02 17:33:17 -05:00
Jiří Klimeš
f4419c9fb3 core: notify that "active-connection" property changed on NMDevice
This is necessary so that PropertiesChanged D-Bus signal is properly
issued.
2012-04-25 16:39:10 +02:00
Dan Williams
2290a70385 firewall: set interface zone before IP configuration (rh #805405)
We need to set the interface's firewall zone before we kick off
any sort of IP configuration, so that rules for stuff like
DHCP are already handled by the time that these services are started.
2012-03-21 15:10:11 -05:00
Dan Williams
6b9511f6e9 core: treat missing IPv6 setting as AUTO
Like IPv4, if the connection contains no IPv6 setting, perform
IPv6 addressing.  Since may-fail defaults to TRUE for IPv6, failure
should have no consequence.
2012-03-16 09:43:16 -05:00
Dan Williams
50a9cfd8f7 core: fix queued state change debug message
Show the actual ID, not 0.
2012-03-14 12:20:23 -05:00
Jiri Popelka
128695c447 firewall-manager: changing the zone an interface belongs to
When we want to change the zone an interface belongs to
we can't use firewalld's addInterface() because this one
doesn't allow to add interface to zone when it already
has been part of some other/same zone.
We need to use changeZone() method instead - hopefuly
this is the final name of this method.
2012-03-01 18:02:00 -06:00
Dan Williams
33d0cff3e4 core: use active connection dependency master instead of manually setting it
We already have the master device kept in the active connection, so
we can just use that instead of having the Policy determine and set
it manually.  This also should allow slaves to auto-activate their
master connections if the master is able to activate.
2012-03-01 17:40:18 -06:00
Dan Williams
9146d4e8c6 core: move slave handling to device subclasses
Let the master control how the slave gets enslaved and released
since that's dependent on the virtual interface type of the master.
2012-03-01 17:40:17 -06:00
Dan Williams
28edd78f89 core: don't require an error argument to nm_device_check_connection_compatible() 2012-03-01 17:40:17 -06:00
Dan Williams
db94e37eb5 core: wait for dependencies before continuing with device activation
Before jumping to activation stage 1, make sure dependencies are activated.
2012-03-01 17:40:17 -06:00
Dan Williams
0eb09bc99b core: don't assert in nm_device_get_connection()
This function used to be used only from activation paths, so it
was fine to assert there because we always expected that there
would be an activation request.  These days we'd like to use it
in more places, so just return NULL if there's no connection.
2012-03-01 17:40:17 -06:00
Dan Williams
5ee7841475 core: extend nm_device_hwaddr_matches() to match specific addresses
We'll want to eventually match (for VLAN) a given hardware address
that's not the device's hardware address.  Only the device itself
knows which NMSetting should contain it's hardware address (ie
the 'wired' setting for NMDeviceEthernet, 'infiniband' for
NMDeviceInfiniband, etc) and VLANs take their hardware address
from the parent interface.  So eventually we'll have VLAN
interfaces use these new arguments to ask their parent interface
to match the VLAN hardware address in a connection, since the
VLAN doesn't know (or need to know) what kind of interface it
really is underneath.
2012-03-01 17:40:17 -06:00
Dan Williams
29672c3f7d core: move IP config matching to NMDevice superclass
It's useful for more than just NMDeviceWired and subclasses.
2012-03-01 17:40:17 -06:00
Jiří Klimeš
5ea7e6086a core: use glib's CLAMP() macro to simplify ipv6_privacy boundary check 2012-02-27 16:42:07 +01:00
Jiří Klimeš
d376270bfe core: add support for IPv6 Privacy Extensions for SLAAC (RFC4941) (bgo #633233) 2012-02-27 16:35:19 +01:00
Jiří Klimeš
785b6fb807 utils: more flexible reading of /proc/sys/net
- changes nm_utils_get_proc_sys_net_value() to allow all values, not just 0,1
- adds nm_utils_get_proc_sys_net_value_with_bounds() for limiting valid values
2012-02-27 16:27:44 +01:00
Dan Williams
0be930c0fc core: flush timestamp cache to disk only on activate/deactivate
To suppress periodic disk wakeups, only write timestamps to disk
when a device gets activated or deactivated.  Timestamps are
still updated periodically in memory, just not flushed to disk
at that time.
2012-02-17 09:49:35 -06:00