wb2osz / direwolf

Dire Wolf is a software "soundcard" AX.25 packet modem/TNC and APRS encoder/decoder. It can be used stand-alone to observe APRS traffic, as a tracker, digipeater, APRStt gateway, or Internet Gateway (IGate). For more information, look at the bottom 1/4 of this page and in https://github.com/wb2osz/direwolf/blob/dev/doc/README.md
GNU General Public License v2.0
1.51k stars 299 forks source link

TBEACON gone wild #519

Open craigerl opened 4 months ago

craigerl commented 4 months ago

If the system clock jumps forward, direwolf will continuously transmit TBEACONS over and over that were scheduled during the missing time, jamming the channel. We saw this with PBEACON (see PBEACONS gone wild). Adding the same fix, below, should do the trick. This situation is common in a raspberry pi environment, when direwolf starts before the GPS gets the time, or before network connections are established.

beacon.c

                  else {
                    /* Stay with the schedule. */
                    /* Important for slotted.  Might reconsider otherwise. */
                    bp->next += bp->every;
+                   if ( bp->next < now ) {
+                        bp->next = now + bp->every;
+                        text_color_set(DW_COLOR_INFO);
+                        dw_printf("\nSystem clock appears to have jumped forward.  Beacon schedule updated.\n\n")
+                   }
                  }
                }
                else if (g_misc_config_p->sb_configured) {

and

                  bp->next = sb_calculate_next_time (now,
                        DW_KNOTS_TO_MPH(gpsinfo.speed_knots), gpsinfo.track,
                        sb_prev_time, sb_prev_course);
                }
                else {
                  /* Tracker beacon, fixed spacing. */
                  bp->next += bp->every;
+                 if ( bp->next < now ) {
+                      bp->next = now + bp->every;
+                      text_color_set(DW_COLOR_INFO);
+                      dw_printf("\nSystem clock appears to have jumped forward.  Beacon schedule updated.\n\n");
+                 }
                }
              }

-craig KM6LYW