openwrtv3/package/base-files/files/lib/functions
Jo-Philipp Wich 1bad852ff5 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-17 08:10:20 +02:00
..
leds.sh base-files: get_dt_led: don't warn about missing led 2018-04-04 09:12:39 +02:00
network.sh base-files: network.sh: gracefully handle missing network.interface ubus ns 2018-07-17 08:10:20 +02:00
preinit.sh base-files: fix ramoverlay function with kernels 3.18+ 2015-09-21 17:41:07 +00:00
service.sh base-files: remove function service_kill 2014-06-02 12:43:10 +00:00
system.sh base-files: add function to get binary mac from file 2018-03-14 19:04:52 +01:00
uci-defaults.sh base-files: fix ucidef_set_interface() protocol selection 2018-05-25 07:48:25 +02:00