Commit Graph

8762 Commits

Author SHA1 Message Date
Jiří Klimeš
a8076f0d9d cli: fill active connections' data even if we can't get NMConnection
This can happen e.g. when D-Bus limits number of replies and there's
a lot of connections. Then nm_remote_settings_list_connections() won't
return all connections and the connection that was activated can be among
the missing connections.
2012-05-22 17:05:34 +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
7054f7ad88 release: update NEWS with ADSL support 2012-05-18 16:26:10 -05:00
Dan Williams
60d2bb824e todo: remove ADSL item 2012-05-18 15:42:56 -05: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
Dan Williams
e048b8e013 adsl: talk ADSL ioctls directly and kill usage of br2684ctl
The code to set up ATM interfaces is actually pretty simple,
so don't bother spawning br2684ctl at all.  Just do the
necessary communication with the kernel directly and save
a bunch of code.

Note: this isn't very likely to work as I don't have an
ADSL connection to test with.  Testing help appreciated.
2012-05-18 15:42:56 -05:00
Dan Williams
f8243e45c9 adsl: fix up for IP config flow changes 2012-05-18 15:42:56 -05:00
Dan Williams
477d8570c1 adsl: cleanups and some rearranging 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
Pantelis Koukousoulas
8039dd30d8 adsl: add libnm-glib and nmcli code
For the finale, this is the libnm-glib and nmcli part of the support,
with this you can now make a full pppoatm connection from NetworkManager
by configuring it in system scope in a keyfile.

As an example, here is mine:
(password and username snipped for obvious reasons)

[connection]
id=MYISP
uuid=34d04e69-fdd9-4231-af2c-25ed1f34dc1e
type=adsl
timestamp=1304621332

[adsl]
username=user@myisp.com
password=mypassword
vpi=8
vci=35
encapsulation=vcmux
protocol=pppoa

[ipv6]
method=ignore

[ipv4]
method=auto

Extract from logs:
NetworkManager[29155]: <info> Activation (ueagle-atm0) starting connection 'MYISP'
NetworkManager[29155]: <info> (ueagle-atm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) starting...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: prepare -> config (reason 'none') [40 50 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) successful.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: config -> ip-config (reason 'none') [50 70 0]
NetworkManager[29155]: <info> starting PPP connection
NetworkManager[29155]: <debug> [1304671146.590156] [nm-ppp-manager.c:1047] nm_ppp_manager_start(): command line: /usr/sbin/pppd nodetach lock nodefaultroute user user@myisp.com plugin pppoatm.so 8.35 noipdefault noauth usepeerdns lcp-echo-failure 0 lcp-echo-interval 0 ipparam /org/freedesktop/NetworkManager/PPP/0 plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so
NetworkManager[29155]: <info> pppd started with pid 29175
NetworkManager[29155]: <debug> [1304671146.591235] [NetworkManagerUtils.c:816] nm_utils_get_proc_sys_net_value(): (ueagle-atm0): error reading /proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra: (4) Failed to open file '/proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra': No such file or directory
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) complete.
Plugin pppoatm.so loaded.
Plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so loaded.
** Message: nm-ppp-plugin: (plugin_init): initializing
** Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
NetworkManager[29155]: <debug> [1304671146.612937] [nm-udev-manager.c:621] handle_uevent(): UDEV event: action 'add' subsys 'net' device 'ppp0'
NetworkManager[29155]: <debug> [1304671146.613134] [nm-udev-manager.c:525] net_add(): ignoring interface with type 512
NetworkManager[29155]: <debug> [1304671146.617308] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x1090
Using interface ppp0
Connect: ppp0 <--> 8.35
** Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
** Message: nm-ppp-plugin: (nm_phasechange): status 6 / phase 'authenticate'
** Message: nm-ppp-plugin: (get_credentials): passwd-hook, requesting credentials...
NetworkManager[29155]: <debug> [1304671149.639511] [nm-agent-manager.c:1044] nm_agent_manager_get_secrets(): Secrets requested for connection /org/freedesktop/NetworkManager/Settings/0 (adsl)
NetworkManager[29155]: <debug> [1304671149.639684] [nm-settings-connection.c:717] nm_settings_connection_get_secrets(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets requested flags 0x1 hint 'password'
NetworkManager[29155]: <debug> [1304671149.640950] [nm-agent-manager.c:959] get_start(): (0x9b4ad10/adsl) system settings secrets sufficient
NetworkManager[29155]: <debug> [1304671149.641332] [nm-settings-connection.c:573] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) existing secrets returned
NetworkManager[29155]: <debug> [1304671149.641541] [nm-settings-connection.c:579] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets request completed
NetworkManager[29155]: <debug> [1304671149.643074] [nm-settings-connection.c:618] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) new agent secrets processed
** Message: nm-ppp-plugin: (get_credentials): got credentials from NetworkManager
PAP authentication succeeded
** Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
local  IP address 94.70.90.201
remote IP address 80.106.108.12
primary   DNS address 195.170.0.1
secondary DNS address 195.170.2.2
** Message: nm-ppp-plugin: (nm_phasechange): status 9 / phase 'running'
** Message: nm-ppp-plugin: (nm_ip_up): ip-up event
** Message: nm-ppp-plugin: (nm_ip_up): sending Ip4Config to NetworkManager...
NetworkManager[29155]: <debug> [1304671150.607440] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x110D1
NetworkManager[29155]: <info> PPP manager(IP Config Get) reply received.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager[29155]: <debug> [1304671150.608918] [nm-system.c:222] sync_addresses(): (ppp0): syncing addresses (family 2)
NetworkManager[29155]: <info> (ueagle-atm0): device state change: ip-config -> activated (reason 'none') [70 100 0]
NetworkManager[29155]: <info> Policy set 'MYISP' (ppp0) as default for IPv4 routing and DNS.
NetworkManager[29155]: <info> Activation (ueagle-atm0) successful, device activated.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) complete.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:56 -05:00
Pantelis Koukousoulas
9039c24bf5 adsl: carrier handling and PPPoA support
This is the "juice" of the patch series. Initial cut at carrier handling
(by polling /sys/class/atm/$iface/carrier) and also support for calling
pppd with the proper command-line to achieve a connection.

Also implement the necessary boilerplate for the NM state machine to
be happy with our device.

This is a "duct tape and gum" implementation, i.e., prefer copy&paste
over proper refactoring, due to limited time, but the foundations are
now there, so we can make it work right slowly-slowly :)

With this patch, you can already test carrier management but not yet
make a complete connection.

Relevant extract from logs:
<info> (ueagle-atm0): carrier now ON (device state 20)
<info> (ueagle-atm0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:55 -05:00
Pantelis Koukousoulas
0e6f5ce38e adsl: settings and initial "scaffolding"
This patch adds the settings code (NMSettingAdsl) and the initial
"scaffolding" i.e., a tiny stub version of NMDeviceAdsl and the
udev handler code to get the device detected.

With this patch you should be able to see an atm device being detected
by networkmanager in the logs, although of course it doesn't
do anything useful yet.

Extract from the logs:

 [1304668252.341354] [nm-udev-manager.c:562] adsl_add(): adsl_add: ATM Device detected from udev. Adding ..
(ueagle-atm0): failed to look up interface index
(ueagle-atm0): new ADSL device (driver: 'ueagle-atm' ifindex: -1)
(ueagle-atm0): exported as /org/freedesktop/NetworkManager/Devices/2
(ueagle-atm0): now managed
(ueagle-atm0): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
(ueagle-atm0): deactivating device (reason: 2).
 [1304668252.345102] [nm-system.c:1349] flush_routes(): (ueagle-atm0) failed to lookup interface index
 [1304668252.347821] [nm-device.c:3912] nm_device_state_changed(): (ueagle-atm0): device is available,

In this version, we hack the nm-device.c:nm_device_get_priority() to get better priority
instead of changing the DeviceType enum.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:55 -05:00
Christian Kirbach
6a0f7d655c po: updated German translation (bgo #676229) 2012-05-18 10:41:31 +02:00
Jiří Klimeš
57bb91f7f0 ifnet: handle 'biosdevname' interface names better (bgo #674765) (lp:962587)
Finding out interface type from interface name string is fragile. It is easily
broken, e.g. by biosdevname changing interface names to em<n> or p<n>*p<n>.
Sadly, Gentoo network configuration scripts are rather stupid, using format:
variable_${interface|mac|essid|apmac}.
http://www.gentoo.org/doc/en/handbook/2007.0/handbook-x86.xml?full=1#book_part4_chap2
The entries interface|mac|essid|apmac are basically indistinguishable. It's not
possible to say whether 'p1p1' is an interface or SSID, for example.

Fix the current behaviour a bit by checking whether the string is an interface.
If so, and it is not a Wi-Fi one, set the connection type as wired. Else it is
regarded as wireless.
2012-05-18 10:19:13 +02:00
Dan Williams
201096b209 bluetooth: move device logic to bluez manager
To simplify NMManager and to make use of the new connection provider
functionality, move the logic for when a paired Bluetooth device
is actually usable for network connections or not into the bluez
manager and out of NMManager.  The general direction should be towards
moving this sort of logic out of the manager and into the device
specific stuff, like we did with the WiMAX bits, so we can make
stuff into plugins.
2012-05-17 13:27:09 -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
75257f5d7e core: move connection provider interface to src/ 2012-05-17 13:21:47 -05:00
Dan Winship
0f9cc88a4c Use GLIB_VERSION_MIN_REQUIRED to work around GValueArray deprecation
GValueArray is deprecated as of GLib 2.32, but we need to use it for
dbus-glib stuff. So use the new GLIB_VERSION_MIN_REQUIRED macro to
prevent those warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=669613
2012-05-17 09:47:55 -04:00
Dan Williams
331b6562cb core: don't print carrier messages if device is unmanaged 2012-05-16 18:10:24 -05:00
Thomas Bechtold
54a0ac0e50 configure: fix libsoup check 2012-05-16 16:21:38 -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
Andika Triwidada
4d74277edd po: updated Indonesian translation (bgo #675738) 2012-05-11 10:22:48 +02:00
Piotr Drąg
5b0adaa033 po: updated Polish translation (bgo #675834) 2012-05-11 10:12:00 +02: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
Jiří Klimeš
c5d75dcdfa cli: fix 'nm -nocheck con up'
When '-nocheck' option was used, NMClient object was created later in the
operation process.
This caused that the callback in nm_client_activate_connection() was not
called. It's fixed by creating NMClient early.
2012-05-09 14:19:11 +02:00
Jiří Klimeš
191da673a8 cli: show progress in --pretty mode for 'nmcli con up'
We need to use a workaround for VPN connection state. There is a bug somewhere
causing that vpn-state-changed signal is not issued on active VPN connection.
Debugging showed that D-Bus PropertiesChanged and VpnStateChanged signals are
not processed properly. That's why libnm-glib's VPN connection object is not
updated. The issue may lie in libnm-glib or even in dbus-glib.
I wasn't able to get VpnStateChanged signal via dbus-glib
(dbus_g_proxy_add_signal() and dbus_g_proxy_connect_signal()), however received
the signal successfully using GDBus.

Until the issue is analyzed and fixed, we need to ask for VPN state of active
VPN connection every second in order to show progress and exit correctly.
2012-05-09 14:19:03 +02:00
Jiří Klimeš
d58c32d214 cli: show progress in --pretty mode for 'nmcli dev disconnect' 2012-05-09 13:37:28 +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
bbd2c6e2e6 libnm-util: add 'hidden' property to the wireless setting
Used as a hint to indicate the network is not broadcasting the SSID
and that workarounds should be used for more reliable connection.
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
27fdc1a42c release: update NEWS 2012-05-01 12:59:11 -05:00
Dan Williams
51f37ca8d5 trivial: fix distcheck in libnm-glib 2012-04-30 16:19:46 -05:00
Jiří Klimeš
aa5ed42941 man: document 'nmcli nm wimax' in nmcli's man page 2012-04-30 13:50:15 +02:00
Jiří Klimeš
0a98d14e48 cli: add a command for listing permissions - nmcli nm permissions 2012-04-30 13:32:55 +02:00
Jiří Klimeš
e7bd96266b man: make nmcli man page more readable
There are a few changes making the text less awkward after a native speaker's
proofreading.
2012-04-30 10:29:36 +02:00