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
diff --git a/README.md b/README.md
index 8b92863..5eac800 100644
--- a/README.md
+++ b/README.md
@@ -6,17 +6,6 @@ This is the snap to package the NetworkManager management service.
66
7All implemented hooks are stored inside the hooks directory.7All implemented hooks are stored inside the hooks directory.
88
9As snapcraft has no support as of today (09/12/2016) to include
10hooks 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
16does the job. Please note that none of the snaps available from the
17store will have these hooks included until snapcraft receives
18support for hooks.
19
20## Running tests9## Running tests
2110
22We have a set of spread (https://github.com/snapcore/spread) tests which11We have a set of spread (https://github.com/snapcore/spread) tests which
@@ -112,3 +101,32 @@ management service in the system.
112101
113Depending on the nature of a test case the right test suite should be102Depending on the nature of a test case the right test suite should be
114picked.103picked.
104
105## Documentation
106
107All documentation is available in the docs/ subdirectory. It uses markdown
108and the documentation-builder (<https://github.com/CanonicalLtd/documentation-builder>)
109to generate HTML-based documentation.
110
111To generate the HTML pages install the documentation-builder snap first
112
113```
114 $ snap install documentation-builder
115 $ snap connect documentation-builder:home core
116```
117
118then enter the docs/ subdirectory and run the builder
119
120```
121 $ cd docs
122 $ documentation-builder
123```
124
125It will generate all documentation as HTML in the build/ subdirectory. Open
126it via
127
128```
129 $ google-chrome build/index.html
130```
131
132for example.
diff --git a/docs/index.md b/docs/index.md
115new file mode 100644133new file mode 100644
index 0000000..4d539c6
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,17 @@
1---
2title: "NetworkManager"
3table_of_contents: True
4---
5
6# About NetworkManager
7
8NetworkManager is a system network service that manages your network
9devices and connections, attempts to keep network connectivity active
10when available. It manages ethernet, WiFi, mobile broadband (WWAN) and
11PPPoE devices while also providing VPN integration with a variety of
12different VPN serivces.
13
14## Upstream documentation
15
16Existing documentation from the upstream project can be found
17[here](https://wiki.gnome.org/Projects/NetworkManager).
diff --git a/docs/metadata.yaml b/docs/metadata.yaml
0new file mode 10064418new file mode 100644
index 0000000..d04aaac
--- /dev/null
+++ b/docs/metadata.yaml
@@ -0,0 +1,11 @@
1navigation:
2 - title: Introduction
3 children:
4 - title: About NetworkManager
5 location: index.md
6 - title: Reference
7 children:
8 - title: Configuration
9 children:
10 - title: Wake on WLAN
11 location: reference/configuration/wowlan.md
diff --git a/docs/reference/configuration/wowlan.md b/docs/reference/configuration/wowlan.md
0new file mode 10064412new file mode 100644
index 0000000..29be8fc
--- /dev/null
+++ b/docs/reference/configuration/wowlan.md
@@ -0,0 +1,123 @@
1---
2title: Wake on WLAN
3table_of_contents: true
4---
5
6# Wake on WLAN
7
8Wake on WLAN (called WoWLAN in the following) is a feature which allows a device
9to be woken up from standby power states to faciliate device management. It is based
10on the well established standard for Wake on LAN. The functionality is not entirely
11equivalent to Wake on LAN and there are some limitations.
12
13The NetworkManager snap allows its users to configure one or more triggers to allow
14the device it operates on to be woken up remotely.
15
16An important precondition for WoWLAN to work is that your kernel WiFi driver has
17support for it.
18
19You can read more about the kernel side implementation on the following sites:
20
21 * <https://wireless.wiki.kernel.org/en/users/documentation/wowlan>
22
23## Enable Wake on WLAN Globally
24
25To allow users to enable or disable WoWLAN, the snap provides two configuration
26options:
27
28 * **wifi.wake-on-wlan**
29 * **wifi.wake-on-wlan-password**
30
31Both options can be set via the configuration API snap provide. See
32<https://docs.ubuntu.com/core/en/guides/build-device/config-hooks> for more
33details.
34
35Both configuration options will affect all wireless network devices. If you
36want to change it just for a single wireless connection please have a look at
37the chapter [Per Connection Configuration](#per-connection-configuration) below.
38
39
40### wifi.wake-on-wlan
41
42This configuration option accepts the following values
43
44 * **disabled (default):** Wake on WLAN is disabled for all wireless network devices.
45 * **any:** Wake on WLAN is enabled and any possible trigger will cause the system to wake up.
46 * **disconnect:** If a connection to a station gets disconnected the device will be woken up.
47 * **magic:** Wake on WLAN is enabled and only a received magic packet will cause the
48 system to wake up. The magic packet has the same structure as the one
49 used for Wake on LAN. For more details see <https://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet>
50 The content of the magic packet can be extended with the
51 wifi.wake-on-wlan-password option to require the client to send a
52 specific byte sequence functioning as a password so that not anyone
53 unpriviledged can wake up the system.
54 * **gtk-rekey-failure:** A failure of a GTK rekey operation will cause the device to wake up.
55 * **4way-handshake:** Reiteration of the 4way handshake will cause the device to wake up.
56 * **rfkill-release:** Release of a rfkill will cause the device to wake up.
57 * **tcp:** Any incoming TCP packet will cause the device to wake up.
58
59Example:
60
61```
62 $ snap set network-manager wifi.wake-on-wlan=magic
63```
64
65### wifi.wake-on-wlan-password
66
67This configuration option accepts a textual value. If specified, the value will
68be used in addition to the wireless device MAC address to function as a password
69that disallows unpriviledged actors to wake up the device.
70
71Example:
72
73```
74 $ snap set network-manager wifi.wake-on-wlan-password=MyPassword
75```
76
77## Per Connection Configuration
78
79To configure WoWLAN per connection you have to use the *nmcli* utility which comes
80with the NetworkManager snap. It allows you to configure the same two options
81as the snap accepts. However, the *wifi.wake-on-wlan* option takes a numeric value
82instead of a textual one.
83
84The *wifi.wake-on-wlan* option accepts the following values (see above for a detailed
85description of each value)
86
87 * **0:** disabled
88 * **1:** Use global default configuration
89 * **2:** any
90 * **4:** disconnect
91 * **8:** magic
92 * **16:** gtk-rekey-failure
93 * **32:** 4way-handshake
94 * **128:** rfkill-release
95 * **256:** tcp
96
97The *wifi.wake-on-wlan-password* option accepts the same values as the snap
98configuration option.
99
100Example:
101
102```
103 $ nmcli c modify my-connection wifi.wake-on-wlan 2
104 $ nmcli c modify my-connection wifi.wake-on-wlan-password Test1234
105```
106
107## Verify WoWLAN Configuration
108
109NetworkManager will use the kernel to configure WoWLAN on the hardware level.
110The *iw* utility provides a simple way to verify the right option is configured.
111
112If you don't have the *iw* utility on your system you can install it with the
113*wireless-tools* snap.
114
115```
116 $ snap install --devmode wireless-tools
117 $ sudo wireless-tools.iw phy phy0 wowlan show
118 WoWLAN is enabled:
119 * wake up on magic packet
120```
121
122See the help output of the *iw* command for more documentation and available
123options.
diff --git a/hooks/configure b/hooks/configure
index 60b33d2..711ff60 100755
--- a/hooks/configure
+++ b/hooks/configure
@@ -34,17 +34,29 @@ switch_wifi_wake_on_wlan() {
34 disabled)34 disabled)
35 value=035 value=0
36 ;;36 ;;
37 global)
38 value=1
39 ;;
40 any)37 any)
41 value=238 value=2
42 ;;39 ;;
40 disconnect)
41 value=4
42 ;;
43 magic)43 magic)
44 value=844 value=8
45 ;;45 ;;
46 all)46 gtk-rekey-failure)
47 value=51047 value=16
48 ;;
49 eap-identity-request)
50 value=32
51 ;;
52 4way-handshake)
53 value=64
54 ;;
55 rfkill-release)
56 value=128
57 ;;
58 tcp)
59 value=256
48 ;;60 ;;
49 *)61 *)
50 echo "ERROR: Invalid value provided for wifi.wake-on-wlan"62 echo "ERROR: Invalid value provided for wifi.wake-on-wlan"
diff --git a/tests/main/wifi-wowlan-config-option/task.yaml b/tests/main/wifi-wowlan-config-option/task.yaml
index f5b59ce..bb34a01 100644
--- a/tests/main/wifi-wowlan-config-option/task.yaml
+++ b/tests/main/wifi-wowlan-config-option/task.yaml
@@ -30,14 +30,22 @@ execute: |
30 # Test all other possible keys for the wifi.wake-on-wlan option30 # Test all other possible keys for the wifi.wake-on-wlan option
31 snap set network-manager wifi.wake-on-wlan=disabled31 snap set network-manager wifi.wake-on-wlan=disabled
32 grep "^wifi.wake-on-wlan=0$" $WIFI_WOWL_CONF_PATH32 grep "^wifi.wake-on-wlan=0$" $WIFI_WOWL_CONF_PATH
33 snap set network-manager wifi.wake-on-wlan=global
34 grep "^wifi.wake-on-wlan=1$" $WIFI_WOWL_CONF_PATH
35 snap set network-manager wifi.wake-on-wlan=any33 snap set network-manager wifi.wake-on-wlan=any
36 grep "^wifi.wake-on-wlan=2$" $WIFI_WOWL_CONF_PATH34 grep "^wifi.wake-on-wlan=2$" $WIFI_WOWL_CONF_PATH
35 snap set network-manager wifi.wake-on-wlan=disconnect
36 grep "^wifi.wake-on-wlan=4$" $WIFI_WOWL_CONF_PATH
37 snap set network-manager wifi.wake-on-wlan=magic37 snap set network-manager wifi.wake-on-wlan=magic
38 grep "^wifi.wake-on-wlan=8$" $WIFI_WOWL_CONF_PATH38 grep "^wifi.wake-on-wlan=8$" $WIFI_WOWL_CONF_PATH
39 snap set network-manager wifi.wake-on-wlan=all39 snap set network-manager wifi.wake-on-wlan=gtk-rekey-failure
40 grep "^wifi.wake-on-wlan=510$" $WIFI_WOWL_CONF_PATH40 grep "^wifi.wake-on-wlan=16$" $WIFI_WOWL_CONF_PATH
41 snap set network-manager wifi.wake-on-wlan=eap-identity-request
42 grep "^wifi.wake-on-wlan=32$" $WIFI_WOWL_CONF_PATH
43 snap set network-manager wifi.wake-on-wlan=4way-handshake
44 grep "^wifi.wake-on-wlan=64$" $WIFI_WOWL_CONF_PATH
45 snap set network-manager wifi.wake-on-wlan=rfkill-release
46 grep "^wifi.wake-on-wlan=128$" $WIFI_WOWL_CONF_PATH
47 snap set network-manager wifi.wake-on-wlan=tcp
48 grep "^wifi.wake-on-wlan=256$" $WIFI_WOWL_CONF_PATH
4149
42 # Not setting any concrete value should remove the configuration50 # Not setting any concrete value should remove the configuration
43 snap set network-manager wifi.wake-on-wlan-password=51 snap set network-manager wifi.wake-on-wlan-password=

Subscribers

People subscribed via source and target branches