Commit Graph

7207 Commits

Author SHA1 Message Date
Dan Williams
9a3995daf6 settings: fix example plugin LDFLAGS
C&P error.
2012-05-14 15:51:31 -05:00
Dan Williams
89bf692c08 dbus: fix Modem interface permissions
Doesn't really matter since everything to NM is allowed in the
at_console block, but just for correctness fix it.
2012-05-14 14:50:17 -05:00
Dan Williams
a5df15d75a settings: add nm_connection_provider_get_connections() to connection provider interface
Will be used by some other stuff.
2012-05-14 10:46:32 -05:00
Dan Williams
c3d3a3d16a supplicant: handle interface state 'disabled'
Been around for a while; happens if the interface goes away or is
rfkilled.  Recognize it for now but we don't do anything with it
yet.
2012-05-11 17:15:40 -05:00
Jiří Klimeš
247bd27e1d backends: fix nscd condrestart for systemd installations (rh #805531)
This also inhibits pointless error message that '/etc/init.d/nscd condrestart'
could not be spawned.
2012-05-10 17:47:01 +02:00
Dan Williams
5c0607d522 examples: add an example system settings plugin 2012-05-07 15:19:09 -05:00
Dan Williams
50435e1d5d wifi: attempt to use same kernel API wpa_supplicant does (bgo #675017)
Some drivers (ipw2x00) support capabilities reporting via nl80211 but
absolutely nothing else.  NM was only checking for capabilities
when deciding whether or not to use nl80211 to communicate with the
driver for associated AP, signal strength, and channel info, and that
clearly fails with half-implementations of nl80211 in the kernel.

Instead, match the logic that wpa_supplicant uses to determine whether
to stick with nl80211 or fall back to WEXT.  For these drivers
NM will now fall back to WEXT and should return to the behavior we
had with 0.9.2 for these devices.
2012-05-04 14:26:10 -05:00
Dan Williams
0e262e04e1 wifi: work around some scan failures at startup
mac80211 drivers don't like being asked to scan when they are already
scanning, and it's pretty impossible to not race with internal
supplicant scanning.  NM requests a scan immediately after the
supplicant interface gets created, and that scan request usually
succeeds.  But since the supplicant's scan request method returns
when the kernel *starts* the scan, not when the scan is finished,
a second scan that NM would immediately request in
request_wireless_scan() would often fail as the card was already
scanning.

The second scan was requested immediately becuase the SCAN_INTERVAL_MIN
was zero, which was set to zero to intentionally request two scans
to work around drivers that would fail the first scan because they
are stupid.

Well, let's just penalize stupid drivers by *possibly* making the
initial connection take a few more seconds due to the change of
SCAN_INTERVAL_MIN.  But what we're really doing here is not asking
for the second scan right after the first one is requested, since
that will almost always fail for most drivers, but request the
second one after the supplicant says the scan is done.

Second, if for some reason the supplicant reports that the scan failed,
don't make the next scan take longer; just queue it up without backing
off so we can retry the scan sooner.
2012-05-04 13:48:54 -05:00
Dan Williams
565d1e2557 wifi: don't report supplicant interface is READY until we've read properties
NMDeviceWifi and a few other things expect the interface will
move from STARTING to READY and then on to other states.  But the
state was getting set to the actual supplicant interface state
immediately when the first properties were read (which include
the State property) and thus the READY state got bypassed.  But
we also want to read stuff like the capabilities before letting
the interface be used.

So first, ensure the supplicant interface object actually uses the
READY state like its callers expect, and second, don't set the
READY state until we actually know what we need to know about it.
2012-05-04 13:48:54 -05:00
Dan Williams
62888a13c9 wifi: probe-scan for hidden SSIDs 2012-05-02 17:33:17 -05:00
Dan Williams
4980a6882b core: pass connection provider to devices 2012-05-02 17:33:17 -05:00
Dan Williams
4fe48b1273 core: add connection provider interface
Allows better encapsulation of the functionality of the NMSettings
object that we want to expose to the device class.  They don't need
the whole object so to keep things simple and contained we'll just
give them a smaller interface to use.
2012-05-02 17:33:17 -05:00
Dan Williams
1b40d82b74 wifi: cache number of available scan SSIDs
Which we'll use later for better handling of non-broadcasting
networks by probing for them.
2012-05-02 17:33:17 -05:00
Dan Williams
a091c7aa0f core: ensure carrier is always on for devices that don't support detection (rh #816719)
We broke this when splitting NMDeviceWired out of NMDeviceEthernet.
2012-04-28 11:48:01 -05:00
Dan Williams
8ed02c3039 core: log whether WEXT is enabled or not (bgo #674650)
Now that we've encountered this twice with distros disabling WEXT
but apparently not realizing it kills staging and out-of-kernel
drivers like wl.o, make it a log message so we don't have to go
hunting for build-time logfiles.
2012-04-26 13:40:07 -05:00
Dan Winship
d6a07c60e9 core: replace strcpy() with g_strlcpy()
When copying device names into ioctl structs, we know that the device
names are of valid length, so we were using strcpy(). But you can't
prove that they're short enough just looking at the local code, so
some code analysis tools warn about a potential buffer overflow.. So
use g_strlcpy() instead.
2012-04-26 09:25:58 -04:00
Dan Winship
f378457f25 ifcfg-rh: fix vlan DEVICE parsing
A vlan DEVICE name must be either $(OTHERDEVICE).$(VLAN_ID) or
vlan$(VLAN_ID). Enforce that. In particular, don't:
(a) crash if the name has no "." and doesn't start with "vlan",
(b) loop forever if the $(VLAN_ID) part is non-numeric, or
(c) silently ignore non-numberic characters after the $(VLAN_ID).
2012-04-25 14:56:51 -04: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 Winship
77de91e5a8 core: don't fight with the kernel over the default IPv6 route
The kernel wants there to be a default route over every RA-ed IPv6
interface, and it gets confused and annoyed if we remove that default
route and replace it with our own (causing it to effectively drop all
further RAs on the floor, which is particularly bad if some of the
information in the earlier RA had an expiration time).

So, rather than replacing the kernel's default route(s), just add an
additional one of our own, with a lower (ie, higher priority) metric.

https://bugzilla.redhat.com/show_bug.cgi?id=785772
2012-04-19 16:25:13 -04:00
Jiří Klimeš
217c5bf6ac core: improve handling of POSIX signals using sigwait() (rh #739836)
There are multiple ways how to handle standard unix signals. They work quite
well for a single-threaded application. However, signal handling in a multi-
threaded app becomes tricky. And, the most safe way is to use sigwait() function
in a dedicated thread, which allows us to process the signals synchronously and
thus avoid various nasty problems.

A few useful links:
http://pubs.opengroup.org/onlinepubs/007904975/functions/sigwait.html
http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.genprogc%2Fdoc%2Fgenprogc%2Fsignal_mgmt.htm
http://www.linuxjournal.com/article/2121?page=0,2
http://www.redwoodsoft.com/~dru/unixbook/book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch12lev1sec8.html
2012-04-17 15:29:10 +02:00
Jiří Klimeš
21bc3ab517 ifnet: do not call g_strv_length() on NULL 2012-04-12 13:45:58 +02:00
Mu Qiao
5f4d238baa ifnet: fix quote handling for global data (bgo #673548) 2012-04-12 13:45:31 +02:00
Mathieu Trudel-Lapierre
de3353d58c wifi: check the driver reports any encryption caps with nl80211 (bgo #673717)
Some drivers, such as ipw2200 doesn't report any encryption with newer kernels.
See also https://bugs.launchpad.net/ubuntu/+source/linux/+bug/973241
2012-04-12 12:21:01 +02:00
Dan Winship
8a2267ab6b Fix a few misc issues noticed by Coverity 2012-04-05 13:30:09 -04:00
Jiří Klimeš
fe3f010044 ifcfg-rh: clear MACADDR before writing it in wired setting (bgo #672646)
Else it's not possible to delete Cloned MAC (e.g. in the editor).
2012-04-03 14:57:31 +02:00
Jiří Klimeš
75de2034c8 trivial: whitespace fixes 2012-04-02 13:08:19 +02:00
Jiří Klimeš
47f9eb80d8 core: call is_adhoc_wpa() only after we check '802-11-wireless' setting
This prevents assertion while checking a connection that is not a wireless one.
2012-04-02 12:57:30 +02:00
Jiří Klimeš
6b64e4db2f ppp: don't use struct ifpppstatsreq that was removed from linux/ip_ppp.h
in recent kernels.

We can use ifreq and ppp_stats structures separately. They needn't have to
to be packed in a structure.
2012-03-28 17:03:19 +02:00
Jiří Klimeš
876f318ee8 ifupdown: add missing test18-wired-static-verify-ip6 to Makefile.am 2012-03-27 15:55:21 +02:00
Dan Williams
8126947e08 settings: quiet warning when checking for AdHoc WPA connections 2012-03-23 09:59:20 -05:00
Dan Williams
085d822f28 core: suppress pointless log message when route already exists (lp:958519) 2012-03-22 16:22:48 -05:00
Dan Winship
49105f7115 core: do a better job of applying bond configuration
Reset all known bond options to their default values, not just the
ones that NMSettingBond allows overriding. Also, remove any bond
slaves that were already attached to the bond before we managed it.

Only update bond parameters that need to be updated. In particular,
setting either arp_interval or miimon to 0 has the side effect of also
setting the other one to 0, so don't do that if it's already 0.

Fix the handling of arp_ip_target; the sysfs arp_ip_target node does
not work the same way as the ifcfg BONDING_OPTS line (which is what
the code was assuming before).
2012-03-22 13:12:57 -04:00
Dan Winship
4ad810fdf4 core: fix NMDeviceBond:dispose() to chain up 2012-03-22 13:12:57 -04:00
Dan Williams
925119074d wifi: work around more wl.o stupidity
Sometimes returns 0 for the current frequency when the radio is
active.  WTF?
2012-03-22 11:50:11 -05:00
Dan Williams
71ad568cfb ip6: fix setting default route with libnl3 (bgo #668286)
libnl3 wants a destination address when setting a route, so just hand
it '::' with a address len of 0 so we don't get -NLE_MISSING_ATTR
when trying to set the IPv6 default route.
2012-03-22 09:21:38 -05:00
Dan Williams
1ecc9c215c trivial: formatting fixes 2012-03-21 22:58:00 -05: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
43f449824a mobile: ensure IPv4 timeout fails activation
With the switch to IPv4 being allowed to fail by default we need
to clean up this old code a bit.  PPP failure during IP config
should trigger a timeout, and the core code will handle whether
to fail the device completely or not.  But if we got a valid IPv4
config and PPP failed later, the device gets failed.  Previously
the device would just sit in IP_CONFIG state because now IPv4
defaults may-fail to TRUE, and when PPP failed the
nm_device_ip_config_should_fail() check would obviously not pass.
2012-03-20 23:21:17 -05:00
Jiří Klimeš
5238aa4107 utils: override VPN plugin's never-default when ignoring auto routes (rh #804563)
Setting never-default ito TRUE when VPN server provides routes was done
in https://bugzilla.gnome.org/show_bug.cgi?id=621698
2012-03-20 17:17:49 +01:00
Dan Williams
ce6b667a68 wifi: make sure we're connected to netlink before using it
This should fix the warning "failed to allocate link cache" when a
new device is added.  It doesn't affect WiFi operation, and the
code would fall back to non-nl80211 mechanisms of detecting whether
a device was wifi or not, so it corrects this check and quiets the
error message.
2012-03-19 16:09:46 -05:00
Mathieu Trudel-Lapierre
1a531b7ecf keyfile: fix testcases after InfiniBand transport-mode default change 2012-03-19 10:10:36 -05:00
Dan Williams
69247a00ea wifi: disable Ad-Hoc WPA connections (lp:905748)
The kernel is broken for Ad-Hoc WPA, and creates the connections
as open connections instead.  Yeah, eventually we can use
wpa_supplicant with RSN support, but for now we just have to
disable Ad-Hoc WPA because it's a problem to say we're creating
a protected network but then have the kernel not do that for
us.  Will be re-enabled once all the necessary bits have been
fixed.

Note that Ad-Hoc WPA has been broken since at least 2.6.32 with
mac80211-based drivers, which is what most users will be using.
2012-03-16 17:58:23 -05:00
Dan Williams
c455eafbef infiniband: fix missing sentinal in 04959c39aa 2012-03-16 15:20:58 -05:00
Dan Winship
04959c39aa Add a workaround for a problem creating InfiniBand connections
It is currently not possible to create a connection where the
connection-type-specific NMSetting has all default values. This hasn't
been a problem in the past because each type had at least one property
that either had no default value or had a default value that didn't
pass verify(). But NMSettingInfiniband didn't have that property, so
it's impossible to create an InfiniBand connection unless you change
the value of at least InfiniBand-specific setting.

Work around this for now by making the default value of
NMSettingInfiniband:transport-mode be NULL, so it needs to be
overridden.
2012-03-16 14:13:52 -04: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
43ba4eb04b ifcfg-rh: fix testcase after 4abb300c96 2012-03-15 17:56:34 -05:00
Evan Broder
447342744e vpn: add a new field so VPN plugins can specify multiple domains 2012-03-15 17:10:15 -05:00
Mathieu Trudel-Lapierre
956e63a673 dnsmasq: allow proxying dnssec data (lp:946093)
This will allow DNSSEC data to be visible in browsers, which would otherwise
not be the case by default because of dnsmasq acting as a middle-man for
resolution.

Otherwise, we have a regression from the libc resolver behavior.
2012-03-15 16:58:19 -05:00
Andrew Bird
34aef8aaaa gsm: pass the PPP auth preferences for STATIC and DHCP device use
When using the either DHCP or STATIC IpMethods the modem manager
or device itself negotiates the PPP session so we need to pass
the authentication preferences through to MM.

Notes:
        1/ Using a bitfield now that happens to match the Ericsson
in the lower orders so that it's far more tidy.
        2/ Devices that wish to utilise this should observe the
following:
        If the bitfield doesn't exist in the dict, then MM uses the
modem default, if it does, MM tries to fulfill the request. If the
modem can only accept one value (Qualcomm-type devices accept only
None, PAP or CHAP with AT$QCPDPP) then MM picks the appropriate one
from the dict if only one of PAP or CHAP was given, otherwise we
default to PAP.

(dcbw: make enum a bitfield instead of the bit position)
2012-03-15 16:19:43 -05:00
Tore Anderson
4abb300c96 core: allow IPv4 to fail by default
(comments by dcbw)
This allows out-of-the-box connectivity	on IPv6-only networks.
Once caveat is that connections	where the user currently
expects	no IPv4	connectivity to	terminate the connection and
retry will no longer do	so until IPv6 also times out, and if
that network where IPv4	is expected to fail also has an IPv6
router sending advertisements, the connection will succeed
instead	of failing.  That can be resolved by setting the
right bit in the connection's config file; and it's expected
that the number	of users who expect IPv4 failure on a
network	with usable IPv6 connectivity is quite small
compared to the	benefit	of OOB IPv6 connectivity.
2012-03-15 15:58:24 -05:00