Skip to content

feat(t2m): GS ダウンリンクで非 C2A-TSP パケットを破棄するオプション#492

Closed
harada hiroki (hender14) wants to merge 1 commit into
mainfrom
fix/t2m-drop-non-c2a-tsp-packets
Closed

feat(t2m): GS ダウンリンクで非 C2A-TSP パケットを破棄するオプション#492
harada hiroki (hender14) wants to merge 1 commit into
mainfrom
fix/t2m-drop-non-c2a-tsp-packets

Conversation

@hender14

@hender14 harada hiroki (hender14) commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

変更内容

  • TcpToMPduuint8_t c2a_tsp_only を追加 (T2M_initialize0 = 従来動作に初期化)
  • T2M_form_m_pdu: c2a_tsp_only が有効なとき、PacketList 先頭パケットを M_PDU へ詰める前 (tcp_rp == 0) に判定し、Fill 以外で 2nd ヘッダ版数が TSP_2ND_HDR_VER_1 でないもの (PUS パケット等) を破棄する
    • Fill パケットは memset 由来で 2nd ヘッダ版数=0 だが、APID_FILL_PKT で除外し破棄しない (破棄すると M_PDU が埋まらず無限ループになるため)

既定 (c2a_tsp_only == 0) では完全に従来どおりの動作で、利用側が明示的に 1 を設定した経路でのみフィルタが有効になります。

T2M_form_m_pdu が PacketList から取り出したパケットを M_PDU へ多重化する際、
TcpToMPdu.c2a_tsp_only が有効な場合に「C2A TSP 形式と Fill 以外」のパケット
(例: PUS パケット) を破棄するようにした。判定はパケット先頭から書き始める前
(tcp_rp == 0) に行い、Fill パケット (APID_FILL_PKT) は 2nd ヘッダ版数が
未設定(0)でも除外して破棄しない (破棄すると M_PDU が埋まらず無限ループになるため)。

狙い: GS SW (tmtc-c2a) 側が未知 APID のパケットを受けると M_PDU 再構成バッファを
reset し、同一バッファ内の後続パケットが巻き添えで欠落する。GS ダウンリンクには
C2A TSP のみを載せることで、この巻き添え欠落を送信側で未然に防ぐ多層防御。

c2a_tsp_only は T2M_initialize で 0 (従来動作) に初期化。利用側が明示的に 1 を
設定した経路でのみ破棄が有効になる。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 18, 2026 03:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an opt-in filter in the T2M (TCPacket → M_PDU) packing path to prevent non-C2A TSP telemetry (e.g., PUS packets) from being included in GS downlink M_PDUs, mitigating downstream GS software behavior that resets its reassembly buffer upon receiving unknown packets.

Changes:

  • Added c2a_tsp_only option to TcpToMPdu, defaulting to disabled to preserve existing behavior.
  • Implemented a head-of-packet (when tcp_rp == 0) drop rule that discards packets whose secondary header version is not TSP_2ND_HDR_VER_1, excluding Fill packets (APID_FILL_PKT) to avoid fill-related infinite loops.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tlm_cmd/ccsds/aos_space_data_link_protocol/tcp_to_m_pdu.h Adds the c2a_tsp_only flag to the T2M state struct for opt-in filtering.
tlm_cmd/ccsds/aos_space_data_link_protocol/tcp_to_m_pdu.c Initializes the new flag and applies the filter before packing a new packet into the M_PDU.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hender14 harada hiroki (hender14) changed the title feat(t2m): GS ダウンリンクで非 C2A-TSP (PUS 等) パケットを破棄するオプション (c2a_tsp_only) feat(t2m): GS ダウンリンクで非 C2A-TSP パケットを破棄するオプション Jun 18, 2026
@hender14

Copy link
Copy Markdown
Contributor Author

この処理は c2a-core 側のレイヤーで対応しない事にしたのでクローズする

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants