Commit graph

341 commits

Author SHA1 Message Date
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
Dan Williams
a868fd5a98 core: don't flush routes/addresses on invalid interface indexes
The NM 'iface' isn't always the IP iface (like for modems) so
to avoid a warning, only flush routes and addresses on deactivate
when the iface can actually handle it.
2011-12-12 14:01:21 -06:00
Dan Williams
fcc441622a core: add generic queued state transitions
There are now three places we need delayed state transitions:

1) unavailable to disconnected
2) failed to disconnected
3) bond unavailable to disconnected

(3) wasn't doing a delayed transition, but we can't change
state from inside a state-change handler otherwise we may not
end up fully processing the current state chagne.  So it needs a
delayed transition too; add some generic code to make that
easier to do.
2011-12-08 11:46:58 -06:00
Thomas Graf
916631f15a bonding: abort activation of unknown slave types
Abort activation of slaves which are unknown and log successful
enslave/release.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-08 10:34:35 -06:00
Dan Williams
dff0d2a189 core: ensure correct IP family completion is scheduled
The callers of fw_add_to_zone() were passing an 'int' (AF_INET or
AF_INET6) while that function was expecting a boolean.  Thus when
IPv6 functions passed AF_INET6 that would be interpreted as TRUE
and IPv4 operations would be scheduled.
2011-12-06 17:31:46 -06:00
Dan Williams
768d54bcc6 core: use right IP family when commiting IP configuration
IPv6 needs to clear it's own activation chain, not IPv4's.
2011-12-06 17:17:34 -06:00
Dan Williams
469b263043 core: better failure handling when starting IP configuration
First, log when there's an unhandled IP config method, and
second, assume failure in IPv4 configs.  IPv6 already did.
2011-12-06 17:00:40 -06:00
Dan Williams
4fd510cbcd trivial: move some log messages earlier
Would have been helpful to more easily catch a bug cyphermox and
I were discussion on IRC.
2011-12-06 16:36:37 -06:00
Thomas Graf
18088e0d07 trivial: add nm_device_get_connection()
Shortcut to access the connection linked to the activation
request of a device.

The patch only replaces usage with nm_device_get_connection()
if the existing code assumes that an activation request must
be available.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:10:23 -06:00
Thomas Graf
5b7503e95e core: use nm_connection_get_setting_<type>() whenever possible
Leads to shorter, easier to read code and improves type casting safety.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:06:43 -06:00
Dan Williams
8e53a44cdd core: clean up per-device rfkill handling
Add an accessor for device rfkill type and use that instead of
GObject properties, and also use that accessor when claiming a
new device instead of checking NM_IS_DEVICE_xxxx().  Allows us
to move one step closer to making WiMAX a plugin.
2011-12-02 13:30:08 -06:00
Dan Williams
da8e21a7d7 core: kill NMDeviceInterface 2011-12-02 13:30:07 -06:00
Dan Williams
6d567e71e6 core: move NMDeviceInterface properties and methods to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
296b488ad4 core: move state-changed signal to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
905f2cdf9a core: move NMDeviceInterfaceError to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
2b1708865f core: move nm_device_interface_deactivate() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
3caf0c80e4 core: move nm_device_interface_activate() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
dcce47bea6 core: move nm_device_interface_disconnect() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
827d9defb9 core: move nm_device_interface_set_enabled() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
51c25508c2 core: move nm_device_interface_get_enabled() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
c71656ff07 core: move nm_device_interface_spec_match_list() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
2db920659f core: move nm_device_interface_connection_match_config() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
1287c8e18d core: move nm_device_interface_can_assume_connections() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
4f330838bd core: move nm_device_interface_check_connection_compatible() to nm-device.c 2011-12-02 13:30:06 -06:00
Dan Williams
e5c1a0ed13 core: move NMDevice private functions to nm-device-private.h
Move stuff that's not "public" API of NMDevice to the private
header that's only used by subclasses.
2011-12-02 13:30:06 -06:00
Dan Winship
5366c3d6d4 wired: split NMDeviceWired out of NMDeviceEthernet and add NMDeviceInfiniband 2011-12-02 13:09:16 -06:00
Dan Williams
7ee3abe19b ip6: suppress merge_ip6_configs() warning
NetworkManager[815]: merge_ip6_configs: assertion `src != NULL' failed

Calling ip6_config_merge_and_apply() with a NULL src_config is fine
since that's what happens during RA or DHCP lease changes.

Reported by Johannes Sjölund
2011-12-01 16:19:24 -06:00
Gary Ching-Pang Lin
4e1abb8315 core: check the iface index correctly
If the iface name is invalid, the index is -1.
2011-11-30 18:05:51 -06:00
Thomas Bechtold
e8051a9b6f modem: map modemmanager errors more detailed
* add 4 new NMDeviceStateReason to map ModemManager errors more detailed
* fix wrong error mapping for MM_MODEM_CONNECT_ERROR_NO_DIALTONE
2011-11-14 17:31:40 -06:00
Dan Williams
e630b638a8 core: ensure slave devices advance to ACTIVATED state
If the interface has no IP configuration (bond slave, etc) then
it still needs to get activated too.  Previously the code would
only move to ACTIVATED when the first IP method completed, but
since slaves don't do IP config, they never got to ACTIVATED
state.
2011-11-10 11:11:43 -06:00