Commit Graph

1002 Commits

Author SHA1 Message Date
agessaman 1fe3fb1779 fix(storage): retain signed advert packets 2026-07-14 15:51:40 -07:00
agessaman 7621074d05 fix(router): accept maximum direct paths 2026-07-14 15:22:20 -07:00
Rightup 781901a750 fix: update hardware dependency to use fix/all-the-things-core branch 2026-07-14 16:42:00 +01:00
Rightup 879834c634 fix: update openhop_core dependency references to fix/all-the-things-core branch 2026-07-14 16:30:59 +01:00
Rightup 6085a06369 fix(mqtt_handler): change log level from info to debug for connection messages 2026-07-14 16:02:24 +01:00
Rightup f49c29874c fix(mqtt_handler): change log level from info to debug for connection messages 2026-07-14 08:51:33 +01:00
Lloyd e5ac415a11 Merge pull request #358 from agessaman/fix/all-the-things
Enhance MAC authentication for PATH and RESPONSE routing
2026-07-14 07:20:04 +01:00
agessaman 059065ce9c fix(router): never forward control packets to the engine
MeshCore never relays control packets: the direct high-bit discovery
subset is explicitly released and any other control payload hits the
switch default that does not flood-route unknown types. Mark control
packets do-not-retransmit unconditionally instead of only when discovery
is enabled, so a repeater with discovery disabled no longer forwards
control/discovery traffic.
2026-07-13 20:40:22 -07:00
agessaman 62ad7424c2 fix(router): consume PATH and RESPONSE only after MAC authentication
Extend the authenticated-ownership model to the PATH and RESPONSE
routing branches so a packet is consumed (do-not-retransmit) only when
a local identity MAC-verifies it. Prefix-only collisions and forged
traffic stay eligible for the forwarding engine.

- PathHelper marks do-not-retransmit and reports authenticated only
  after a successful MAC decrypt with a valid path envelope; invalid or
  truncated envelopes remain forwardable.
- PacketRouter aggregates authenticated results across the path helper
  and companion bridges for PATH and RESPONSE, skipping the engine only
  on authenticated ownership while preserving empty-path DIRECT release
  hygiene.
2026-07-13 19:54:59 -07:00
Lloyd 8d766c8a2a Merge pull request #357 from agessaman/fix/consume-on-decrypt
fix(router): consume packets only on authenticated local handling (#353)
2026-07-13 23:02:56 +01:00
agessaman 8875177088 fix(router): consume packets only on authenticated local handling (#353)
Route login, text, and protocol-request packets through a single
_consume_via_local_candidates fan-out that offers each one to every local
candidate sharing the one-byte destination hash — the companion bridge and the
room-server/repeater identity — and consumes it only when one MAC-verifies it.
A prefix collision with a remote node (or a forged packet) is left for the
forwarding engine instead of being swallowed.

- gate processed_by_injection on the core HandlerResult.authenticated
- protocol-request now forwards on collision instead of always marking handled
- add real-crypto integration tests (text, room-server login, protocol-request)
  and router fan-out tests covering companion + room-server collisions
2026-07-13 14:46:56 -07:00
Rightup a0eb0fc38c feat: TX delay update calculation with route-aware random window and update tests 2026-07-13 22:39:11 +01:00
Rightup e2172c2b73 refactor: separate import statements for clarity 2026-07-13 22:07:27 +01:00
Rightup e5d72eaff9 feat: update advert packet sending with error handling and add corresponding tests 2026-07-13 21:54:16 +01:00
Rightup 6f61365d88 feat: enhance flood loop detection with hash size validation and update tests 2026-07-13 21:28:21 +01:00
Rightup 5d75cb9ad4 feat: add manual cad tests to cad UI 2026-07-12 22:35:57 +01:00
Rightup ad87ca3db2 feat: enhance CAD configuration with dynamic symbol number handling and update OpenAPI documentation 2026-07-12 22:34:51 +01:00
Rightup 4990322cef feat: implement dynamic serving of frontend static assets and enhance error handling for unraisable exceptions 2026-07-12 22:34:23 +01:00
Rightup 0485023143 feat: add CAD symbol number configuration with validation and logging 2026-07-12 22:30:50 +01:00
Rightup fac5b1bdce feat: add CAD calibration session configuration and manual check endpoint 2026-07-11 07:41:00 +01:00
Lloyd 86a2ac3083 feat: enhance CAD calibration thresholds and sensitivity scoring 2026-07-10 16:46:23 +01:00
Lloyd 25db2d19fc feat:add LBT reporting chart/heat map UI 2026-07-10 13:37:42 +01:00
Lloyd b2eb45b199 feat: Add LBT diagnostics endpoint with correlation analysis
- Implemented `lbt_diagnostics` API endpoint to return aggregated Listen Before Talk (LBT) diagnostics aligned with RF metrics.
- Introduced methods for calculating Pearson correlation coefficients and auto-bucket sizing for diagnostics.
- Enhanced data aggregation logic in `StorageCollector` for LBT diagnostics.
- Updated OpenAPI specification to include new endpoint and response schemas.
- Added comprehensive unit tests for LBT diagnostics, including validation of correlation calculations and data integrity.
2026-07-10 13:36:49 +01:00
Lloyd 95500ece09 feat:add restore config to first time setup 2026-07-09 14:30:39 +01:00
Lloyd fa046a1c5f feat: allow unauthenticated config import during first-run setup 2026-07-09 14:25:08 +01:00
Rightup ff53b2520b fix:typo in openhop 2026-07-08 22:47:18 +01:00
Rightup 11552c467f feat:add auto logout for websockets 2026-07-08 22:25:57 +01:00
Rightup 9f75c0460d feat:update ui term-cli help and add default region ui to region keys 2026-07-08 17:27:00 +01:00
Rightup 1906f576bb feat: add region/default-scope / cli commands update
standardize default region on mesh.default_region (remove legacy region_default_scope usage)
add/align CLI support for owner.info, path.hash.mode, and loop.detect with validation
wire UI terminal get/set + autocomplete/help for owner.info, path.hash.mode, loop.detect
extend update_radio_config to persist owner_info for UI set owner.info
add and use shared packet utility for advert creation + default-region transport scoping
refactor repeater and room-server advert paths to reuse shared packet logic
2026-07-08 17:25:35 +01:00
Rightup 92310235ae fix: correct model name in MeshCoreToMqttPusher class 2026-07-08 15:34:12 +01:00
agessaman e22514882f perf: force timestamp range scan for windowed packet-stats GROUP BYs
The GROUP BY type and GROUP BY drop_reason sub-queries in
get_packet_stats (and get_packet_type_stats) filter by a time window but
let the planner pick idx_packets_type / idx_packets_transmitted to get
grouping for free. It then heap-checks the timestamp filter across the
entire table, turning a bounded window into a full scan: on a 1.5M-row
packets table the 24h stats load spent ~4.8s (type) + ~2.3s
(drop_reason) instead of ~0.1s each.

Pin these to idx_packets_timestamp with INDEXED BY so they range-scan the
window (~50k rows) and group via a small temp b-tree. Verified on the
live DB: 4.80s -> 0.10s and 2.32s -> 0.10s. Unlike a covering index this
adds no write-path cost on the packet-insert hot path.
2026-07-08 10:13:28 +01:00
agessaman 676e2cea30 perf: add covering index for airtime chart queries
The airtime/utilization chart queries (get_airtime_data and
get_airtime_buckets) range-scan and order packets by timestamp,
selecting only timestamp/length/payload_length/transmitted. On a large
packets table this forced a full scan of the row heap, saturating slow
storage (e.g. a Pi SD card): each dashboard poll took longer than the
client timeout, aborted polls stacked, and sustained I/O starved the
transmit queue.

Add a covering index on packets(timestamp, length, payload_length,
transmitted) so these queries run index-only, dropping the read from the
full row heap to just the index range. Verified via EXPLAIN QUERY PLAN
(COVERING INDEX idx_packets_airtime). Additive and idempotent.
2026-07-08 10:13:28 +01:00
agessaman d8bc448f82 fix: update dependencies for platform-specific installation of openhop_core 2026-07-08 10:13:28 +01:00
Björkan 4a124782ae Replace favicon with openhop favicon 2026-07-08 10:12:47 +01:00
Will Dillon d1a9230ab5 feat: allow API key authentication in WebSocket handler
The PacketWebSocket.opened() method only accepts JWT tokens for
authentication. API keys (used via X-API-Key header for REST endpoints)
are silently rejected, forcing WS clients to obtain a JWT through a
separate login flow.

Add fallback to token_manager.verify_token() when JWT verification
fails or when an X-API-Key header is present. This lets API token
holders connect directly to the WebSocket without needing a JWT.

Auth priority:
1. JWT in ?token= query parameter (existing behavior)
2. API key in X-API-Key header
3. API key in ?token= query parameter (falls through from JWT reject)
2026-07-08 10:12:47 +01:00
Vashiru 667169c7ff feat: Bump to 168 hours to match docs.meshcore.io 2026-07-08 10:12:47 +01:00
Vashiru 17f8bcca2f feat: Allow setting max. flood interval to 50 2026-07-08 10:12:46 +01:00
Rightup 05d1e391d6 Merge branch 'dev' of https://github.com/rightup/pyMC_Repeater into dev 2026-07-08 07:25:56 +01:00
Rightup 630f2cfa4e Merge branch 'pr-343' into dev 2026-07-08 07:25:07 +01:00
Yellowcooln 143c7633bf Merge pull request #344 from yellowcooln/fix/docker-console-cache-bust
fix: refresh bundled Console in Docker builds
2026-07-07 21:44:37 -04:00
yellowcooln c14d8b2226 fix: refresh bundled console in docker builds
Invalidate the Docker cache layer that downloads the bundled Console release when the latest release changes, and allow manual builds to pin a Console tag.

Co-Authored-By: Warp <agent@warp.dev>
2026-07-07 21:35:13 -04:00
agessaman 4a055be8df fix(router): try both companion and server on colliding dest hash
On-air dest hashes are one byte, so a companion and a room-server (or
repeater) identity can share one. The login and text dispatch used
`if dest_hash in companion_bridges: ... elif login_helper/text_helper`,
so a companion silently shadowed a same-hash room server: its login
never reached the room-server handler and failed with Invalid HMAC
(e.g. Lake Stevens pubkey f55d.. / hash 0xf5 colliding with a companion).

Offer the packet to both handlers when both are registered at the hash;
decryption disambiguates — the key owner replies, the other fails HMAC
and no-ops. Non-colliding paths are unchanged. Applied to both the
LoginServerHandler and TextMessageHandler branches.

Adds regression tests covering collision (both invoked), companion-only
(server helper skipped), and server-without-companion for each path.
2026-07-07 14:51:59 -07:00
Rightup 9177d1aacc feat: add repeat on/off to status for mqtt 2026-07-07 22:41:32 +01:00
Rightup 1a0823b6d7 fix: rename radio settings entry for rak6421-13300x-slot2 to rak6421-13300x-slot2-hw-mod 2026-07-07 22:40:15 +01:00
Rightup 90d63d61de Merge branch 'pr-340' into dev 2026-07-07 22:34:41 +01:00
Rastislav Vysoky f15884565e Merge branch 'dev' into patch-1 2026-07-07 23:02:33 +02:00
Lloyd 7d30dd4247 Merge pull request #342 from agessaman/companion/post-refactor-cleanup
Companion/post refactor cleanup
2026-07-07 21:03:59 +01:00
agessaman 954150b2d8 merge: reconcile companion cleanup with fix-general-tidy
Merge the maintainer's fix-general-tidy branch (neighbor discovery,
keygen, API endpoints, web-asset rebuild, HTTP server config/control
commands, and an independent #286 room-server push/ACK/guest fix) into
the companion cleanup branch.

Both branches fixed #286 in parallel with byte-identical push-ACK CRC
logic. In the six overlapping files the maintainer's implementation is
kept (ACL replay-detection/session helpers, encoded path-len with legacy
fallback, expected_crc/ack_timeout_s injector API, dispatcher ACK
helpers); this branch's unique companion work is preserved on top
(sender_prefix persistence + migration, boot-state hardening /
CompanionStateLoadError, MessageQueue.max_size, older-core fallbacks).

Conflict resolution took the maintainer's side across the overlap, then
fixed two integration seams the merge introduced and updated this
branch's tests to the maintainer's API:
- room_server: timeout used undefined `hops`; aligned to `path_len`.
- packet_router: PATH helper was invoked twice (maintainer's
  unconditional call plus this branch's conditional local-identity
  call); dropped the now-redundant conditional block.

Pin openhop_core to @dev (was @feature/publish-workflow-message-handling)
so this can merge to the repeater's dev; core dev carries the required
sender_prefix and PathUtils.is_valid_path_len APIs.

Full suite green (1040 passed) against openhop_core dev and
refactor/companion-housekeeping; ruff clean.
2026-07-07 12:56:43 -07:00
Rightup 43a112ce7c feat: add HTTP server configuration and control commands 2026-07-07 20:38:22 +01:00
agessaman b2e45c2038 fix: resolve room-server push ACKs through the dispatcher
Room server pushes waited on dispatcher.wait_for_ack, but nothing in the
repeater could ever resolve it, so every push timed out and re-pushed on
the backoff schedule (issue #286's duplicate floods — worst for virtual
companions on the same instance, whose ACKs never even cross the air):

- no core AckHandler is registered (all RX lands in the router fallback),
  so received ACK CRCs were never fed to dispatcher ACK matching
- inject_packet waited on packet.get_crc(), a packet-hash CRC that no ACK
  sender produces; the crypto CRC only the room server knows was ignored
- PATH returns (how a flood-received DM is ACKed) were decrypted by
  PathHelper, but it read the encoded path_len wire byte as a raw count —
  an empty 3-byte-hash path (0x80) parsed as a 128-byte truncated
  payload — and the router's PATH branch never ran PathHelper for
  room/repeater destinations when any companion bridge existed

Fixes:
- router ACK branch feeds discrete ACK CRCs (RF and locally injected) to
  dispatcher._register_ack_received
- PATH packets addressed to a local server identity are processed by
  PathHelper regardless of companion bridges; PathHelper decodes the
  encoded path_len via PathUtils, keeps the encoded byte in out_path_len,
  and registers the embedded ACK via ack_received_fn
- inject_packet accepts expected_ack_crc/ack_timeout; the room server
  passes its crypto CRC and a hop-count-based timeout (the encoded byte
  would have produced a ~4-minute direct-push wait)

Verified live on a real mesh: push to a same-instance virtual companion
resolves via the PATH-embedded ACK (encoded path_len 0x80) and push to a
firmware client resolves via the discrete RF ACK, no re-push loops.

Fixes #286
Fixes #341
2026-07-07 11:17:54 -07:00