tftpd64 icon indicating copy to clipboard operation
tftpd64 copied to clipboard

DHCP Option 2 - Time Offset

Open telcra opened this issue 1 year ago • 7 comments

Hello there,

Does anyone have a list with the "correct" syntax on how to enter the different time zones that TFTP32/64 DHCP Server support for the Additional option (2) Time offset.

Thanks in advanced for your help.

telcra avatar Mar 22 '24 22:03 telcra

From the manual:

Additional Option The first field is the number of the option to be handled The second filed is the value of the field. The value is prefixed with its type (a for list of IPv4 address, x for list of hex digits, b for list of decimal bytes, s for an ASCII string) [legacy prefixes: i for integer, n for network order integers]

So for an offset of plus one hour use x00000E10

Settings file looks like this:

[DHCP]
Lease_NumLeases=0
IP_Pool=192.168.1.11
PoolSize=199
BootFile=
DNS=192.168.1.1
DNS2=
WINS=
Mask=255.255.255.0
Gateway=192.168.1.1
Option42=
Option120=
DomainName=
Lease (minutes)=10080
AddOptionNumber1=2
AddOptionValue1=x00000E10
AddOptionNumber2=0
AddOptionValue2=
AddOptionNumber3=0
AddOptionValue3=
AddOptionNumber4=0
AddOptionValue4=
AddOptionNumber5=0
AddOptionValue5=
AddOptionNumber6=0
AddOptionValue6=
AddOptionNumber7=0
AddOptionValue7=
AddOptionNumber8=0
AddOptionValue8=
AddOptionNumber9=0
AddOptionValue9=
AddOptionNumber10=0
AddOptionValue10= 

There is additional info on option 2 here.

JonnyTech avatar Mar 22 '24 23:03 JonnyTech

Hi JonnyTech, thanks for the reply. Yeah, I read the help, but it didn't help. I'm testing with an GrandStream IP phone. I have it connected to a closed network where I only have a Windows10 computer (where the TFTP62 program is running) and the IP Phone. I tried different combinations for the TFTP62 "Additional Option" field, trying to set a time offset on the phone. The phone does get an IP address from the TFTP64 program but not the Time offset.

See attached image below. I had a Wireshark trace running on the Windows10 PC, I included what the trace showed for the Option (2) Time Offset.

TFTp64 (DHCP Option 2 - Time Offset)

Then I moved the "very' same IP phone from the closed network to my office network (where we have a Windows Server 2016 DHCP running) and the phone got an IP from the office DHCP and "also" got the time offset and correct time.

Based on my testing, I believe the option (2) Tiem Offset on the TFTP62 program is "not" working.

Any ideas ?

telcra avatar Mar 25 '24 18:03 telcra

So, you are looking to get a -4H offset. Just tested with a value of x FFFFC7CD and it works here. Can you supply the full contents of your tftpd32.ini file?

EDIT: I just noticed a typo in my previous post, there needs to be a space between the prefix and the value, ie AddOptionValue1=x 00000E10

JonnyTech avatar Mar 25 '24 19:03 JonnyTech

Hi JonnyTech, Please see attached ZIP file that contains 3 files.

The PC (Windows10) time is 15:49 The original phone time was 11:46 am. The phone time after obtaining an IP address from TFTP64 (on Windows 10 PC) was 19:49 instead of 15:49.

tftpd64 (Time Offset).zip

Thanks again for your help.

telcra avatar Mar 25 '24 20:03 telcra

I am now away from my office so I cannot check until at least tomorrow, but... this smells of a timezone issue.

To which timezone is the Windows computer set to? Is it UTC or other? According to Section 3.4 of RFC 2132:

The time offset field specifies the offset of the client's subnet ... from Coordinated Universal Time (UTC)

So if Windows time is 15:49 and the phone time obtained is 19:49, which is +4h, but your settings file shows that is should be -4h from UTC, then is your computer set to +8h from UTC?

Please try setting everything to UTC to see if offsets work correctly then look for which item is incorrectly interpreting the timezone offset in its calculations.

Reread and interpret the RTC again: "specifies the offset of the client's subnet from UTC". I suspect that you have a server misconfiguration somewhere that the Windows DHCP server is aware of and compensates but TFTPD64 assumes otherwise.

JonnyTech avatar Mar 25 '24 20:03 JonnyTech

Hi JonnyTech, The Windows10 PC is set to UTC -5, see attached image.

TimeZone (Win10 PC)

And the time on the Win10 PC is correct.

telcra avatar Mar 25 '24 21:03 telcra

Hi JonnyTech, On the "same" Win10 computer I loaded another DCHP program called "Open DHCP Server" that I downloaded from Sourceforge.net and set it up in a similar way as the TFTP64 was. I set up both with Time Offset = 7200 (+2 hrs) for testing.

The Open DHCP server, sent the to the Grandstream phone, option (2) Time offset: Length (4) Time offset: 2 hours (7200) And the phone displayed the correct time, 2 hours ahead of GMT. PC time: 09:36am (EST), Phone time: 15:36

The TFTP64, sent the to the Grandstream phone, option (2) Time offset: Length (4) Time offset: 6235 days 32 minutes (358705920) And the phone displayed the "wrong" time, it wasn't 2 hours ahead of GMT. It was at GMT. PC time: 09:43am (EST), Phone time: 13:43

telcra avatar Mar 26 '24 13:03 telcra