forked from Archive/PX4-Autopilot
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:
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);
|
||||||
|
|
Loading…
Reference in New Issue