Merge ~morphis/snappy-hwe-snaps/+git/network-manager:feature/add-wowlan-documentation into ~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager:master

Proposed by Simon Fels
Status: Merged
Approved by: Alfonso Sanchez-Beato
Approved revision: 64ea63d4cabe13200932d0339a3a55c33f4f9b49
Merged at revision: ef41ac61f3c0ff6fe63c877bb10433693ffb5fd2
Proposed branch: ~morphis/snappy-hwe-snaps/+git/network-manager:feature/add-wowlan-documentation
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager:master
Diff against target: 294 lines (+209/-20)
6 files modified
README.md (+29/-11)
docs/index.md (+17/-0)
docs/metadata.yaml (+11/-0)
docs/reference/configuration/wowlan.md (+123/-0)
hooks/configure (+17/-5)
tests/main/wifi-wowlan-config-option/task.yaml (+12/-4)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Needs Fixing
Alfonso Sanchez-Beato Approve
Jim Hodapp (community) Approve
Tony Espy Pending
Review via email: mp+314913@code.launchpad.net

Description of the change

Add documentation for Wake-on-WLAN support

This introduces in repository documentation of the snap. This can be easily consumed by a larger documentation site based on the documentation builder (see http://github.com/CanonicalLtd/documentation-builder) to build a common Ubuntu Core snap stacks documentation platform.

This also adds support for all available configuration values NetworkManager provides via the snap wifi.wake-on-wlan option.

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Looking very nice Simon, some of your best English documentation I've seen you write yet. See the following changes inline below.

Also, what do you think about adding a section in the documentation that covers some simple examples on how to test the WoWLAN functionality from a client side? This could provide our future customers some great value.

review: Needs Fixing
Revision history for this message
Jim Hodapp (jhodapp) wrote :

A couple more issues found.

Revision history for this message
Jim Hodapp (jhodapp) :
Revision history for this message
Simon Fels (morphis) wrote :

Fixed all found issues. Also added a note about how a user can verify WoWLAN is correctly applied on the hardware/driver level.

Revision history for this message
Simon Fels (morphis) :
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Weird, I'm running 16.04 and only have snapd version 2.20:

jhodapp@smith:~/Projects/build-scripts$ snap --version
snap 2.20.1ubuntu1
snapd 2.20.1ubuntu1
series 16
ubuntu 16.04

Why would our versions differ? Doesn't snapd still come from a debian
package?

On Wed, Jan 18, 2017 at 5:40 AM, Simon Fels <email address hidden>
wrote:

>
>
> Diff comments:
>
> > diff --git a/README.md b/README.md
> > index 8b92863..968a93c 100644
> > --- a/README.md
> > +++ b/README.md
> > @@ -112,3 +101,32 @@ management service in the system.
> >
> > Depending on the nature of a test case the right test suite should be
> > picked.
> > +
> > +## Documentation
> > +
> > +All documentation is available in the docs/ subdirectory. It uses
> markdown
> > +and the documentation-builder (<https://github.com/
> CanonicalLtd/documentation-builder>)
> > +to generate HTML based documentation.
> > +
> > +To generate the HTML pages install the documentation build snap first
> > +
> > +```
> > + $ snap install documentation-build
> > + $ snap connect documentation-build:home core
>
> Works fine here on 16.04 and snapd 2.21
>
> $ sudo snap install documentation-builder
> documentation-builder 1.1.0 from 'nottrobin' installed
> $ sudo snap list | grep documentation-builder
> documentation-builder 1.1.0 23
> nottrobin -
> $ sudo snap interfaces | grep documentation-builder
> - documentation-builder:home
> $ sudo snap connect documentation-builder:home core
> $ snap --version
> snap 2.21
> snapd 2.21
> series 16
> ubuntu 16.04
>
> > +```
> > +
> > +then enter the docs/ subdirectory and run the builder
> > +
> > +```
> > + $ cd docs
> > + $ documentation-builder
> > +```
> > +
> > +It will generate all documentation as HTML in the a build/
> subdirectory. Open
> > +it via
> > +
> > +```
> > + $ google-chrome build/index.html
> > +```
> > +
> > +for example.
>
>
> --
> https://code.launchpad.net/~morphis/snappy-hwe-snaps/+git/
> network-manager/+merge/314913
> You are reviewing the proposed merge of ~morphis/snappy-hwe-snaps/+
> git/network-manager:feature/add-wowlan-documentation into
> ~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager:master.
>

Revision history for this message
Jim Hodapp (jhodapp) wrote :

One additional issue found.

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Simon Fels (morphis) wrote :

Normally snapd comes from a debian package but if you have SNAP_REEXEC set in your environment then will execute itself from the current core snap. But that doesn't seem to be the case here. Maybe remove the documentation-builder snap and installing it again helps. Otherwise try installing it with --devmode first.

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

LGTM

review: Approve
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

There are a couple of minor issues in the docs.

review: Needs Fixing
Revision history for this message
Simon Fels (morphis) :
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

LGTM

review: Approve
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/README.md b/README.md
2index 8b92863..5eac800 100644
3--- a/README.md
4+++ b/README.md
5@@ -6,17 +6,6 @@ This is the snap to package the NetworkManager management service.
6
7 All implemented hooks are stored inside the hooks directory.
8
9-As snapcraft has no support as of today (09/12/2016) to include
10-hooks in a snap this always needs to be done manually. For this
11-
12-$ snapcraft
13-$ cp -r hooks prime/meta/
14-$ snapcraft snap prime
15-
16-does the job. Please note that none of the snaps available from the
17-store will have these hooks included until snapcraft receives
18-support for hooks.
19-
20 ## Running tests
21
22 We have a set of spread (https://github.com/snapcore/spread) tests which
23@@ -112,3 +101,32 @@ management service in the system.
24
25 Depending on the nature of a test case the right test suite should be
26 picked.
27+
28+## Documentation
29+
30+All documentation is available in the docs/ subdirectory. It uses markdown
31+and the documentation-builder (<https://github.com/CanonicalLtd/documentation-builder>)
32+to generate HTML-based documentation.
33+
34+To generate the HTML pages install the documentation-builder snap first
35+
36+```
37+ $ snap install documentation-builder
38+ $ snap connect documentation-builder:home core
39+```
40+
41+then enter the docs/ subdirectory and run the builder
42+
43+```
44+ $ cd docs
45+ $ documentation-builder
46+```
47+
48+It will generate all documentation as HTML in the build/ subdirectory. Open
49+it via
50+
51+```
52+ $ google-chrome build/index.html
53+```
54+
55+for example.
56diff --git a/docs/index.md b/docs/index.md
57new file mode 100644
58index 0000000..4d539c6
59--- /dev/null
60+++ b/docs/index.md
61@@ -0,0 +1,17 @@
62+---
63+title: "NetworkManager"
64+table_of_contents: True
65+---
66+
67+# About NetworkManager
68+
69+NetworkManager is a system network service that manages your network
70+devices and connections, attempts to keep network connectivity active
71+when available. It manages ethernet, WiFi, mobile broadband (WWAN) and
72+PPPoE devices while also providing VPN integration with a variety of
73+different VPN serivces.
74+
75+## Upstream documentation
76+
77+Existing documentation from the upstream project can be found
78+[here](https://wiki.gnome.org/Projects/NetworkManager).
79diff --git a/docs/metadata.yaml b/docs/metadata.yaml
80new file mode 100644
81index 0000000..d04aaac
82--- /dev/null
83+++ b/docs/metadata.yaml
84@@ -0,0 +1,11 @@
85+navigation:
86+ - title: Introduction
87+ children:
88+ - title: About NetworkManager
89+ location: index.md
90+ - title: Reference
91+ children:
92+ - title: Configuration
93+ children:
94+ - title: Wake on WLAN
95+ location: reference/configuration/wowlan.md
96diff --git a/docs/reference/configuration/wowlan.md b/docs/reference/configuration/wowlan.md
97new file mode 100644
98index 0000000..29be8fc
99--- /dev/null
100+++ b/docs/reference/configuration/wowlan.md
101@@ -0,0 +1,123 @@
102+---
103+title: Wake on WLAN
104+table_of_contents: true
105+---
106+
107+# Wake on WLAN
108+
109+Wake on WLAN (called WoWLAN in the following) is a feature which allows a device
110+to be woken up from standby power states to faciliate device management. It is based
111+on the well established standard for Wake on LAN. The functionality is not entirely
112+equivalent to Wake on LAN and there are some limitations.
113+
114+The NetworkManager snap allows its users to configure one or more triggers to allow
115+the device it operates on to be woken up remotely.
116+
117+An important precondition for WoWLAN to work is that your kernel WiFi driver has
118+support for it.
119+
120+You can read more about the kernel side implementation on the following sites:
121+
122+ * <https://wireless.wiki.kernel.org/en/users/documentation/wowlan>
123+
124+## Enable Wake on WLAN Globally
125+
126+To allow users to enable or disable WoWLAN, the snap provides two configuration
127+options:
128+
129+ * **wifi.wake-on-wlan**
130+ * **wifi.wake-on-wlan-password**
131+
132+Both options can be set via the configuration API snap provide. See
133+<https://docs.ubuntu.com/core/en/guides/build-device/config-hooks> for more
134+details.
135+
136+Both configuration options will affect all wireless network devices. If you
137+want to change it just for a single wireless connection please have a look at
138+the chapter [Per Connection Configuration](#per-connection-configuration) below.
139+
140+
141+### wifi.wake-on-wlan
142+
143+This configuration option accepts the following values
144+
145+ * **disabled (default):** Wake on WLAN is disabled for all wireless network devices.
146+ * **any:** Wake on WLAN is enabled and any possible trigger will cause the system to wake up.
147+ * **disconnect:** If a connection to a station gets disconnected the device will be woken up.
148+ * **magic:** Wake on WLAN is enabled and only a received magic packet will cause the
149+ system to wake up. The magic packet has the same structure as the one
150+ used for Wake on LAN. For more details see <https://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet>
151+ The content of the magic packet can be extended with the
152+ wifi.wake-on-wlan-password option to require the client to send a
153+ specific byte sequence functioning as a password so that not anyone
154+ unpriviledged can wake up the system.
155+ * **gtk-rekey-failure:** A failure of a GTK rekey operation will cause the device to wake up.
156+ * **4way-handshake:** Reiteration of the 4way handshake will cause the device to wake up.
157+ * **rfkill-release:** Release of a rfkill will cause the device to wake up.
158+ * **tcp:** Any incoming TCP packet will cause the device to wake up.
159+
160+Example:
161+
162+```
163+ $ snap set network-manager wifi.wake-on-wlan=magic
164+```
165+
166+### wifi.wake-on-wlan-password
167+
168+This configuration option accepts a textual value. If specified, the value will
169+be used in addition to the wireless device MAC address to function as a password
170+that disallows unpriviledged actors to wake up the device.
171+
172+Example:
173+
174+```
175+ $ snap set network-manager wifi.wake-on-wlan-password=MyPassword
176+```
177+
178+## Per Connection Configuration
179+
180+To configure WoWLAN per connection you have to use the *nmcli* utility which comes
181+with the NetworkManager snap. It allows you to configure the same two options
182+as the snap accepts. However, the *wifi.wake-on-wlan* option takes a numeric value
183+instead of a textual one.
184+
185+The *wifi.wake-on-wlan* option accepts the following values (see above for a detailed
186+description of each value)
187+
188+ * **0:** disabled
189+ * **1:** Use global default configuration
190+ * **2:** any
191+ * **4:** disconnect
192+ * **8:** magic
193+ * **16:** gtk-rekey-failure
194+ * **32:** 4way-handshake
195+ * **128:** rfkill-release
196+ * **256:** tcp
197+
198+The *wifi.wake-on-wlan-password* option accepts the same values as the snap
199+configuration option.
200+
201+Example:
202+
203+```
204+ $ nmcli c modify my-connection wifi.wake-on-wlan 2
205+ $ nmcli c modify my-connection wifi.wake-on-wlan-password Test1234
206+```
207+
208+## Verify WoWLAN Configuration
209+
210+NetworkManager will use the kernel to configure WoWLAN on the hardware level.
211+The *iw* utility provides a simple way to verify the right option is configured.
212+
213+If you don't have the *iw* utility on your system you can install it with the
214+*wireless-tools* snap.
215+
216+```
217+ $ snap install --devmode wireless-tools
218+ $ sudo wireless-tools.iw phy phy0 wowlan show
219+ WoWLAN is enabled:
220+ * wake up on magic packet
221+```
222+
223+See the help output of the *iw* command for more documentation and available
224+options.
225diff --git a/hooks/configure b/hooks/configure
226index 60b33d2..711ff60 100755
227--- a/hooks/configure
228+++ b/hooks/configure
229@@ -34,17 +34,29 @@ switch_wifi_wake_on_wlan() {
230 disabled)
231 value=0
232 ;;
233- global)
234- value=1
235- ;;
236 any)
237 value=2
238 ;;
239+ disconnect)
240+ value=4
241+ ;;
242 magic)
243 value=8
244 ;;
245- all)
246- value=510
247+ gtk-rekey-failure)
248+ value=16
249+ ;;
250+ eap-identity-request)
251+ value=32
252+ ;;
253+ 4way-handshake)
254+ value=64
255+ ;;
256+ rfkill-release)
257+ value=128
258+ ;;
259+ tcp)
260+ value=256
261 ;;
262 *)
263 echo "ERROR: Invalid value provided for wifi.wake-on-wlan"
264diff --git a/tests/main/wifi-wowlan-config-option/task.yaml b/tests/main/wifi-wowlan-config-option/task.yaml
265index f5b59ce..bb34a01 100644
266--- a/tests/main/wifi-wowlan-config-option/task.yaml
267+++ b/tests/main/wifi-wowlan-config-option/task.yaml
268@@ -30,14 +30,22 @@ execute: |
269 # Test all other possible keys for the wifi.wake-on-wlan option
270 snap set network-manager wifi.wake-on-wlan=disabled
271 grep "^wifi.wake-on-wlan=0$" $WIFI_WOWL_CONF_PATH
272- snap set network-manager wifi.wake-on-wlan=global
273- grep "^wifi.wake-on-wlan=1$" $WIFI_WOWL_CONF_PATH
274 snap set network-manager wifi.wake-on-wlan=any
275 grep "^wifi.wake-on-wlan=2$" $WIFI_WOWL_CONF_PATH
276+ snap set network-manager wifi.wake-on-wlan=disconnect
277+ grep "^wifi.wake-on-wlan=4$" $WIFI_WOWL_CONF_PATH
278 snap set network-manager wifi.wake-on-wlan=magic
279 grep "^wifi.wake-on-wlan=8$" $WIFI_WOWL_CONF_PATH
280- snap set network-manager wifi.wake-on-wlan=all
281- grep "^wifi.wake-on-wlan=510$" $WIFI_WOWL_CONF_PATH
282+ snap set network-manager wifi.wake-on-wlan=gtk-rekey-failure
283+ grep "^wifi.wake-on-wlan=16$" $WIFI_WOWL_CONF_PATH
284+ snap set network-manager wifi.wake-on-wlan=eap-identity-request
285+ grep "^wifi.wake-on-wlan=32$" $WIFI_WOWL_CONF_PATH
286+ snap set network-manager wifi.wake-on-wlan=4way-handshake
287+ grep "^wifi.wake-on-wlan=64$" $WIFI_WOWL_CONF_PATH
288+ snap set network-manager wifi.wake-on-wlan=rfkill-release
289+ grep "^wifi.wake-on-wlan=128$" $WIFI_WOWL_CONF_PATH
290+ snap set network-manager wifi.wake-on-wlan=tcp
291+ grep "^wifi.wake-on-wlan=256$" $WIFI_WOWL_CONF_PATH
292
293 # Not setting any concrete value should remove the configuration
294 snap set network-manager wifi.wake-on-wlan-password=

Subscribers

People subscribed via source and target branches