dhcp timestamp issue ?

47 views
Skip to first unread message

Robert Nilsson

unread,
Oct 9, 2023, 4:25:47 AM10/9/23
to mTCP
Hi all!

I am trying to get mtcp working on an old 486, just for fun. My setup:

- Compaq Prolinea 4/66
- NIC is a 3COM 3C509B-Combo
- DOS 6.22
- mTCP 2023-03-31

The problem is that the TIMESTAMP written in the mtcp.cfg file is way off in the future, in the year 2106. :)

My trouble shooting thus far:
- Packet driver is returning a MAC address
- Using pkttool I can listen and see network traffic

This Compaq has its own weird BIOS and my amateur suspicion is that the time function used in dhcp.cpp cannot read the time correctly. The BIOS setup and DOS reports the time correctly after power cycling.

Code snippet:

 time_t currentTime;
  time( &currentTime );

  if ( (fprintf( newFile, "DHCPVER DHCP Client version %s\n", __DATE__ ) < 0) ||
       (fprintf( newFile, "TIMESTAMP ( %lu ) %s", currentTime, ctime( &currentTime ) ) < 0) )
  {
    printErrno( Msg_writing_to_temp_file );
    return -1;
  }

Michael Brutman

unread,
Oct 9, 2023, 12:36:31 PM10/9/23
to mTCP
Hi Robert,

I don't think there is anything strange about the BIOS on a Prolinea ...  that's a fairly modern machine.  The original Compaq Portable BIOS caused problems because the date timestamp was not present or in the wrong place, but Compaqs in general are very compliant.

mTCP uses the Watcom C runtime for time functions, and Watcom in turn uses DOS.  The time function referenced there has to convert the current DOS date and time to a Unix style time value, which counts the number of seconds from Jan 1 1970.

Are you setting the TZ environment variable before running DHCP?  If so, what do you have it set to?  You can try removing/unsetting the environment variable entirely to see what happens; if it's a problem with the environment variable you'll get a timestamp that is no more than 24 hours off.  If it still writes a timestamp from the year 2106 then I'll have to send you some test code to figure out where the breakage is.

Nobody has ever reported something like this, so that's fun at least.  For now you can run DHCP, get an address, and then delete the TIMESTAMP line.  That effectively converts it to a static IP config.


-Mike

Michael Brutman

unread,
Oct 10, 2023, 11:20:00 AM10/10/23
to mTCP
Just a small update ..  I have no clue what is happening on Robert's system so I've sent him some test code to test the various date/time functions.

The TIMESTAMP written on his system is suspicious because the underlying 32 bit integer just happens to be the maximum number you can fit in 32 bits.  I suspect the problem is in the Watcom C runtime library, but I'm confused because that should be fairly simple code and the target machine should be a fairly standard DOS PC.


-Mike

Robert Nilsson

unread,
Oct 12, 2023, 4:10:44 PM10/12/23
to mTCP
Well, it turned out that the mTCP exe-files got corrupted in the transfer to the 486 system. I was using a USB floppy on the "modern" computer to write the mTCP suite to a disk.
The floppy drive on the 486 was very dodgy also, so I got the files over using the ftp client which was working.
After overwriting all the exe-files everything worked right away.
Now running ftpsrv and happily transferring files over. Very useful software!
Reply all
Reply to author
Forward
0 new messages