mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-27 00:48:23 +08:00
netman: generate default config if file doesn't exist
ENOENT returns if the file doesn't exist yet, when using mtd /fs/mtd_net always exist. On a filesystem you've to generate the file so if ENOENT returns we've to regenerate the default config as well.
This commit is contained in:
committed by
Daniel Agar
parent
1bd65f8beb
commit
87d79aeb75
@@ -201,7 +201,7 @@ public:
|
|||||||
struct ipv4cfg_s ipcfg;
|
struct ipv4cfg_s ipcfg;
|
||||||
int rv = ipcfg_read(netdev, (FAR struct ipcfg_s *) &ipcfg, AF_INET);
|
int rv = ipcfg_read(netdev, (FAR struct ipcfg_s *) &ipcfg, AF_INET);
|
||||||
|
|
||||||
if (rv == -EINVAL ||
|
if (rv == -EINVAL || rv == -ENOENT ||
|
||||||
(rv == OK && (ipcfg.proto > IPv4PROTO_FALLBACK || ipcfg.ipaddr == 0xffffffff))) {
|
(rv == OK && (ipcfg.proto > IPv4PROTO_FALLBACK || ipcfg.ipaddr == 0xffffffff))) {
|
||||||
// Build a default
|
// Build a default
|
||||||
ipcfg.ipaddr = HTONL(DEFAULT_IP);
|
ipcfg.ipaddr = HTONL(DEFAULT_IP);
|
||||||
|
|||||||
Reference in New Issue
Block a user