Commit Graph

4279 Commits

Author SHA1 Message Date
Dan Winship
75ea0b0593 core: remove some dead code in NMDevice 2013-08-16 17:27:34 -04:00
Jiri Pirko
f81e2cbe68 core: spawn teamd for team device connection
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
dcf5355810 ifcfg-rh: add write support for team devices
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
db65980328 ifcfg-rh: add read support for team devices
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
23836e8146 core: add support for team device
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Martin Pitt
5dc4be54e6 keyfile: Drop owner check
In nm_keyfile_plugin_connection_from_file(), disable the "bad owner"
check.
As root you can read all files anyway, or if necessary even chown them,
and for
other users the standard file permissions will do a fine job.

This fixes running "make check" as root.

https://bugzilla.gnome.org/show_bug.cgi?id=701112
2013-08-13 23:28:54 +02:00
Pavel Šimerda
80c48a62be dhcp: kill dhclient on fatal errors
This helps to avoid dhclient DOSing the network.

https://bugzilla.gnome.org/show_bug.cgi?id=705137
2013-08-13 22:35:00 +02:00
Thomas Haller
6e6b573383 core: minor code cleanup to use preprocessor constants
Use preprocessor constants for signal names NM_PLATFORM_LINK_*
instead of hard coded values.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-12 13:31:33 -05:00
Thomas Haller
e26642c26c trivial: fix spelling errors in code comments
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-12 13:31:07 -05:00
Pavel Šimerda
8d10e8bbe6 platform: ignore multi-hop routes
https://bugzilla.gnome.org/show_bug.cgi?id=705606
2013-08-12 17:35:22 +02:00
Dan Williams
e16e8ab7fb policy: prevent double-deactivation of an NMActiveConnection after it's removed
When a connection is removed from NMSettings, it gets deactivated.  That was
happening once in response to the now-removed connection's visibility changing
to invisible to everyone, and a second time in response to the actual removal
signal.  Unfortunately the second time the NMActiveConnection is already
cleaned up and in the DEACTIVATED state, and has no priv->device, which
causes great hilarity when nm_device_set_state() is called with NULL.

_deactivate_if_active() should only try to deactivate NMActiveConnections
that actually are active.
2013-08-09 00:54:58 -05:00
Dan Williams
b5170903c0 settings: correctly handle connection deletion after unsaved and monitor-connection-files
Plugins that could save connections to disk previously depended on inotify
events from the kernel to know when to signal connection removal; that is
in response to a 'delete' request they would unlink the backing filesystem
resources, get the inotify signal, and cause NM_SETTINGS_CONNECTION_REMOVED
to be emitted.

Unsaved connections don't have any backing resources, so they would never
get the signal emitted, and NMSettings would never forget about them.

Also, when monitor-connection-files=false in the configuration, obviously
the inotify signals will never come in because they aren't set up.

Given that we can no longer rely on inotify, it's best to just explicitly
send out the NM_SETTINGS_CONNECTION_REMOVED signal whenever a connection
is deleted via the D-Bus interface or internally.
2013-08-09 00:54:58 -05:00
Stanislaw Gruszka
dd9cf657ef wifi: change bgscan threshold parameter
We do not need to increase periodical scanning frequency when AP signal
strength is good enough. Signal level of -45dBm is considered as good,
change the threshold to -65dBm.
2013-08-08 10:52:39 -05:00
Dan Williams
119345d90a core: fix double-free C&P error 2013-08-08 10:14:38 -05:00
Dan Williams
37efd55699 platform: fix some bogus compiler warnings
platform/nm-linux-platform.c: In function 'delete_object':
platform/nm-linux-platform.c:102:13: error: 'cached_object' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (object && *object) {
             ^
platform/nm-linux-platform.c:1019:35: note: 'cached_object' was declared here

Except that it won't be, but I guess the gsystem auto* stuff is
confusing the compiler.
2013-08-07 15:47:47 -05:00
Dan Williams
b637c6a101 platform: don't assert on multi-hop routes (rh #989022)
It only matters that there's at least one next hop, not that there
is only one.
2013-08-07 14:47:22 -05:00
Dan Williams
ead39cb421 core,platform: don't completely ignore WWAN pseudo-ethernet interfaces
The platform still needs to know about them, becuase the ethernet interface
is what gets configured and used for IP.  But the Manager doens't want to
create a full new NMDevice for them, because there's already a Modem
device that "owns" that WWAN interface.  So keep WWAN devices visible
to the platform, but just make the manager ignore them when creating
NMDevices.

Also, many WWAN pseduo-ethernet drivers set NOARP becuase they really
are point-to-point and thus ARP is pointless, and in this case, they
won't have any arptype of ARPHRD_ETHER.  So determining the NMLinkType
from udev must take that into account.
2013-08-07 14:39:00 -05:00
Thomas Haller
ac24000650 core: takeover existing virtual devices in system_create_virtual_device
If a virtual device is about to be added and it already exists, it gets
reused.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-07 12:53:24 -05:00
Dan Williams
1f084567f0 ifcfg-rh: don't require an error for read_mac_address()
No reason to; the caller knows success/failure from the return value
and might want to ignore the error.
2013-08-07 12:53:24 -05:00
Dan Williams
0c8d8b4da3 core: update UDI when it's available
Software devices don't have a UDI until udev finds them, and since we need
to know about the software devices before udev finds them the UDI will be
missing.  Instead of requiring a UDI on NMDevice creation, update the
property from the NMPlatform link change signal when udev does find the
device.

Now that a UDI is no longer required for device creation, software devices
added by NM would be created in the platform_link_added_cb() signal
handler triggered by the various software device creation methods in
system_create_virtual_device() (eg nm_platform_bridge_add() etc).  Then
the NMDevice created in system_create_virtual_device() would be a duplicate
and cause problems when it was added.  Since system_create_virtual_device()
needs to do setup on some devices, suppress the device creation from the
platform link added handler in this function.

Much of this is a hack which should be cleaned up later.
2013-08-07 12:53:24 -05:00
Thomas Haller
81ed5307d3 fixup! core: fix cleanup of NMDevices that fail construction
The unref in finalize is not needed, because the hash table gets already freed
in dispose.

Note that setting available_connections to NULL in dispose is not really
needed, because (altough dispose might be called more than once) there
is a guarded by "priv->disposed = TRUE;". But leave it for clearity in
case somebody tries to access the pointer (which shouldn't happen).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-07 12:53:24 -05:00
Dan Winship
588547b343 core: fix cleanup of NMDevices that fail construction
We were leaving signal handlers attached to devices that failed in
constructor() (and also leaking the available_connections hash). Fix
that.
2013-08-06 16:36:51 -05:00
Dan Winship
1d3ae22905 platform: fix initial link-added emission
nm_platform_query_devices() wasn't including the new "reason" argument
in its link-added emissions. (This didn't cause any problems since
NMManager doesn't look at that argument anyway, but it's still
obviously wrong.)
2013-08-06 16:36:51 -05:00
Dan Williams
e9e84c19c9 ifcfg-rh: fix handling of VLAN parent PHYSDEV key
The initscripts do this:

    MATCH='^.+\.[0-9]{1,4}$'
    if [[ "${DEVICE}" =~ $MATCH ]]; then
	VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^.*\.\([0-9]\+\)/\1/')
	PHYSDEV=${DEVICE%.*}
    fi
    MATCH='^vlan[0-9]{1,4}?'
    if [[ "${DEVICE}" =~ $MATCH ]]; then
	VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
	# PHYSDEV should be set in ifcfg-vlan* file
	if test -z "$PHYSDEV"; then
		net_log $"PHYSDEV should be set for device ${DEVICE}"
		exit 1
	fi
    fi

which means that if the VLAN name starts with "vlan" then
PHYSDEV must be set, otherwise the parent interface cannot
be determined.

Since PHYSDEV, if set, reflects the explicit intentions of the
user instead of assuming the name from DEVICE, make PHYSDEV
take precedence over determining the parent interface from
heuristics.
2013-08-06 16:36:51 -05:00
Dan Williams
eba7484367 core: don't wait for udev to find created software devices
NM knows software devices it creates exist immediately, and it knows
it can use them immediately instead of waiting for udev to find them.
Ideally we'd wait for udev to find all devices, to allow tags and
other rules to run, but when creating software devices they must
currently be available for use immediately.

Bridges and bonds are required to be IFF_UP before they can be
activated (see their is_available() implementation).  But during
activation code paths, specifically in nm_manager_activate_connection(),
the interface is created and immediately checked for availability
to activate (since the creation was a result of the user requesting
device activation).  That availability check fails, because the
device is not visible outside NMPlatform (because it hasn't been
found by udev yet, because we haven't gotten back to the event
loop) and thus nm_platform_link_is_up() fails, failing the
availability check.  Thus the device activation ends in error.

What should really happen is that device activation shouldn't
be synchronous; a new NMActiveConnection should be created for
any activation request, which can then wait until all the
resources it needs for activation are available (device found,
master devices created, etc).  That's going to take more work
though.
2013-08-06 16:36:51 -05:00
Dan Williams
3c6d789c62 logging: add log domain for D-Bus PropertiesChanged signal stuff
Otherwise it really clutters up the CORE logging when debugging is
enabled.
2013-08-06 16:29:09 -05:00
Thomas Haller
a853b3bd23 core: minor code cleanup to use preprocessor constants
Use preprocessor constants in nm_logging_all_domains_to_string instead
of hard coded values for the special logging domain names.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Thomas Haller
4861161bd4 trivial: fix spelling errors in code comments and README file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Dan Winship
04bd4a9ea5 core: don't log warnings when devices are removed
If a device is removed, then trying to reset its IPv6 state will cause
nm_utils_do_sysctl() to log a warning since the path no longer exists.
So don't try to do it in that case.
2013-08-06 11:49:06 -04:00
Pavel Šimerda
320a9d16a3 all: replace struct in_addr with guint32 2013-08-03 00:15:07 -05:00
Pavel Šimerda
6762b2f792 core: use NMIP[46]Route in nm-ip[46]-config 2013-08-03 00:15:07 -05:00
Dan Williams
7570832b20 platform: simplify getting routes and ignoring the default route
Most places except the tests don't want the default route when asking
the platform for all routes, so make that simpler by just adding a
parameter for including the default route or not.
2013-08-03 00:14:19 -05:00
Dan Williams
873df63e78 core: add nm_ip4_config_dump() 2013-08-02 17:19:36 -05:00
Dan Williams
0aada347c1 core: recognize and handle external IPv4 routes and addresses added under NM
Don't blow them away on DHCP/VPN/IP changes.
2013-08-02 17:19:36 -05:00
Dan Williams
455df69f02 core: fix handling of externally added IPv4 adresses and routes on IP change
The switch to combine IPv4 configs to arrive at the final config would
cause externally added addresses and routes to be removed from the
interface when a DHCP or LLv4 event came in, becasue the externally
added details weren't cached anywhere and thus would be dropped on the
IP changes.
2013-08-02 17:19:36 -05:00
Dan Williams
7e21b528a9 core: add nm_ip4_config_subtract()
Removes anything in 'src' from 'dst'.
2013-08-02 17:19:36 -05:00
Dan Williams
5c1ec7cedf core: track VPN routes on the master device, not the VPN
When a VPN wanted to add some routes (like the host route for the
VPN gateway) it would add them itself and listen for parent device
events and re-add them if necessary.  That's pretty fragile, plus
the platform blows away routes that aren't part of the IP config
that's getting applied.

So we might as well just have the VPN connection tell the parent
what the routes are, and have the parent device handle updating
the routing.  The routes are through the parent device anyway,
and so are "owned" by the parent too.
2013-08-02 17:19:35 -05:00
Dan Williams
468243baf2 core: combine and apply IPv4 configs instead of applying directly
Like IPv6, keep the DHCP/LLv4 config separate and combine it with the
NMSettingIP4Config to arrive at the final, combined IP4 config.  This
brings the behavior in line with IPv6 code flow and will allow adding
the VPN routes config into the mix more easily.
2013-08-02 17:19:35 -05:00
Dan Williams
1923f54d79 build: fix distcheck
New platform changes need NMPlatformReason enum which requires the
generated nm-enum-types.h, which is only in the builddir.
2013-08-02 17:09:50 -05:00
Pavel Šimerda
356cad68fa platform: add reason attribute to all signals 2013-08-02 23:12:21 +02:00
Pavel Šimerda
c1bbacae4c platform: re-check potentially removed objects 2013-08-02 23:04:46 +02:00
Pavel Šimerda
d85ae74388 platform: rework the object refresh code 2013-08-02 22:17:07 +02:00
Pavel Šimerda
900b4b15c5 platform: don't check for route existence (fixup)
This was part of a patch that resulted in commit 5dd15bd but
unfortunately also part of a reverted patch 42b4323. We need
to add it back.
2013-08-02 22:17:07 +02:00
Pavel Šimerda
2167e4376b Revert "platform: work around missing kernel netlink notifications of default route changes"
This reverts commit 42b4323902.
2013-08-02 22:17:06 +02:00
Dan Winship
f9016e203a ifcfg-rh: update InfiniBand P_Key support to match latest initscripts 2013-08-02 13:54:13 -04:00
Pavel Šimerda
5dd15bd459 platform: don't check for route existence
This is the same we already did for nm-platform addresses in commit
68c3e1153c. It will help to avoid various
issues and is also a step towards support for route lifetimes.
2013-08-01 18:09:03 +02:00
Dan Williams
42b4323902 platform: work around missing kernel netlink notifications of default route changes
It appears the kernel does not send notifications via netlink if the
default route is removed in some cases.  This causes the platform
route cache to become stale, and thus when the default route is
reset by NM the platform thinks the route already exists, and does
not add it.  But the route doesn't exist, becuase the kernel silently
removed it without telling anyone.

Fix that with a big hammer by flushing/refilling the route cache when
devices are deactivated (deletion of their addresses causes the default
route to be removed by the kernel) and when the default route is
updated by NM itself.

Pavel: if we find a more granular method, we should probably revert
this as the cache refill can be expensive.
2013-07-31 12:14:52 -05:00
Dan Williams
802d4cdad2 agents: don't make method calls with a destroyed proxy
If the agent has dropped off the bus then its proxy may already
be destroyed, so we'll get warnings when trying to make method
calls using it.  Track proxy destruction and warn if we try to
use a destroyed proxy.
2013-07-31 08:16:41 -05:00
Dan Williams
724b9c045b agents: remove request_cancel()
Turns out this function is useless, because it's only called when the
agent has dropped off the bus or when the whole request is being
freed.  If the agent has dropped off the bus then there's no point
in asking it to cancel the request because there's nothing to ask.
So we can collapse request_cancel() into request_free().
2013-07-31 08:16:41 -05:00
Dan Williams
ab84a86678 vpn: handle interactive plugin secrets requests
If all agents can handle VPN hints, then we'll try to use
ConnectInteractive() to let the VPN plugin ask for secrets
interactively via the SecretsRequired signal.  These hints
are then passed to agents during the connection process if
the plugin needs more secrets or different secrets, and when
the new secrets are returned, they are passed back to the VPN
plugin.

If at least one agent does not have the VPN hints capability,
we can't use ConnectInteractive(), but fall back to the old
Connect call, because that agent won't be able to send the
hints to the VPN plugin's authentication dialog, and thus
we won't get back the secrets the VPN plugin is looking for.

So, for interactive secrets to work correctly, you need:

1) A VPN plugin updated for interactive secrets requests
2) NM updated for interactive secrets requests
3) all agents to set the VPN_HINTS capability when
    registering with NetworkManager and to pass hints
    along to the VPN authentication dialog
4) a VPN authentication dialog updated to look for hints
    and only return secrets corresponding to the hints
    requested by the plugin
2013-07-31 08:16:40 -05:00