Compare commits

..

47 Commits

Author SHA1 Message Date
Jo-Philipp Wich
03b693064b OpenWrt v18.06.0: adjust config defaults
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-30 18:30:59 +02:00
Jo-Philipp Wich
b0b5c64c22 Revert "ar71xx: define switch for rb-952ui-5ac2nd"
This reverts commit 3442ec5d57.

The device behaviour is reportedly erratic so let's not take chances and
leave this out for now.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-30 18:25:17 +02:00
Thibaut VARÈNE
3442ec5d57 ar71xx: define switch for rb-952ui-5ac2nd
QCA9533 built-in switch can be configured

Tested-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
(cherry picked from commit 0e43c31ebde996ca88f5857bb7e6c4cbf3f65756)
2018-07-30 18:14:17 +02:00
Paul Spooren
f4798d37f1 imagebuilder: add function to show manifest
Tested with 18.06.0-rc2/ar71xx/generic/tl-wdr4300-v1, image & list

This PR is based on the work of @fewckert[1] with slight improvements.

Add function `manifest` to show the manifest of the produced image,
before actually building it. The manifest contains an orderd list of
package name and version.

This is usefull to check package dependencies but also determine a
unique and reproducible image name before building the package. The
sysupgrade server[2] builds images on request with individual package
selection. To distignish between created images which contain differnt
packages, the EXTRA_IMAGE_NAME is set to a shortend hash of the
manifest's content. So far the image was renamed afterwards as the
manifests content was unknown, however this corrupts the signed
sha256sums. This patch allows a clean solution as to dtermine the
manifest in advance and set the EXTRA_IMAGE_NAME accordingly.

[1]: https://github.com/lede-project/source/pull/1591
[2]: https://github.com/aparcar/attendedsysupgrade-server

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry-picked from commit 869b0d11db)
2018-07-30 16:33:57 +02:00
张鹏
a3dd6c939d ar71xx:add support for E750G v8
Qxwlan E750G v8 is based on Qualcomm QCA9344.

Specification:

 - 560/450/225 MHz (CPU/DDR/AHB)
 - 128 MB of RAM (DDR2)
 - 8/16 MB of FLASH (SPI NOR)
 - 2T2R 2.4G GHz (AR9344)
 - 2x 10/100 Mbps Ethernet (PoE support)
 - 2x 10/100/1000 Mbps Ethernet
 - 7x LED (6 driven by GPIO)
 - 1x button (reset)
 - 1x DC jack for main power input (9-48 V)
 - UART (J23) and LEDs (J2) headers on PCB

Flash instruction (using U-Boot CLI and tftp server):

 - Configure PC with static IP 192.168.1.10 and tftp server.
 - Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
 - Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
 - Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

 - Configure PC with static IP 192.168.1.xxx(2-254)/24.
 - Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
 - Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: 张鹏 <sd20@qxwlan.com>
(cherry picked from commit 53a4502013)
2018-07-30 14:02:41 +02:00
张鹏
11a5128b98 ar71xx:add support for E750A v4
Qxwlan E750A v4 is based on Qualcomm QCA9344.

Specification:

 - 560/450/225 MHz (CPU/DDR/AHB)
 - 128 MB of RAM (DDR2)
 - 8/16 MB of FLASH (SPI NOR)
 - 2T2R 5G GHz (AR9344)
 - 2x 10/100 Mbps Ethernet (one port with PoE support)
 - 1x miniPCIe slot (USB 2.0 bus only)
 - 7x LED (6 driven by GPIO)
 - 1x button (reset)
 - 1x DC jack for main power input (9-48 V)
 - UART (J23) and LEDs (J2) headers on PCB

Flash instruction (using U-Boot CLI and tftp server):

 - Configure PC with static IP 192.168.1.10 and tftp server.
 - Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
 - Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
 - Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

 - Configure PC with static IP 192.168.1.xxx(2-254)/24.
 - Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
 - Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: 张鹏 <sd20@qxwlan.com>
(cherry picked from commit ac03d51a3f)
2018-07-30 14:02:40 +02:00
张鹏
21ad5fb1ea ar71xx:add support for E558 v2
Qxwlan E558 v2 is based on Qualcomm QCA9558 + AR8327.

Specification:

 - 720/600/200 MHz (CPU/DDR/AHB)
 - 128 MB of RAM (DDR2)
 - 8/16 MB of FLASH (SPI NOR)
 - 2T2R 2.4 GHz (QCA9558)
 - 3x 10/100/1000 Mbps Ethernet (one port with PoE support)
 - 4x miniPCIe slot (USB 2.0 bus only)
 - 1x microSIM slot
 - 5x LED (4 driven by GPIO)
 - 1x button (reset)
 - 1x 3-pos switch
 - 1x DC jack for main power input (9-48 V)
 - UART (JP5) and LEDs (J8) headers on PCB

Flash instruction (using U-Boot CLI and tftp server):

 - Configure PC with static IP 192.168.1.10 and tftp server.
 - Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
 - Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
 - Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

 - Configure PC with static IP 192.168.1.xxx(2-254)/24.
 - Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
 - Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: 张鹏 <sd20@qxwlan.com>
(cherry picked from commit b74f63f81d)
2018-07-30 14:02:40 +02:00
Christian Lamparter
4dc0ff8183 brcm2708: split sdcard.img.gz into a sysupgrade and factory image
@vahid-dan reported a issue with extracting the rpi images with
Gnome's Archive Manager:
"Ubuntu Archive Manager cannot extract the file and it just
throws a general error message: "An error occurred while
extracting files".
<https://forum.lede-project.org/t/corrupted-pre-built-v18-06-0-rc2-image-for-rpi>

@blogic told me to split the single sdcard.img.gz for the RPi
into a sysupgrade and a factory image for all brcm2708 targets.
The factory images will have no metadata attached, this way
these utilities that can't deal with the attached metadata will
not fail for no reason.

Cc: John Crispin <john@phrozen.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
(cherry picked from commit 7516a96011)
2018-07-30 14:00:59 +02:00
Jo-Philipp Wich
f24e012997 base-files: network.sh: gracefully handle missing network.interface ubus ns
When attempting to use any of the functions in network.sh while netifd is
not started yet, the ubus interface dump query will fail with "Not found",
yielding an empty response.

Subsequently, jsonfilter is invoked with an empty string instead of a valid
JSON document, causing it to emit a second "unexpected end of data" error.

This caused the dnsmasq init script to log the following errors during
early boot on some systems:

    procd: /etc/rc.d/S19dnsmasq: Command failed: Not found.
    procd: /etc/rc.d/S19dnsmasq: Failed to parse json data: unexpected end of data.

Fix the issue by allowing the ubus query to fail with "Not found" but still
logging other failures, and by passing an empty JSON object to jsonfilter
if the interface status cache is empty.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-30 13:19:19 +02:00
Nick Hainke
d4a4f06589 iwinfo: update to version 2018-07-24
Update to new iwinfo version.
Adds support for channel survey.
Adds ubus support.
Etc.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 296ae7ab89)
2018-07-30 11:21:25 +02:00
John Crispin
4a39d8cfd0 iwinfo: bump to latest git HEAD
e59f925 hardware: add device ids for QCA9984, 88W8887 and 88W8964 radios
2a82f87 nl80211: back out early when receiving FAIL-BUSY reply
77c32f0 nl80211: fix code calculating average signal and rate

Signed-off-by: John Crispin <john@phrozen.org>
(cherry picked from commit 20b76c0a5b)
2018-07-30 11:21:24 +02:00
Thibaut VARÈNE
cb73dd21a3 ar71xx: rbspi: fix RB wAP AC gpio conflict and LED
e15c63a375 introduced code that was trying
to register GPIO 1 as both an LED and a button. The OEM source makes it
clear that LED1 is not wired to the SoC GPIOs. GPIO 1 is the reset button.

Furthermore the (green) power led default state should also be defined,
(matching OEM source), and it should be used by diag.sh since it's
currently the only software-controllable LED.

This patch fixes these issues and renames the corresponding #defines for
clarity

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
(cherry picked from commit e99f760235)
2018-07-30 11:12:41 +02:00
Thibaut VARÈNE
bb06f6d3ba ar71xx: add missing diag LED support for RB wAP 2nD
3b15eb06c3 did not include diag.sh
edit

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
(cherry picked from commit 5c2419b6f8)
2018-07-30 11:12:41 +02:00
Jo-Philipp Wich
c8e8ff1c9f brcm47xx: rework model detection
On brcm47xx boards, the model ID is the combination of the "boardtype" nvram
variable and an optional supplemental "boardnum" variable while the human
readable model name is usually exposed in the "machine" field of the
/proc/cpuinfo file.

Move the extraction of the board nvram variables and model name string into
the 01_sysinfo file and rework the 01_detect board configuration script to
solely use the prepared sysinfo values without performing own detection
logic.

As a consequence, we can drop the ucidef_set_board_id() and
ucidef_set_model_name() invocations in favor to the generic behaviour
which copies the /tmp/sysinfo/{board_name,model} values into the board.json
"id" and "name" fields respectively.

Since "01_detect" only contains network configuration logic after this
change, move it to "01_network" and rename the contained "detect_by_xxx"
functions to "configure_by_xxx" instead, to avoid potential confusion.

Fixes FS#1576
Acked-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>

(cherry picked from commit d7d10f2c1e)
2018-07-30 11:11:21 +02:00
Rafał Miłecki
ca0c649a38 bcm53xx: revert SPI controller commit breaking flash reads
That upstream commit caused instability in flash reads. It was reported
but there isn't any proper fix as for now.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 0417b08b06)
2018-07-29 11:10:03 +02:00
Kevin Darbyshire-Bryant
cf5a892430 dnsmasq: bump to dnsmasq v2.80test3
Refresh patches

Upstream commits since last bump:

3b6eb19 Log DNSSEC trust anchors at startup.
f3e5787 Trivial comment change.
c851c69 Log failure to confirm an address in DHCPv6.
a3bd7e7 Fix missing fatal errors when parsing some command-line/config options.
ab5ceaf Document the --help option in the french manual
1f2f69d Fix recurrent minor spelling mistake in french manual
f361b39 Fix some mistakes in french translation of the manual
eb1fe15 When replacing cache entries, preserve CNAMES which target them.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit 1e93ef8498)
2018-07-28 11:23:58 +01:00
Hans Dedecker
bf1b0fad2b dnsmasq: don't use network functions at boottime (FS#1542)
As dnsmasq is started earlier than netifd usage of network.sh functions
at boottime will fail; therefore don't call at boottime the functions
which construct the dhcp pool/relay info.
As interface triggers are installed the dhcp pool/relay info will be
constructed when the interface gets reported as up by netifd.
At the same time also register interface triggers based on DHCP relay
config.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
(cherry picked from commit 2336b942b3)
2018-07-28 11:23:57 +01:00
Kevin Darbyshire-Bryant
cb9d5f0a7c dnsmasq: bump to latest patches on 2.80rc2
Refresh patches and backport upstream to current HEAD:

a997ca0 Fix sometimes missing DNSSEC RRs when DNSSEC validation not enabled.
51e4eee Fix address-dependent domains for IPv6.
05ff659 Fix stupid infinite loop introduced by preceding commit.
db0f488 Handle some corner cases in RA contructed interfaces with addresses changing interface.
7dcca6c Warn about the impact of cache-size on performance.
090856c Allow zone transfer in authoritative mode whenever auth-peer is specified.
cc5cc8f Sane error message when pcap file header is wrong.
c488b68 Handle standard and contructed dhcp-ranges on the same interface.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit fbf475403b)
2018-07-28 11:23:57 +01:00
Rafał Miłecki
962e86d9af brcm47xx: revert upstream commit breaking BCM4718A1
This fixes kernel hang when booting on BCM4718A1 (& probably BCM4717A1).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 4c1aa64b4d)
2018-07-27 16:00:31 +02:00
Rafał Miłecki
29aab93ea2 mac80211: backport brcmfmac fixes & debugging helpers from 4.18
The most important is probably regression fix in handling platform
NVRAM. That bug stopped hardware from being properly calibrated breaking
e.g. 5 GHz for Netgear R8000.

Other than that it triggers memory dumps when experiencing firmware
problems which is important for debugging purposes.

Fixes: 2811c97803 ("mac80211: backport brcmfmac firmware & clm_blob loading rework")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit b26214adb5)
2018-07-27 08:14:13 +02:00
Jo-Philipp Wich
4e7f4777b0 odhcpd: update to latest git HEAD
Changes:

  81a281e dhcpv6-ia: fix border assignment size setting
  a2ffc59 dhcpv6-ia: fix status code for not on link IAs
  5b087a6 dhcpv6-ia: improve error checking in assign_pd()
  c9114a1 config: fix wrong assignment
  bb8470f dhcpv4: delay forced renew transaction start
  62a1b09 dhcpv4: fix DHCP address space logic
  d5726ff dhcpv4: improve logging when sending DHCP messages
  9484351 odhcpd: call handle_error when socket error can be retrieved
  c45e2eb dhcpv6: fix out of bounds write in handle_nested_message()
  c2ff5af dhcpv6-ia: log renew messages as well
  676eb38 router: fix possible segfault in send_router_advert()
  392701f odhcpd: fix passing possible negative parameter
  029123b treewide: switch to C-code style comments
  6b79748 router: improve error checking
  12e21bc netlink: fix incorrect sizeof argument
  d7aa414 dhcpv6: improve error checking in dhcpv6_setup_interface()
  373495a ubus: fix invalid ipv6-prefix json
  79d5e6f ndp: improve error checking
  d834ae3 dhcpv4: fix error checking in dhcpv4_setup_interface()
  f2aa383 dhcpv4: fix out of bound access in dhcpv4_put
  4591b36 dhcpv4: improve error checking in dhcpv4_setup_interface()
  4983ee5 odhcpd: fix strncpy bounds
  c0f6390 odhcpd: Check if open the ioctl socket failed
  345bba0 dhcpv4: improve error checking in handle_dhcpv4()
  44cce31 ubus: avoid dumping interface state with NULL message

Cherry picked and squashed from commits:

  b7ef10cbf0 odhcpd: update to latest git HEAD
  98a6bee09a odhcpd: update to latest git HEAD
  88c88823d5 odhcpd: update to latest git HEAD

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-26 18:55:32 +02:00
Jo-Philipp Wich
da0dd6adc2 ubus: update to latest git HEAD
40e0931 libubus: pass an empty UBUS_ATTR_DATA block if msg is NULL on invoke

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 7316515891)
2018-07-26 18:37:18 +02:00
Hans Dedecker
3f0d44b8de firewall: update to latest git HEAD and build with LTO
Reduces .ipk size on MIPS from 41.6k to 41.1k

Changes:

  30463d0 zones: add interface/subnet bound LOG rules
  0e77bf2 options: treat time strings as UTC times
  d2bbeb7 firewall3: make reject types selectable by user
  aa8846b ubus: avoid dumping interface state with NULL message

Cherry picked and squashed from commits:

  a3f2451fba firewall: update to latest git HEAD
  433d71e73e fw3: update to latest git HEAD
  ef96d1e34a firewall: compile with LTO enabled
  1e83f775a3 firewall3: update to latest git HEAD
  3ee2c76ae0 firewall: update to latest git HEAD

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-26 08:49:52 +02:00
John Crispin
69021e9b89 ubus: update to latest git HEAD
884be45 libubus: check for non-NULL data before running callbacks

Signed-off-by: John Crispin <john@phrozen.org>
(cherry picked from commit a5c3bbaf56)
2018-07-25 13:03:58 +02:00
John Crispin
6302f0161b libubox: update to latest git HEAD
c83a84a fix segfault when passed blobmsg attr is NULL

Signed-off-by: John Crispin <john@phrozen.org>
(cherry picked from commit 5dc32620c4)
2018-07-25 13:03:55 +02:00
Aleksandr V. Piskunov
f91a0f3b1a wireguard-tools: add wireguard_watchdog script
This watchdog script tries to re-resolve hostnames for inactive WireGuard peers.
Use it for peers with a frequently changing dynamic IP.
persistent_keepalive must be set, recommended value is 25 seconds.
Run this script from cron every minute:
echo '* * * * * /usr/bin/wireguard_watchdog' >> /etc/crontabs/root

Signed-off-by: Aleksandr V. Piskunov <aleksandr.v.piskunov@gmail.com>
[bump the package release]
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit 20c4819c7b)
2018-07-25 11:23:35 +01:00
Jason A. Donenfeld
f1dbfa1937 wireguard: bump to 0.0.20180718
80b41cd version: bump snapshot
fe5f0f6 recieve: disable NAPI busy polling
e863f40 device: destroy workqueue before freeing queue
81a2e7e wg-quick: allow link local default gateway
95951af receive: use gro call instead of plain call
d9501f1 receive: account for zero or negative budget
e80799b tools: only error on wg show if all interfaces failk

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
[Added commit log to commit description]
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit 57b808ec88)
2018-07-25 11:23:35 +01:00
Jason A. Donenfeld
ff91b32d26 wireguard: bump to 0.0.20180708
* device: print daddr not saddr in missing peer error
* receive: style

Debug messages now make sense again.

* wg-quick: android: support excluding applications

Android now supports excluding certain apps (uids) from the tunnel.

* selftest: ratelimiter: improve chance of success via retry
* qemu: bump default kernel version
* qemu: decide debug kernel based on KERNEL_VERSION

Some improvements to our testing infrastructure.

* receive: use NAPI on the receive path

This is a big change that should both improve preemption latency (by not
disabling it unconditionally) and vastly improve rx performance on most
systems by using NAPI. The main purpose of this snapshot is to test out this
technique.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
(cherry picked from commit 4630159294)
2018-07-25 11:23:34 +01:00
Jo-Philipp Wich
b84a1c56f3 build: do not alter global default package selection from profiles
This partly reverts ca32373c95 which lets
profiles that suppress packages to alter the package selection for all
devices of the target when building with CONFIG_TARGET_PER_DEVICE_ROOTFS.

In particular, this caused the brcm47xx Edimax PS-1208MFG profile to
disable mtd, dropbear, firewall and other essential packages for all
brcm47xx/generic builds.

To solve this problem, prevent profiles from mangling the global
DEFAULT_PACKAGES selection and restrict the supression of negated
packages to the local PACKAGE variable list only.

Fixes ca32373c95 ("target.mk: let profile remove from DEFAULT_PACKAGES")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>

(cherry picked from commit 69ea512c62)
2018-07-21 20:53:43 +02:00
Tim Small
90b15b00a2 WDR4900v1 remove dt node for absent hw crypto.
The WDR4900v1 uses the P1040 SoC, so the device tree pulls in the
definition for the related P1010 SoC.  However, the P1040 lacks the
CAAM/SEC4 hardware crypto accelerator which the P1010 device tree
defines.  If left defined, this causes the CAAM drivers (if present) to
attempt to use the non-existent device, making various crypto-related
operations (e.g. macsec and ipsec) fail.

This commit overrides the incorrect dt node definition in the included
file.

See also:
 - https://bugs.openwrt.org/index.php?do=details&task_id=1262
 - https://community.nxp.com/thread/338432#comment-474107

Signed-off-by: Tim Small <tim@seoss.co.uk>
(cherry picked from commit e97aaf483c)
2018-07-21 18:38:18 +02:00
Kevin Darbyshire-Bryant
a80276235a iproute2: tc: backport canonical cake support
iproute2's tc was updated to support the recently upstreamed cake qdisc.
Backport this canonical support from upstream into iproute2 v4.16

There is no kernel kmod/userspace tc ABI change in this release from the
previous package bump, so everyone can breath a sigh of relief.

This is largely a code style change, the exception to prove the rule:
option 'autorate_ingress' has been changed to 'autorate-ingress' to fit
in with upstream option naming expectations.

No openwrt package (e.g. sqm-scripts) has knowledge of
'autorate_ingress' thus only users who made their own scripts or used
it within the 'dangerous configuration' options of sqm-scripts will be
affected.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2018-07-21 09:08:45 +01:00
Felix Fietkau
5b12057d7c build: fix compile error when a package includes itself in PROVIDES
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 7c306ae640)
2018-07-20 15:37:17 +02:00
Christian Lamparter
8a0ad2660a apm821xx: fix sata access freezes
The original vendor's driver programmed the dma controller's
AHB HPROT values to enable bufferable, privileged mode. This
along with the "same priorty for both channels" fixes the
freezes according to @takimata, @And.short, that have been
reported on the forum by @ticerex.

Furtheremore, @takimata reported that the patch also improved
the performance of the HDDs considerably:
|<https://forum.lede-project.org/t/wd-mybook-live-duo-two-disks/16195/55>
|It seems your patch unleashed the full power of the SATA port.
|Where I was previously hitting a really hard limit at around
|82 MB/s for reading and 27 MB/s for writing, I am now getting this:
|
|root@OpenWrt:/mnt# time dd if=/dev/zero of=tempfile bs=1M count=1024
|1024+0 records in
|1024+0 records out
|real    0m 13.65s
|user    0m 0.01s
|sys     0m 11.89s
|
|root@OpenWrt:/mnt# time dd if=tempfile of=/dev/null bs=1M count=1024
|1024+0 records in
|1024+0 records out
|real    0m 8.41s
|user    0m 0.01s
|sys     0m 4.70s
|
|This means: 121 MB/s reading and 75 MB/s writing!
|
|[...]
|
|The drive is a WD Green WD10EARX taken from an older MBL Single.
|I repeated the test a few times with even larger files to rule out
|any caching, I'm still seeing the same great performance. OpenWrt is
|now completely on par with the original MBL firmware's performance.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2018-07-19 18:54:40 +02:00
Luiz Angelo Daros de Luca
a297324a13 base-files: fix wrong sysctl parameter order
Restarting service sysctl echos multiple errors like:

  sysctl: -e: No such file or directory

After the first filename, all remaining arguments are treated
as files.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2018-07-18 19:20:07 +02:00
Kevin Darbyshire-Bryant
1e48546a6a igmpproxy: run in foreground for procd
procd needs processes to stay in foreground to remain under its gaze and
control.  Failure to do so means service stop commands fail to actually
stop the process (procd doesn't think it's running 'cos the process has
exited already as part of its forking routing)

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit 9d5a246930)
2018-07-18 18:06:15 +01:00
Jo-Philipp Wich
f8cc68670f mediatek: fix parallel build issues in image build code
Drop the parallel-unsafe custom Build/dtb macro and use the .dtb artifacts
produced by the generic image build code.

Also remove unused .dtb references in the mt7623 subtarget.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 8194f9ef4a)
2018-07-17 14:45:33 +02:00
Rafał Miłecki
1086408b17 mtd: improve check for TRX header being already fixed
First of all lengths should be compared after checking all blocks for
being good/bad. It's because requested length may differ from a final
one if there were some bad blocks.

Secondly it makes sense to also compare crc32 since we already have a
new one calculated.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 82498a7f7a)
2018-07-16 23:18:45 +02:00
Rafał Miłecki
5dca299fab mtd: support bad blocks within the mtd_fixtrx()
Reading MTD data with (p)read doesn't return any error when accessing
bad block. As the result, with current code, CRC32 covers "data" stored
in bad blocks.

That behavior doesn't match CFE's one (bootloader simply skips bad
blocks) and may result in:
1) Invalid CRC32
2) CFE refusing to boot firmware with a following error:
Boot program checksum is invalid

Fix that problem by checking every block before reading its content.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 0f54489f75)
2018-07-16 23:18:45 +02:00
Kevin Darbyshire-Bryant
5889cf70e9 kmod-sched-cake: bump to 20180716
Bump to the latest cake recipe.

This backports tc class support to kernel 4.9 and other than conditional
kernel compilation pre-processor macros represents the cake that has
gone upstream into kernel 4.19.  Loud cheer!

Fun may be had by changing cake tin classification for packets on
ingress. e.g.

tc filter add dev ifb4eth0 parent 800b: protocol ip u32 match \
ip dport 6981 0xffff action skbedit priority 800b:1

Where 800b: represents the filter handle for the ifb obtained by 'tc
qdisc' and the 1 from 800b:1 represents the cake tin number.  So the
above example puts all incoming packets destined for port 6981 into the
BULK (lowest priority) tin.

f39ab9a Obey tin_order for tc filter classifiers
1e2473f Clean up after latest backport.
82531d0 Reorder includes to fix out of tree compilation
52cbc00 Code style cleanup
6cdb496 Fix argument order for NL_SET_ERR_MSG_ATTR()
cab17b6 Remove duplicate call to qdisc_watchdog_init()
71c7991 Merge branch 'backport-classful'
32aa7fb Fix compilation on Linux 4.9
9f8fe7a Fix compilation on Linux 4.14
ceab7a3 Rework filter classification
aad5436 Fixed version of class stats
be1c549 Add cake-specific class stats
483399d Use tin_order for class dumps
80dc129 Add class dumping
0c8e6c1 Fix dropping when using filters
c220493 Add the minimum class ops
5ed54d2 Start implementing tc filter/class support

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit c729c43b39)
2018-07-16 13:57:31 +01:00
Tony Ambardar
393ee8d0b2 qos-scripts: fix uci callback handling
The previous callback code was fragile, dependent on some UCI callback
bugs and side-effects now fixed in master commit 73d8a6ab.

Update scripts to use callbacks where appropriate and necessary, while
using normal UCI config parsing for all else. This results in smaller,
simpler, more robust code. Use callbacks in generate.sh to only process
'interface' defaults and the varying entries for 'reclassify', 'default'
and 'classify' sections. Also switch qos-stat to use non-callback UCI
handling.

The current changes work independently of 73d8a6ab (i.e. both before and
after), and are consistent with UCI config parsing documentation.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2018-07-16 09:32:27 +02:00
Tony Ambardar
c9c0fc28a9 base-files: fix UCI config parsing and callback handling
There are several long-standing issues present in the UCI shell API as
documented in https://wiki.openwrt.org/doc/devel/config-scripting. They
relate both to high-level, user-defined callback functions used to
process UCI config files, and also to low-level functions used within
scripts generally.

The related problems have been encountered now and in the past, e.g.
https://forum.openwrt.org/viewtopic.php?id=54295, and include:

a) UCI parsing option() function and user-defined option_cb() callbacks
being erroneously called during processing of "list" config file entries;

b) normal usage of the low-level config_set() unexpectedy calling any
defined option_cb() if present; and

c) handling of the list_cb() not respecting the NO_CALLBACK variable.

Root causes include a function stack "inversion", where the low-level
config_set() function incorrectly calls the high-level option() function,
intended only for processing the "option" keyword of UCI config files.

This change addresses the inversion and other issues, making the option
handling code more consistent and smaller, and simplifying developers'
usage of UCI callbacks.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
2018-07-16 09:32:06 +02:00
Christian Lamparter
aee917a5a2 apm821xx: fix usb-otg on 4.14
Starting with 4.14, the "amcc,dwc-otg" needs to be used
in order to get the usb-otg to work.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
(cherry picked from commit 12b80f1cab)
2018-07-16 08:43:15 +02:00
Hans Dedecker
3539430b3d odhcp6c: add noserverunicast config option for broken DHCPv6 servers
Fix broken DHCPv6 servers which provide the server unicast option but
do not reply on DHCPv6 renew messages directed to the IPv6 address
contained in the server unicast option which results in broken IPv6
connectivity.

67ae6a7 odhcp6c: add option to ignore Server Unicast option

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-07-15 22:23:09 +02:00
Hans Dedecker
6363377c47 odhcp6c: update to latest git HEAD
b99c1f6 odhcp6c: remove len check in option parsing handle

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-07-15 22:22:26 +02:00
Hans Dedecker
ce8cab388a odhcp6c: user string option support
ca8822b odhcp6c: add support for user string options

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-07-15 22:22:17 +02:00
David Bauer
dc52b7b104 ipq40xx: add get_status_led to diag.sh
This commit adds the get_status_led method to diag.sh, which sets the
boot-led as status-led for scripts using this method to get a
status-led.

This method is used platform-independent in downstream project gluon to
set the LED used to indicate the config-mode.

Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 4fc005197a)
2018-07-15 20:08:44 +02:00
Jo-Philipp Wich
7fc7128b08 OpenWrt v18.06.0-rc2: revert to branch defaults
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-15 17:54:39 +02:00
78 changed files with 1624 additions and 1475 deletions

View File

@@ -1,4 +1,4 @@
src-git packages https://git.openwrt.org/feed/packages.git^05b9aceb00725b69220defaaad11f24b63731ac3
src-git luci https://git.openwrt.org/project/luci.git^911219898f5e65e8bb867a8195812550cff583d5
src-git packages https://git.openwrt.org/feed/packages.git^8bf5fc17db6072549a4e3bd8230d7962364f2043
src-git luci https://git.openwrt.org/project/luci.git^6df9a57ef0773c7158dadbb5054a58cb3d70c621
src-git routing https://git.openwrt.org/feed/routing.git^1b9d1c419f0ecefda51922a7845ab2183d6acd76
src-git telephony https://git.openwrt.org/feed/telephony.git^278ca6938638aa2d5569b29166d157e0458f656e
src-git telephony https://git.openwrt.org/feed/telephony.git^88b12368f11f3feeefcd4dcbe54f21159b8356c1

View File

@@ -190,7 +190,7 @@ $(_endef)
fi; \
done; $(Package/$(1)/extra_provides) \
) | sort -u > $(PKG_INFO_DIR)/$(1).provides
$(if $(PROVIDES),@for pkg in $(PROVIDES); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
$(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
$(CheckDependencies)
$(RSTRIP) $$(IDIR_$(1))

View File

@@ -72,7 +72,6 @@ define Profile
$(eval $(call ProfileDefault))
$(eval $(call Profile/$(1)))
dumpinfo : $(call shexport,Profile/$(1)/Description)
DEFAULT_PACKAGES := $(filter-out $(patsubst -%,%,$(filter -%,$(PACKAGES))),$(DEFAULT_PACKAGES))
PACKAGES := $(filter-out -%,$(PACKAGES))
DUMPINFO += \
echo "Target-Profile: $(1)"; \

View File

@@ -25,13 +25,13 @@ PKG_CONFIG_DEPENDS += \
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06.0-rc2)
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06.0)
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r7141-e4d0ee5af5)
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r7188-b0b5c64c22)
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06.0-rc2)
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06.0)
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)

View File

@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
include $(INCLUDE_DIR)/feeds.mk
PKG_NAME:=base-files
PKG_RELEASE:=190
PKG_RELEASE:=192
PKG_FLAGS:=nonshared
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/

View File

@@ -39,6 +39,6 @@ apply_defaults() {
start() {
apply_defaults
for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
[ -f "$CONF" ] && sysctl -e -p "$CONF" >&-
done
}

View File

@@ -57,16 +57,16 @@ config () {
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
append CONFIG_SECTIONS "$name"
[ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name"
export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype"
config_set "$CONFIG_SECTION" "TYPE" "${cfgtype}"
[ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name"
}
option () {
local varname="$1"; shift
local value="$*"
export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value"
config_set "$CONFIG_SECTION" "${varname}" "${value}"
[ -n "$NO_CALLBACK" ] || option_cb "$varname" "$*"
}
@@ -81,7 +81,7 @@ list() {
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
list_cb "$varname" "$*"
[ -n "$NO_CALLBACK" ] || list_cb "$varname" "$*"
}
config_unset() {
@@ -113,11 +113,8 @@ config_set() {
local section="$1"
local option="$2"
local value="$3"
local old_section="$CONFIG_SECTION"
CONFIG_SECTION="$section"
option "$option" "$value"
CONFIG_SECTION="$old_section"
export ${NO_EXPORT:+-n} "CONFIG_${section}_${option}=${value}"
}
config_foreach() {

View File

@@ -6,10 +6,16 @@
__network_ifstatus() {
local __tmp
[ -z "$__NETWORK_CACHE" ] && \
export __NETWORK_CACHE="$(ubus call network.interface dump)"
[ -z "$__NETWORK_CACHE" ] && {
__tmp="$(ubus call network.interface dump 2>&1)"
case "$?" in
4) : ;;
0) export __NETWORK_CACHE="$__tmp" ;;
*) echo "$__tmp" >&2 ;;
esac
}
__tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "$__NETWORK_CACHE" -e "$1=@.interface${2:+[@.interface='$2']}$3")"
__tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "${__NETWORK_CACHE:-{}}" -e "$1=@.interface${2:+[@.interface='$2']}$3")"
[ -z "$__tmp" ] && \
unset "$1" && \

View File

@@ -183,7 +183,7 @@ if VERSIONOPT
config VERSION_REPO
string
prompt "Release repository"
default "http://downloads.openwrt.org/releases/18.06.0-rc2"
default "http://downloads.openwrt.org/releases/18.06.0"
help
This is the repository address embedded in the image, it defaults
to the trunk snapshot repo; the url may contain the following placeholders:

View File

@@ -13,9 +13,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git
PKG_SOURCE_DATE:=2018-07-06
PKG_SOURCE_VERSION:=c91b94f0b4456c43def2e77248a455a9a2449ed1
PKG_MIRROR_HASH:=e1b7081e1b559a9c01721ffc856debdb91e36488b51b9facb7db73f40ab85914
PKG_SOURCE_DATE:=2018-07-16
PKG_SOURCE_VERSION:=f39ab9a402ad51d7c17d4cde18ca15b2b7022030
PKG_MIRROR_HASH:=fc22fc6eb7a24f4595c2777f33758ebcf9a2a404c16d00aa37ae389cd7f9c78f
PKG_MAINTAINER:=Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
include $(INCLUDE_DIR)/package.mk

View File

@@ -0,0 +1,52 @@
From f8793c26fe586659d6da3fa277e63961a69d314b Mon Sep 17 00:00:00 2001
From: Arend Van Spriel <arend.vanspriel@broadcom.com>
Date: Wed, 16 May 2018 14:11:58 +0200
Subject: [PATCH] brcmfmac: move ALLFFMAC variable in flowring module
The only user of ALLFFMAC is the flowring module so no need to
expose it in a header file.
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 --
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 --
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 2 ++
3 files changed, 2 insertions(+), 4 deletions(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -36,8 +36,6 @@ MODULE_AUTHOR("Broadcom Corporation");
MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
MODULE_LICENSE("Dual BSD/GPL");
-const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
@@ -19,8 +19,6 @@
#include <linux/platform_data/brcmfmac.h>
#include "fwil_types.h"
-extern const u8 ALLFFMAC[ETH_ALEN];
-
#define BRCMF_FW_ALTPATH_LEN 256
/* Definitions for the module global and device specific settings are defined
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
@@ -46,6 +46,8 @@ static const u8 brcmf_flowring_prio2fifo
3
};
+static const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+
static bool
brcmf_flowring_is_tdls_mac(struct brcmf_flowring *flow, u8 mac[ETH_ALEN])

View File

@@ -0,0 +1,76 @@
From 8e072168f75ebce85b96cbcefea2b10ddbd5913f Mon Sep 17 00:00:00 2001
From: Arend Van Spriel <arend.vanspriel@broadcom.com>
Date: Wed, 16 May 2018 14:11:59 +0200
Subject: [PATCH] brcmfmac: add support for sysfs initiated coredump
The driver already supports device coredump initiated by firmware
event. Since commit 3c47d19ff4dc ("drivers: base: add coredump driver
ops") it is also possible to initiate it from user-space through
sysfs. This patch adds support for SDIO and PCIe devices.
[rafal@milecki.pl: use LINUX_VERSION_CODE]
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 8 ++++++++
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 +
4 files changed, 12 insertions(+)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -1165,6 +1165,9 @@ static struct sdio_driver brcmf_sdmmc_dr
#ifdef CONFIG_PM_SLEEP
.pm = &brcmf_sdio_pm_ops,
#endif /* CONFIG_PM_SLEEP */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+ .coredump = brcmf_dev_coredump,
+#endif
},
};
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
@@ -250,6 +250,8 @@ int brcmf_attach(struct device *dev, str
void brcmf_detach(struct device *dev);
/* Indication from bus module that dongle should be reset */
void brcmf_dev_reset(struct device *dev);
+/* Request from bus module to initiate a coredump */
+void brcmf_dev_coredump(struct device *dev);
/* Configure the "global" bus state used by upper layers */
void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1201,6 +1201,14 @@ void brcmf_dev_reset(struct device *dev)
brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1);
}
+void brcmf_dev_coredump(struct device *dev)
+{
+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+
+ if (brcmf_debug_create_memdump(bus_if, NULL, 0) < 0)
+ brcmf_dbg(TRACE, "failed to create coredump\n");
+}
+
void brcmf_detach(struct device *dev)
{
s32 i;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -2044,6 +2044,9 @@ static struct pci_driver brcmf_pciedrvr
#ifdef CONFIG_PM
.driver.pm = &brcmf_pciedrvr_pm,
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+ .driver.coredump = brcmf_dev_coredump,
+#endif
};

View File

@@ -0,0 +1,32 @@
From d2af9b566554e01f9ad67b330ce569dbc130e5d3 Mon Sep 17 00:00:00 2001
From: Franky Lin <franky.lin@broadcom.com>
Date: Wed, 16 May 2018 14:12:01 +0200
Subject: [PATCH] brcmfmac: validate user provided data for memdump before
copying
In patch "brcmfmac: add support for sysfs initiated coredump", a new
scenario of brcmf_debug_create_memdump was added in which the user of
the function might not necessarily provide prefix data. Hence the
function should not assume the data is always valid and should perform a
check before copying.
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
@@ -40,7 +40,8 @@ int brcmf_debug_create_memdump(struct br
if (!dump)
return -ENOMEM;
- memcpy(dump, data, len);
+ if (data && len > 0)
+ memcpy(dump, data, len);
err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
if (err) {
vfree(dump);

View File

@@ -0,0 +1,38 @@
From 8a3ab2f38f1669e3be6433a1f6b82a077b38c4c7 Mon Sep 17 00:00:00 2001
From: Franky Lin <franky.lin@broadcom.com>
Date: Wed, 16 May 2018 14:12:02 +0200
Subject: [PATCH] brcmfmac: trigger memory dump upon firmware halt signal
PCIe dongle firmware signals a halt/trap through mailbox interrupt.
Trigger a memory dump upon receiving such signal could help to provide
useful information for issue debug.
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -182,6 +182,7 @@ static const struct brcmf_firmware_mappi
#define BRCMF_D2H_DEV_D3_ACK 0x00000001
#define BRCMF_D2H_DEV_DS_ENTER_REQ 0x00000002
#define BRCMF_D2H_DEV_DS_EXIT_NOTE 0x00000004
+#define BRCMF_D2H_DEV_FWHALT 0x10000000
#define BRCMF_H2D_HOST_D3_INFORM 0x00000001
#define BRCMF_H2D_HOST_DS_ACK 0x00000002
@@ -717,6 +718,10 @@ static void brcmf_pcie_handle_mb_data(st
devinfo->mbdata_completed = true;
wake_up(&devinfo->mbdata_resp_wait);
}
+ if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) {
+ brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n");
+ brcmf_dev_coredump(&devinfo->pdev->dev);
+ }
}

View File

@@ -0,0 +1,30 @@
From b8248236e92790ac635caeb4156e46ea2417e037 Mon Sep 17 00:00:00 2001
From: Franky Lin <franky.lin@broadcom.com>
Date: Wed, 16 May 2018 14:12:03 +0200
Subject: [PATCH] brcmfmac: trigger memory dump on SDIO firmware halt message
Attempt to dump dongle memory for debug upon receiving firmware halt
message through dongle to host mail box interrupt.
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -1072,8 +1072,10 @@ static u32 brcmf_sdio_hostmail(struct br
bus->sdcnt.f1regdata += 2;
/* dongle indicates the firmware has halted/crashed */
- if (hmb_data & HMB_DATA_FWHALT)
+ if (hmb_data & HMB_DATA_FWHALT) {
brcmf_err("mailbox indicates firmware halted\n");
+ brcmf_dev_coredump(&sdiod->func1->dev);
+ }
/* Dongle recomposed rx frames, accept them again */
if (hmb_data & HMB_DATA_NAKHANDLED) {

View File

@@ -0,0 +1,70 @@
From 373c83a801f15b1e3d02d855fad89112bd4ccbe0 Mon Sep 17 00:00:00 2001
From: Michael Trimarchi <michael@amarulasolutions.com>
Date: Wed, 30 May 2018 11:06:34 +0200
Subject: [PATCH] brcmfmac: stop watchdog before detach and free everything
Using built-in in kernel image without a firmware in filesystem
or in the kernel image can lead to a kernel NULL pointer deference.
Watchdog need to be stopped in brcmf_sdio_remove
The system is going down NOW!
[ 1348.110759] Unable to handle kernel NULL pointer dereference at virtual address 000002f8
Sent SIGTERM to all processes
[ 1348.121412] Mem abort info:
[ 1348.126962] ESR = 0x96000004
[ 1348.130023] Exception class = DABT (current EL), IL = 32 bits
[ 1348.135948] SET = 0, FnV = 0
[ 1348.138997] EA = 0, S1PTW = 0
[ 1348.142154] Data abort info:
[ 1348.145045] ISV = 0, ISS = 0x00000004
[ 1348.148884] CM = 0, WnR = 0
[ 1348.151861] user pgtable: 4k pages, 48-bit VAs, pgdp = (____ptrval____)
[ 1348.158475] [00000000000002f8] pgd=0000000000000000
[ 1348.163364] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 1348.168927] Modules linked in: ipv6
[ 1348.172421] CPU: 3 PID: 1421 Comm: brcmf_wdog/mmc0 Not tainted 4.17.0-rc5-next-20180517 #18
[ 1348.180757] Hardware name: Amarula A64-Relic (DT)
[ 1348.185455] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 1348.190251] pc : brcmf_sdiod_freezer_count+0x0/0x20
[ 1348.195124] lr : brcmf_sdio_watchdog_thread+0x64/0x290
[ 1348.200253] sp : ffff00000b85be30
[ 1348.203561] x29: ffff00000b85be30 x28: 0000000000000000
[ 1348.208868] x27: ffff00000b6cb918 x26: ffff80003b990638
[ 1348.214176] x25: ffff0000087b1a20 x24: ffff80003b94f800
[ 1348.219483] x23: ffff000008e620c8 x22: ffff000008f0b660
[ 1348.224790] x21: ffff000008c6a858 x20: 00000000fffffe00
[ 1348.230097] x19: ffff80003b94f800 x18: 0000000000000001
[ 1348.235404] x17: 0000ffffab2e8a74 x16: ffff0000080d7de8
[ 1348.240711] x15: 0000000000000000 x14: 0000000000000400
[ 1348.246018] x13: 0000000000000400 x12: 0000000000000001
[ 1348.251324] x11: 00000000000002c4 x10: 0000000000000a10
[ 1348.256631] x9 : ffff00000b85bc40 x8 : ffff80003be11870
[ 1348.261937] x7 : ffff80003dfc7308 x6 : 000000078ff08b55
[ 1348.267243] x5 : 00000139e1058400 x4 : 0000000000000000
[ 1348.272550] x3 : dead000000000100 x2 : 958f2788d6618100
[ 1348.277856] x1 : 00000000fffffe00 x0 : 0000000000000000
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -4297,6 +4297,13 @@ void brcmf_sdio_remove(struct brcmf_sdio
brcmf_dbg(TRACE, "Enter\n");
if (bus) {
+ /* Stop watchdog task */
+ if (bus->watchdog_tsk) {
+ send_sig(SIGTERM, bus->watchdog_tsk, 1);
+ kthread_stop(bus->watchdog_tsk);
+ bus->watchdog_tsk = NULL;
+ }
+
/* De-register interrupt handler */
brcmf_sdiod_intr_unregister(bus->sdiodev);

View File

@@ -0,0 +1,41 @@
From 299b6365a3b7cf7f5ea1c945a420e9ee4841d6f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Sun, 22 Jul 2018 23:46:25 +0200
Subject: [PATCH] brcmfmac: fix regression in parsing NVRAM for multiple
devices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NVRAM is designed to work with Broadcom's SDK Linux kernel which fakes
PCI domain 0 for all internal MMIO devices. Since official Linux kernel
uses platform devices for that purpose there is a mismatch in numbering
PCI domains.
There used to be a fix for that problem but it was accidentally dropped
during the last firmware loading rework. That resulted in brcmfmac not
being able to extract device specific NVRAM content and all kind of
calibration problems.
Reported-by: Aditya Xavier <adityaxavier@gmail.com>
Fixes: 2baa3aaee27f ("brcmfmac: introduce brcmf_fw_alloc_request() function")
Cc: stable@vger.kernel.org # v4.17+
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1785,7 +1785,8 @@ brcmf_pcie_prepare_fw_request(struct brc
fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL;
- fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus);
+ /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */
+ fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1;
fwreq->bus_nr = devinfo->pdev->bus->number;
return fwreq;

View File

@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1314,6 +1314,7 @@ int __init brcmf_core_init(void)
@@ -1322,6 +1322,7 @@ int __init brcmf_core_init(void)
{
if (!schedule_work(&brcmf_driver_work))
return -EBUSY;

View File

@@ -9,7 +9,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -72,7 +72,11 @@ static int brcmf_fcmode;
@@ -70,7 +70,11 @@ static int brcmf_fcmode;
module_param_named(fcmode, brcmf_fcmode, int, 0);
MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control");

View File

@@ -5,9 +5,9 @@ PKG_RELEASE=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
PKG_SOURCE_DATE:=2018-04-12
PKG_SOURCE_VERSION:=6eff829d788b36939325557066f58aafd6a05321
PKG_MIRROR_HASH:=d0ea16385a133d668d18d793d0bffd867a8c799832a176f0a312c1b473ff918d
PKG_SOURCE_DATE:=2018-07-25
PKG_SOURCE_VERSION:=c83a84afbef2b24f960ddeda0b5e2ab01fba6981
PKG_MIRROR_HASH:=9ab6dc6e300cb56ed503425c9fe060a154bcab8067da5615c0428c968947484f
CMAKE_INSTALL:=1
PKG_LICENSE:=ISC

View File

@@ -13,9 +13,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git
PKG_SOURCE_DATE:=2018-05-14
PKG_SOURCE_VERSION:=b45e162eca2c6e913318c4552643aae2a973ae3a
PKG_MIRROR_HASH:=bdc6be90a94669817cf1543b814da7b5cd10eac3f5096533e0336352ff132d16
PKG_SOURCE_DATE:=2018-07-26
PKG_SOURCE_VERSION:=aa8846bb101054392b81f09bade120c021695892
PKG_MIRROR_HASH:=cc2ff632744bdefbc64ad11dc18944b44af006c986367a28d6483ade6012effa
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC
@@ -40,8 +40,8 @@ define Package/firewall/conffiles
/etc/firewall.user
endef
TARGET_CFLAGS += -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
TARGET_LDFLAGS += -Wl,--gc-sections -flto
CMAKE_OPTIONS += $(if $(CONFIG_IPV6),,-DDISABLE_IPV6=1)
define Package/firewall/install

View File

@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qos-scripts
PKG_VERSION:=1.3.0
PKG_VERSION:=1.3.1
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0

View File

@@ -14,16 +14,17 @@ get_ifname() {
[ "$cfgt" = "interface" ] && config_get "$interface" ifname
}
config_cb() {
config_get TYPE "$CONFIG_SECTION" TYPE
qos_set_device() {
config_get TYPE "$1" TYPE
[ "interface" = "$TYPE" ] && {
config_get device "$CONFIG_SECTION" ifname
[ -z "$device" ] && device="$(get_ifname ${CONFIG_SECTION})"
config_set "$CONFIG_SECTION" device "$device"
config_get device "$1" ifname
[ -z "$device" ] && device="$(get_ifname $1)"
config_set "$1" device "$device"
}
}
config_load qos
config_foreach qos_set_device
print_comments() {
echo ''

View File

@@ -191,8 +191,6 @@ config_cb() {
option_cb() {
return 0
}
# Section start
case "$1" in
interface)
config_set "$2" "classgroup" "Default"
@@ -200,43 +198,41 @@ config_cb() {
;;
classify|default|reclassify)
option_cb() {
append options "$1"
append "CONFIG_${CONFIG_SECTION}_options" "$1"
}
;;
esac
}
# Section end
config_get TYPE "$CONFIG_SECTION" TYPE
qos_parse_config() {
config_get TYPE "$1" TYPE
case "$TYPE" in
interface)
config_get_bool enabled "$CONFIG_SECTION" enabled 1
[ 1 -eq "$enabled" ] || return 0
config_get classgroup "$CONFIG_SECTION" classgroup
config_set "$CONFIG_SECTION" ifbdev "$C"
config_get_bool enabled "$1" enabled 1
[ 1 -eq "$enabled" ] && {
config_get classgroup "$1" classgroup
config_set "$1" ifbdev "$C"
C=$(($C+1))
append INTERFACES "$CONFIG_SECTION"
append INTERFACES "$1"
config_set "$classgroup" enabled 1
config_get device "$CONFIG_SECTION" device
config_get device "$1" device
[ -z "$device" ] && {
device="$(find_ifname ${CONFIG_SECTION})"
config_set "$CONFIG_SECTION" device "$device"
device="$(find_ifname $1)"
config_set "$1" device "$device"
}
}
;;
classgroup) append CG "$CONFIG_SECTION";;
classgroup) append CG "$1";;
classify|default|reclassify)
case "$TYPE" in
classify) var="ctrules";;
*) var="rules";;
esac
config_get target "$CONFIG_SECTION" target
config_set "$CONFIG_SECTION" options "$options"
append "$var" "$CONFIG_SECTION"
unset options
append "$var" "$1"
;;
esac
}
enum_classes() {
local c="0"
config_get classes "$1" classes
@@ -500,7 +496,10 @@ INTERFACES=""
[ -e ./qos.conf ] && {
. ./qos.conf
config_cb
} || config_load qos
} || {
config_load qos
config_foreach qos_parse_config
}
C="0"
for iface in $INTERFACES; do

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=odhcp6c
PKG_RELEASE:=12
PKG_RELEASE:=14
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git
PKG_SOURCE_DATE:=2018-04-29
PKG_SOURCE_VERSION:=5316d7f8bdcd8dd29286e98404a4f4fd2456500f
PKG_MIRROR_HASH:=93acfd799c798da25b69e05e5926b1ada9a8213cdb70e1ccbd6027c2d27741ce
PKG_SOURCE_DATE:=2018-07-14
PKG_SOURCE_VERSION:=67ae6a71b5762292e114b281d0e329cc24209ae6
PKG_MIRROR_HASH:=176b637b3856af0d6bb9c526afbddca4e569ea056fc36fc026345e7e22a6cef5
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0

View File

@@ -16,6 +16,7 @@ proto_dhcpv6_init_config() {
proto_config_add_string 'forceprefix:bool'
proto_config_add_string 'extendprefix:bool'
proto_config_add_string 'norelease:bool'
proto_config_add_string 'noserverunicast:bool'
proto_config_add_array 'ip6prefix:list(ip6addr)'
proto_config_add_string iface_dslite
proto_config_add_string zone_dslite
@@ -50,8 +51,8 @@ proto_dhcpv6_setup() {
local config="$1"
local iface="$2"
local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease ip6prefix ip6prefixes iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease noserverunicast ip6prefix ip6prefixes iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease noserverunicast iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
json_for_each_item proto_dhcpv6_add_prefix ip6prefix ip6prefixes
# Configure
@@ -71,6 +72,8 @@ proto_dhcpv6_setup() {
[ "$norelease" = "1" ] && append opts "-k"
[ "$noserverunicast" = "1" ] && append opts "-U"
[ -n "$ifaceid" ] && append opts "-i$ifaceid"
[ -n "$vendorclass" ] && append opts "-V$vendorclass"

View File

@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dnsmasq
PKG_VERSION:=2.80test2
PKG_RELEASE:=3
PKG_VERSION:=2.80test3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
PKG_HASH:=e731666094699afcbad947f89f7f8afbf92e5ddc3c915459d4936159d81116f0
PKG_HASH:=af9f6fd13e0d6c5a68059bcf8634c2784c0533017fd48fbaf59cd2955342d301
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@@ -844,8 +844,10 @@ dnsmasq_start()
config_list_foreach "$cfg" "rev_server" append_rev_server
config_list_foreach "$cfg" "address" append_address
config_list_foreach "$cfg" "ipset" append_ipset
[ -n "$BOOT" ] || {
config_list_foreach "$cfg" "interface" append_interface
config_list_foreach "$cfg" "notinterface" append_notinterface
}
config_list_foreach "$cfg" "addnhosts" append_addnhosts
config_list_foreach "$cfg" "bogusnxdomain" append_bogusnxdomain
append_parm "$cfg" "leasefile" "--dhcp-leasefile" "/tmp/dhcp.leases"
@@ -967,7 +969,7 @@ dnsmasq_start()
config_foreach filter_dnsmasq match dhcp_match_add "$cfg"
config_foreach filter_dnsmasq domain dhcp_domain_add "$cfg"
config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg"
config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg"
[ -n "$BOOT" ] || config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg"
echo >> $CONFIGFILE_TMP
config_foreach filter_dnsmasq srvhost dhcp_srv_add "$cfg"
@@ -984,13 +986,13 @@ dnsmasq_start()
# Enable RA feature for when/if it is constructed,
# and RA is selected per interface pool (RA, DHCP, or both),
# but no one (should) want RA broadcast in syslog
config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
[ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
xappend "--enable-ra"
xappend "--quiet-ra"
append_bool "$cfg" quietdhcp "--quiet-dhcp6"
elif [ "$DNSMASQ_DHCP_VER" -gt 0 ] ; then
config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
[ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
fi
@@ -1059,6 +1061,13 @@ service_triggers()
config_load dhcp
config_foreach add_interface_trigger dhcp
config_foreach add_interface_trigger relay
}
boot()
{
BOOT=1
start "$@"
}
start_service() {

View File

@@ -1,26 +0,0 @@
From f84e674d8aa2316fea8d2145a40fcef0441e3856 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 4 May 2018 16:29:57 +0100
Subject: [PATCH 01/10] Be persistent with broken-upstream-DNSSEC warnings.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/dnssec.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
--- a/src/dnssec.c
+++ b/src/dnssec.c
@@ -876,12 +876,7 @@ int dnssec_validate_ds(time_t now, struc
if (rc == STAT_INSECURE)
{
- static int reported = 0;
- if (!reported)
- {
- reported = 1;
- my_syslog(LOG_WARNING, _("Insecure DS reply received, do upstream DNS servers support DNSSEC?"));
- }
+ my_syslog(LOG_WARNING, _("Insecure DS reply received, do upstream DNS servers support DNSSEC?"));
rc = STAT_BOGUS;
}

View File

@@ -1,35 +0,0 @@
From 0669ee7a69a004ce34fed41e50aa575f8e04427b Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 4 May 2018 16:46:24 +0100
Subject: [PATCH 02/10] Fix DHCP broken-ness when --no-ping AND
--dhcp-sequential-ip are set.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
CHANGELOG | 3 ++-
src/dhcp.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,7 +14,8 @@ version 2.80
when the upstream namesevers do not support DNSSEC, and in this
case no DNSSEC validation at all is occuring.
-
+ Fix DHCP broken-ness when --no-ping AND --dhcp-sequential-ip
+ are set. Thanks to Daniel Miess for help with this.
version 2.79
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -678,7 +678,7 @@ struct ping_result *do_icmp_ping(time_t
if ((count >= max) || option_bool(OPT_NO_PING) || loopback)
{
/* overloaded, or configured not to check, loopback interface, return "not in use" */
- dummy.hash = 0;
+ dummy.hash = hash;
return &dummy;
}
else if (icmp_ping(addr))

View File

@@ -1,184 +0,0 @@
From 07ed585c38d8f7c0a18470d2e79cf46ea92ea96a Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 4 May 2018 21:52:22 +0100
Subject: [PATCH 03/10] Add logging for DNS error returns from upstream and
local configuration.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/cache.c | 13 +++++++++++++
src/dnsmasq.h | 7 ++++++-
src/forward.c | 25 +++++++++++++++++++------
src/rfc1035.c | 19 ++++++++++++++-----
4 files changed, 52 insertions(+), 12 deletions(-)
--- a/src/cache.c
+++ b/src/cache.c
@@ -1598,6 +1598,19 @@ void log_query(unsigned int flags, char
{
if (flags & F_KEYTAG)
sprintf(daemon->addrbuff, arg, addr->addr.log.keytag, addr->addr.log.algo, addr->addr.log.digest);
+ else if (flags & F_RCODE)
+ {
+ unsigned int rcode = addr->addr.rcode.rcode;
+
+ if (rcode == SERVFAIL)
+ dest = "SERVFAIL";
+ else if (rcode == REFUSED)
+ dest = "REFUSED";
+ else if (rcode == NOTIMP)
+ dest = "not implemented";
+ else
+ sprintf(daemon->addrbuff, "%u", rcode);
+ }
else
{
#ifdef HAVE_IPV6
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -268,7 +268,11 @@ struct all_addr {
/* for log_query */
struct {
unsigned short keytag, algo, digest;
- } log;
+ } log;
+ /* for log_query */
+ struct {
+ unsigned int rcode;
+ } rcode;
/* for cache_insert of DNSKEY, DS */
struct {
unsigned short class, type;
@@ -459,6 +463,7 @@ struct crec {
#define F_IPSET (1u<<26)
#define F_NOEXTRA (1u<<27)
#define F_SERVFAIL (1u<<28)
+#define F_RCODE (1u<<29)
/* Values of uid in crecs with F_CONFIG bit set. */
#define SRC_INTERFACE 0
--- a/src/forward.c
+++ b/src/forward.c
@@ -563,6 +563,7 @@ static size_t process_reply(struct dns_h
unsigned char *pheader, *sizep;
char **sets = 0;
int munged = 0, is_sign;
+ unsigned int rcode = RCODE(header);
size_t plen;
(void)ad_reqd;
@@ -593,6 +594,9 @@ static size_t process_reply(struct dns_h
if ((pheader = find_pseudoheader(header, n, &plen, &sizep, &is_sign, NULL)))
{
+ /* Get extended RCODE. */
+ rcode |= sizep[2] << 4;
+
if (check_subnet && !check_source(header, plen, pheader, query_source))
{
my_syslog(LOG_WARNING, _("discarding DNS reply: subnet option mismatch"));
@@ -641,11 +645,20 @@ static size_t process_reply(struct dns_h
if (!is_sign && !option_bool(OPT_DNSSEC_PROXY))
header->hb4 &= ~HB4_AD;
- if (OPCODE(header) != QUERY || (RCODE(header) != NOERROR && RCODE(header) != NXDOMAIN))
+ if (OPCODE(header) != QUERY)
return resize_packet(header, n, pheader, plen);
+
+ if (rcode != NOERROR && rcode != NXDOMAIN)
+ {
+ struct all_addr a;
+ a.addr.rcode.rcode = rcode;
+ log_query(F_UPSTREAM | F_RCODE, "error", &a, NULL);
+
+ return resize_packet(header, n, pheader, plen);
+ }
/* Complain loudly if the upstream server is non-recursive. */
- if (!(header->hb4 & HB4_RA) && RCODE(header) == NOERROR &&
+ if (!(header->hb4 & HB4_RA) && rcode == NOERROR &&
server && !(server->flags & SERV_WARNED_RECURSIVE))
{
prettyprint_addr(&server->addr, daemon->namebuff);
@@ -654,7 +667,7 @@ static size_t process_reply(struct dns_h
server->flags |= SERV_WARNED_RECURSIVE;
}
- if (daemon->bogus_addr && RCODE(header) != NXDOMAIN &&
+ if (daemon->bogus_addr && rcode != NXDOMAIN &&
check_for_bogus_wildcard(header, n, daemon->namebuff, daemon->bogus_addr, now))
{
munged = 1;
@@ -666,7 +679,7 @@ static size_t process_reply(struct dns_h
{
int doctored = 0;
- if (RCODE(header) == NXDOMAIN &&
+ if (rcode == NXDOMAIN &&
extract_request(header, n, daemon->namebuff, NULL) &&
check_for_local_domain(daemon->namebuff, now))
{
@@ -1090,7 +1103,7 @@ void reply_query(int fd, int family, tim
if (status == STAT_BOGUS && extract_request(header, n, daemon->namebuff, NULL))
domain = daemon->namebuff;
- log_query(F_KEYTAG | F_SECSTAT, domain, NULL, result);
+ log_query(F_SECSTAT, domain, NULL, result);
}
if (status == STAT_SECURE)
@@ -1948,7 +1961,7 @@ unsigned char *tcp_request(int confd, ti
if (status == STAT_BOGUS && extract_request(header, m, daemon->namebuff, NULL))
domain = daemon->namebuff;
- log_query(F_KEYTAG | F_SECSTAT, domain, NULL, result);
+ log_query(F_SECSTAT, domain, NULL, result);
if (status == STAT_BOGUS)
{
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -926,12 +926,11 @@ unsigned int extract_request(struct dns_
return F_QUERY;
}
-
size_t setup_reply(struct dns_header *header, size_t qlen,
struct all_addr *addrp, unsigned int flags, unsigned long ttl)
{
unsigned char *p;
-
+
if (!(p = skip_questions(header, qlen)))
return 0;
@@ -948,7 +947,12 @@ size_t setup_reply(struct dns_header *he
else if (flags == F_NXDOMAIN)
SET_RCODE(header, NXDOMAIN);
else if (flags == F_SERVFAIL)
- SET_RCODE(header, SERVFAIL);
+ {
+ struct all_addr a;
+ a.addr.rcode.rcode = SERVFAIL;
+ log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
+ SET_RCODE(header, SERVFAIL);
+ }
else if (flags == F_IPV4)
{ /* we know the address */
SET_RCODE(header, NOERROR);
@@ -966,8 +970,13 @@ size_t setup_reply(struct dns_header *he
}
#endif
else /* nowhere to forward to */
- SET_RCODE(header, REFUSED);
-
+ {
+ struct all_addr a;
+ a.addr.rcode.rcode = REFUSED;
+ log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
+ SET_RCODE(header, REFUSED);
+ }
+
return p - (unsigned char *)header;
}

View File

@@ -1,587 +0,0 @@
From 6b17335209639a56f214d011eaed4ebcde8dd276 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Tue, 8 May 2018 18:32:14 +0100
Subject: [PATCH 04/10] Add packet-dump debugging facility.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
CHANGELOG | 6 ++
Makefile | 2 +-
bld/Android.mk | 3 +-
man/dnsmasq.8 | 7 ++
src/config.h | 16 ++++-
src/dnsmasq.c | 16 ++++-
src/dnsmasq.h | 29 +++++++-
src/dump.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/forward.c | 37 ++++++++--
src/option.c | 14 ++++
10 files changed, 329 insertions(+), 11 deletions(-)
create mode 100644 src/dump.c
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,12 @@ version 2.80
Fix DHCP broken-ness when --no-ping AND --dhcp-sequential-ip
are set. Thanks to Daniel Miess for help with this.
+ Add a facilty to store DNS packets sent/recieved in a
+ pcap-format file for later debugging. The file location
+ is given by the --dumpfile option, and a bitmap controlling
+ which packets should be dumped is given by the --dumpmask
+ option.
+
version 2.79
Fix parsing of CNAME arguments, which are confused by extra spaces.
--- a/Makefile
+++ b/Makefile
@@ -76,7 +76,7 @@ objs = cache.o rfc1035.o util.o option.o
helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o \
domain.o dnssec.o blockdata.o tables.o loop.o inotify.o \
- poll.o rrfilter.o edns0.o arp.o crypto.o
+ poll.o rrfilter.o edns0.o arp.o crypto.o dump.o
hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
dns-protocol.h radv-protocol.h ip6addr.h
--- a/bld/Android.mk
+++ b/bld/Android.mk
@@ -10,7 +10,8 @@ LOCAL_SRC_FILES := bpf.c cache.c dbus.c
dhcp6.c rfc3315.c dhcp-common.c outpacket.c \
radv.c slaac.c auth.c ipset.c domain.c \
dnssec.c dnssec-openssl.c blockdata.c tables.c \
- loop.c inotify.c poll.c rrfilter.c edns0.c arp.c crypto.c
+ loop.c inotify.c poll.c rrfilter.c edns0.c arp.c \
+ crypto.c dump.c
LOCAL_MODULE := dnsmasq
--- a/man/dnsmasq.8
+++ b/man/dnsmasq.8
@@ -647,6 +647,13 @@ V4 mapped IPv6 addresses, which have a r
The address range can be of the form
<ip address>,<ip address> or <ip address>/<netmask> in both forms of the option.
.TP
+.B --dumpfile=<path/to/file>
+Specify the location of a pcap-format file which dnsmasq uses to dump copies of network packets for debugging purposes. If the file exists when dnsmasq starts, it is not deleted; new packets are added to the end.
+.TP
+.B --dumpmask=<mask>
+Specify which types of packets should be added to the dumpfile. The argument should be the OR of the bitmasks for each type of packet to be dumped: it can be specified in hex by preceding the number with 0x in the normal way. Each time a packet is written to the dumpfile, dnsmasq logs the packet sequence and the mask
+representing its type. The current types are: 0x0001 - DNS queries from clients 0x0002 DNS replies to clients 0x0004 - DNS queries to upstream 0x0008 - DNS replies from upstream 0x0010 - queries send upstream for DNSSEC validation 0x0020 - replies to queries for DNSSEC validation 0x0040 - replies to client queries which fail DNSSEC validation 0x0080 replies to queries for DNSSEC validation which fail validation.
+.TP
.B --add-mac[=base64|text]
Add the MAC address of the requestor to DNS queries which are
forwarded upstream. This may be used to DNS filtering by the upstream
--- a/src/config.h
+++ b/src/config.h
@@ -117,6 +117,9 @@ HAVE_AUTH
HAVE_DNSSEC
include DNSSEC validator.
+HAVE_DUMPFILE
+ include code to dump packets to a libpcap-format file for debugging.
+
HAVE_LOOP
include functionality to probe for and remove DNS forwarding loops.
@@ -132,6 +135,7 @@ NO_DHCP6
NO_SCRIPT
NO_LARGEFILE
NO_AUTH
+NO_DUMPFILE
NO_INOTIFY
these are available to explicitly disable compile time options which would
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
@@ -164,6 +168,7 @@ RESOLVFILE
#define HAVE_AUTH
#define HAVE_IPSET
#define HAVE_LOOP
+#define HAVE_DUMPFILE
/* Build options which require external libraries.
@@ -363,6 +368,10 @@ HAVE_SOCKADDR_SA_LEN
#undef HAVE_LOOP
#endif
+#ifdef NO_DUMPFILE
+#undef HAVE_DUMPFILE
+#endif
+
#if defined (HAVE_LINUX_NETWORK) && !defined(NO_INOTIFY)
#define HAVE_INOTIFY
#endif
@@ -451,8 +460,11 @@ static char *compile_opts =
#ifndef HAVE_INOTIFY
"no-"
#endif
-"inotify";
-
+"inotify "
+#ifndef HAVE_DUMPFILE
+"no-"
+#endif
+"dumpfile";
#endif
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -366,7 +366,16 @@ int main (int argc, char **argv)
else
daemon->inotifyfd = -1;
#endif
-
+
+ if (daemon->dump_file)
+#ifdef HAVE_DUMPFILE
+ dump_init();
+ else
+ daemon->dumpfd = -1;
+#else
+ die(_("Packet dumps not available: set HAVE_DUMP in src/config.h"), NULL, EC_BADCONF);
+#endif
+
if (option_bool(OPT_DBUS))
#ifdef HAVE_DBUS
{
@@ -1424,6 +1433,11 @@ static void async_event(int pipe, time_t
if (daemon->runfile)
unlink(daemon->runfile);
+
+#ifdef HAVE_DUMPFILE
+ if (daemon->dumpfd != -1)
+ close(daemon->dumpfd);
+#endif
my_syslog(LOG_INFO, _("exiting on receipt of SIGTERM"));
flush_log();
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -119,6 +119,9 @@ typedef unsigned long long u64;
#include <net/if_arp.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
+#ifdef HAVE_IPV6
+#include <netinet/ip6.h>
+#endif
#include <netinet/ip_icmp.h>
#include <sys/uio.h>
#include <syslog.h>
@@ -598,6 +601,16 @@ struct hostsfile {
unsigned int index; /* matches to cache entries for logging */
};
+/* packet-dump flags */
+#define DUMP_QUERY 0x0001
+#define DUMP_REPLY 0x0002
+#define DUMP_UP_QUERY 0x0004
+#define DUMP_UP_REPLY 0x0008
+#define DUMP_SEC_QUERY 0x0010
+#define DUMP_SEC_REPLY 0x0020
+#define DUMP_BOGUS 0x0040
+#define DUMP_SEC_BOGUS 0x0080
+
/* DNSSEC status values. */
#define STAT_SECURE 1
@@ -1020,14 +1033,14 @@ extern struct daemon {
unsigned int duid_enterprise, duid_config_len;
unsigned char *duid_config;
char *dbus_name;
+ char *dump_file;
+ int dump_mask;
unsigned long soa_sn, soa_refresh, soa_retry, soa_expiry;
#ifdef OPTION6_PREFIX_CLASS
struct prefix_class *prefix_classes;
#endif
#ifdef HAVE_DNSSEC
struct ds_config *ds;
- int dnssec_no_time_check;
- int back_to_the_future;
char *timestamp_file;
#endif
@@ -1040,6 +1053,8 @@ extern struct daemon {
char *workspacename; /* ditto */
char *rr_status; /* flags for individual RRs */
int rr_status_sz;
+ int dnssec_no_time_check;
+ int back_to_the_future;
#endif
unsigned int local_answer, queries_forwarded, auth_answer;
struct frec *frec_list;
@@ -1094,6 +1109,10 @@ extern struct daemon {
char *addrbuff;
char *addrbuff2; /* only allocated when OPT_EXTRALOG */
+#ifdef HAVE_DUMPFILE
+ /* file for packet dumps. */
+ int dumpfd;
+#endif
} *daemon;
/* cache.c */
@@ -1588,3 +1607,9 @@ int check_source(struct dns_header *head
/* arp.c */
int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now);
int do_arp_script_run(void);
+
+/* dump.c */
+#ifdef HAVE_DUMPFILE
+void dump_init(void);
+void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, union mysockaddr *dst);
+#endif
--- /dev/null
+++ b/src/dump.c
@@ -0,0 +1,210 @@
+/* dnsmasq is Copyright (c) 2000-2018 Simon Kelley
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 dated June, 1991, or
+ (at your option) version 3 dated 29 June, 2007.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "dnsmasq.h"
+
+#ifdef HAVE_DUMPFILE
+
+static u32 packet_count;
+
+/* https://wiki.wireshark.org/Development/LibpcapFileFormat */
+struct pcap_hdr_s {
+ u32 magic_number; /* magic number */
+ u16 version_major; /* major version number */
+ u16 version_minor; /* minor version number */
+ u32 thiszone; /* GMT to local correction */
+ u32 sigfigs; /* accuracy of timestamps */
+ u32 snaplen; /* max length of captured packets, in octets */
+ u32 network; /* data link type */
+};
+
+struct pcaprec_hdr_s {
+ u32 ts_sec; /* timestamp seconds */
+ u32 ts_usec; /* timestamp microseconds */
+ u32 incl_len; /* number of octets of packet saved in file */
+ u32 orig_len; /* actual length of packet */
+};
+
+
+void dump_init(void)
+{
+ struct stat buf;
+ struct pcap_hdr_s header;
+ struct pcaprec_hdr_s pcap_header;
+
+ packet_count = 0;
+
+ if (stat(daemon->dump_file, &buf) == -1)
+ {
+ /* doesn't exist, create and add header */
+ header.magic_number = 0xa1b2c3d4;
+ header.version_major = 2;
+ header.version_minor = 4;
+ header.thiszone = 0;
+ header.sigfigs = 0;
+ header.snaplen = daemon->edns_pktsz + 200; /* slop for IP/UDP headers */
+ header.network = 101; /* DLT_RAW http://www.tcpdump.org/linktypes.html */
+
+ if (errno != ENOENT ||
+ (daemon->dumpfd = creat(daemon->dump_file, S_IRUSR | S_IWUSR)) == -1 ||
+ !read_write(daemon->dumpfd, (void *)&header, sizeof(header), 0))
+ die(_("cannot create %s: %s"), daemon->dump_file, EC_FILE);
+ }
+ else if ((daemon->dumpfd = open(daemon->dump_file, O_APPEND | O_RDWR)) == -1 ||
+ !read_write(daemon->dumpfd, (void *)&header, sizeof(header), 1) ||
+ header.magic_number != 0xa1b2c3d4)
+ die(_("cannot access %s: %s"), daemon->dump_file, EC_FILE);
+ else
+ {
+ /* count existing records */
+ while (read_write(daemon->dumpfd, (void *)&pcap_header, sizeof(pcap_header), 1))
+ {
+ lseek(daemon->dumpfd, pcap_header.incl_len, SEEK_CUR);
+ packet_count++;
+ }
+ }
+}
+
+void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, union mysockaddr *dst)
+{
+ struct ip ip;
+#ifdef HAVE_IPV6
+ struct ip6_hdr ip6;
+ int family;
+#endif
+ struct udphdr {
+ u16 uh_sport; /* source port */
+ u16 uh_dport; /* destination port */
+ u16 uh_ulen; /* udp length */
+ u16 uh_sum; /* udp checksum */
+ } udp;
+ struct pcaprec_hdr_s pcap_header;
+ struct timeval time;
+ u32 i, sum;
+ void *iphdr;
+ size_t ipsz;
+ int rc;
+
+ if (daemon->dumpfd == -1 || !(mask & daemon->dump_mask))
+ return;
+
+ /* So wireshark can Id the packet. */
+ udp.uh_sport = udp.uh_dport = htons(NAMESERVER_PORT);
+
+#ifdef HAVE_IPV6
+ if (src)
+ family = src->sa.sa_family;
+ else
+ family = dst->sa.sa_family;
+
+ if (family == AF_INET6)
+ {
+ iphdr = &ip6;
+ ipsz = sizeof(ip6);
+ memset(&ip6, 0, sizeof(ip6));
+
+ ip6.ip6_vfc = 6 << 4;
+ ip6.ip6_plen = htons(sizeof(struct udphdr) + len);
+ ip6.ip6_nxt = IPPROTO_UDP;
+ ip6.ip6_hops = 64;
+
+ if (src)
+ {
+ memcpy(&ip6.ip6_src, &src->in6.sin6_addr, IN6ADDRSZ);
+ udp.uh_sport = src->in6.sin6_port;
+ }
+
+ if (dst)
+ {
+ memcpy(&ip6.ip6_dst, &dst->in6.sin6_addr, IN6ADDRSZ);
+ udp.uh_dport = dst->in6.sin6_port;
+ }
+
+ /* start UDP checksum */
+ for (sum = 0, i = 0; i < IN6ADDRSZ; i++)
+ sum += ((u16 *)&ip6.ip6_src)[i];
+ }
+ else
+#endif
+ {
+ iphdr = &ip;
+ ipsz = sizeof(ip);
+ memset(&ip, 0, sizeof(ip));
+
+ ip.ip_v = IPVERSION;
+ ip.ip_hl = sizeof(struct ip) / 4;
+ ip.ip_len = htons(sizeof(struct ip) + sizeof(struct udphdr) + len);
+ ip.ip_ttl = IPDEFTTL;
+ ip.ip_p = IPPROTO_UDP;
+
+ if (src)
+ {
+ ip.ip_src = src->in.sin_addr;
+ udp.uh_sport = src->in.sin_port;
+ }
+
+ if (dst)
+ {
+ ip.ip_dst = dst->in.sin_addr;
+ udp.uh_dport = dst->in.sin_port;
+ }
+
+ ip.ip_sum = 0;
+ for (sum = 0, i = 0; i < sizeof(struct ip) / 2; i++)
+ sum += ((u16 *)&ip)[i];
+ while (sum >> 16)
+ sum = (sum & 0xffff) + (sum >> 16);
+ ip.ip_sum = (sum == 0xffff) ? sum : ~sum;
+
+ /* start UDP checksum */
+ sum = ip.ip_src.s_addr & 0xffff;
+ sum += (ip.ip_src.s_addr >> 16) & 0xffff;
+ sum += ip.ip_dst.s_addr & 0xffff;
+ sum += (ip.ip_dst.s_addr >> 16) & 0xffff;
+ }
+
+ if (len & 1)
+ ((unsigned char *)packet)[len] = 0; /* for checksum, in case length is odd. */
+
+ udp.uh_sum = 0;
+ udp.uh_ulen = htons(sizeof(struct udphdr) + len);
+ sum += htons(IPPROTO_UDP);
+ sum += htons(sizeof(struct udphdr) + len);
+ for (i = 0; i < sizeof(struct udphdr)/2; i++)
+ sum += ((u16 *)&udp)[i];
+ for (i = 0; i < (len + 1) / 2; i++)
+ sum += ((u16 *)packet)[i];
+ while (sum >> 16)
+ sum = (sum & 0xffff) + (sum >> 16);
+ udp.uh_sum = (sum == 0xffff) ? sum : ~sum;
+
+ rc = gettimeofday(&time, NULL);
+ pcap_header.ts_sec = time.tv_sec;
+ pcap_header.ts_usec = time.tv_usec;
+ pcap_header.incl_len = pcap_header.orig_len = ipsz + sizeof(udp) + len;
+
+ if (rc == -1 ||
+ !read_write(daemon->dumpfd, (void *)&pcap_header, sizeof(pcap_header), 0) ||
+ !read_write(daemon->dumpfd, iphdr, ipsz, 0) ||
+ !read_write(daemon->dumpfd, (void *)&udp, sizeof(udp), 0) ||
+ !read_write(daemon->dumpfd, (void *)packet, len, 0))
+ my_syslog(LOG_ERR, _("failed to write packet dump"));
+ else
+ my_syslog(LOG_INFO, _("dumping UDP packet %u mask 0x%04x"), ++packet_count, mask);
+
+}
+
+#endif
--- a/src/forward.c
+++ b/src/forward.c
@@ -508,6 +508,10 @@ static int forward_query(int udpfd, unio
if (errno == 0)
{
+#ifdef HAVE_DUMPFILE
+ dump_packet(DUMP_UP_QUERY, (void *)header, plen, NULL, &start->addr);
+#endif
+
/* Keep info in case we want to re-send this packet */
daemon->srv_save = start;
daemon->packet_len = plen;
@@ -769,7 +773,7 @@ void reply_query(int fd, int family, tim
#endif
header = (struct dns_header *)daemon->packet;
-
+
if (n < (int)sizeof(struct dns_header) || !(header->hb3 & HB3_QR))
return;
@@ -796,6 +800,12 @@ void reply_query(int fd, int family, tim
if (!(forward = lookup_frec(ntohs(header->id), hash)))
return;
+#ifdef HAVE_DUMPFILE
+ dump_packet((forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY)) ? DUMP_SEC_REPLY : DUMP_UP_REPLY,
+ (void *)header, n, &serveraddr, NULL);
+#endif
+
+
/* log_query gets called indirectly all over the place, so
pass these in global variables - sorry. */
daemon->log_display_id = forward->log_id;
@@ -934,6 +944,11 @@ void reply_query(int fd, int family, tim
status = dnssec_validate_reply(now, header, n, daemon->namebuff, daemon->keyname, &forward->class,
!option_bool(OPT_DNSSEC_IGN_NS) && (server->flags & SERV_DO_DNSSEC),
NULL, NULL);
+#ifdef HAVE_DUMPFILE
+ if (status == STAT_BOGUS)
+ dump_packet((forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY)) ? DUMP_SEC_BOGUS : DUMP_BOGUS,
+ header, (size_t)n, &serveraddr, NULL);
+#endif
}
/* Can't validate, as we're missing key data. Put this
@@ -1060,6 +1075,11 @@ void reply_query(int fd, int family, tim
setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
}
#endif
+
+#ifdef HAVE_DUMPFILE
+ dump_packet(DUMP_SEC_QUERY, (void *)header, (size_t)nn, NULL, &server->addr);
+#endif
+
while (retry_send(sendto(fd, (char *)header, nn, 0,
&server->addr.sa,
sa_len(&server->addr))));
@@ -1114,8 +1134,8 @@ void reply_query(int fd, int family, tim
bogusanswer = 1;
}
}
-#endif
-
+#endif
+
/* restore CD bit to the value in the query */
if (forward->flags & FREC_CHECKING_DISABLED)
header->hb4 |= HB4_CD;
@@ -1141,6 +1161,11 @@ void reply_query(int fd, int family, tim
nn = resize_packet(header, nn, NULL, 0);
}
#endif
+
+#ifdef HAVE_DUMPFILE
+ dump_packet(DUMP_REPLY, daemon->packet, (size_t)nn, NULL, &forward->source);
+#endif
+
send_from(forward->fd, option_bool(OPT_NOWILD) || option_bool (OPT_CLEVERBIND), daemon->packet, nn,
&forward->source, &forward->dest, forward->iface);
}
@@ -1394,7 +1419,11 @@ void receive_query(struct listener *list
pass these in global variables - sorry. */
daemon->log_display_id = ++daemon->log_id;
daemon->log_source_addr = &source_addr;
-
+
+#ifdef HAVE_DUMPFILE
+ dump_packet(DUMP_QUERY, daemon->packet, (size_t)n, &source_addr, NULL);
+#endif
+
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
{
#ifdef HAVE_AUTH
--- a/src/option.c
+++ b/src/option.c
@@ -161,6 +161,8 @@ struct myoption {
#define LOPT_TFTP_MTU 349
#define LOPT_REPLY_DELAY 350
#define LOPT_RAPID_COMMIT 351
+#define LOPT_DUMPFILE 352
+#define LOPT_DUMPMASK 353
#ifdef HAVE_GETOPT_LONG
static const struct option opts[] =
@@ -327,6 +329,8 @@ static const struct myoption opts[] =
{ "dhcp-ttl", 1, 0 , LOPT_DHCPTTL },
{ "dhcp-reply-delay", 1, 0, LOPT_REPLY_DELAY },
{ "dhcp-rapid-commit", 0, 0, LOPT_RAPID_COMMIT },
+ { "dumpfile", 1, 0, LOPT_DUMPFILE },
+ { "dumpmask", 1, 0, LOPT_DUMPMASK },
{ NULL, 0, 0, 0 }
};
@@ -500,6 +504,8 @@ static struct {
{ LOPT_DHCPTTL, ARG_ONE, "<ttl>", gettext_noop("Set TTL in DNS responses with DHCP-derived addresses."), NULL },
{ LOPT_REPLY_DELAY, ARG_ONE, "<integer>", gettext_noop("Delay DHCP replies for at least number of seconds."), NULL },
{ LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL },
+ { LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
+ { LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
{ 0, 0, NULL, NULL, NULL }
};
@@ -1811,6 +1817,14 @@ static int one_opt(int option, char *arg
ret_err(_("bad MX target"));
break;
+ case LOPT_DUMPFILE: /* --dumpfile */
+ daemon->dump_file = opt_string_alloc(arg);
+ break;
+
+ case LOPT_DUMPMASK: /* --dumpmask */
+ daemon->dump_mask = strtol(arg, NULL, 0);
+ break;
+
#ifdef HAVE_DHCP
case 'l': /* --dhcp-leasefile */
daemon->lease_file = opt_string_alloc(arg);

View File

@@ -1,22 +0,0 @@
From 34e26e14c5e0fb2d5f05f67858319c9db2058333 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Thu, 10 May 2018 20:54:57 +0100
Subject: [PATCH 05/10] Retry query to other servers on receipt of SERVFAIL
rcode.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/forward.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/forward.c
+++ b/src/forward.c
@@ -817,7 +817,7 @@ void reply_query(int fd, int family, tim
/* Note: if we send extra options in the EDNS0 header, we can't recreate
the query from the reply. */
- if (RCODE(header) == REFUSED &&
+ if ((RCODE(header) == REFUSED || RCODE(header) == SERVFAIL) &&
forward->forwardall == 0 &&
!(forward->flags & FREC_HAS_EXTRADATA))
/* for broken servers, attempt to send to another one. */

View File

@@ -1,87 +0,0 @@
From a0088e83640d7d1544127dd668660462e9f78e52 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Thu, 10 May 2018 21:43:14 +0100
Subject: [PATCH 06/10] Handle query retry on REFUSED or SERVFAIL for
DNSSEC-generated queries.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/forward.c | 46 ++++++++++++++++++++++++++++++++++++++++------
1 file changed, 40 insertions(+), 6 deletions(-)
--- a/src/forward.c
+++ b/src/forward.c
@@ -298,9 +298,9 @@ static int forward_query(int udpfd, unio
fd = forward->rfd4->fd;
}
- while (retry_send( sendto(fd, (char *)header, plen, 0,
- &forward->sentto->addr.sa,
- sa_len(&forward->sentto->addr))));
+ while (retry_send(sendto(fd, (char *)header, plen, 0,
+ &forward->sentto->addr.sa,
+ sa_len(&forward->sentto->addr))));
return 1;
}
@@ -804,8 +804,7 @@ void reply_query(int fd, int family, tim
dump_packet((forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY)) ? DUMP_SEC_REPLY : DUMP_UP_REPLY,
(void *)header, n, &serveraddr, NULL);
#endif
-
-
+
/* log_query gets called indirectly all over the place, so
pass these in global variables - sorry. */
daemon->log_display_id = forward->log_id;
@@ -826,6 +825,40 @@ void reply_query(int fd, int family, tim
size_t plen;
int is_sign;
+ /* For DNSSEC originated queries, just retry the query to the same server. */
+ if (forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY))
+ {
+ blockdata_retrieve(forward->stash, forward->stash_len, (void *)header);
+ plen = forward->stash_len;
+
+ forward->forwardall = 2; /* only retry once */
+
+ if (forward->sentto->addr.sa.sa_family == AF_INET)
+ log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (struct all_addr *)&forward->sentto->addr.in.sin_addr, "dnssec");
+#ifdef HAVE_IPV6
+ else
+ log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&forward->sentto->addr.in6.sin6_addr, "dnssec");
+#endif
+
+ if (forward->sentto->sfd)
+ fd = forward->sentto->sfd->fd;
+ else
+ {
+#ifdef HAVE_IPV6
+ if (forward->sentto->addr.sa.sa_family == AF_INET6)
+ fd = forward->rfd6->fd;
+ else
+#endif
+ fd = forward->rfd4->fd;
+ }
+
+ while (retry_send(sendto(fd, (char *)header, plen, 0,
+ &forward->sentto->addr.sa,
+ sa_len(&forward->sentto->addr))));
+
+ return;
+ }
+
/* In strict order mode, there must be a server later in the chain
left to send to, otherwise without the forwardall mechanism,
code further on will cycle around the list forwever if they
@@ -1017,7 +1050,8 @@ void reply_query(int fd, int family, tim
#ifdef HAVE_IPV6
new->rfd6 = NULL;
#endif
- new->flags &= ~(FREC_DNSKEY_QUERY | FREC_DS_QUERY);
+ new->flags &= ~(FREC_DNSKEY_QUERY | FREC_DS_QUERY | FREC_HAS_EXTRADATA);
+ new->forwardall = 0;
new->dependent = forward; /* to find query awaiting new one. */
forward->blocking_query = new; /* for garbage cleaning */

View File

@@ -1,100 +0,0 @@
From 1f60a18ea1c64beb8b6cffa0650a2bfad95ac352 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 11 May 2018 16:44:16 +0100
Subject: [PATCH 07/10] Retry SERVFAIL DNSSEC queries to a different server, if
possible.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/forward.c | 53 ++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 11 deletions(-)
--- a/src/forward.c
+++ b/src/forward.c
@@ -825,9 +825,12 @@ void reply_query(int fd, int family, tim
size_t plen;
int is_sign;
+#ifdef HAVE_DNSSEC
/* For DNSSEC originated queries, just retry the query to the same server. */
if (forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY))
{
+ struct server *start;
+
blockdata_retrieve(forward->stash, forward->stash_len, (void *)header);
plen = forward->stash_len;
@@ -839,26 +842,54 @@ void reply_query(int fd, int family, tim
else
log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&forward->sentto->addr.in6.sin6_addr, "dnssec");
#endif
-
- if (forward->sentto->sfd)
- fd = forward->sentto->sfd->fd;
+
+ start = forward->sentto;
+
+ /* for non-domain specific servers, see if we can find another to try. */
+ if ((forward->sentto->flags & SERV_TYPE) == 0)
+ while (1)
+ {
+ if (!(start = start->next))
+ start = daemon->servers;
+ if (start == forward->sentto)
+ break;
+
+ if ((start->flags & SERV_TYPE) == 0 &&
+ (start->flags & SERV_DO_DNSSEC))
+ break;
+ }
+
+
+ if (start->sfd)
+ fd = start->sfd->fd;
else
{
#ifdef HAVE_IPV6
- if (forward->sentto->addr.sa.sa_family == AF_INET6)
- fd = forward->rfd6->fd;
+ if (start->addr.sa.sa_family == AF_INET6)
+ {
+ /* may have changed family */
+ if (!forward->rfd6)
+ forward->rfd6 = allocate_rfd(AF_INET6);
+ fd = forward->rfd6->fd;
+ }
else
#endif
- fd = forward->rfd4->fd;
+ {
+ /* may have changed family */
+ if (!forward->rfd4)
+ forward->rfd4 = allocate_rfd(AF_INET);
+ fd = forward->rfd4->fd;
+ }
}
-
+
while (retry_send(sendto(fd, (char *)header, plen, 0,
- &forward->sentto->addr.sa,
- sa_len(&forward->sentto->addr))));
+ &start->addr.sa,
+ sa_len(&start->addr))));
return;
}
-
+#endif
+
/* In strict order mode, there must be a server later in the chain
left to send to, otherwise without the forwardall mechanism,
code further on will cycle around the list forwever if they
@@ -1024,7 +1055,7 @@ void reply_query(int fd, int family, tim
while (1)
{
if (type == (start->flags & (SERV_TYPE | SERV_DO_DNSSEC)) &&
- (type != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) &&
+ ((type & SERV_TYPE) != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) &&
!(start->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
{
new_server = start;

View File

@@ -1,41 +0,0 @@
From e27825b0ef1e79ab05b1752c8c838cb43ad39d79 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 11 May 2018 17:20:47 +0100
Subject: [PATCH 08/10] Fix logging in previous.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/forward.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
--- a/src/forward.c
+++ b/src/forward.c
@@ -835,14 +835,6 @@ void reply_query(int fd, int family, tim
plen = forward->stash_len;
forward->forwardall = 2; /* only retry once */
-
- if (forward->sentto->addr.sa.sa_family == AF_INET)
- log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (struct all_addr *)&forward->sentto->addr.in.sin_addr, "dnssec");
-#ifdef HAVE_IPV6
- else
- log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&forward->sentto->addr.in6.sin6_addr, "dnssec");
-#endif
-
start = forward->sentto;
/* for non-domain specific servers, see if we can find another to try. */
@@ -886,6 +878,13 @@ void reply_query(int fd, int family, tim
&start->addr.sa,
sa_len(&start->addr))));
+ if (start->addr.sa.sa_family == AF_INET)
+ log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (struct all_addr *)&start->addr.in.sin_addr, "dnssec");
+#ifdef HAVE_IPV6
+ else
+ log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&start->addr.in6.sin6_addr, "dnssec");
+#endif
+
return;
}
#endif

View File

@@ -1,44 +0,0 @@
From 0a496f059c1e9d75c33cce4c1211d58422ba4f62 Mon Sep 17 00:00:00 2001
From: Maarten de Vries <maarten+dnsmasq@m.de-vri.es>
Date: Fri, 11 May 2018 23:20:58 +0100
Subject: [PATCH 09/10] Do unsolicited RAs for interfaces which appear after
dnsmasq startup.
I noticed that dnsmasq often wasn't sending any unsolicited RAs for me.
This turned out to happen when the interface (a bridge interface) wasn't
created yet at the time dnsmasq started. When dnsmasq is started after
the interface is created, it sends RAs as expected. I assume this also
extends to other types of virtual interfaces that are created after
dnsmasq starts.
Digging into the source, it seems to be caused by a missing call to
ra_start_unsolicited for non-template contexts in construct_worker from
src/dhcp6.c. The attached patch adds that call, but only if the
interface index or address changed to prevent doing fast RAs for no reason.
I tested it on my own server and it appears to work as expected. When
the interface is created and configured, dnsmasq does fast RAs for a
while and then settles into slow RAs.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/dhcp6.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -647,6 +647,13 @@ static int construct_worker(struct in6_a
is_same_net6(local, &template->start6, template->prefix) &&
is_same_net6(local, &template->end6, template->prefix))
{
+ /* First time found, do fast RA. */
+ if (template->if_index != if_index || !IN6_ARE_ADDR_EQUAL(&template->local6, local))
+ {
+ ra_start_unsolicited(param->now, template);
+ param->newone = 1;
+ }
+
template->if_index = if_index;
template->local6 = *local;
}

View File

@@ -1,38 +0,0 @@
From 1f1873aadd092a0fab505dd278a484d887ba0ec3 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 11 May 2018 23:38:23 +0100
Subject: [PATCH 10/10] Log warning on very large cachesize config, instead of
truncating it.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
src/dnsmasq.c | 6 +++++-
src/option.c | 2 --
2 files changed, 5 insertions(+), 3 deletions(-)
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -740,7 +740,11 @@ int main (int argc, char **argv)
else
{
if (daemon->cachesize != 0)
- my_syslog(LOG_INFO, _("started, version %s cachesize %d"), VERSION, daemon->cachesize);
+ {
+ my_syslog(LOG_INFO, _("started, version %s cachesize %d"), VERSION, daemon->cachesize);
+ if (daemon->cachesize > 10000)
+ my_syslog(LOG_WARNING, _("cache size greater than 10000 may cause performance issues, and is unlikely to be useful."));
+ }
else
my_syslog(LOG_INFO, _("started, version %s cache disabled"), VERSION);
--- a/src/option.c
+++ b/src/option.c
@@ -2603,8 +2603,6 @@ static int one_opt(int option, char *arg
if (size < 0)
size = 0;
- else if (size > 10000)
- size = 10000;
daemon->cachesize = size;
}

View File

@@ -74,7 +74,7 @@
int main (int argc, char **argv)
{
int bind_fallback = 0;
@@ -944,6 +1004,7 @@ int main (int argc, char **argv)
@@ -949,6 +1009,7 @@ int main (int argc, char **argv)
set_dbus_listeners();
#endif
@@ -82,7 +82,7 @@
#ifdef HAVE_DHCP
if (daemon->dhcp || daemon->relay4)
{
@@ -1074,6 +1135,8 @@ int main (int argc, char **argv)
@@ -1079,6 +1140,8 @@ int main (int argc, char **argv)
check_dbus_listeners();
#endif
@@ -104,7 +104,7 @@
mostly_clean :
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -1440,6 +1440,8 @@ void emit_dbus_signal(int action, struct
@@ -1445,6 +1445,8 @@ void emit_dbus_signal(int action, struct
# endif
#endif

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=igmpproxy
PKG_VERSION:=0.2.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/pali/igmpproxy/releases/download/${PKG_VERSION}/

View File

@@ -114,7 +114,7 @@ start_service() {
[ -n "$has_upstream" ] || return
procd_open_instance
procd_set_param command $PROG
procd_set_param command $PROG '-n'
[ -n "$logopts" ] && procd_append_param command $logopts
procd_append_param command $CONFIGFILE
procd_set_param file $CONFIGFILE

View File

@@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=odhcpd
PKG_RELEASE:=1
PKG_VERSION:=1.7
PKG_VERSION:=1.10
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git
PKG_SOURCE_DATE:=2018-04-23
PKG_SOURCE_VERSION:=413652910234f44e11d6550abf6871621474b8cb
PKG_MIRROR_HASH:=2245eea8764e40b518e40633eeabd30eb8cc4d01574a351a3d6b0aef27f654ca
PKG_SOURCE_DATE:=2018-07-26
PKG_SOURCE_VERSION:=44cce3169a961727b1f046b786e7995ffb26a957
PKG_MIRROR_HASH:=f068ddad6e4c630a5baf7369a6deaebd1ec3f7e5c0aa4826496451da425e40dc
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0

View File

@@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard
PKG_VERSION:=0.0.20180625
PKG_RELEASE:=1
PKG_VERSION:=0.0.20180718
PKG_RELEASE:=2
PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
PKG_HASH:=d9bedeb22b1f83d48581608a6521fea1d429fbeb8809419d08703ef2ec570020
PKG_HASH:=083c093a6948c8d38f92e7ea5533f9ff926019f24dc2612ea974851ed3e24705
PKG_LICENSE:=GPL-2.0 Apache-2.0
PKG_LICENSE_FILES:=COPYING
@@ -84,12 +84,13 @@ define Package/wireguard-tools/description
$(call Package/wireguard/Default/description)
This package provides the userspace control program for WireGuard,
`wg(8)`, and a netifd protocol helper.
`wg(8)`, a netifd protocol helper, and a re-resolve watchdog script.
endef
define Package/wireguard-tools/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
endef

View File

@@ -0,0 +1,60 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2018 Aleksandr V. Piskunov <aleksandr.v.piskunov@gmail.com>.
# Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
#
# This watchdog script tries to re-resolve hostnames for inactive WireGuard peers.
# Use it for peers with a frequently changing dynamic IP.
# persistent_keepalive must be set, recommended value is 25 seconds.
#
# Run this script from cron every minute:
# echo '* * * * * /usr/bin/wireguard_watchdog' >> /etc/crontabs/root
. /lib/functions.sh
check_peer_activity() {
local cfg=$1
local iface=$2
local public_key
local endpoint_host
local endpoint_port
local persistent_keepalive
local last_handshake
local idle_seconds
config_get public_key "${cfg}" "public_key"
config_get endpoint_host "${cfg}" "endpoint_host"
config_get endpoint_port "${cfg}" "endpoint_port"
persistent_keepalive=`wg show ${iface} persistent-keepalive | grep ${public_key} | awk '{print $2}'`
# only process peers with endpoints and keepalive set
[ -z ${endpoint_host} ] && return 0;
[ -z ${persistent_keepalive} -o ${persistent_keepalive} = "off" ] && return 0;
# skip IP addresses
# check taken from packages/net/ddns-scripts/files/dynamic_dns_functions.sh
local IPV4_REGEX="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
local IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)"
local IPV4=$(echo ${endpoint_host} | grep -m 1 -o "$IPV4_REGEX$") # do not detect ip in 0.0.0.0.example.com
local IPV6=$(echo ${endpoint_host} | grep -m 1 -o "$IPV6_REGEX")
[ -n "${IPV4}" -o -n "${IPV6}" ] && return 0;
# re-resolve endpoint hostname if not responding for too long
last_handshake=`wg show ${iface} latest-handshakes | grep ${public_key} | awk '{print $2}'`
[ -z ${last_handshake} ] && return 0;
idle_seconds=$((`date +%s`-${last_handshake}))
[ ${idle_seconds} -lt 150 ] && return 0;
logger -t "wireguard_monitor" "${iface} endpoint ${endpoint_host}:${endpoint_port} is not responding for ${idle_seconds} seconds, trying to re-resolve hostname"
wg set ${iface} peer ${public_key} endpoint "${endpoint_host}:${endpoint_port}"
}
# query ubus for all active wireguard interfaces
wg_ifaces=`ubus -S call network.interface dump | jsonfilter -e '@.interface[@.up=true]' | jsonfilter -a -e '@[@.proto="wireguard"].interface' | tr "\n" " "`
# check every peer in every active wireguard interface
config_load network
for iface in $wg_ifaces; do
config_foreach check_peer_activity "wireguard_${iface}" "${iface}"
done

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2
PKG_VERSION:=4.16.0
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2

View File

@@ -122,7 +122,7 @@
--- /dev/null
+++ b/man/man8/tc-cake.8
@@ -0,0 +1,632 @@
+.TH CAKE 8 "23 November 2017" "iproute2" "Linux"
+.TH CAKE 8 "19 July 2018" "iproute2" "Linux"
+.SH NAME
+CAKE \- Common Applications Kept Enhanced (CAKE)
+.SH SYNOPSIS
@@ -133,7 +133,7 @@
+RATE |
+.BR unlimited*
+|
+.BR autorate_ingress
+.BR autorate-ingress
+]
+.br
+[
@@ -273,7 +273,7 @@
+.BR tc(8)
+or examples below for details of the RATE value.
+.PP
+.B autorate_ingress
+.B autorate-ingress
+.br
+ Automatic capacity estimation based on traffic arriving at this qdisc.
+This is most likely to be useful with cellular links, which tend to change
@@ -522,7 +522,7 @@
+.br
+ So named because Jupiter is about 1 light-hour from Earth. Use this to
+(almost) completely disable AQM actions. Equivalent to
+.B rtt 1000s.
+.B rtt 3600s.
+
+.SH FLOW ISOLATION PARAMETERS
+With flow isolation enabled, CAKE places packets from different flows into
@@ -677,7 +677,7 @@
+.br
+# tc -s qdisc show dev eth0
+.br
+qdisc cake 1: dev eth0 root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84
+qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84
+ Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
+ backlog 0b 0p requeues 0
+ memory used: 0b of 5000000b
@@ -745,7 +745,7 @@
+.BR tc (8),
+.BR tc-codel (8),
+.BR tc-fq_codel (8),
+.BR tc-red (8)
+.BR tc-htb (8)
+
+.SH AUTHORS
+Cake's principal author is Jonathan Morton, with contributions from
@@ -754,20 +754,31 @@
+
+This manual page was written by Loganaden Velvindron. Please report corrections
+to the Linux Networking mailing list <netdev@vger.kernel.org>.
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -776,6 +776,7 @@ was written by Alexey N. Kuznetsov and a
.BR tc-basic (8),
.BR tc-bfifo (8),
.BR tc-bpf (8),
+.BR tc-cake (8),
.BR tc-cbq (8),
.BR tc-cgroup (8),
.BR tc-choke (8),
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -64,6 +64,7 @@ TCMODULES += em_meta.o
TCMODULES += q_mqprio.o
TCMODULES += q_codel.o
@@ -66,6 +66,7 @@ TCMODULES += q_codel.o
TCMODULES += q_fq_codel.o
+TCMODULES += q_cake.o
TCMODULES += q_fq.o
TCMODULES += q_pie.o
+TCMODULES += q_cake.o
TCMODULES += q_hhf.o
TCMODULES += q_clsact.o
TCMODULES += e_bpf.o
--- /dev/null
+++ b/tc/q_cake.c
@@ -0,0 +1,796 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
@@ -0,0 +1,790 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+
+/*
+ * Common Applications Kept Enhanced -- CAKE
+ *
@@ -785,6 +796,7 @@
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "utils.h"
+#include "tc_util.h"
@@ -806,6 +818,24 @@
+ {"interplanetary", 50000000, 1000000000},
+};
+
+static const char * diffserv_names[CAKE_DIFFSERV_MAX] = {
+ [CAKE_DIFFSERV_DIFFSERV3] = "diffserv3",
+ [CAKE_DIFFSERV_DIFFSERV4] = "diffserv4",
+ [CAKE_DIFFSERV_DIFFSERV8] = "diffserv8",
+ [CAKE_DIFFSERV_BESTEFFORT] = "besteffort",
+ [CAKE_DIFFSERV_PRECEDENCE] = "precedence",
+};
+
+static const char * flowmode_names[CAKE_FLOW_MAX] = {
+ [CAKE_FLOW_NONE] = "flowblind",
+ [CAKE_FLOW_SRC_IP] = "srchost",
+ [CAKE_FLOW_DST_IP] = "dsthost",
+ [CAKE_FLOW_HOSTS] = "hosts",
+ [CAKE_FLOW_FLOWS] = "flows",
+ [CAKE_FLOW_DUAL_SRC] = "dual-srchost",
+ [CAKE_FLOW_DUAL_DST] = "dual-dsthost",
+ [CAKE_FLOW_TRIPLE] = "triple-isolate",
+};
+
+static struct cake_preset *find_preset(char *argv)
+{
@@ -820,7 +850,7 @@
+static void explain(void)
+{
+ fprintf(stderr,
+"Usage: ... cake [ bandwidth RATE | unlimited* | autorate_ingress ]\n"
+"Usage: ... cake [ bandwidth RATE | unlimited* | autorate-ingress ]\n"
+" [ rtt TIME | datacentre | lan | metro | regional |\n"
+" internet* | oceanic | satellite | interplanetary ]\n"
+" [ besteffort | diffserv8 | diffserv4 | diffserv3* ]\n"
@@ -838,25 +868,25 @@
+static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
+ struct nlmsghdr *n, const char *dev)
+{
+ int unlimited = 0;
+ __u64 bandwidth = 0;
+ unsigned interval = 0;
+ unsigned target = 0;
+ unsigned diffserv = 0;
+ unsigned memlimit = 0;
+ int overhead = 0;
+ bool overhead_set = false;
+ struct cake_preset *preset, *preset_set = NULL;
+ bool overhead_override = false;
+ int mpu = 0;
+ int flowmode = -1;
+ int nat = -1;
+ int atm = -1;
+ int autorate = -1;
+ int wash = -1;
+ int ingress = -1;
+ bool overhead_set = false;
+ unsigned int interval = 0;
+ unsigned int diffserv = 0;
+ unsigned int memlimit = 0;
+ unsigned int target = 0;
+ __u64 bandwidth = 0;
+ int ack_filter = -1;
+ struct rtattr *tail;
+ struct cake_preset *preset, *preset_set = NULL;
+ int unlimited = 0;
+ int flowmode = -1;
+ int autorate = -1;
+ int ingress = -1;
+ int overhead = 0;
+ int wash = -1;
+ int nat = -1;
+ int atm = -1;
+ int mpu = 0;
+
+ while (argc > 0) {
+ if (strcmp(*argv, "bandwidth") == 0) {
@@ -871,9 +901,8 @@
+ bandwidth = 0;
+ unlimited = 1;
+ autorate = 0;
+ } else if (strcmp(*argv, "autorate_ingress") == 0) {
+ } else if (strcmp(*argv, "autorate-ingress") == 0) {
+ autorate = 1;
+
+ } else if (strcmp(*argv, "rtt") == 0) {
+ NEXT_ARG();
+ if (get_time(&interval, *argv)) {
@@ -881,7 +910,7 @@
+ return -1;
+ }
+ target = interval / 20;
+ if(!target)
+ if (!target)
+ target = 1;
+ } else if ((preset = find_preset(*argv))) {
+ if (preset_set)
@@ -889,7 +918,6 @@
+ preset_set = preset;
+ target = preset->target;
+ interval = preset->interval;
+
+ } else if (strcmp(*argv, "besteffort") == 0) {
+ diffserv = CAKE_DIFFSERV_BESTEFFORT;
+ } else if (strcmp(*argv, "precedence") == 0) {
@@ -902,12 +930,10 @@
+ diffserv = CAKE_DIFFSERV_DIFFSERV4;
+ } else if (strcmp(*argv, "diffserv3") == 0) {
+ diffserv = CAKE_DIFFSERV_DIFFSERV3;
+
+ } else if (strcmp(*argv, "nowash") == 0) {
+ wash = 0;
+ } else if (strcmp(*argv, "wash") == 0) {
+ wash = 1;
+
+ } else if (strcmp(*argv, "flowblind") == 0) {
+ flowmode = CAKE_FLOW_NONE;
+ } else if (strcmp(*argv, "srchost") == 0) {
@@ -924,19 +950,16 @@
+ flowmode = CAKE_FLOW_DUAL_DST;
+ } else if (strcmp(*argv, "triple-isolate") == 0) {
+ flowmode = CAKE_FLOW_TRIPLE;
+
+ } else if (strcmp(*argv, "nat") == 0) {
+ nat = 1;
+ } else if (strcmp(*argv, "nonat") == 0) {
+ nat = 0;
+
+ } else if (strcmp(*argv, "ptm") == 0) {
+ atm = CAKE_ATM_PTM;
+ } else if (strcmp(*argv, "atm") == 0) {
+ atm = CAKE_ATM_ATM;
+ } else if (strcmp(*argv, "noatm") == 0) {
+ atm = CAKE_ATM_NONE;
+
+ } else if (strcmp(*argv, "raw") == 0) {
+ atm = CAKE_ATM_NONE;
+ overhead = 0;
@@ -1006,7 +1029,6 @@
+ atm = CAKE_ATM_PTM;
+ overhead += 22;
+ overhead_set = true;
+
+ } else if (strcmp(*argv, "via-ethernet") == 0) {
+ /*
+ * We used to use this flag to manually compensate for
@@ -1020,10 +1042,10 @@
+ * stats output when the automatic compensation is
+ * active.
+ */
+
+ } else if (strcmp(*argv, "ethernet") == 0) {
+ /* ethernet pre-amble & interframe gap & FCS
+ * you may need to add vlan tag */
+ * you may need to add vlan tag
+ */
+ overhead += 38;
+ overhead_set = true;
+ mpu = 84;
@@ -1043,45 +1065,46 @@
+ overhead += 18;
+ overhead_set = true;
+ mpu = 64;
+
+ } else if (strcmp(*argv, "overhead") == 0) {
+ char* p = NULL;
+ char *p = NULL;
+
+ NEXT_ARG();
+ overhead = strtol(*argv, &p, 10);
+ if(!p || *p || !*argv || overhead < -64 || overhead > 256) {
+ fprintf(stderr, "Illegal \"overhead\", valid range is -64 to 256\\n");
+ if (!p || *p || !*argv ||
+ overhead < -64 || overhead > 256) {
+ fprintf(stderr,
+ "Illegal \"overhead\", valid range is -64 to 256\\n");
+ return -1;
+ }
+ overhead_set = true;
+
+ } else if (strcmp(*argv, "mpu") == 0) {
+ char* p = NULL;
+ char *p = NULL;
+
+ NEXT_ARG();
+ mpu = strtol(*argv, &p, 10);
+ if(!p || *p || !*argv || mpu < 0 || mpu > 256) {
+ fprintf(stderr, "Illegal \"mpu\", valid range is 0 to 256\\n");
+ if (!p || *p || !*argv || mpu < 0 || mpu > 256) {
+ fprintf(stderr,
+ "Illegal \"mpu\", valid range is 0 to 256\\n");
+ return -1;
+ }
+
+ } else if (strcmp(*argv, "ingress") == 0) {
+ ingress = 1;
+ } else if (strcmp(*argv, "egress") == 0) {
+ ingress = 0;
+
+ } else if (strcmp(*argv, "no-ack-filter") == 0) {
+ ack_filter = CAKE_ACK_NONE;
+ } else if (strcmp(*argv, "ack-filter") == 0) {
+ ack_filter = CAKE_ACK_FILTER;
+ } else if (strcmp(*argv, "ack-filter-aggressive") == 0) {
+ ack_filter = CAKE_ACK_AGGRESSIVE;
+
+ } else if (strcmp(*argv, "memlimit") == 0) {
+ NEXT_ARG();
+ if(get_size(&memlimit, *argv)) {
+ fprintf(stderr, "Illegal value for \"memlimit\": \"%s\"\n", *argv);
+ if (get_size(&memlimit, *argv)) {
+ fprintf(stderr,
+ "Illegal value for \"memlimit\": \"%s\"\n", *argv);
+ return -1;
+ }
+
+ } else if (strcmp(*argv, "help") == 0) {
+ explain();
+ return -1;
@@ -1096,17 +1119,22 @@
+ tail = NLMSG_TAIL(n);
+ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ if (bandwidth || unlimited)
+ addattr_l(n, 1024, TCA_CAKE_BASE_RATE64, &bandwidth, sizeof(bandwidth));
+ addattr_l(n, 1024, TCA_CAKE_BASE_RATE64, &bandwidth,
+ sizeof(bandwidth));
+ if (diffserv)
+ addattr_l(n, 1024, TCA_CAKE_DIFFSERV_MODE, &diffserv, sizeof(diffserv));
+ addattr_l(n, 1024, TCA_CAKE_DIFFSERV_MODE, &diffserv,
+ sizeof(diffserv));
+ if (atm != -1)
+ addattr_l(n, 1024, TCA_CAKE_ATM, &atm, sizeof(atm));
+ if (flowmode != -1)
+ addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode, sizeof(flowmode));
+ addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode,
+ sizeof(flowmode));
+ if (overhead_set)
+ addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead, sizeof(overhead));
+ addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead,
+ sizeof(overhead));
+ if (overhead_override) {
+ unsigned zero = 0;
+ unsigned int zero = 0;
+
+ addattr_l(n, 1024, TCA_CAKE_RAW, &zero, sizeof(zero));
+ }
+ if (mpu > 0)
@@ -1116,9 +1144,11 @@
+ if (target)
+ addattr_l(n, 1024, TCA_CAKE_TARGET, &target, sizeof(target));
+ if (autorate != -1)
+ addattr_l(n, 1024, TCA_CAKE_AUTORATE, &autorate, sizeof(autorate));
+ addattr_l(n, 1024, TCA_CAKE_AUTORATE, &autorate,
+ sizeof(autorate));
+ if (memlimit)
+ addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit, sizeof(memlimit));
+ addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit,
+ sizeof(memlimit));
+ if (nat != -1)
+ addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat));
+ if (wash != -1)
@@ -1126,31 +1156,41 @@
+ if (ingress != -1)
+ addattr_l(n, 1024, TCA_CAKE_INGRESS, &ingress, sizeof(ingress));
+ if (ack_filter != -1)
+ addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter, sizeof(ack_filter));
+ addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter,
+ sizeof(ack_filter));
+
+ tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ return 0;
+}
+
+static void cake_print_mode(unsigned int value, unsigned int max,
+ const char *key, const char **table)
+{
+ if (value < max && table[value]) {
+ print_string(PRINT_ANY, key, "%s ", table[value]);
+ } else {
+ print_string(PRINT_JSON, key, NULL, "unknown");
+ print_string(PRINT_FP, NULL, "(?%s?)", key);
+ }
+}
+
+static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{
+ struct rtattr *tb[TCA_CAKE_MAX + 1];
+ unsigned int interval = 0;
+ unsigned int memlimit = 0;
+ __u64 bandwidth = 0;
+ unsigned diffserv = 0;
+ unsigned flowmode = 0;
+ unsigned interval = 0;
+ unsigned memlimit = 0;
+ int ack_filter = 0;
+ int split_gso = 0;
+ int overhead = 0;
+ int autorate = 0;
+ int ingress = 0;
+ int wash = 0;
+ int raw = 0;
+ int mpu = 0;
+ int atm = 0;
+ int nat = 0;
+ int autorate = 0;
+ int wash = 0;
+ int ingress = 0;
+ int ack_filter = 0;
+ int split_gso = 0;
+
+ SPRINT_BUF(b1);
+ SPRINT_BUF(b2);
+
@@ -1162,77 +1202,33 @@
+ if (tb[TCA_CAKE_BASE_RATE64] &&
+ RTA_PAYLOAD(tb[TCA_CAKE_BASE_RATE64]) >= sizeof(bandwidth)) {
+ bandwidth = rta_getattr_u64(tb[TCA_CAKE_BASE_RATE64]);
+ if(bandwidth) {
+ if (bandwidth) {
+ print_uint(PRINT_JSON, "bandwidth", NULL, bandwidth);
+ print_string(PRINT_FP, NULL, "bandwidth %s ", sprint_rate(bandwidth, b1));
+ print_string(PRINT_FP, NULL, "bandwidth %s ",
+ sprint_rate(bandwidth, b1));
+ } else
+ print_string(PRINT_ANY, "bandwidth", "bandwidth %s ", "unlimited");
+ print_string(PRINT_ANY, "bandwidth", "bandwidth %s ",
+ "unlimited");
+ }
+ if (tb[TCA_CAKE_AUTORATE] &&
+ RTA_PAYLOAD(tb[TCA_CAKE_AUTORATE]) >= sizeof(__u32)) {
+ autorate = rta_getattr_u32(tb[TCA_CAKE_AUTORATE]);
+ if(autorate == 1)
+ print_string(PRINT_ANY, "autorate", "autorate_%s ", "ingress");
+ else if(autorate)
+ print_string(PRINT_ANY, "autorate", "(?autorate?) ", "unknown");
+ if (autorate == 1)
+ print_string(PRINT_ANY, "autorate", "%s ",
+ "autorate-ingress");
+ else if (autorate)
+ print_string(PRINT_ANY, "autorate", "(?autorate?) ",
+ "unknown");
+ }
+ if (tb[TCA_CAKE_DIFFSERV_MODE] &&
+ RTA_PAYLOAD(tb[TCA_CAKE_DIFFSERV_MODE]) >= sizeof(__u32)) {
+ diffserv = rta_getattr_u32(tb[TCA_CAKE_DIFFSERV_MODE]);
+ switch(diffserv) {
+ case CAKE_DIFFSERV_DIFFSERV3:
+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv3");
+ break;
+ case CAKE_DIFFSERV_DIFFSERV4:
+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv4");
+ break;
+ case CAKE_DIFFSERV_DIFFSERV8:
+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv8");
+ break;
+ case CAKE_DIFFSERV_BESTEFFORT:
+ print_string(PRINT_ANY, "diffserv", "%s ", "besteffort");
+ break;
+ case CAKE_DIFFSERV_PRECEDENCE:
+ print_string(PRINT_ANY, "diffserv", "%s ", "precedence");
+ break;
+ default:
+ print_string(PRINT_ANY, "diffserv", "(?diffserv?) ", "unknown");
+ break;
+ };
+ cake_print_mode(rta_getattr_u32(tb[TCA_CAKE_DIFFSERV_MODE]),
+ CAKE_DIFFSERV_MAX, "diffserv", diffserv_names);
+ }
+ if (tb[TCA_CAKE_FLOW_MODE] &&
+ RTA_PAYLOAD(tb[TCA_CAKE_FLOW_MODE]) >= sizeof(__u32)) {
+ flowmode = rta_getattr_u32(tb[TCA_CAKE_FLOW_MODE]);
+ switch(flowmode) {
+ case CAKE_FLOW_NONE:
+ print_string(PRINT_ANY, "flowmode", "%s ", "flowblind");
+ break;
+ case CAKE_FLOW_SRC_IP:
+ print_string(PRINT_ANY, "flowmode", "%s ", "srchost");
+ break;
+ case CAKE_FLOW_DST_IP:
+ print_string(PRINT_ANY, "flowmode", "%s ", "dsthost");
+ break;
+ case CAKE_FLOW_HOSTS:
+ print_string(PRINT_ANY, "flowmode", "%s ", "hosts");
+ break;
+ case CAKE_FLOW_FLOWS:
+ print_string(PRINT_ANY, "flowmode", "%s ", "flows");
+ break;
+ case CAKE_FLOW_DUAL_SRC:
+ print_string(PRINT_ANY, "flowmode", "%s ", "dual-srchost");
+ break;
+ case CAKE_FLOW_DUAL_DST:
+ print_string(PRINT_ANY, "flowmode", "%s ", "dual-dsthost");
+ break;
+ case CAKE_FLOW_TRIPLE:
+ print_string(PRINT_ANY, "flowmode", "%s ", "triple-isolate");
+ break;
+ default:
+ print_string(PRINT_ANY, "flowmode", "(?flowmode?) ", "unknown");
+ break;
+ };
+
+ cake_print_mode(rta_getattr_u32(tb[TCA_CAKE_FLOW_MODE]),
+ CAKE_FLOW_MAX, "flowmode", flowmode_names);
+ }
+
+ if (tb[TCA_CAKE_NAT] &&
@@ -1240,7 +1236,7 @@
+ nat = rta_getattr_u32(tb[TCA_CAKE_NAT]);
+ }
+
+ if(nat)
+ if (nat)
+ print_string(PRINT_FP, NULL, "nat ", NULL);
+ print_bool(PRINT_JSON, "nat", NULL, nat);
+
@@ -1289,7 +1285,8 @@
+ print_bool(PRINT_JSON, "ingress", NULL, ingress);
+
+ if (ack_filter == CAKE_ACK_AGGRESSIVE)
+ print_string(PRINT_ANY, "ack-filter", "ack-filter-%s ", "aggressive");
+ print_string(PRINT_ANY, "ack-filter", "ack-filter-%s ",
+ "aggressive");
+ else if (ack_filter == CAKE_ACK_FILTER)
+ print_string(PRINT_ANY, "ack-filter", "ack-filter ", "enabled");
+ else
@@ -1300,7 +1297,8 @@
+ print_bool(PRINT_JSON, "split_gso", NULL, split_gso);
+
+ if (interval)
+ print_string(PRINT_FP, NULL, "rtt %s ", sprint_time(interval, b2));
+ print_string(PRINT_FP, NULL, "rtt %s ",
+ sprint_time(interval, b2));
+ print_uint(PRINT_JSON, "rtt", NULL, interval);
+
+ if (raw)
@@ -1321,7 +1319,8 @@
+
+ if (memlimit) {
+ print_uint(PRINT_JSON, "memlimit", NULL, memlimit);
+ print_string(PRINT_FP, NULL, "memlimit %s", sprint_size(memlimit, b1));
+ print_string(PRINT_FP, NULL, "memlimit %s",
+ sprint_size(memlimit, b1));
+ }
+
+ return 0;
@@ -1331,7 +1330,8 @@
+{
+#define PRINT_TSTAT_JSON(type, name, attr) if (tstat[TCA_CAKE_TIN_STATS_ ## attr]) \
+ print_u64(PRINT_JSON, name, NULL, \
+ rta_getattr_ ## type((struct rtattr *)tstat[TCA_CAKE_TIN_STATS_ ## attr]))
+ rta_getattr_ ## type((struct rtattr *) \
+ tstat[TCA_CAKE_TIN_STATS_ ## attr]))
+
+ open_json_object(NULL);
+ PRINT_TSTAT_JSON(u64, "threshold_rate", THRESHOLD_RATE64);
@@ -1362,15 +1362,15 @@
+static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
+ struct rtattr *xstats)
+{
+ SPRINT_BUF(b1);
+ struct rtattr *st[TCA_CAKE_STATS_MAX + 1];
+ SPRINT_BUF(b1);
+ int i;
+
+ if (xstats == NULL)
+ return 0;
+
+#define GET_STAT_U32(attr) rta_getattr_u32(st[TCA_CAKE_STATS_ ## attr])
+#define GET_STAT_S32(attr) (*(__s32*)RTA_DATA(st[TCA_CAKE_STATS_ ## attr]))
+#define GET_STAT_S32(attr) (*(__s32 *)RTA_DATA(st[TCA_CAKE_STATS_ ## attr]))
+#define GET_STAT_U64(attr) rta_getattr_u64(st[TCA_CAKE_STATS_ ## attr])
+
+ parse_rtattr_nested(st, TCA_CAKE_STATS_MAX, xstats);
@@ -1399,7 +1399,7 @@
+ if (st[TCA_CAKE_STATS_MIN_NETLEN] &&
+ st[TCA_CAKE_STATS_MAX_NETLEN]) {
+ print_uint(PRINT_ANY, "min_network_size",
+ " min/max network layer size: %8u",
+ " min/max network layer size: %12u",
+ GET_STAT_U32(MIN_NETLEN));
+ print_uint(PRINT_ANY, "max_network_size",
+ " /%8u\n", GET_STAT_U32(MAX_NETLEN));
@@ -1416,7 +1416,7 @@
+
+ if (st[TCA_CAKE_STATS_AVG_NETOFF])
+ print_uint(PRINT_ANY, "avg_hdr_offset",
+ " average network hdr offset: %8u\n\n",
+ " average network hdr offset: %12u\n\n",
+ GET_STAT_U32(AVG_NETOFF));
+
+ /* class stats */
@@ -1431,6 +1431,7 @@
+ print_bool(PRINT_ANY, "dropping", " dropping", true);
+ if (st[TCA_CAKE_STATS_DROP_NEXT_US]) {
+ int drop_next = GET_STAT_S32(DROP_NEXT_US);
+
+ if (drop_next < 0) {
+ print_string(PRINT_FP, NULL, " drop_next -%s",
+ sprint_time(drop_next, b1));
@@ -1448,6 +1449,7 @@
+ GET_STAT_U32(P_DROP));
+ if (st[TCA_CAKE_STATS_BLUE_TIMER_US]) {
+ int blue_timer = GET_STAT_S32(BLUE_TIMER_US);
+
+ if (blue_timer < 0) {
+ print_string(PRINT_FP, NULL, " blue_timer -%s",
+ sprint_time(blue_timer, b1));
@@ -1465,14 +1467,16 @@
+#undef GET_STAT_U64
+
+ if (st[TCA_CAKE_STATS_TIN_STATS]) {
+ struct rtattr *tins[TC_CAKE_MAX_TINS + 1];
+ struct rtattr *tstat[TC_CAKE_MAX_TINS][TCA_CAKE_TIN_STATS_MAX + 1];
+ struct rtattr *tins[TC_CAKE_MAX_TINS + 1];
+ int num_tins = 0;
+
+ parse_rtattr_nested(tins, TC_CAKE_MAX_TINS, st[TCA_CAKE_STATS_TIN_STATS]);
+ parse_rtattr_nested(tins, TC_CAKE_MAX_TINS,
+ st[TCA_CAKE_STATS_TIN_STATS]);
+
+ for (i = 1; i <= TC_CAKE_MAX_TINS && tins[i]; i++) {
+ parse_rtattr_nested(tstat[i-1], TCA_CAKE_TIN_STATS_MAX, tins[i]);
+ parse_rtattr_nested(tstat[i-1], TCA_CAKE_TIN_STATS_MAX,
+ tins[i]);
+ num_tins++;
+ }
+
@@ -1489,7 +1493,7 @@
+ }
+
+
+ switch(num_tins) {
+ switch (num_tins) {
+ case 3:
+ fprintf(f, " Bulk Best Effort Voice\n");
+ break;
@@ -1500,7 +1504,7 @@
+
+ default:
+ fprintf(f, " ");
+ for(i=0; i < num_tins; i++)
+ for (i = 0; i < num_tins; i++)
+ fprintf(f, " Tin %u", i);
+ fprintf(f, "\n");
+ };

View File

@@ -11,9 +11,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git
PKG_SOURCE_DATE:=2018-02-15
PKG_SOURCE_VERSION:=223e09bf3f180797aeea0f6dc1721e5a55215e66
PKG_MIRROR_HASH:=cbf90b6dcc9765c03814f1c99363efef073c030bc5e5456a0674d2748e2eeed8
PKG_SOURCE_DATE:=2018-07-24
PKG_SOURCE_VERSION:=94b1366de313c4d1c0c1ea8f0b859bc44d0b231a
PKG_MIRROR_HASH:=6fe4b76b24b9df0ced458d821df1f84818ca1647ae4d3c4439f486b5d35c986e
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=GPL-2.0
@@ -32,7 +32,7 @@ define Package/libiwinfo
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Generalized Wireless Information Library (iwinfo)
DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci
DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci +libubus
ABI_VERSION:=$(PKG_RELEASE)
endef

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mtd
PKG_RELEASE:=21
PKG_RELEASE:=23
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)

View File

@@ -46,6 +46,12 @@ struct trx_header {
uint32_t offsets[3]; /* Offsets of partitions from start of header */
};
#define min(x,y) ({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x < _y ? _x : _y; })
#if __BYTE_ORDER == __BIG_ENDIAN
#define STORE32_LE(X) ((((X) & 0x000000FF) << 24) | (((X) & 0x0000FF00) << 8) | (((X) & 0x00FF0000) >> 8) | (((X) & 0xFF000000) >> 24))
#elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -156,7 +162,7 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size)
int fd;
struct trx_header *trx;
char *first_block;
char *buf;
char *buf, *to;
ssize_t res;
size_t block_offset;
@@ -201,24 +207,42 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size)
exit(1);
}
if (trx->len == STORE32_LE(data_size + TRX_CRC32_DATA_OFFSET)) {
if (quiet < 2)
fprintf(stderr, "Header already fixed, exiting\n");
close(fd);
return 0;
}
buf = malloc(data_size);
if (!buf) {
perror("malloc");
exit(1);
}
res = pread(fd, buf, data_size, data_offset);
if (res != data_size) {
to = buf;
while (data_size) {
size_t read_block_offset = data_offset & ~(erasesize - 1);
size_t read_chunk;
read_chunk = erasesize - (data_offset & (erasesize - 1));
read_chunk = min(read_chunk, data_size);
/* Read from good blocks only to match CFE behavior */
if (!mtd_block_is_bad(fd, read_block_offset)) {
res = pread(fd, to, read_chunk, data_offset);
if (res != read_chunk) {
perror("pread");
exit(1);
}
to += read_chunk;
}
data_offset += read_chunk;
data_size -= read_chunk;
}
data_size = to - buf;
if (trx->len == STORE32_LE(data_size + TRX_CRC32_DATA_OFFSET) &&
trx->crc32 == STORE32_LE(crc32buf(buf, data_size))) {
if (quiet < 2)
fprintf(stderr, "Header already fixed, exiting\n");
close(fd);
return 0;
}
trx->len = STORE32_LE(data_size + offsetof(struct trx_header, flag_version));
@@ -244,4 +268,3 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size)
return 0;
}

View File

@@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git
PKG_SOURCE_DATE:=2018-01-16
PKG_SOURCE_VERSION:=5bae22eb5472c9c7cc30caa9a84004bba19940d3
PKG_MIRROR_HASH:=6f46398279339dcc597965306275fe1272af384f8cb253ee8de2c68e366eed55
PKG_SOURCE_DATE:=2018-07-26
PKG_SOURCE_VERSION:=40e0931e70bfe198690a7dac43b32fad06f46ef9
PKG_MIRROR_HASH:=ddf8a42ff9a88a81b87058887d79a4eea6f2d606a29f168422d41112702793e5
CMAKE_INSTALL:=1
PKG_LICENSE:=LGPL-2.1

View File

@@ -45,6 +45,14 @@ Building images:
make image FILES="<path>" # include extra files from <path>
make image BIN_DIR="<path>" # alternative output directory for the images
make image EXTRA_IMAGE_NAME="<string>" # Add this to the output image filename (sanitized)
Print manifest:
List "all" packages which get installed into the image.
You can use the following parameters:
make manifest PROFILE="<profilename>" # override the default target profile
make manifest PACKAGES="<pkg1> [<pkg2> [<pkg3> ...]]" # include extra packages
endef
$(eval $(call shexport,Helptext))
@@ -108,6 +116,13 @@ _call_image: staging_dir/host/.prereq-build
$(MAKE) -s build_image
$(MAKE) -s checksum
_call_manifest: FORCE
rm -rf $(TARGET_DIR)
mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(DL_DIR)
$(MAKE) package_reload >/dev/null 2>/dev/null
$(MAKE) package_install >/dev/null 2>/dev/null
$(OPKG) list-installed
package_index: FORCE
@echo >&2
@echo Building package index... >&2
@@ -164,7 +179,7 @@ info:
PROFILE_FILTER = $(filter DEVICE_$(PROFILE) $(PROFILE),$(PROFILE_NAMES))
image:
_check_profile: FORCE
ifneq ($(PROFILE),)
ifeq ($(PROFILE_FILTER),)
@echo 'Profile "$(PROFILE)" does not exist!'
@@ -172,6 +187,9 @@ ifneq ($(PROFILE),)
@exit 1
endif
endif
image:
$(MAKE) -s _check_profile
(unset PROFILE FILES PACKAGES MAKEFLAGS; \
$(MAKE) -s _call_image \
$(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \
@@ -179,4 +197,11 @@ endif
$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \
$(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)"))
.SILENT: help info image
manifest: FORCE
$(MAKE) -s _check_profile
(unset PROFILE FILES PACKAGES MAKEFLAGS; \
$(MAKE) -s _call_manifest \
$(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \
$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)"))
.SILENT: help info image manifest

View File

@@ -248,7 +248,7 @@
};
USBOTG0: usbotg@bff80000 {
compatible = "amcc,usb-otg-405ex";
compatible = "amcc,dwc-otg";
reg = <4 0xbff80000 0x10000>;
interrupt-parent = <&USBOTG0>;
interrupts = <0 1 2>;

View File

@@ -0,0 +1,25 @@
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -167,6 +167,8 @@ static void dwc_initialize_chan_dw(struc
cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id);
cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id);
+ cfghi |= DWC_CFGH_PROTCTL(3); /* bufferable + privileged access */
+
/* Set polarity of handshake interface */
cfglo |= hs_polarity ? DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL : 0;
@@ -1293,11 +1295,8 @@ int dw_dma_probe(struct dw_dma_chip *chi
else
list_add(&dwc->chan.device_node, &dw->dma.channels);
- /* 7 is highest priority & 0 is lowest. */
- if (pdata->chan_priority == CHAN_PRIORITY_ASCENDING)
- dwc->priority = pdata->nr_channels - i - 1;
- else
- dwc->priority = i;
+ /* set all channels to the same priority */
+ dwc->priority = pdata->nr_channels - 1;
dwc->ch_regs = &__dw_regs(dw)->CHAN[i];
spin_lock_init(&dwc->lock);

View File

@@ -66,7 +66,8 @@ cpe830|\
cpe870|\
dr531|\
e600g-v2|\
e600gac-v2)
e600gac-v2|\
e750a-v4)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth1"
@@ -372,6 +373,10 @@ e1700ac-v2)
ucidef_set_led_usbdev "usb" "USB" "$board:green:usb" "1-1"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt"
;;
e558-v2|\
e750g-v8)
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
;;
esr900)
ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "engenius:blue:wlan-2g" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "engenius:blue:wlan-5g" "phy1tpt"

View File

@@ -380,11 +380,17 @@ ar71xx_setup_interfaces()
ucidef_add_switch_attr "switch0" "enable" "false"
;;
e1700ac-v2|\
e750g-v8|\
unifiac-pro|\
xd3200)
ucidef_add_switch "switch0" \
"0@eth0" "2:lan" "3:wan"
;;
e558-v2)
ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
ucidef_add_switch "switch0" \
"0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
;;
ebr-2310-c1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "switch0" \

View File

@@ -24,7 +24,10 @@ get_status_led() {
antminer-s3|\
antminer-r1|\
e1700ac-v2|\
e558-v2|\
e600gac-v2|\
e750a-v4|\
e750g-v8|\
eap120|\
minibox-v1|\
packet-squirrel|\
@@ -374,7 +377,8 @@ get_status_led() {
rb-962uigs-5hact2hnt|\
rb-lhg-5nd|\
rb-map-2nd|\
rb-mapl-2nd)
rb-mapl-2nd|\
rb-wap-2nd)
status_led="rb:green:user"
;;
rb-951ui-2hnd)
@@ -383,7 +387,8 @@ get_status_led() {
rb-912uag-2hpnd|\
rb-912uag-5hpnd|\
rb-sxt2n|\
rb-sxt5n)
rb-sxt5n|\
rb-wapg-5hact2hnd)
status_led="rb:green:power"
;;
re355|\

View File

@@ -675,12 +675,21 @@ ar71xx_board_detect() {
*"E2100L")
name="e2100l"
;;
*"E558 v2")
name="e558-v2"
;;
*"E600G v2")
name="e600g-v2"
;;
*"E600GAC v2")
name="e600gac-v2"
;;
*"E750A v4")
name="e750a-v4"
;;
*"E750G v8")
name="e750g-v8"
;;
*"EAP120")
name="eap120"
tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')"

View File

@@ -250,8 +250,11 @@ platform_check_image() {
dr531|\
dragino2|\
e1700ac-v2|\
e558-v2|\
e600g-v2|\
e600gac-v2|\
e750a-v4|\
e750g-v8|\
ebr-2310-c1|\
ens202ext|\
epg5000|\

View File

@@ -101,7 +101,10 @@ CONFIG_ATH79=y
# CONFIG_ATH79_MACH_DRAGINO2 is not set
# CONFIG_ATH79_MACH_E1700AC_V2 is not set
# CONFIG_ATH79_MACH_E2100L is not set
# CONFIG_ATH79_MACH_E558_V2 is not set
# CONFIG_ATH79_MACH_E600G_V2 is not set
# CONFIG_ATH79_MACH_E750A_V4 is not set
# CONFIG_ATH79_MACH_E750G_V8 is not set
# CONFIG_ATH79_MACH_EAP120 is not set
# CONFIG_ATH79_MACH_EAP300V2 is not set
# CONFIG_ATH79_MACH_EAP7660D is not set

View File

@@ -711,6 +711,17 @@ config ATH79_MACH_E2100L
select ATH79_DEV_WMAC
select ATH79_NVRAM
config ATH79_MACH_E558_V2
bool "Qxwlan E558 v2 support"
select SOC_QCA955X
select ATH79_DEV_AP9X_PCI if PCI
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_USB
select ATH79_DEV_WMAC
config ATH79_MACH_E600G_V2
bool "Qxwlan E600G/E600GAC v2 support"
select SOC_QCA953X
@@ -722,6 +733,28 @@ config ATH79_MACH_E600G_V2
select ATH79_DEV_USB
select ATH79_DEV_WMAC
config ATH79_MACH_E750A_V4
bool "Qxwlan E750A v4 support"
select SOC_AR934X
select ATH79_DEV_AP9X_PCI if PCI
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_USB
select ATH79_DEV_WMAC
config ATH79_MACH_E750G_V8
bool "Qxwlan E750G v8 support"
select SOC_AR934X
select ATH79_DEV_AP9X_PCI if PCI
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_USB
select ATH79_DEV_WMAC
config ATH79_MACH_ESR900
bool "EnGenius ESR900 board support"
select SOC_QCA955X

View File

@@ -112,7 +112,10 @@ obj-$(CONFIG_ATH79_MACH_DR344) += mach-dr344.o
obj-$(CONFIG_ATH79_MACH_DR531) += mach-dr531.o
obj-$(CONFIG_ATH79_MACH_DRAGINO2) += mach-dragino2.o
obj-$(CONFIG_ATH79_MACH_E1700AC_V2) += mach-e1700ac-v2.o
obj-$(CONFIG_ATH79_MACH_E558_V2) += mach-e558-v2.o
obj-$(CONFIG_ATH79_MACH_E600G_V2) += mach-e600g-v2.o
obj-$(CONFIG_ATH79_MACH_E750A_V4) += mach-e750a-v4.o
obj-$(CONFIG_ATH79_MACH_E750G_V8) += mach-e750g-v8.o
obj-$(CONFIG_ATH79_MACH_EAP120) += mach-eap120.o
obj-$(CONFIG_ATH79_MACH_EAP300V2) += mach-eap300v2.o
obj-$(CONFIG_ATH79_MACH_EAP7660D) += mach-eap7660d.o

View File

@@ -0,0 +1,170 @@
/*
* Qxwlan E558 v2 board support
*
* Copyright (C) 2017 Peng Zhang <sd20@qxwlan.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/phy.h>
#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "dev-ap9x-pci.h"
#include "dev-eth.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-spi.h"
#include "dev-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"
#include "pci.h"
#define E558_V2_GPIO_LED_WLAN 13
#define E558_V2_GPIO_LED_SYSTEM 14
#define E558_V2_GPIO_LED_QSS 15
#define E558_V2_GPIO_BTN_RESET 16
#define E558_V2_KEYS_POLL_INTERVAL 20 /* msecs */
#define E558_V2_KEYS_DEBOUNCE_INTERVAL (3 * E558_V2_KEYS_POLL_INTERVAL)
static struct gpio_led e558_v2_leds_gpio[] __initdata = {
{
.name = "e558-v2:green:qss",
.gpio = E558_V2_GPIO_LED_QSS,
.active_low = 1,
},
{
.name = "e558-v2:green:system",
.gpio = E558_V2_GPIO_LED_SYSTEM,
.active_low = 1,
},
{
.name = "e558-v2:green:wlan",
.gpio = E558_V2_GPIO_LED_WLAN,
.active_low = 1,
},
};
static struct gpio_keys_button e558_v2_gpio_keys[] __initdata = {
{
.desc = "reset",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = E558_V2_KEYS_DEBOUNCE_INTERVAL,
.gpio = E558_V2_GPIO_BTN_RESET,
.active_low = 1,
},
};
/* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */
static struct ar8327_pad_cfg e558_v2_ar8327_pad0_cfg = {
.mode = AR8327_PAD_MAC_SGMII,
.sgmii_delay_en = true,
};
/* GMAC6 of the AR8327 switch is connected to the QCA9558 SoC via RGMII */
static struct ar8327_pad_cfg e558_v2_ar8327_pad6_cfg = {
.mode = AR8327_PAD_MAC_RGMII,
.txclk_delay_en = true,
.rxclk_delay_en = true,
.txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
};
static const struct ar8327_led_info e558_v2_leds_qca8334[] = {
AR8327_LED_INFO(PHY2_0, HW, "e558-v2:green:wan"),
AR8327_LED_INFO(PHY3_0, HW, "e558-v2:green:lan1"),
AR8327_LED_INFO(PHY4_0, HW, "e558-v2:green:lan2"),
};
static struct ar8327_led_cfg e558_v2_ar8327_led_cfg = {
.led_ctrl0 = 0xc737c737,
.led_ctrl1 = 0x00000000,
.led_ctrl2 = 0x00000000,
.led_ctrl3 = 0x0030c300,
.open_drain = false,
};
static struct ar8327_platform_data e558_v2_ar8327_data = {
.pad0_cfg = &e558_v2_ar8327_pad0_cfg,
.pad6_cfg = &e558_v2_ar8327_pad6_cfg,
.port0_cfg = {
.force_link = 1,
.speed = AR8327_PORT_SPEED_1000,
.duplex = 1,
.txpause = 1,
.rxpause = 1,
},
.port6_cfg = {
.force_link = 1,
.speed = AR8327_PORT_SPEED_1000,
.duplex = 1,
.txpause = 1,
.rxpause = 1,
},
.led_cfg = &e558_v2_ar8327_led_cfg,
.leds = e558_v2_leds_qca8334,
.num_leds = ARRAY_SIZE(e558_v2_leds_qca8334),
};
static struct mdio_board_info e558_v2_mdio0_info[] = {
{
.bus_id = "ag71xx-mdio.0",
.phy_addr = 0,
.platform_data = &e558_v2_ar8327_data,
},
};
static void __init e558_v2_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f050400);
u8 *art = (u8 *) KSEG1ADDR(0x1f061000);
ath79_register_m25p80(NULL);
ath79_register_leds_gpio(-1, ARRAY_SIZE(e558_v2_leds_gpio),
e558_v2_leds_gpio);
ath79_register_gpio_keys_polled(-1, E558_V2_KEYS_POLL_INTERVAL,
ARRAY_SIZE(e558_v2_gpio_keys),
e558_v2_gpio_keys);
ath79_register_mdio(0, 0x0);
mdiobus_register_board_info(e558_v2_mdio0_info,
ARRAY_SIZE(e558_v2_mdio0_info));
ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
/* GMAC0 is connected to the RMGII interface */
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
ath79_eth0_data.phy_mask = BIT(0);
ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
ath79_eth0_pll_data.pll_1000 = 0x56000000;
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
ath79_register_eth(0);
/* GMAC1 is connected to the SGMII interface */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
ath79_eth1_data.speed = SPEED_1000;
ath79_eth1_data.duplex = DUPLEX_FULL;
ath79_eth1_pll_data.pll_1000 = 0x03000101;
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
ath79_register_eth(1);
ath79_register_pci();
ath79_register_usb();
ath79_register_wmac(art, NULL);
}
MIPS_MACHINE(ATH79_MACH_E558_V2, "E558-V2", "Qxwlan E558 v2",
e558_v2_setup);

View File

@@ -0,0 +1,122 @@
/*
* Qxwlan E750A v4 board support
*
* Copyright (C) 2017 Peng Zhang <sd20@qxwlan.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/phy.h>
#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "dev-eth.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"
#include "pci.h"
#define E750A_V4_GPIO_LED_SYS 14
#define E750A_V4_GPIO_LED_LAN 19
#define E750A_V4_GPIO_LED_WAN 18
#define E750A_V4_GPIO_LED_DS10 15
#define E750A_V4_GPIO_LED_DS20 20
#define E750A_V4_GPIO_LED_WLAN 21
#define E750A_V4_GPIO_BTN_RESET 12
#define E750A_V4_KEYS_POLL_INTERVAL 20 /* msecs */
#define E750A_V4_KEYS_DEBOUNCE_INTERVAL (3 * E750A_V4_KEYS_POLL_INTERVAL)
static struct gpio_led e750a_v4_leds_gpio[] __initdata = {
{
.name = "e750a-v4:green:system",
.gpio = E750A_V4_GPIO_LED_SYS,
.active_low = 1,
},
{
.name = "e750a-v4:green:lan",
.gpio = E750A_V4_GPIO_LED_LAN,
.active_low = 1,
},
{
.name = "e750a-v4:green:wan",
.gpio = E750A_V4_GPIO_LED_WAN,
.active_low = 1,
},
{
.name = "e750a-v4:green:wlan",
.gpio = E750A_V4_GPIO_LED_WLAN,
.active_low = 1,
},
{
.name = "e750a-v4:green:ds10",
.gpio = E750A_V4_GPIO_LED_DS10,
.active_low = 1,
},
{
.name = "e750a-v4:green:ds20",
.gpio = E750A_V4_GPIO_LED_DS20,
.active_low = 1,
},
};
static struct gpio_keys_button e750a_v4_gpio_keys[] __initdata = {
{
.desc = "reset",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = E750A_V4_KEYS_DEBOUNCE_INTERVAL,
.gpio = E750A_V4_GPIO_BTN_RESET,
.active_low = 1,
},
};
static void __init e750a_v4_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f050400);
u8 *art = (u8 *) KSEG1ADDR(0x1f061000);
ath79_register_m25p80(NULL);
ath79_register_leds_gpio(-1, ARRAY_SIZE(e750a_v4_leds_gpio),
e750a_v4_leds_gpio);
ath79_register_gpio_keys_polled(-1, E750A_V4_KEYS_POLL_INTERVAL,
ARRAY_SIZE(e750a_v4_gpio_keys),
e750a_v4_gpio_keys);
ath79_register_mdio(1, 0x0);
ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
/* GMAC1 is connected to the internal switch */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
ath79_register_eth(1);
/* GMAC0 is connected to the PHY4 of the internal switch */
ath79_switch_data.phy4_mii_en = 1;
ath79_switch_data.phy_poll_mask = BIT(4);
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ath79_eth0_data.phy_mask = BIT(4);
ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
ath79_register_eth(0);
ath79_register_pci();
ath79_register_usb();
ath79_register_wmac(art, NULL);
}
MIPS_MACHINE(ATH79_MACH_E750A_V4, "E750A-V4", "Qxlan E750A v4",
e750a_v4_setup);

View File

@@ -0,0 +1,151 @@
/*
* Qxwlan E750G v8 board support
*
* Copyright (C) 2017 Peng Zhang <sd20@qxwlan.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/phy.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "pci.h"
#include "dev-ap9x-pci.h"
#include "dev-gpio-buttons.h"
#include "dev-eth.h"
#include "dev-usb.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-spi.h"
#include "dev-wmac.h"
#include "machtypes.h"
#define E750G_V8_GPIO_LED_SYS 14
#define E750G_V8_GPIO_LED_DS20 15
#define E750G_V8_GPIO_LED_DS10 20
#define E750G_V8_GPIO_LED_WLAN 21
#define E750G_V8_GPIO_BTN_RESET 12
#define E750G_V8_KEYS_POLL_INTERVAL 20 /* msecs */
#define E750G_V8_KEYS_DEBOUNCE_INTERVAL (3 * E750G_V8_KEYS_POLL_INTERVAL)
static struct gpio_led e750g_v8_leds_gpio[] __initdata = {
{
.name = "e750g-v8:green:system",
.gpio = E750G_V8_GPIO_LED_SYS,
.active_low = 1,
},
{
.name = "e750g-v8:green:ds10",
.gpio = E750G_V8_GPIO_LED_DS10,
.active_low = 1,
},
{
.name = "e750g-v8:green:ds20",
.gpio = E750G_V8_GPIO_LED_DS20,
.active_low = 1,
},
{
.name = "e750g-v8:green:wlan",
.gpio = E750G_V8_GPIO_LED_WLAN,
.active_low = 1,
},
};
static struct gpio_keys_button e750g_v8_gpio_keys[] __initdata = {
{
.desc = "reset",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = E750G_V8_KEYS_DEBOUNCE_INTERVAL,
.gpio = E750G_V8_GPIO_BTN_RESET,
.active_low = 1,
},
};
static const struct ar8327_led_info e750g_v8_leds_qca8334[] = {
AR8327_LED_INFO(PHY1_0, HW, "e750g-v8:green:lan"),
AR8327_LED_INFO(PHY2_0, HW, "e750g-v8:green:wan"),
};
static struct ar8327_pad_cfg e750g_v8_ar8327_pad0_cfg = {
.mode = AR8327_PAD_MAC_RGMII,
.txclk_delay_en = true,
.rxclk_delay_en = true,
.txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
.mac06_exchange_dis = true,
};
static struct ar8327_led_cfg e750g_v8_ar8327_led_cfg = {
.led_ctrl0 = 0x00000000,
.led_ctrl1 = 0xc737c737,
.led_ctrl2 = 0x00000000,
.led_ctrl3 = 0x00c30c00,
.open_drain = true,
};
static struct ar8327_platform_data e750g_v8_ar8327_data = {
.pad0_cfg = &e750g_v8_ar8327_pad0_cfg,
.port0_cfg = {
.force_link = 1,
.speed = AR8327_PORT_SPEED_1000,
.duplex = 1,
.txpause = 1,
.rxpause = 1,
},
.led_cfg = &e750g_v8_ar8327_led_cfg,
.leds = e750g_v8_leds_qca8334,
.num_leds = ARRAY_SIZE(e750g_v8_leds_qca8334),
};
static struct mdio_board_info e750g_v8_mdio0_info[] = {
{
.bus_id = "ag71xx-mdio.0",
.phy_addr = 0,
.platform_data = &e750g_v8_ar8327_data,
},
};
static void __init e750g_v8_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f050400);
u8 *art = (u8 *) KSEG1ADDR(0x1f061000);
ath79_register_m25p80(NULL);
ath79_register_leds_gpio(-1, ARRAY_SIZE(e750g_v8_leds_gpio),
e750g_v8_leds_gpio);
ath79_register_gpio_keys_polled(-1, E750G_V8_KEYS_POLL_INTERVAL,
ARRAY_SIZE(e750g_v8_gpio_keys),
e750g_v8_gpio_keys);
mdiobus_register_board_info(e750g_v8_mdio0_info,
ARRAY_SIZE(e750g_v8_mdio0_info));
ath79_register_mdio(0, 0x0);
ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
AR934X_ETH_CFG_SW_ONLY_MODE);
/* GMAC0 is connected to an AR8327 switch */
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
ath79_eth0_data.phy_mask = BIT(0);
ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
ath79_eth0_pll_data.pll_1000 = 0x06000000;
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
ath79_register_eth(0);
ath79_register_pci();
ath79_register_usb();
ath79_register_wmac(art, NULL);
}
MIPS_MACHINE(ATH79_MACH_E750G_V8, "E750G-V8", "Qxwlan E750G v8",
e750g_v8_setup);

View File

@@ -476,10 +476,10 @@ static struct gpio_led rblhg_leds[] __initdata = {
};
/* RB w APG-5HacT2HnD (wAP AC) gpios*/
#define RBWAPGSC_LED1 1
#define RBWAPGSC_LED2 8
#define RBWAPGSC_LED3 9
#define RBWAPGSC_POWERLED 16
#define RBWAPGSC_WIFI_LED_1 1
#define RBWAPGSC_WIFI_LED_2 8
#define RBWAPGSC_WIFI_LED_3 9
#define RBWAPGSC_GPIO_LED_POWER 16
#define RBWAPGSC_GPIO_BTN_RESET 1
#define RBWAPGSC_GPIO_MDIO_MDC 12
#define RBWAPGSC_GPIO_MDIO_DATA 11
@@ -487,13 +487,10 @@ static struct gpio_led rblhg_leds[] __initdata = {
static struct gpio_led rbwapgsc_leds[] __initdata = {
{
.name = "rb:green:led1",
.gpio = RBWAPGSC_LED1,
.active_low = 1,
},{
.name = "rb:blue:power",
.gpio = RBWAPGSC_POWERLED,
.name = "rb:green:power",
.gpio = RBWAPGSC_GPIO_LED_POWER,
.active_low = 1,
.default_state = LEDS_GPIO_DEFSTATE_ON,
},
};

View File

@@ -105,8 +105,11 @@ enum ath79_mach_type {
ATH79_MACH_DR531, /* Wallys DR531 */
ATH79_MACH_DRAGINO2, /* Dragino Version 2 */
ATH79_MACH_E1700AC_V2, /* Qxwlan E1700AC v2 */
ATH79_MACH_E558_V2, /* Qxwlan E558 v2 */
ATH79_MACH_E600G_V2, /* Qxwlan E600G v2 */
ATH79_MACH_E600GAC_V2, /* Qxwlan E600GAC v2 */
ATH79_MACH_E750A_V4, /* Qxwlan E750A v4 */
ATH79_MACH_E750G_V8, /* Qxwlan E750G v8 */
ATH79_MACH_EAP120, /* TP-LINK EAP120 */
ATH79_MACH_EAP300V2, /* EnGenius EAP300 v2 */
ATH79_MACH_EAP7660D, /* Senao EAP7660D */

View File

@@ -74,7 +74,10 @@ CONFIG_ATH79_MACH_DR531=y
CONFIG_ATH79_MACH_DRAGINO2=y
CONFIG_ATH79_MACH_E1700AC_V2=y
CONFIG_ATH79_MACH_E2100L=y
CONFIG_ATH79_MACH_E558_V2=y
CONFIG_ATH79_MACH_E600G_V2=y
CONFIG_ATH79_MACH_E750A_V4=y
CONFIG_ATH79_MACH_E750G_V8=y
CONFIG_ATH79_MACH_EAP120=y
CONFIG_ATH79_MACH_EAP300V2=y
CONFIG_ATH79_MACH_EAP7660D=y

View File

@@ -334,6 +334,25 @@ define Device/e1700ac-v2-8M
endef
TARGET_DEVICES += e1700ac-v2-8M
define Device/e558-v2-16M
DEVICE_TITLE := Qxwlan E558 v2 (16MB flash)
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig
BOARDNAME := E558-V2
SUPPORTED_DEVICES := e558-v2
IMAGE_SIZE := 15936k
MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(pri-data)ro,64k(art),-(firmware)
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += e558-v2-16M
define Device/e558-v2-8M
$(Device/e558-v2-16M)
DEVICE_TITLE := Qxwlan E558 v2 (8MB flash)
IMAGE_SIZE := 7744k
endef
TARGET_DEVICES += e558-v2-8M
define Device/e600g-v2-16M
DEVICE_TITLE := Qxwlan E600G v2 (16MB flash)
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig
@@ -373,6 +392,44 @@ define Device/e600gac-v2-8M
endef
TARGET_DEVICES += e600gac-v2-8M
define Device/e750a-v4-16M
DEVICE_TITLE := Qxwlan E750A v4 (16MB flash)
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig
BOARDNAME := E750A-V4
SUPPORTED_DEVICES := e750a-v4
IMAGE_SIZE := 15936k
MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(pri-data)ro,64k(art),-(firmware)
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += e750a-v4-16M
define Device/e750a-v4-8M
$(Device/e750a-v4-16M)
DEVICE_TITLE := Qxwlan E750A v4 (8MB flash)
IMAGE_SIZE := 7744k
endef
TARGET_DEVICES += e750a-v4-8M
define Device/e750g-v8-16M
DEVICE_TITLE := Qxwlan E750G v8 (16MB flash)
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig
BOARDNAME := E750G-V8
SUPPORTED_DEVICES := e750g-v8
IMAGE_SIZE := 15936k
MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(pri-data)ro,64k(art),-(firmware)
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += e750g-v8-16M
define Device/e750g-v8-8M
$(Device/e750g-v8-16M)
DEVICE_TITLE := Qxwlan E750G v8 (8MB flash)
IMAGE_SIZE := 7744k
endef
TARGET_DEVICES += e750g-v8-8M
define Device/ew-balin
DEVICE_TITLE := Embedded Wireless Balin Platform
DEVICE_PACKAGES := kmod-usb-core kmod-usb-chipidea

View File

@@ -0,0 +1,146 @@
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Subject: [PATCH] Revert "spi: bcm-qspi: Fix bcm_qspi_bspi_read() performance"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 345309fa7c0c9206a5344d379b174499952d79d9.
BSPI reads became unstable starting with above commit. There are BSPI
timeouts like this:
[ 15.637809] bcm_iproc 18029200.spi: timeout waiting for BSPI
(...)
[ 15.997809] bcm_iproc 18029200.spi: timeout waiting for BSPI
which cause filesystem stability problems.
Before above commit every time that bcm_qspi_bspi_lr_l2_isr() called
bcm_qspi_bspi_lr_l2_isr() it was resulting in bspi_rf_msg_len becoming
0.
With that change it's not the case anymore which suggests there may be
some bug around that code.
It has changed and the new behavior seems to be causing problems.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -88,7 +88,7 @@
#define BSPI_BPP_MODE_SELECT_MASK BIT(8)
#define BSPI_BPP_ADDR_SELECT_MASK BIT(16)
-#define BSPI_READ_LENGTH 512
+#define BSPI_READ_LENGTH 256
/* MSPI register offsets */
#define MSPI_SPCR0_LSB 0x000
@@ -806,7 +806,7 @@ static int bcm_qspi_bspi_flash_read(stru
struct spi_flash_read_message *msg)
{
struct bcm_qspi *qspi = spi_master_get_devdata(spi->master);
- u32 addr = 0, len, rdlen, len_words;
+ u32 addr = 0, len, len_words;
int ret = 0;
unsigned long timeo = msecs_to_jiffies(100);
struct bcm_qspi_soc_intc *soc_intc = qspi->soc_intc;
@@ -819,7 +819,7 @@ static int bcm_qspi_bspi_flash_read(stru
bcm_qspi_write(qspi, MSPI, MSPI_WRITE_LOCK, 0);
/*
- * when using flex mode we need to send
+ * when using flex mode mode we need to send
* the upper address byte to bspi
*/
if (bcm_qspi_bspi_ver_three(qspi) == false) {
@@ -833,56 +833,47 @@ static int bcm_qspi_bspi_flash_read(stru
else
addr = msg->from & 0x00ffffff;
+ /* set BSPI RAF buffer max read length */
+ len = msg->len;
+ if (len > BSPI_READ_LENGTH)
+ len = BSPI_READ_LENGTH;
+
if (bcm_qspi_bspi_ver_three(qspi) == true)
addr = (addr + 0xc00000) & 0xffffff;
- /*
- * read into the entire buffer by breaking the reads
- * into RAF buffer read lengths
- */
- len = msg->len;
+ reinit_completion(&qspi->bspi_done);
+ bcm_qspi_enable_bspi(qspi);
+ len_words = (len + 3) >> 2;
+ qspi->bspi_rf_msg = msg;
+ qspi->bspi_rf_msg_status = 0;
qspi->bspi_rf_msg_idx = 0;
+ qspi->bspi_rf_msg_len = len;
+ dev_dbg(&qspi->pdev->dev, "bspi xfr addr 0x%x len 0x%x", addr, len);
- do {
- if (len > BSPI_READ_LENGTH)
- rdlen = BSPI_READ_LENGTH;
- else
- rdlen = len;
-
- reinit_completion(&qspi->bspi_done);
- bcm_qspi_enable_bspi(qspi);
- len_words = (rdlen + 3) >> 2;
- qspi->bspi_rf_msg = msg;
- qspi->bspi_rf_msg_status = 0;
- qspi->bspi_rf_msg_len = rdlen;
- dev_dbg(&qspi->pdev->dev,
- "bspi xfr addr 0x%x len 0x%x", addr, rdlen);
- bcm_qspi_write(qspi, BSPI, BSPI_RAF_START_ADDR, addr);
- bcm_qspi_write(qspi, BSPI, BSPI_RAF_NUM_WORDS, len_words);
- bcm_qspi_write(qspi, BSPI, BSPI_RAF_WATERMARK, 0);
- if (qspi->soc_intc) {
- /*
- * clear soc MSPI and BSPI interrupts and enable
- * BSPI interrupts.
- */
- soc_intc->bcm_qspi_int_ack(soc_intc, MSPI_BSPI_DONE);
- soc_intc->bcm_qspi_int_set(soc_intc, BSPI_DONE, true);
- }
+ bcm_qspi_write(qspi, BSPI, BSPI_RAF_START_ADDR, addr);
+ bcm_qspi_write(qspi, BSPI, BSPI_RAF_NUM_WORDS, len_words);
+ bcm_qspi_write(qspi, BSPI, BSPI_RAF_WATERMARK, 0);
+
+ if (qspi->soc_intc) {
+ /*
+ * clear soc MSPI and BSPI interrupts and enable
+ * BSPI interrupts.
+ */
+ soc_intc->bcm_qspi_int_ack(soc_intc, MSPI_BSPI_DONE);
+ soc_intc->bcm_qspi_int_set(soc_intc, BSPI_DONE, true);
+ }
- /* Must flush previous writes before starting BSPI operation */
- mb();
- bcm_qspi_bspi_lr_start(qspi);
- if (!wait_for_completion_timeout(&qspi->bspi_done, timeo)) {
- dev_err(&qspi->pdev->dev, "timeout waiting for BSPI\n");
- ret = -ETIMEDOUT;
- break;
- }
+ /* Must flush previous writes before starting BSPI operation */
+ mb();
- /* set msg return length */
- msg->retlen += rdlen;
- addr += rdlen;
- len -= rdlen;
- } while (len);
+ bcm_qspi_bspi_lr_start(qspi);
+ if (!wait_for_completion_timeout(&qspi->bspi_done, timeo)) {
+ dev_err(&qspi->pdev->dev, "timeout waiting for BSPI\n");
+ ret = -ETIMEDOUT;
+ } else {
+ /* set the return length for the caller */
+ msg->retlen = len;
+ }
return ret;
}

View File

@@ -49,8 +49,9 @@ endef
define Device/Default
KERNEL := kernel-bin | kernel-img
KERNEL_IMG := kernel.img
IMAGES := sdcard.img.gz
IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata
IMAGES := factory.img.gz sysupgrade.img.gz
IMAGE/sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata
IMAGE/factory.img.gz := boot-img | sdcard-img | gzip
endef
define Device/rpi

View File

@@ -4,7 +4,7 @@
. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
detect_by_vlanports() {
configure_by_vlanports() {
local vlan0ports="$(nvram get vlan0ports)"
local vlan1ports="$(nvram get vlan1ports)"
local vlan2ports="$(nvram get vlan2ports)"
@@ -44,7 +44,7 @@ detect_by_vlanports() {
fi
}
detect_by_boardnum() {
configure_by_boardnum() {
local boardnum="$1"
case "$boardnum" in
@@ -56,12 +56,12 @@ detect_by_boardnum() {
# Generic detection fallback
*)
detect_by_vlanports
configure_by_vlanports
;;
esac
}
detect_by_boardtype() {
configure_by_boardtype() {
local boardtype="$1"
local boardnum="$2"
@@ -111,12 +111,12 @@ detect_by_boardtype() {
;;
*)
detect_by_boardnum "$boardnum"
configure_by_boardnum "$boardnum"
;;
esac
}
detect_by_model() {
configure_by_model() {
local model="$1"
local boardtype="$2"
local boardnum="$3"
@@ -172,21 +172,24 @@ detect_by_model() {
;;
*)
detect_by_boardtype "$boardtype" "$boardnum"
configure_by_boardtype "$boardtype" "$boardnum"
;;
esac
}
model="$(board_name)"
boardtype="$(nvram get boardtype)"
boardnum="$(nvram get boardnum)"
model="$(cat /tmp/sysinfo/model)"
boardtype="$(board_name)"
case "$boardtype" in
*:*)
boardnum="${boardtype##*:}"
boardtype="${boardtype%:*}"
;;
esac
board_config_update
ucidef_set_board_id "$boardtype${boardnum:+:$boardnum}"
ucidef_set_model_name "$model"
detect_by_model "$model" "$boardtype" "$boardnum"
configure_by_model "$model" "$boardtype" "$boardnum"
board_config_flush

View File

@@ -1,12 +1,16 @@
#!/bin/sh
do_sysinfo_brcm47xx() {
local name="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)"
[ -z "$name" ] && name="unknown"
local boardtype="$(nvram get boardtype)"
local boardnum="$(nvram get boardnum)"
local model="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)"
[ -z "$model" ] && model="unknown"
[ -z "$boardtype" ] && boardtype="unknown"
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
echo "$name" > /tmp/sysinfo/board_name
echo "unknown" > /tmp/sysinfo/model
echo "$boardtype${boardnum:+:$boardnum}" > /tmp/sysinfo/board_name
echo "$model" > /tmp/sysinfo/model
}
boot_hook_add preinit_main do_sysinfo_brcm47xx

View File

@@ -0,0 +1,76 @@
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 27 Jul 2018 12:39:01 +0200
Subject: [PATCH] Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe
erratum"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 2a027b47dba6b77ab8c8e47b589ae9bbc5ac6175.
Enabling ExternalSync caused a regression for BCM4718A1 (used e.g. in
Netgear E3000 and ASUS RT-N16): it simply hangs during PCIe
initialization. It's likely that BCM4717A1 is also affected.
I didn't notice that earlier as the only BCM47XX devices with PCIe I
own are:
1) BCM4706 with 2 x 14e4:4331
2) BCM4706 with 14e4:4360 and 14e4:4331
it appears that BCM4706 is unaffected.
While BCM5300X-ES300-RDS.pdf seems to document that erratum and its
workarounds (according to quotes provided by Tokunori) it seems not even
Broadcom follows them.
According to the provided info Broadcom should define CONF7_ES in their
SDK's mipsinc.h and implement workaround in the si_mips_init(). Checking
both didn't reveal such code. It *could* mean Broadcom also had some
problems with the given workaround.
Reported-by: Michael Marley <michael@michaelmarley.com>
Cc: Tokunori Ikegami <ikegami@allied-telesis.co.jp>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: stable@vger.kernel.org
Cc: James Hogan <jhogan@kernel.org>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
arch/mips/bcm47xx/setup.c | 6 ------
arch/mips/include/asm/mipsregs.h | 3 ---
2 files changed, 9 deletions(-)
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -212,12 +212,6 @@ static int __init bcm47xx_cpu_fixes(void
*/
if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706)
cpu_wait = NULL;
-
- /*
- * BCM47XX Erratum "R10: PCIe Transactions Periodically Fail"
- * Enable ExternalSync for sync instruction to take effect
- */
- set_c0_config7(MIPS_CONF7_ES);
break;
#endif
}
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -680,8 +680,6 @@
#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
#define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
-/* ExternalSync */
-#define MIPS_CONF7_ES (_ULCAST_(1) << 8)
#define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
#define MIPS_CONF7_AR (_ULCAST_(1) << 16)
@@ -2747,7 +2745,6 @@ __BUILD_SET_C0(status)
__BUILD_SET_C0(cause)
__BUILD_SET_C0(config)
__BUILD_SET_C0(config5)
-__BUILD_SET_C0(config7)
__BUILD_SET_C0(intcontrol)
__BUILD_SET_C0(intctl)
__BUILD_SET_C0(srsmap)

View File

@@ -7,6 +7,10 @@ failsafe="$(get_dt_led failsafe)"
running="$(get_dt_led running)"
upgrade="$(get_dt_led upgrade)"
get_status_led() {
status_led="$boot"
}
set_state() {
status_led="$boot"

View File

@@ -16,12 +16,6 @@ ifeq ($(SUBTARGET),mt7622)
KERNEL_LOADADDR = 0x41080000
endif
# build dtb
define Build/dtb
$(call Image/BuildDTB,$(DEVICE_DTS_DIR)/$(DEVICE_DTS).dts,$(DEVICE_DTS_DIR)/$(DEVICE_DTS).dtb)
$(CP) $(DEVICE_DTS_DIR)/$(DEVICE_DTS).dtb $(BIN_DIR)/
endef
# default all platform image(fit) build
define Device/Default
PROFILES = Default $$(DEVICE_NAME)
@@ -32,13 +26,13 @@ define Device/Default
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
ifeq ($(SUBTARGET),mt7623)
KERNEL_NAME := zImage
KERNEL := dtb | kernel-bin | append-dtb | uImage none
KERNEL_INITRAMFS := dtb | kernel-bin | append-dtb | uImage none
KERNEL := kernel-bin | append-dtb | uImage none
KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
endif
ifeq ($(SUBTARGET),mt7622)
KERNEL_NAME := Image
KERNEL = dtb | kernel-bin | lzma | fit lzma $$(DEVICE_DTS_DIR)/$$(DEVICE_DTS).dtb
KERNEL_INITRAMFS = dtb | kernel-bin | lzma | fit lzma $$(DEVICE_DTS_DIR)/$$(DEVICE_DTS).dtb
KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
KERNEL_INITRAMFS = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
endif
endef

View File

@@ -236,3 +236,27 @@
};
/include/ "fsl/p1010si-post.dtsi"
/*
* The TL-WDR4900 v1 uses the NXP (Freescale) P1014 SoC which is closely
* related to the P1010.
*
* NXP QP1010FS.pdf "QorIQ P1010 and P1014 Communications Processors"
* datasheet states that the P1014 does not include the accelerated crypto
* module (CAAM/SEC4) which is present in the P1010.
*
* NXP Appliation Note AN4938 Rev. 2 implies that some P1014 may contain the
* SEC4 module, but states that SoCs with System Version Register values
* 0x80F10110 or 0x80F10120 do not have the security feature.
*
* All v1.3 TL-WDR4900 tested have SVR == 0x80F10110 which AN4938 describes
* as: core rev 1.0, "P1014 (without security)".
*
* The SVR value is reported by uboot on the serial console.
*/
/ {
soc: soc@ffe00000 {
/delete-node/ crypto@30000; /* Pulled in by p1010si-post */
};
};

View File

@@ -1 +1 @@
r7141-e4d0ee5af5
r7188-b0b5c64c22

View File

@@ -1 +1 @@
1531657850
1532967917