Commit graph

3065 commits

Author SHA1 Message Date
Dan Williams
75257f5d7e core: move connection provider interface to src/ 2012-05-17 13:21:47 -05:00
Dan Williams
331b6562cb core: don't print carrier messages if device is unmanaged 2012-05-16 18:10:24 -05:00
Daniel Drake
3278b82d3d olpc-mesh: force use of WEXT
The libertas driver now uses nl80211 for mesh, and wifi-utils chooses to
use wifi-utils-nl80211.

The wifi-utils-nl80211 code does not have implementations for
mesh_get_channel/mesh_set_channel and this breaks mesh networking.
Adding these methods under nl80211 is a little painful.

For now, force use of wifi-utils-wext to restore mesh networking.
2012-05-16 15:56:38 -05:00
Dan Williams
a531f0d4ea dhcp: allow some same-state transitions (rh #801744)
The DHCP code usually ignores dhclient state transitions to the
same state it's currently in.  This turns out to be wrong, since
dhclient will use the same reason code (which NM uses for the
state value) for operations like RENEW and REBIND.  i.e. you'll
see states like this:

BOUND
RENEW (first renew)
RENEW (second renew)
RENEW (third renew)
etc

Therefore to ensure we trigger dispatcher scripts and internal
housekeeping code for renewals we need to make sure we process
these events even though they use the same state as the previous
event.
2012-05-15 22:54:42 -05:00
Dan Williams
a843431236 Revert "dhcp: allow some same-state transitions (rh #810744)"
This reverts commit a5dfb5a482.

Screwed up the bug #.  Dyslexia?  Maybe...
2012-05-15 22:54:14 -05:00
Dan Williams
a5dfb5a482 dhcp: allow some same-state transitions (rh #810744)
The DHCP code usually ignores dhclient state transitions to the
same state it's currently in.  This turns out to be wrong, since
dhclient will use the same reason code (which NM uses for the
state value) for operations like RENEW and REBIND.  i.e. you'll
see states like this:

BOUND
RENEW (first renew)
RENEW (second renew)
RENEW (third renew)
etc

Therefore to ensure we trigger dispatcher scripts and internal
housekeeping code for renewals we need to make sure we process
these events even though they use the same state as the previous
event.
2012-05-15 22:50:36 -05:00
Dan Winship
cca40524ac core: silently ignore duplicates in NMIP[46]Config
The various nm_ip[46]_config_add_* routines were inconsistent in their
behavior when trying to add a duplicate item: add_address() and
add_route() would add it anyway; add_nameserver() and add_wins() would
g_return_if_fail(); and add_domain() and add_search() would return
silently. Update to use the "return silently" behavior everywhere.

In particular: if we get an RDNSS message listing the same nameserver
twice, don't cause a warning. (rh #820752)
2012-05-15 13:51:37 -04:00
Dan Williams
682cd73524 keyfile: be more helpful about the property that's invalid or missing 2012-05-15 09:19:31 -05:00
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