todo: update with latest ADSL status
[NetworkManager.git] / TODO
1 So you're interested in hacking on NetworkManager?  Here's some cool
2 stuff you could do...
3
4 * Internet Connectivity Detection
5
6 This feature would consist of attempting to make an HTTP request to a known
7 DNS address and compare the response to a well-known string, like Windows does.
8 This feature and the server address should be configurable via an option in the
9 /etc/NetworkManager/NetworkManager.conf config file.
10
11 Once the device has successfully gotten an IPv4 or IPv6 address, it should
12 enter the state NM_DEVICE_STATE_IP_CHECK, where this HTTP request would be
13 performed.  After the check was done, the device would set a property in
14 NMDevicePrivate to indicate whether Internet access was successful or not, and
15 advance to the NM_DEVICE_STATE_ACTIVATED state.
16
17 The NMManager object, when determining the overall NM_STATE_* state in the
18 nm_manager_update_state() function, would query this property and set
19 NM_STATE_CONNECTED_LOCAL, NM_STATE_CONNECTED_SITE, or NM_STATE_CONNECTED_GLOBAL
20 based on it and the device's state.
21
22 Ideally this feature would not require linking to an HTTP library like libcurl,
23 but would use open-coded simple HTTP or libsoup for the request.  The request
24 must be done asynchronously, of course.
25
26
27 * ADSL support
28
29 NetworkManager should natively support ADSL modems using one of the 3 main
30 connection methods, PPP over ATM (pppoa), PPP over Ethernet (pppoe), or
31 IP over ATM (ipoatm).  Initial support could be targeted at just pppoa and
32 pppoe, and there is some code in NetworkManager already for pppoe.  More info
33 about ADSL configuration on Linux in general is here:
34
35 http://atm.eagle-usb.org/wakka.php?wiki=UeagleAtmDoc
36
37 Big thanks to Pantelis Koukousoulas for getting ADSL working for PPPoA and PPPoE
38 methods in the 'adsl' branch in NetworkManager git.  We need more testing, IPv6
39 PPP support, and also support for multiple ADSL devices (by reading the "atmindex"
40 attribute from the sysfs directory for the ATM interface on 2.6.38.8 and later
41 kernels).
42
43
44 * Convert WEXT code to nl80211
45
46 There's still some WEXT code in NetworkManager for signal strength reporting,
47 mode, frequency, BSSID, etc.  This should all get converted to nl80211 code,
48 possibly using libnl as a base.  It's not particularly hard, but some
49 investigation on how to talk to netlink and how to use nl80211 and netlink
50 attributes will need to be done.  Tools like 'iw' already do much of this work,
51 but we *cannot* copy & paste code from them since the 'iw' license is not
52 compatible with NetworkManager's GPL license.  For exmaple, the following code
53 does the job, but should be reworked a bit to use the internal synchronous
54 netlink connection from src/nm-netlink-manager.c instead of doing the
55 netlink communication on its own with genl_connect() and such:
56
57 http://mail.gnome.org/archives/networkmanager-list/2009-September/msg00214.html
58
59 The same approach should be taken for signal strength reporting, etc.
60
61
62 * Real Access Point mode support
63
64 Now that NetworkManager requires wpa_supplicant 0.7.x or later, we can add
65 full Access Point (AP) mode support.  NetworkManager currently implements
66 connection sharing via AdHoc mode support, which has some limitations.  Instead,
67 we should check whether the wifi device supports AP mode, and if so, use
68 that mode instead.  wpa_supplicant has support for a "lightweight AP" mode which
69 we should use.  Witold Sowa started this support a while ago and wrote the new
70 D-Bus API for wpa_supplicant that makes all this possible, but some NM pieces
71 are still missing.  If the wifi driver supports AP mode, then in
72 src/supplicant-manager/ NM should send an AP-mode config instead of sending
73 the adhoc config.
74
75 Note that some devices (airo, ipw2100, ipw2200, iwl3945, iwl4965, atmel, zd1201)
76 will never support AP mode due to firmware limitations, so we clearly must still
77 provide Ad-Hoc connection sharing support for those devices and switch between
78 Ad-Hoc and AP mode depending on device capabilities.
79
80
81 * On-Demand WiFi Scan support
82
83 Single-user and embedded devices often use a continuous wifi scan when the
84 networking configuration interface is open to quickly allow users to find their
85 wifi network.  NM periodically scans, but this could take as long as 2 mintues
86 to update the list.  Note that WiFi scans require 2 - 10 seconds to complete,
87 and during this time normal traffic (video, VOIP, streaming music, downloads,
88 etc) is not transmitted, so a WiFi scan is a disruptive operation to the user.
89
90 A D-Bus method should be added to the NMDeviceWifi device to allow user
91 applications to request a scan.  This request should be rate-limited to no
92 more than once every 10 seconds to give time for traffic to resume when the
93 scan is done, and to lessen the effect of any DDoS by malicious user
94 applications.  This request should also be restricted by one or more PolicyKit
95 permissions like org.freedesktop.NetworkManager.network-control.
96
97 To begin, a new method definition should be added to the
98 introspection/nm-device-wifi.xml for a method called "RequestScan" which takes
99 an argument called "options" of type of "a{sv}".  This argument will be used
100 later.  An annotation (like the other functions have) should be added so that
101 the method will be called "impl_device_request_scan".
102
103 Next, the corresponding method implementation should be added to
104 src/nm-device-wifi.c by adding the prototype for impl_device_request_scan
105 near the top of the file, and implementing it below.  The implementation will
106 recieve a GHashTable corresponding to the "a{sv}" argument list from the XML
107 file, but we can ignore that for now.
108
109 The incoming request should be authenticated using nm_auth_get_caller_uid()
110 and additionally starting a PolicyKit authentication check with
111 with nm_auth_chain_new().  See the function manager_device_disconnect_request()
112 in src/nm-manager.c for an example of this.
113
114 Only after the caller is authorized to scan should the request be checked
115 against the last scan timestamp, and if the last scan was 10 seconds or more
116 ago, a new scan should be requested.
117
118
119 * Implement NM_DEVICE_STATE_DISCONNECTING
120
121 To allow for "pre-down" scenarios, this state should be implemented before a
122 device is taken down while it still has connectivity.  If the device is
123 taken down because it's ethernet carrier was dropped, or because the WiFi
124 connection was terminated by the supplicant, this state is pointless and should
125 be skipped.  But if the user requested a manual "disconnect", or NM is dropping
126 connections on exit, etc, then this state should be entered.  In the future
127 this state should hook into a new dispatcher action in src/NetworkManagerUtils.c
128 to exectue dispatcher scripts during the disconnection, and to wait a limited
129 amount of time for each script to complete before allowing the device to
130 proceed to the NM_DEVICE_STATE_DISCONNECTED state, fully implementing pre-down.
131
132
133 * VPN re-connect
134
135 NM should remember whether a VPN was connected if a connection disconnects
136 (like WiFi drops out or short carrier drop) or if the laptop goes to sleep.
137 Upon reconnect, if the same Connection is again active, the previously
138 connected VPN should be activated again as well.  Basically, don't just drop
139 the VPN because WiFi choked for 10 seconds, but reconnect the VPN if it was
140 connected before the drop.
141
142
143 * VPN autoconnect
144
145 We should add a property to the NMSettingConnection object in
146 libnm-util/nm-setting-connection.c called "vpns" that is a string list,
147 containing a list of Connection UUIDs that should be activated when the base
148 connection itself is activated.  This will allow a VPN connection to be
149 started every time another connection is started, so that if you choose you're
150 always on the VPN in your favorite coffee shop.
151
152 The NM_DEVICE_STATE_SECONDARIES state was added specifically for cases like
153 this.  Thus, after the base device has IP connectivity, but before it has
154 signaled that it's fully activated, the device should enter the SECONDARIES
155 state and kick off activation of the given VPN connection.  Only after this
156 VPN connection has successfully connected should the base device to the
157 NM_DEVICE_STATE_ACTIVATED state.
158
159
160 * VPN and IPv6
161
162 The internal VPN capability should support IPv6.  Essentially, the D-Bus
163 interface between NetworkManager and the VPN service daemons should be extended
164 with an IP6Config signal that passes up the IPv6 addressing and routing details
165 if the VPN daemon is IPv6 capable.  NM should then process those details like it
166 does with IPv4.  include/NetworkManagerVPN.h should be updated with key/value
167 pairs defining the various IPv6 attributes much like the IPv4 ones are defined.
168
169
170 * VPN IP Methods
171
172 Some VPNs (openvpn with TAP for example) require that DHCP is run on a
173 pseudo-ethernet device to obtain addressing information.  This is not currently
174 possible, but NM already has all the code for DHCP.  Thus, a new "method"
175 key should be defined in include/NetworkManagerVPN.h to allow for DHCP to
176 be performed if the VPN service daemon requests it in the IP4Config or IP6Config
177 signals.  A patch here:
178
179 http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?h=vpn-ip-method
180
181 shows that.  In nm-vpn-connection.c, upon receipt of the D-Bus Ip4Config signal
182 from the VPN plugin, NetworkManager would inspect the "method" property of the
183 ip4 config dictionary.  If that property was present and set to "auto" then
184 DHCP would be started using the network interface returned in the dict.  The
185 nm_vpn_connection_ip4_config_get() function should be split up into two
186 functions, one containing the existing code for static configuration, and a
187 second for handling DHCP kickoff.  Minimal parsing of the response should be
188 handled in the newly reduced nm_vpn_connection_ip4_config_get() function.
189
190 To handle DHCP, the NMVPNConnectionPrivate structure should have two members
191 added:
192
193     NMDHCPManager *dhcp_manager;
194     NMDHCPClient  *dhcp4_client;
195
196 which would be initialized in the new DHCP handler code split off from
197 nm_vpn_connection_ip4_config_get().  These new members would be disposed of in
198 both vpn_cleanup() and dispose(), though remember to stop any ongoing DHCP
199 transaction when doing so (see dhcp4_cleanup() in nm-device.c for example code).
200 For basic code to start the DHCP transaction, see dhcp4_start() in nm-device.c
201 as well.  After calling nm_dhcp_manager_start_ip4() and connecting the signals
202 to monitor success and failure, the VPN IP4 config handler would simply return
203 without changing VPN state, unless a failure occurred.
204
205 Then, when the DHCP transaction succeeds, which we'd know by checking the
206 DHCP client state changes in the "state-changed" signal handler we attached to
207 the DHCP client object returned from nm_dhcp_manager_start_ip4(), the code
208 would retrieve the completed NMIP4Config object from the DHCP client using the
209 nm_dhcp_client_get_ip4_config() function, and then proceed to execute
210 essentially the bottom-half of the existing nm_vpn_connection_ip4_config_get()
211 function to merge that config with user overrides and apply it to the VPN
212 tunnel interface.  Other state changes from the DHCP client might trigger a
213 failure of the VPN connection, just like DHCP timeouts and lease-renewal
214 failures do for other devices (see dhcp_state_changed() in nm-device.c).
215
216
217 * WPS
218
219 wpa_supplicant has support for WPS (Wifi Protected Setup, basically Bluetooth-
220 like PIN codes for setting up a wifi connection) and we should add support for
221 this to NetworkManager too.  APs that support WPS will say so in their beacon
222 IEs which are contained in the "WPA" and "RSN" properties of the BSS object
223 exported by the supplicant, and can be processed in src/nm-wifi-ap.c's
224 foreach_property_cb() function.  We should add some private fields to the
225 NMAccessPoint object (defined in nm-wifi-ap.c) to remember whether a specific
226 AP supports WPS and what WPS methods it supports, and expose that over D-Bus to
227 GUI clients as well.
228
229 There are two common WPS setup methods: PIN and button.  For PIN, the router
230 either displays a random PIN on an LCD or the router's web UI, or a static PIN
231 is printed on the router itself.  The user enters that PIN instead of a PSK
232 when connecting.  For the "button" method, the router has a physical button that
233 when pushed, allows any client to connect for a short period of time.
234
235 We'll then need to add some properties to the NMSettingWirelessSecurity setting
236 for the WPS PIN code so that when the user enters it through the GUI, it can
237 be passed back to NM.  And we'll need to figure out some mechanism for passing
238 back an indication that the user pushed the button on the router for the
239 pushbutton method.
240
241 When connecting to a new access point that supports WPS, the GUI client would
242 call the AddAndActivateConnection method and wait for NM to request secrets.
243 NM would determine that the AP supports WPS, and request WPS secrets from the
244 applet.  The applet would ask the user for a PIN, or to push the button on the
245 AP, instead of asking for a passphrase or PSK.  When the user has entered the
246 PIN or pushed the button, the applet returns this information to NM, which
247 proceeds with the connection.
248
249 NM sends the correct wpa_supplicant config for WPS to the supplicant, and waits
250 for the connection to occur.  WPS can only be used the *first* time, so after a
251 first successfull connection, NM must request the actual hexadecimal PSK from 
252 wpa_supplicant via D-Bus, and store that PSK in the connection, clear any WPS
253 PIN code from the connection, and save the connection to backing storage.
254
255 Any applet GUI should also allow the user to enter the PSK instead of completing
256 association using WPS, since quite a few routers out there are broken, or
257 because the user has no physical access to the router itself, but has been given
258 as passphrase/PSK instead.
259
260
261 * Proxies
262
263 HTTP and other proxies are per-connection configuration.  It's highly unlikely
264 that the same proxy you need to use at work is used at home or in a coffee shop.
265 Thus, it makes sense that which proxy settings to use should be updated when
266 network connections change.  NetworkManager is a perfect place to do this since
267 it tracks which network connections are active, and it already queries the
268 network for automatic proxy configuration via DHCP and WPAD.
269
270 We should add a new NMSetting subclass called NMSettingProxy that holds
271 necessary proxy configuration.  The properties of this setting should be a
272 superset of what is provided in the Firefox proxy configuration screen and the
273 various desktop environment proxy configuration tools like the GNOME Network
274 Proxy control panel; this should include at a minimum:
275
276   method: "auto", "manual", "none"
277   default-proxy: string
278   default-proxy-port: uint
279   default-always: boolean (use default proxy for all protocols)
280   ssl-proxy: string
281   ssl-proxy-port: uint
282   ftp-proxy: string
283   ftp-proxy-port: uint
284   socks-proxy: string
285   socks-proxy-port: uint
286   socks-version: uint, either 4 or 5
287   no-proxy-for: array of strings (things not to use the proxy for, ie ".foobar.com",
288                  "192.168.0.1/24", an IPv6 address, etc)
289   pac-url: string (URL of PAC file, overrides DHCP-provided WPAD value)
290   (FIXME: proxy authentication?  do we need separate user/pass properties for
291     each protocol type?  should NM handle proxy auth or should it be punted
292     to each application?)
293
294 After completing IP configuration but still during the NM_DEVICE_STATE_IP_CONFIG
295 activation stage, NetworkManager would merge the automatically supplied proxy
296 configuration (from DHCP's WPAD option) with user-provided overrides from the
297 NMSettingProxy and send the results to the system.  The 'default' connection's
298 proxy configuration would be preferred, so we'd have to update proxy
299 configuration from nm-policy.c the same time we update DNS information and the
300 default route.
301
302 The merged proxy configuration would then be sent to the system.  There is no
303 canonical proxy daemon in-use, so we should have plugins (if not separate
304 shared libraries, then certainly encapsulated source files that implement a
305 common glib GInterface or are subclasses of eg a parent NMProxyHandler class)
306 that handle different system proxy handlers.  Some of the proxy handlers are:
307
308   libproxy: need to figure out how it gets proxy info and have NM write merged
309              proxy config out to that location
310   pacrunner: a D-Bus enabled daemon, NM would call D-Bus methods of the
311                pacrunner service with the proxy information
312   GNOME/KDE: how do these desktop environments retrieve proxy configuration?
313
314
315 * Bridging and Bonding Support
316
317 The largest complication here is that NetworkManager normally operates on
318 physical interfaces, while bridging and bonding involve tying multiple physical
319 interfaces together into a logical interface.  This has interesting implications
320 for the D-Bus API and the NM device model.  The first complication is that
321 we may need to do 802.1x port authentication on an interface before it can
322 communicate with the other side of the link, and those credentials may be
323 different for each interface; thus we may need to do separate 802.1x
324 operations on each interface that is part of a bridge/bond before adding each
325 one to the master bridge/bond interface.
326
327 In this way bridge/bond interfaces may be treated the same way as NetworkManager
328 treats VPN interfaces already; one or more physical interface NMConnections must
329 be activated before the master bridge/bond interface's NMConnection can be
330 activated, though this all happens internally.
331
332 To enable bridging and bonding in the NMConnection itself, we should create
333 new NMSettingBridge and NMSettingBond classes that contain information specific
334 to each.  Both settings would contain a 'components' property with an
335 'array of string' type which would contain the UUIDs of the Connections of
336 physical interfaces that compose the bridge or bond.  Thus NetworkManager would
337 have the necessary information to tie lower-level interface configuration
338 (802.1x, MTU, MAC address locking, duplex mode, speed, etc) to each physical
339 interface that will be part of the bridge/bond, configure the interface with
340 it, and then configure the master bridge/bond interface at upper layers using
341 configuration specific for the bridge/bond interface (like IP details).  Thus
342 for a single active bridge, two or more NMConnections would be activated; one
343 for each physical interface component of the bridge/bond, and one for the master
344 bridge/bond interface itself.
345
346 NMSettingBridge would contain at least the following keys:
347
348   components: (array of string) UUIDs of component connections
349   stp:        (boolean) on to enable STP, off to disable
350
351 NMSettingBond would contain at least the following keys:
352
353   components: (array of string) UUIDs of component connections
354   mode:       (string) one of "balance-rr", "active-backup", "balance-xor",
355                   "broadcast", "802.3ad", "balance-tlb", or "balance-alb"
356   monitor-interval: (uint) Specifies link monitoring interval (in milliseconds);
357                        NM will always enable netlink carrier monitoring if this
358                        value is non-zero so this property only affects speed and
359                        duplex checking
360
361 In the future we may consider adding other bonding parameters like "up-delay"
362 and "down-delay".
363
364 Then we'd add a 'component' (boolean) property to NMSettingConnection to
365 indicate that the component interface connections were in fact components of
366 a bridge or bond and shouldn't be automatically started by NetworkManager or
367 displayed as separate connections in the user interface.
368
369 TO BE CONTINUED