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:
@@ -40,7 +40,7 @@ custom PCB; pick it in `menuconfig -> micrOBU firmware -> Board`.
|
||||
- **Unsigned transmission.** Niklas Dathe's station signs everything. A request with GN security
|
||||
profile 1 (or 0 while the station is configured `security = 0`) goes out unsigned with
|
||||
`geonet.c`'s header and the position of the last PoTi (`Station::unsecured_request`), from a
|
||||
random locally administered MAC drawn at every STATION_CONFIGURE. The app's "Sign outgoing
|
||||
random locally administered MAC drawn at every STATION_CONFIGURE, or the MAC the phone names in the 16-octet STATION_CONFIGURE (address_configuration 0), which also sets the address of signed frames: a ride rotates it with the pseudonym, the CAM pinger keeps one. The app's "Sign outgoing
|
||||
messages" setting decides per message. It bypasses the BLE collision guard's queue but not the
|
||||
guard itself.
|
||||
- **Radio polled from configure on**, not from the first PoTi, so the 16-frame queue never overflows
|
||||
|
||||
@@ -387,7 +387,7 @@ Send all five fields in the six-byte body to set or replace the station configur
|
||||
\toprule\textbf{Parameter} & \textbf{Setting} & \textbf{Description} \\\midrule\endhead
|
||||
\bottomrule\endfoot
|
||||
{\ttfamily radio} & {\ttfamily transmit-\allowbreak{}and-\allowbreak{}receive} & Enables both transmission and reception. \\
|
||||
{\ttfamily address\_\allowbreak{}configuration} & {\ttfamily anonymous} & Derives the GN address from the ticket identity. MicrOBU extension: unsecured frames carry a random locally administered unicast MAC, drawn anew at every STATION\_CONFIGURE. \\
|
||||
{\ttfamily address\_\allowbreak{}configuration} & {\ttfamily anonymous} & Derives the GN address from the ticket identity. MicrOBU extension: with the 16-octet form (Section~\ref{sec:microbu-mac}) the host names the MAC; without, unsecured frames carry a random locally administered unicast MAC, drawn anew at every STATION\_CONFIGURE. \\
|
||||
{\ttfamily traffic\_\allowbreak{}class} & {\ttfamily 2} & Selects default traffic priority DP2. \\
|
||||
{\ttfamily lifetime} & {\ttfamily 0x05} & Encodes the default one-second lifetime. \\
|
||||
\end{longtable}}
|
||||
@@ -1187,6 +1187,24 @@ A BTP\_DATA\_REQUEST with \texttt{gn\_security\_profile} 0x01, or 0x00 while the
|
||||
{\ttfamily accounting} & {\ttfamily requests\_accepted} & Counted as an accepted or refused stack request; not counted as a signed message. \\
|
||||
{\ttfamily tx\_guard} & {\ttfamily BLE collision guard} & Handed to the radio through the same BLE guard as signed frames. \\
|
||||
\end{longtable}}
|
||||
\Needspace{8\baselineskip}\subsection{Naming the MAC: the 16-octet STATION\_CONFIGURE}\label{sec:microbu-mac}
|
||||
Revision 1 retires the long STATION\_CONFIGURE and defines only the 6-octet form. The station still decodes the long form, and the MicrOBU host uses it to choose the link-layer address: a rider's phone rotates the MAC with its pseudonym, and the bench CAM pinger keeps one fixed MAC so that its frames stay recognisable in a capture. A different MID is a different configuration, so the station is configured again (the radio keeps running).
|
||||
{\small\begin{longtable}{F}
|
||||
\hline\textbf{Offset} & \textbf{Field} & \textbf{Type} & \textbf{Unit / values} & \textbf{Description} \\hline\endfirsthead
|
||||
\hline\textbf{Offset} & \textbf{Field} & \textbf{Type} & \textbf{Unit / values} & \textbf{Description} \\hline\endhead
|
||||
\hline\endfoot
|
||||
{\ttfamily 0} & {\ttfamily station\_\allowbreak{}type} & {\ttfamily u8} & \textemdash & As in the 6-octet form. \
|
||||
{\ttfamily 1} & {\ttfamily security} & {\ttfamily u8} & 0 or 1 & As in the 6-octet form. \
|
||||
{\ttfamily 2} & {\ttfamily address\_\allowbreak{}configuration} & {\ttfamily u8} & 0=AUTO, 1=anonymous & 0 uses the MID below as the GN address MID and the 802.11 source address. \
|
||||
{\ttfamily 3} & {\ttfamily mid} & {\ttfamily u8[6]} & \textemdash & The MAC (locally administered, unicast). Ignored when address\_configuration is 1. \
|
||||
{\ttfamily 9} & {\ttfamily beaconing} & {\ttfamily u8} & 0 or 1 & As in the 6-octet form. \
|
||||
{\ttfamily 10} & {\ttfamily channel\_\allowbreak{}number} & {\ttfamily u16} & \textemdash & As in the 6-octet form. \
|
||||
{\ttfamily 12} & {\ttfamily transmit\_\allowbreak{}power\_\allowbreak{}dbm} & {\ttfamily u8} & dBm & As in the 6-octet form. \
|
||||
{\ttfamily 13} & {\ttfamily radio} & {\ttfamily u8} & 0, 1 or 2 & 2 transmits and receives. \
|
||||
{\ttfamily 14} & {\ttfamily default\_\allowbreak{}traffic\_\allowbreak{}class} & {\ttfamily u8} & raw GN octet & 2 (DP2). \
|
||||
{\ttfamily 15} & {\ttfamily default\_\allowbreak{}lifetime} & {\ttfamily u8} & raw GN octet & 0x05 (1 s). \
|
||||
\end{longtable}}
|
||||
Checked on the bench (2026-11-11) with the station's own raw capture: a signed CAM sent with MID 02:aa:bb:cc:dd:01 left the radio from 802.11 source 02:aa:bb:cc:dd:01; the 6-octet form gave the ticket-derived address of the authorization ticket (4a:38:7a:4c:12:eb) when signed and a fresh random MAC per configuration when unsigned.
|
||||
\Needspace{8\baselineskip}\subsection{Battery protection}\label{sec:microbu-battery}
|
||||
The prototype cell has no protection board. The station samples it every 5 s; the value in the status snapshot is \texttt{battery\_mv}. The shutdown rule is local to the station and has no link message.
|
||||
{\small\begin{longtable}{@{}P{45mm}P{55mm}P{72.8mm}@{}}
|
||||
@@ -1207,6 +1225,6 @@ MicrOBU extension. While no USB host is connected to the native port (the phone
|
||||
\toprule\textbf{Revision} & \textbf{Date} & \textbf{Changes} \\\midrule\endhead
|
||||
\bottomrule\endfoot
|
||||
1 & 2026-11 & Niklas Dathe: the microbu-firmware interface reference, commit e4e4bd8. \\
|
||||
2 & 2026-11-10 & MicrOBU additions: opcode 0x90 V2X\_RX (all heard ITS messages, unverified); unsecured transmission for security profile 0x01 and for profile 0x00 with \texttt{security} 0, from a random MAC per configuration; the radio is polled from STATION\_CONFIGURE on; battery protection by deep sleep; no USB writes without a host. Wire format of revision 1 unchanged; the original is kept as microbu-firmware/docs/station-link.pdf. \\
|
||||
2 & 2026-11-10 & MicrOBU additions: opcode 0x90 V2X\_RX (all heard ITS messages, unverified); unsecured transmission for security profile 0x01 and for profile 0x00 with \texttt{security} 0, from a random MAC per configuration, or the MAC named by the host in the 16-octet STATION\_CONFIGURE; the radio is polled from STATION\_CONFIGURE on; battery protection by deep sleep; no USB writes without a host. Wire format of revision 1 unchanged; the original is kept as microbu-firmware/docs/station-link.pdf. \\
|
||||
\end{longtable}}
|
||||
\end{document}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -121,6 +121,22 @@ TEST(station_configure_is_the_six_octet_form_the_app_sends) {
|
||||
CHECK(!link::decode(hex("02b4001401"), bad)); // five octets
|
||||
}
|
||||
|
||||
TEST(station_configure_with_a_named_mac_is_the_sixteen_octet_form) {
|
||||
// the app's form for a ride (rotating pseudonym MAC) and for the bench pinger (fixed MAC)
|
||||
link::StationConfigure c;
|
||||
CHECK(link::decode(hex("02010002112233445500b40014020205"), c));
|
||||
CHECK_EQ(c.station_type, 2); CHECK_EQ(c.security, 1);
|
||||
CHECK_EQ(c.address_configuration, 0); // AUTO: the MID below names the address
|
||||
CHECK_STR(to_hex(Bytes(c.mid, c.mid + 6)), std::string("021122334455"));
|
||||
CHECK_EQ(c.channel_number, 180); CHECK_EQ(c.transmit_power_dbm, 20);
|
||||
CHECK_EQ(c.radio, 2); CHECK_EQ(c.default_traffic_class, 2); CHECK_EQ(c.default_lifetime, 0x05);
|
||||
// and the station's own encoder produces the same bytes for the same values
|
||||
CHECK_STR(to_hex(link::encode(c)), std::string("02010002112233445500b40014020205"));
|
||||
link::StationConfigure bad;
|
||||
CHECK(!link::decode(hex("02010002112233445500b4001402"), bad)); // cut short
|
||||
CHECK(!link::decode(hex("02010202112233445500b40014020205"), bad)); // address_configuration 2 does not exist
|
||||
}
|
||||
|
||||
TEST(poti_update_decodes_the_apps_31_octets) {
|
||||
link::PotiUpdate p;
|
||||
CHECK(link::decode(hex("fbb2b7ffa60000002bcbeb1f914bf905e601e60100000e000000001f02d204"), p));
|
||||
|
||||
Reference in New Issue
Block a user