Rotate the link-layer address with the pseudonym again
The app sends the pseudonym's MAC in the 16-octet STATION_CONFIGURE (address_configuration 0), the station uses it for unsigned frames too, and a different MAC reconfigures the station. A ride rotates it with the station ID; the bench CAM pinger keeps one. Without a MAC the station behaves as before (ticket-derived when signed, random when unsigned). tools/station_tx_test.py plays the phone over USB and reads the station's own raw capture (source MAC, signed or not, submitted and completed counts). Add the 16-octet form to the spec (revision 2), a firmware unit test and an app test. Fix the stale Connection texts.
This commit is contained in:
@@ -234,7 +234,7 @@ class Esp32Link @Inject constructor(
|
||||
|
||||
private suspend fun sendStationLink(its: OutgoingIts): Boolean {
|
||||
val pv = its.positionVector
|
||||
if (!ensureConfigured(StationConfigure(stationType = pv.stationType))) return false
|
||||
if (!ensureConfigured(StationConfigure(stationType = pv.stationType, mid = pv.mac))) return false
|
||||
// The micrOBU's ITS clock must never be sent backwards: past 1 s it answers
|
||||
// time_regression and rebuilds its whole stack. Two things tried to. The transmit loops
|
||||
// re-send the latest GNSS fix every tick while fused location pauses, so an old fix time
|
||||
|
||||
@@ -90,10 +90,16 @@ internal class LinkWriter {
|
||||
}
|
||||
|
||||
/**
|
||||
* STATION_CONFIGURE body (6 octets). (Re)creates the GeoNetworking stack and security entity on the
|
||||
* micrOBU. The GN address derives from the authorization ticket (signed) or is drawn at random per
|
||||
* configuration (unsigned), so the app's pseudonym MAC is no longer sent; radio mode, traffic class
|
||||
* and lifetime are fixed by the station (transmit and receive, DP2, 1 s).
|
||||
* STATION_CONFIGURE body. (Re)creates the GeoNetworking stack and security entity on the micrOBU.
|
||||
*
|
||||
* Without [mid] it is the 6-octet form of docs/station-link.pdf: the GN address derives from the
|
||||
* authorization ticket (signed) or is drawn at random per configuration (unsigned). With [mid], the
|
||||
* pseudonym MAC, it is the 16-octet form (address_configuration 0, AUTO), which the station still
|
||||
* accepts: [mid] becomes both the GN_ADDR MID and the 802.11 source address, signed or not. A ride
|
||||
* sends the rotating pseudonym's MAC, so the link-layer address rotates with the station ID; the bench
|
||||
* CAM pinger sends its fixed MAC. A different [mid] is a different configuration, so the next message
|
||||
* reconfigures the station. Radio mode, traffic class and lifetime are the station's (transmit and
|
||||
* receive, DP2, 1 s).
|
||||
*/
|
||||
data class StationConfigure(
|
||||
val stationType: Int,
|
||||
@@ -101,10 +107,18 @@ data class StationConfigure(
|
||||
val beaconing: Int = 0,
|
||||
val channelNumber: Int = 180,
|
||||
val transmitPowerDbm: Int = 20,
|
||||
val mid: ByteArray? = null,
|
||||
) {
|
||||
fun encode(): ByteArray = LinkWriter()
|
||||
.u8(stationType).u16(channelNumber).u8(transmitPowerDbm).u8(security).u8(beaconing)
|
||||
.toByteArray()
|
||||
init { require(mid == null || mid.size == 6) }
|
||||
|
||||
fun encode(): ByteArray = if (mid == null) {
|
||||
LinkWriter().u8(stationType).u16(channelNumber).u8(transmitPowerDbm).u8(security).u8(beaconing)
|
||||
.toByteArray()
|
||||
} else {
|
||||
LinkWriter().u8(stationType).u8(security).u8(0).bytes(mid).u8(beaconing)
|
||||
.u16(channelNumber).u8(transmitPowerDbm).u8(2).u8(2).u8(0x05)
|
||||
.toByteArray()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean = other is StationConfigure && encode().contentEquals(other.encode())
|
||||
override fun hashCode(): Int = encode().contentHashCode()
|
||||
|
||||
Reference in New Issue
Block a user