Commit graph

370 commits

Author SHA1 Message Date
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
Dan Williams
46eee484f9 core: fix matching VLAN connections to interfaces
The check for virtual interface name was too loose, so
restrict it to VLAN only which is what actually uses it,
and ensure we have an interface name to compare against
the device.

Found by Weiping Pan <wpan@redhat.com>
2012-02-16 15:20:51 -06:00
Dan Williams
13c8d2c51e core: add NMDevice hwaddr_matches() class method
Match the device's hardware address with a connection.
2012-02-16 15:20:50 -06:00
Dan Williams
c1a66936f3 core: don't create virtual interfaces we already have
Make sure we don't already have an NMDevice for this interface
before creating it, and also when creating the interface, make
a new NMDevice for it immediately to prevent a race between
telling the kernel to create the interface via netlink, and when
udev later tells us about it.  In between there we could be
triggered to try creating the interface again.
2012-02-16 15:20:50 -06:00
Dan Winship
839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Jiri Popelka
1e4ccb39d4 firewall: add remove_from_zone()
nm_firewall_manager_remove_from_zone() is called from
nm_device_deactivate()

Also fix nm_firewall_manager_add_to_zone() to the latest
FirewallD1.zone.addInterface signature.
2012-02-13 13:23:20 -06:00
Dan Williams
b378c3089c core: make NMActiveConnection a base class for NMActRequest and NMVPNConnection
That was always the goal, but never got there.  This time we need it
for real to abstract handling of dependent connections so bite the
bullet and make it happen.
2012-02-09 17:54:26 -06:00
Thomas Bechtold
775ec828b9 core: add device property "StateReason"
Allows clients to retrieve the reason a device changed to
the given state along with the state itself, preventing
race conditions if the state were retrieved separately
from the reason.  Reason codes were not previously
accessible without listening to the StateChanged signal.
2012-02-02 12:02:11 -06:00
Dan Winship
b860c7be4a infiniband: add transport-mode property
Add transport-mode property to NMSettingInfiniband (and parse it
correctly in ifcfg-rh), and set it up properly on the device in
NMDeviceInfiniband.
2012-01-26 09:58:48 -06:00
Thomas Graf
1ba50e2f1b bonding: export path of master device property over DBUS
Adds a new "master" property to NMActiveConnection containing the path
of the master NMDevice if the connection has a master.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-01-25 11:12:43 -06:00