We don't want expiry to unmount the root FS.
Also, we don't want a reboot with an expired lease to kill
our current assignment either.
Only works on NetBSD right now.
* SUCH DAMAGE.
*/
+#include <sys/statvfs.h>
+
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
fclose(fp);
return len;
}
+
+int
+is_root_local(void)
+{
+#ifdef ST_LOCAL
+ struct statvfs vfs;
+
+ if (statvfs("/", &vfs) == -1)
+ return -1;
+ return vfs.f_flag & ST_LOCAL ? 1 : 0;
+#else
+ errno = ENOTSUP;
+ return -1;
+#endif
+}
const char *hwaddr_ntoa(const void *, size_t, char *, size_t);
size_t hwaddr_aton(uint8_t *, const char *);
size_t read_hwaddr_aton(uint8_t **, const char *);
+int is_root_local(void);
#endif
}
}
#endif
+
+ /* If root is network mounted, we don't want to kill the connection
+ * if the DHCP server goes the way of the dodo OR dhcpcd is rebooting
+ * and the lease file has expired. */
+ if (is_root_local() == 0)
+ ifo->options |= DHCPCD_LASTLEASE_EXTEND;
}
int