Author: quozl Date: Wed Aug 14 11:09:24 2013 New Revision: 3699 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3699
Log: OLPC - ntp-set-clock did leave device open if name lookup failed, fixes #12735
Modified: ofw/inet/sntp.fth
Modified: ofw/inet/sntp.fth ============================================================================== --- ofw/inet/sntp.fth Wed Aug 14 07:01:40 2013 (r3698) +++ ofw/inet/sntp.fth Wed Aug 14 11:09:24 2013 (r3699) @@ -67,13 +67,7 @@ swap h# 28 + be-l@ ( fraction seconds ) false ( d.timestamp false ) ; -: try-sntp ( hostname$ -- true | d.timestamp false ) - " ip" open-dev to ip-ih - ip-ih 0= if - ." Networking not available" cr - true exit - then - +: do-sntp ( hostname$ -- true | d.timestamp false ) d# 5,000 " set-timeout" $call-ip
2dup " DHCP" $= if ( hostname$ ) @@ -88,6 +82,16 @@
send-sntp-request receive-sntp-reply +; +: try-sntp ( hostname$ -- true | d.timestamp false ) + " ip" open-dev to ip-ih + ip-ih 0= if + ." Networking not available" cr + true exit + then + ['] do-sntp catch if ( x x ) + 2drop true ( true ) + then ( true | d.timestamp false ) ip-ih close-dev ;
openfirmware@openfirmware.info