>Synopsis: session uptime is wrong >Category: system >Environment: System : OpenBSD 7.0 Details : OpenBSD 7.0 (GENERIC.MP) #698: Thu Sep 30 21:07:33 MDT 2021 dera...@octeon.openbsd.org:/usr/src/sys/arch/octeon/compile/GENERIC.MP
Architecture: OpenBSD.octeon Machine : octeon >Description: On a router (octeon with no RTC) the uptime looks like so: 11:12AM up 2 days, 15:56, 1 user, load averages: 0.01, 0.03, 0.01 The pppoe(4) interface however displays 51 days uptime for a session: pppoe0: flags=8851<UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST> mtu 1500 description: Telekom index 7 priority 0 llprio 3 dev: vlan7 state: session sid: 0x3f2f PADI retries: 1 PADR retries: 0 time: 51d 08:03:55 <cut> I reason that my router rebooted (which it did two days ago) and used microuptime() to fill the session time, and then NTP updated the time and we have this timejump. What should be done is the uptime in seconds should be gotten and the ifconfig code that does the ioctl(2) does the appropriate math. >How-To-Repeat: any pppoe0 router without RTC. Should see this behaviour on the very first session. >Fix: explained in pseudo-words above. No workable code provided. dmesg: OpenBSD 7.0 (GENERIC.MP) #698: Thu Sep 30 21:07:33 MDT 2021 dera...@octeon.openbsd.org:/usr/src/sys/arch/octeon/compile/GENERIC.MP real mem = 536870912 (512MB) avail mem = 521224192 (497MB) random: good seed from bootblocks mainbus0 at root: board 20004 rev 0.16, model CN3xxx/CN5xxx cpu0 at mainbus0: CN50xx CPU rev 0.1 500 MHz, Software FP emulation cpu0: cache L1-I 32KB 4 way D 16KB 64 way, L2 128KB 8 way cpu1 at mainbus0: CN50xx CPU rev 0.1 500 MHz, Software FP emulation cpu1: cache L1-I 32KB 4 way D 16KB 64 way, L2 128KB 8 way clock0 at mainbus0: int 5 octcrypto0 at mainbus0 iobus0 at mainbus0 simplebus0 at iobus0: "soc" octciu0 at simplebus0 octsmi0 at simplebus0 octpip0 at simplebus0 octgmx0 at octpip0 interface 0 cnmac0 at octgmx0: port 0 RGMII, address fc:ec:da:04:8d:68 atphy0 at cnmac0 phy 7: AR8035 10/100/1000 PHY, rev. 2 cnmac1 at octgmx0: port 1 RGMII, address fc:ec:da:04:8d:69 atphy1 at cnmac1 phy 6: AR8035 10/100/1000 PHY, rev. 2 cnmac2 at octgmx0: port 2 RGMII, address fc:ec:da:04:8d:6a atphy2 at cnmac2 phy 5: AR8035 10/100/1000 PHY, rev. 2 com0 at simplebus0: ns16550a, 64 byte fifo com0: console dwctwo0 at iobus0 base 0x1180068000000 irq 56 usb0 at dwctwo0: USB revision 2.0 uhub0 at usb0 configuration 1 interface 0 "Octeon DWC2 root hub" rev 2.00/1.00 addr 1 octrng0 at iobus0 base 0x1400000000000 irq 0 umass0 at uhub0 port 1 configuration 1 interface 0 " UDinfo UF2 4GB" rev 2.00/1.00 addr 2 umass0: using SCSI over Bulk-Only scsibus0 at umass0: 2 targets, initiator 0 sd0 at scsibus0 targ 1 lun 0: <, UDinfo UF2 4GB, PMAP> removable serial.13fe420077C9177D2781 sd0: 3824MB, 512 bytes/sector, 7831552 sectors vscsi0 at root scsibus1 at vscsi0: 256 targets softraid0 at root scsibus2 at softraid0: 256 targets root on sd0a (d5ffec0c72cad730.a) swap on sd0b dump on sd0b WARNING: /mnt was not properly unmounted WARNING: CHECK AND RESET THE DATE! usbdevs: Controller /dev/usb0: addr 01: 0000:0000 Octeon, DWC2 root hub high speed, self powered, config 1, rev 1.00 driver: uhub0 addr 02: 13fe:4200 , UDinfo UF2 4GB high speed, power 200 mA, config 1, rev 1.00, iSerial 070877C9177D2781 driver: umass0 pcidump: acpidump: