fix(native): repost RX queue before waiting for relay ACK

This commit is contained in:
冰朔 2026-08-06 20:25:27 +08:00
commit f7a6dd2f19
4 changed files with 49 additions and 4 deletions

View file

@ -64,7 +64,7 @@ def verified_request(frame: bytes, sequence: int, magic: bytes) -> None:
assert checksum(frame[34:82]) == 0
def authenticated_reply(frame: bytes, magic: bytes) -> bytes:
def ordinary_reply(frame: bytes) -> bytes:
reply = bytearray(frame)
reply[0:6] = GUEST_MAC
reply[6:12] = PEER_MAC
@ -74,6 +74,13 @@ def authenticated_reply(frame: bytes, magic: bytes) -> bytes:
reply[24:26] = struct.pack("!H", checksum(bytes(reply[14:34])))
reply[34] = 0
reply[36:38] = b"\0\0"
reply[36:38] = struct.pack("!H", checksum(bytes(reply[34:82])))
return bytes(reply)
def authenticated_reply(frame: bytes, magic: bytes) -> bytes:
reply = bytearray(ordinary_reply(frame))
reply[36:38] = b"\0\0"
reply[66:82] = NATIVE_ACK_MAGIC
reply[36:38] = struct.pack("!H", checksum(bytes(reply[34:82])))
return bytes(reply)
@ -137,6 +144,8 @@ def main() -> None:
else:
raise AssertionError(f"unexpected native sequence {sequence}")
verified_request(frame, sequence, magic)
peer.sendto(ordinary_reply(frame), qemu)
time.sleep(0.05)
peer.sendto(authenticated_reply(frame, magic), qemu)
terminal_sequence = 3 if args.login_only else (16 if args.resident else 5)
@ -147,6 +156,7 @@ def main() -> None:
"arp_gateway_reply: VERIFIED\n"
"handshake_direction: NATIVE_INITIATED_OUTBOUND_ICMP\n"
"authenticated_relay_reply: VERIFIED\n"
"ordinary_echo_reply_ignored: true\n"
"icmp_login_request_sent: true\n"
"icmp_login_reply_verified: true\n"
f"icmp_login_reply_count: {login_count}\n"

View file

@ -62,6 +62,7 @@ peer_pid=
grep -q '^handshake_direction: NATIVE_INITIATED_OUTBOUND_ICMP$' \
"${test_root}/peer.hldp"
grep -q '^authenticated_relay_reply: VERIFIED$' "${test_root}/peer.hldp"
grep -q '^ordinary_echo_reply_ignored: true$' "${test_root}/peer.hldp"
grep -q '^icmp_login_reply_count: 3$' "${test_root}/peer.hldp"
grep -q '^code_commit_reply_verified: true$' "${test_root}/peer.hldp"
grep -q '^branch_move_reply_verified: true$' "${test_root}/peer.hldp"