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:
Ashin Walpola
2026-11-11 15:02:39 +01:00
parent a7a6c39ca1
commit 37707548ca
13 changed files with 313 additions and 24 deletions
+10 -4
View File
@@ -482,10 +482,16 @@ link::Code Station::configure(const link::StationConfigure& c, link::Bytes& deta
}
}
config_ = c;
// MicrOBU: a fresh locally administered unicast MAC for unsecured frames on every configuration,
// so a station that does not sign does not keep one link-layer identity either.
esp_fill_random(unsecured_mid_, sizeof unsecured_mid_);
unsecured_mid_[0] = static_cast<std::uint8_t>((unsecured_mid_[0] & 0xFC) | 0x02);
// MicrOBU: the MAC of unsecured frames. A phone that sends the 16-octet STATION_CONFIGURE with
// address_configuration 0 (AUTO) names it itself: it rotates it with its pseudonym on a ride and
// keeps it fixed for the bench pinger. Without one (the 6-octet form) a fresh locally administered
// unicast MAC is drawn at every configuration.
if (c.address_configuration == 0) {
std::copy(std::begin(c.mid), std::end(c.mid), unsecured_mid_);
} else {
esp_fill_random(unsecured_mid_, sizeof unsecured_mid_);
unsecured_mid_[0] = static_cast<std::uint8_t>((unsecured_mid_[0] & 0xFC) | 0x02);
}
link_subscriptions_.clear(); // a configuration starts a phone session: earlier subscriptions are void
counters_ = link::Status {}; // and the session's counters start at zero
const auto result = build();