};
// Details of an interface at a remote.
struct Interface {
unsigned char mac[6]; // MAC address used last (key for by_mac table)
};
// Details of an interface at a remote.
struct Interface {
unsigned char mac[6]; // MAC address used last (key for by_mac table)
-// Macros for timing, for struct timeb variables
-#define TIMEB_MILLIS(TM) (((int64_t) (TM)->time * 1000) + (TM)->millitm )
-#define DIFFB_MILLIS(TM1,TM2) ( TIMEB_MILLIS(TM1) - TIMEB_MILLIS(TM2) )
+// Macros for timing, for struct timeval variables
+#define TIME_MICROS(TM) (((int64_t) (TM)->tv_sec * 1000000) + (TM)->tv_usec )
+#define DIFF_MICROS(TM1,TM2) ( TIME_MICROS(TM1) - TIME_MICROS(TM2) )
// RECENT(T,M) is the time logic for requiring a gap time (in
// milliseconds) before shifting a MAC to a new remote. The limit is
// 6000 for broadcast and 20000 for unicast.
#define RECENT(T,M) ((M) < ((T)? 6000 : 20000 ))
// RECENT(T,M) is the time logic for requiring a gap time (in
// milliseconds) before shifting a MAC to a new remote. The limit is
// 6000 for broadcast and 20000 for unicast.
#define RECENT(T,M) ((M) < ((T)? 6000 : 20000 ))
// primary channel, or the time since the last packet for that
// interface is less than RECENT, with different limits for
// broadcast and unicast.
// primary channel, or the time since the last packet for that
// interface is less than RECENT, with different limits for
// broadcast and unicast.
}
VERBOSE2OUT( "BC %s -> %s from %s\n",
inet_mtoa( buf+6 ), inet_mtoa( buf ),
}
VERBOSE2OUT( "BC %s -> %s from %s\n",
inet_mtoa( buf+6 ), inet_mtoa( buf ),
// remove old downlink connection
VERBOSEOUT( "Old remote discarded %s (%ld)\n",
inet_stoa( &r->uaddr ),
// remove old downlink connection
VERBOSEOUT( "Old remote discarded %s (%ld)\n",
inet_stoa( &r->uaddr ),
- if ( len == 17 && memcmp( buf, "STOPSTOPSTOPSTOP", 16 ) == 0 ) {
+ if ( todo->len == 17 &&
+ memcmp( todo->buffer, "STOPSTOPSTOPSTOP", 16 ) == 0 ) {
r = (struct Remote *) tmp;
VERBOSE3OUT( "heartbeat check %s\n", inet_stoa( &r->uaddr ) );
if ( r->spec && is_uplink( r->spec ) ) {
r = (struct Remote *) tmp;
VERBOSE3OUT( "heartbeat check %s\n", inet_stoa( &r->uaddr ) );
if ( r->spec && is_uplink( r->spec ) ) {
VERBOSE3OUT( "heartbeat %s\n", inet_stoa( &r->uaddr ) );
write_remote( data, 0, r );
}
VERBOSE3OUT( "heartbeat %s\n", inet_stoa( &r->uaddr ) );
write_remote( data, 0, r );
}