Re: [OpenWrt-Devel] Retaining WAN IP addresses across reboots

2011-04-13 Thread Philip Prindeville
All of the platforms I have use a CMOS NVRAM with RTC built-in.


On 4/12/11 5:02 PM, Nuno Gonçalves wrote:
 Please also note that the real time clock is important for knowing if
 the DHCP lease is still valid.
 Since most routers don't have a hardware RTC, there is no way to know
 it the DHCP lease is still valid before you get WAN connectivity to
 update the time with NTP.
 
 Nuno
 
 On Tue, Apr 12, 2011 at 05:15, Stefan Monnier monn...@iro.umontreal.ca 
 wrote:
 I note that the file /tmp/state/network contains the interface, ip address,
 and expiration time of the WAN DHCP lease...  I'm wondering what's
 involved in writing that information into somewhere persistent where it
 can be reused on reboot?

 You may want to start by replacing the /var symlink to /tmp by
 a real directory.  OpenWRT should be using the /var/state/network
 filename, so after performing the above change, the file will be
 preserved across reboots.  If not, report it as a bug.
 I'm not sure if OpenWRT will later start udhcpd in such a way as to take
 advantage of this pre-existing file, but that's a second step.


Stefan
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Retaining WAN IP addresses across reboots

2011-04-13 Thread Philip Prindeville
On 4/13/11 1:16 PM, edgar.sol...@web.de wrote:
 On 13.04.2011 19:18, Philip Prindeville wrote:
 All of the platforms I have use a CMOS NVRAM with RTC built-in.


 
 do they have names? ;)
 
 ..ede


Alix, net5501, Geos... and a couple of others that haven't yet been publicly 
announced.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Retaining WAN IP addresses across reboots

2011-04-13 Thread Philip Prindeville
I was thinking about this some more...  if we simply took the leased IP address 
and stuffed it up into:

config 'wan'
option ipaddr x.x.x.x

in network, the /lib/network/config.sh script would then try to request that 
address the next time the box rebooted.

If the address was in use, then we'd be NAK'd the address by the DHCP server, 
and we'd retry with no address, right?

So it wouldn't really matter if the lease had expired or not, in the end... 
because the server knows if it has in any case.

-Philip

On 4/12/11 5:02 PM, Nuno Gonçalves wrote:
 Please also note that the real time clock is important for knowing if
 the DHCP lease is still valid.
 Since most routers don't have a hardware RTC, there is no way to know
 it the DHCP lease is still valid before you get WAN connectivity to
 update the time with NTP.
 
 Nuno
 
 On Tue, Apr 12, 2011 at 05:15, Stefan Monnier monn...@iro.umontreal.ca 
 wrote:
 I note that the file /tmp/state/network contains the interface, ip address,
 and expiration time of the WAN DHCP lease...  I'm wondering what's
 involved in writing that information into somewhere persistent where it
 can be reused on reboot?

 You may want to start by replacing the /var symlink to /tmp by
 a real directory.  OpenWRT should be using the /var/state/network
 filename, so after performing the above change, the file will be
 preserved across reboots.  If not, report it as a bug.
 I'm not sure if OpenWRT will later start udhcpd in such a way as to take
 advantage of this pre-existing file, but that's a second step.


Stefan
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Retaining WAN IP addresses across reboots

2011-04-12 Thread Nuno Gonçalves
Please also note that the real time clock is important for knowing if
the DHCP lease is still valid.
Since most routers don't have a hardware RTC, there is no way to know
it the DHCP lease is still valid before you get WAN connectivity to
update the time with NTP.

Nuno

On Tue, Apr 12, 2011 at 05:15, Stefan Monnier monn...@iro.umontreal.ca wrote:
 I note that the file /tmp/state/network contains the interface, ip address,
 and expiration time of the WAN DHCP lease...  I'm wondering what's
 involved in writing that information into somewhere persistent where it
 can be reused on reboot?

 You may want to start by replacing the /var symlink to /tmp by
 a real directory.  OpenWRT should be using the /var/state/network
 filename, so after performing the above change, the file will be
 preserved across reboots.  If not, report it as a bug.
 I'm not sure if OpenWRT will later start udhcpd in such a way as to take
 advantage of this pre-existing file, but that's a second step.


        Stefan


 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Retaining WAN IP addresses across reboots

2011-04-11 Thread Stefan Monnier
 I note that the file /tmp/state/network contains the interface, ip address,
 and expiration time of the WAN DHCP lease...  I'm wondering what's
 involved in writing that information into somewhere persistent where it
 can be reused on reboot?

You may want to start by replacing the /var symlink to /tmp by
a real directory.  OpenWRT should be using the /var/state/network
filename, so after performing the above change, the file will be
preserved across reboots.  If not, report it as a bug.
I'm not sure if OpenWRT will later start udhcpd in such a way as to take
advantage of this pre-existing file, but that's a second step.


Stefan


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Retaining WAN IP addresses across reboots

2011-04-10 Thread Philip Prindeville
I note that the file /tmp/state/network contains the interface, ip address,
and expiration time of the WAN DHCP lease...  I'm wondering what's
involved in writing that information into somewhere persistent where it
can be reused on reboot?

If, for instance, a previous boot acquired a lease for x.x.x.x and it hasn't
yet expired before we reboot... can we just reprime the lease request with
the same IP address?

Udhcpc allows this to be done with the -r x.x.x.x option.

Of course, that starts the entire lease negotiation process from the DISCOVERY
process, as opposed to using the entire lease state (including transaction ID)
to do a simple lease renewal via a REQUEST message instead.

Ideally, we'd simply reuse the original lease if it hadn't expired, but 
currently
udhcpc doesn't allow this.

-Philip

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel