Commit graph

289 commits

Author SHA1 Message Date
aedb139e38 test_connection: add regression test for 1-byte packet handling
All checks were successful
/ build-hamnet70 (push) Successful in 40s
/ build-doc (push) Successful in 23s
/ deploy-doc (push) Has been skipped
2025-11-01 17:51:37 +01:00
440382da57 Fixed handling of too small packets
All checks were successful
/ build-hamnet70 (push) Successful in 39s
/ build-doc (push) Successful in 19s
/ deploy-doc (push) Has been skipped
If a packet of only 1 byte was received (which only can happen due to
noise), a segmentation fault could occur because the CRC expects at
least two bytes. This is now handled correctly.
2025-10-26 20:23:46 +01:00
f7a0186f4f test_connection: test packet queue and (re)transmission
All checks were successful
/ build-hamnet70 (push) Successful in 38s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2025-02-23 13:55:03 +01:00
d908c16702 test_connection: verify correct seq. number overflow for incoming packets
All checks were successful
/ build-hamnet70 (push) Successful in 38s
/ build-doc (push) Successful in 18s
/ deploy-doc (push) Has been skipped
2025-02-22 21:31:12 +01:00
84d15331c2 test_connection: test handling of (lost) data packets
All checks were successful
/ build-hamnet70 (push) Successful in 37s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2025-02-22 21:10:04 +01:00
f896c0264e unittest: fix potential name collisions 2025-02-22 21:00:30 +01:00
008a3faf13 test_connection: check empty packet sequence numbers 2025-02-22 20:44:00 +01:00
399df50413 test_connection: check empty queue handling and empty packets
All checks were successful
/ build-hamnet70 (push) Successful in 37s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2025-02-22 20:35:12 +01:00
56742ef811 connection: use one-shot packet „queueing“ to send connection request
The connection module now has a separate queueing mechanism for packets that
are only transmitted once and not acknowledged through the regular Go-back-N
mechanism. An example is the Connection Request that is a one-time response to
a received beacon.

When such a packet shall be sent, a simple flag is set and the packet is
transmitted first in the next burst. Data packets may follow depending on the
one-shot packet type (Connection Request ends the burst immediately).
2025-02-22 20:19:34 +01:00
d4f101793b test_connection: complete verification of the connection request packet
All checks were successful
/ build-hamnet70 (push) Successful in 39s
/ build-doc (push) Successful in 21s
/ deploy-doc (push) Has been skipped
2025-02-22 16:17:33 +01:00
5ae79994ec connection: log payload size 2025-02-22 16:16:53 +01:00
de533f5871 workflows: run the unit tests
All checks were successful
/ build-hamnet70 (push) Successful in 38s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2025-02-15 01:51:53 +01:00
4c34bcc420 connection: only accept management packets in CONNECTING state
All checks were successful
/ build-hamnet70 (push) Successful in 37s
/ build-doc (push) Successful in 21s
/ deploy-doc (push) Has been skipped
2025-02-15 01:37:46 +01:00
22b262f6eb Add unit test infrastructure and start testing connection 2025-02-15 01:37:15 +01:00
f9c69698af connection: log tx_request flag
All checks were successful
/ build-hamnet70 (push) Successful in 35s
/ build-doc (push) Successful in 21s
/ deploy-doc (push) Has been skipped
2025-01-23 20:23:07 +01:00
026f412093 digipeater: also set cycle timeout for beacons 2025-01-23 20:22:40 +01:00
57ec459d80 Fixed empty packet transmission in client 2025-01-23 20:21:52 +01:00
6086f2c169 Improve handling of retransmissions
As this system is currently half-duplex and therefore there are no packets that
can still be received after a burst transmission has started, retransmission
handling can be simplified a lot. This commit therefore removes all time-based
retransmission code and instead transmits all so far unacknowledged packets in
every burst.
2025-01-22 22:16:31 +01:00
e4f73eb74b Adjust config.h.template to match setup_tundev.h 2025-01-09 20:12:38 +01:00
6483baa74c Add ham64 conversion utility
All checks were successful
/ build-hamnet70 (push) Successful in 33s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2025-01-04 17:19:16 +01:00
176770eef5 l2udptest_client: Improve code readability; only count valid data in statistics
All checks were successful
/ build-hamnet70 (push) Successful in 33s
/ build-doc (push) Successful in 16s
/ deploy-doc (push) Has been skipped
2025-01-04 16:17:25 +01:00
cea8145946 l2udptest_client: only transmit after receiving a tx_request
All checks were successful
/ build-hamnet70 (push) Successful in 33s
/ build-doc (push) Successful in 16s
/ deploy-doc (push) Has been skipped
2025-01-02 09:14:25 +01:00
f3f0733a3f Add _MS suffix to TX_SWITCH_BACKOFF_AFTER_RX_ON constant 2025-01-02 09:14:25 +01:00
dcd0b1a4a1 connection: ensure that tx_request is set on the last packet in a burst
All checks were successful
/ build-hamnet70 (push) Successful in 46s
/ build-doc (push) Successful in 26s
/ deploy-doc (push) Has been skipped
2025-01-01 14:58:31 +01:00
04399c0022 Fix byte order in TUN packet header
All checks were successful
/ build-hamnet70 (push) Successful in 39s
/ build-doc (push) Successful in 31s
/ deploy-doc (push) Has been skipped
2024-12-18 21:01:14 +01:00
b2df27bb92 digipeater: avoid writing to full packet queues 2024-12-18 21:00:46 +01:00
d77f4d4498 Multiple fixes in packet handling
All checks were successful
/ build-hamnet70 (push) Successful in 33s
/ build-doc (push) Successful in 19s
/ deploy-doc (push) Has been skipped
- add and handle layer 2 packet type correctly in data packets
- don't produce garbage packets if a packet could not be decoded or was not a
  data packet
- handle beacon/connection request/connection parameters handshake
- digipeater cycle timeout does not reset beacon timer anymore. This prevented
  any beacon transmission.
- Reset the connection timeout when empty packets are received
2024-12-15 22:29:47 +01:00
f85bb7f83e Update config.h.template to fix CI builds
All checks were successful
/ build-hamnet70 (push) Successful in 32s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2024-12-12 19:56:48 +01:00
559283d87f connection: process beacons and send connection requests
Some checks failed
/ build-hamnet70 (push) Failing after 17s
/ build-doc (push) Successful in 17s
/ deploy-doc (push) Has been skipped
2024-12-12 19:44:07 +01:00
fefacc69c3 Fixed all warnings 2024-12-12 19:44:07 +01:00
a0ccf9699a layer2: Remove event callbacks
Instead, connection and digipeater now update a event code passed by reference
to the maintain() function. This was the only place where the callback was
called before.

Minor side effect: maintain must be called multiple times if multiple events
trigger at the same time.
2024-12-12 19:44:07 +01:00
49dacffde1 digipeater: remove empty packet from current connection after burst 2024-12-12 19:44:07 +01:00
f376bd7db3 Remove data callbacks in connection and digipeater modules 2024-12-12 19:44:07 +01:00
f895adf877 digipeater: rename interval to cycle
Interval suggests a regular timing structure which is not intended in this
construct and therefore is misleading.
2024-12-12 19:44:07 +01:00
1c8e46f54a digipeater: improve beacon handling 2024-12-12 19:44:07 +01:00
580e4005ed digipeater: enqueue packets in the correct connection queue
So far, only IPv6 is supported.
2024-12-12 19:44:07 +01:00
e4961bf519 WIP: handle packets from the TUN device in digipeater
This is only a backup commit.
2024-12-12 19:44:07 +01:00
816d753cfb tundev: remove IFF_NO_PI
Without this flag the kernel adds packet information to each packet. The
interesting part of that information is the EtherType of the packet, which
simplifies handling.
2024-12-12 19:44:07 +01:00
774f5c0420 l2udptest_client: fix compilation 2024-12-12 19:44:07 +01:00
f51b1da9d5 connection: calculate IPv6 address for peer 2024-12-12 19:44:07 +01:00
339dc5490c Add missing call to digipeater_end_interval() 2024-12-12 19:44:07 +01:00
f3b6ab1a29 digipeater: add one-shot packet queue and interval handling
The oneshot queue is for connection management frames that are only sent once,
at the beginning of the next burst. An example is the Connection Reset packet.

Intervals define the boundary between the handling of different connections.
The interval can be either ended by a packet with TX Request set, or by a
timeout. In either case, forwarding of packets to the current connection stops
and the connection is re-scheduled to a later point in time.
2024-12-12 19:44:07 +01:00
01edbb1db1 WIP: managing multiple connections
Working towards handling multiple connections. A lot is still missing.
2024-12-12 19:44:07 +01:00
6e303e8aed WIP: digipeater module managing multiple connections
Backup commit. This is a basic setup with lots of TODOs and errors. Will not
compile yet.
2024-12-12 19:44:07 +01:00
8572018c4e l2/connection: refactoring
- split handle_packet() in two functions: the first does basic checks and calls
  the second one. This allows to do the basic checks externally (in the
  multi-connection management module) without duplicating them.
- use the new layer2_encode_packet() function.
2024-12-12 19:44:07 +01:00
16f7ae5242 l2/packet_structs: add function to encode a complete packet 2024-12-12 19:44:07 +01:00
97a23701d0 Handle retransmits inside the connection module 2024-12-12 19:44:07 +01:00
ec3244a61f Add a module to manage a list of connections 2024-12-12 19:44:07 +01:00
a0623668a7 Do all time calculations in uint64_t
This prevents loss of precision that occurs with double-precision floats if
timestamps become very large. Timestamps are already large if they contain a
UNIX time value (requires 60 bits; double has 53 bit resolution).
2024-12-12 19:44:07 +01:00
ec9e893c73 l2udptest: replace by two programs: client and digipeater
Both are identical so far, this is just an infrastructure commit.
2024-12-12 19:44:07 +01:00