Based on openwrt #6847: https://dev.openwrt.org/ticket/6847 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>