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:
Peter van der Perk 2024-02-28 21:55:31 +01:00 committed by Daniel Agar
parent 1bd65f8beb
commit 87d79aeb75
1 changed files with 1 additions and 1 deletions

View File

@ -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);