23 Commits

Author SHA1 Message Date
AmadeusGhost
50d57a982c treewide: use upstream caldata script 2021-01-30 12:18:02 +08:00
AmadeusGhost
ead018693c Merge Mainline 2020-10-13 19:00:16 +08:00
Adrian Schmutzler
2dc590d630 base-files: source functions.sh in /lib/functions/system.sh
The file /lib/functions/system.sh depends on find_mtd_index() and
find_mtd_part() located in /lib/function.sh, so let's source that
file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:54:18 +08:00
Rosen Penev
e2aef72220 base-files/system.sh: remove $ in $(())
Not needed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-13 18:53:58 +08:00
Adrian Schmutzler
1398716680 base-files: don't store label MAC address in uci system config
If set, label MAC address is available from one of two sources,
device tree or board.json. So far, the function get_mac_label
was meant for retrieving the address, while an option in uci
system config was specified only for case 2 (board.json).

The uci config option has several drawbacks:
- it is only used for a fraction of devices (those not in DT)
- label MAC address is a device property, while config implies
  user interaction
- label_macaddr option will only be set if /etc/config/system
  does not exist (i.e. only for new installations)

Thus, this patch changes the behavior of get_mac_label:
Instead of writing the value in board.json to uci system config
and reading from this location afterwards, get_mac_label now
extracts data from board.json directly. The uci config option
won't be used anymore.
In addition, two utility functions for extraction only from DT
or from board.json are introduced.

Since this is only changing the access to the label MAC address, it
won't interfere with the addresses stored in the code base so far.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:52:50 +08:00
Adrian Schmutzler
a34c043890 base-files: provide option to specify label MAC address in board.d
For many devices, MAC addresses cannot be retrieved via the
device tree alias.

To still provide the label MAC address for those, this implements
a second mechanism that will put the address into uci config.
Note that this stores the actual MAC address, whereas in DTS
we reference the bearing device.

This is based on the work of Rosy Song <rosysong@rosinson.com>

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:52:23 +08:00
Adrian Schmutzler
ba5180c747 base-files: add function to retrieve label MAC address
To refer to the MAC address on a device's label, one can
specify the alias label-mac-device in the DTS which should
point to the bearer of the corresponding MAC address.

With the function get_mac_label, the user can retrieve then
retrieve this address and use it as a value that uniquely
identifies his device.

This is severely helpful for several downstream functionalities,
e.g. define MAC addresses of custom netifs or change the SSID to
be easily recognizable.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:52:00 +08:00
Adrian Schmutzler
c1b72b8178 base-files: use get_mac_binary() in mtd_get_mac_binary_ubi()
The actual retrieval of the MAC address in mtd_get_mac_binary_ubi()
is the same as in get_mac_binary(). Thus, use the latter function
in the former to reduce duplicate code.

This will also allow to benefit from the enhanced path check there
and bring mtd_get_mac_binary_ubi() more in line with the similar
mtd_get_mac_binary().

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:51:31 +08:00
Adrian Schmutzler
c731bccc2a base-files: Fix path check in get_mac_binary
Logic was inverted when changing from string check to file check.
Fix it.

Fixes: 8592602d0a88 ("base-files: Really check path in get_mac_binary")
Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:51:10 +08:00
Adrian Schmutzler
dd5236d4b7 base-files: Really check path in get_mac_binary
Currently, path argument is only checked for being not empty.

This changes behavior to actually check whether path exists.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:50:47 +08:00
David Bauer
f11241f0fc
base-files: add function for generating random MAC
This adds a function for generating a valid random MAC address (unset MC
bit / set locally administered bit).

It is necessary for devices which do not have a MAC address programmed
by the manufacturer.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-07-18 13:25:37 +08:00
CN_SZTL
5893c0d03c
Merge Lean's source 2020-02-03 14:13:23 +08:00
coolsnowwolf
ecea39f109 Revert "files: sync from openwrt v19.07 (#2690)"
This reverts commit 2289184a623c4da882a376abb649969dee73654f.
2020-02-03 12:33:25 +08:00
CN_SZTL
e6abd4e3ba
Merge Lean's source 2020-02-01 17:10:56 +08:00
AmadeusGhost
2289184a62
files: sync from openwrt v19.07 (#2690) 2020-02-01 16:50:37 +08:00
CN_SZTL
92e3440682
Revert "base-files: update"
This reverts commit 468c38afbf472940f4e3cdac41dc03674c7852a9.
2019-11-24 01:27:26 +08:00
CN_SZTL
468c38afbf
base-files: update 2019-11-23 18:21:44 +08:00
CN_SZTL
38864eaeb6
Revert "base-files: update"
This reverts commit d88d3ca89a9ab431ec9c25077be2fe96aaba1499.
2019-11-07 11:43:47 +08:00
CN_SZTL
d88d3ca89a
base-files: update 2019-11-07 11:41:06 +08:00
CN_SZTL
ce8ed9121b
add luci-app-haproxy & luci-app-udpspeederv2 2019-05-25 21:05:51 +08:00
coolsnowwolf
806f5db174 sync with OpenWrt trunk 2018-09-07 13:43:55 +08:00
coolsnowwolf
8fe0636b8a Merge branch 'master' of github.com:lede-project/source 2018-04-23 18:50:49 +08:00
coolsnowwolf
97a4ffcc12 update source 2017-09-06 19:19:45 +08:00