Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTP protocol definition has two fields that shouldn't be there #4591

Open
tadkollar opened this issue Nov 15, 2024 · 3 comments · May be fixed by #4613
Open

LTP protocol definition has two fields that shouldn't be there #4591

tadkollar opened this issue Nov 15, 2024 · 3 comments · May be fixed by #4613
Labels

Comments

@tadkollar
Copy link

Brief description

The Scapy LTP protocol implementation should not contain ConditionalFields CancelAckToBlockSender and CancelAckToBlockReceiver.

Scapy version

2.6.1

Python version

3.12

Operating system

Ubuntu 22.04

Additional environment information

RFC 5326, section 3.2.4 states that "The Cancel-acknowledgments (CAx) have no content." However, ConditionalFields CancelAckToBlockSender and CancelAckToBlockReceiver are defined for segments (scapy/contrib/ltp.py lines 176-179) with flags values 13 and 15 (cancel acknowledgement segments).

The result of this is:

  • An extra byte is appended when that type of segment is created
  • Scapy is unable to decode proper received CAx segments due to that byte missing.

How to reproduce

from scapy.contrib.ltp import LTP
from scapy.all import raw

cancel_segment = LTP(flags = 13, SessionOriginator = 1, SessionNumber = 2)
cancel_segment.show2()
print(f"Length of segment: {len(raw(cancel_segment))}")

Actual result

###[ LTP ]###
  version   = 0
  flags     = 0xD Cancel-acknowledgment segment to block sender
  SessionOriginator= 1
  SessionNumber= 2
  HeaderExtensionCount= 0
  TrailerExtensionCount= 0
  \HeaderExtensions\
  CancelAckToBlockSender= 0
  \TrailerExtensions\

Length of segment: 5

Expected result

###[ LTP ]###
  version   = 0
  flags     = 0xD Cancel-acknowledgment segment to block sender
  SessionOriginator= 1
  SessionNumber= 2
  HeaderExtensionCount= 0
  TrailerExtensionCount= 0
  \HeaderExtensions\
  \TrailerExtensions\

Length of segment: 4

Related resources

https://www.rfc-editor.org/rfc/rfc5326.html#page-20

@gpotter2 gpotter2 added the bug label Nov 16, 2024
@gpotter2
Copy link
Member

Thanks for the report.
Would you by any chance be able to share a pcap? We sadly generally don't have much tests for LTP
Thanks

@satveerbrar
Copy link

satveerbrar commented Dec 16, 2024

If I understood correctly. Removing the Conditional Field for Cancel ACK's(Flag 13 and 15) going to fix this issue.

image

@tadkollar
Copy link
Author

Yes, that's correct.

Sorry, I haven't had a chance to send a pcap. We're developing a test framework for DTN implementations that uses LTP and includes full Scapy-based implementations of BPv6, BPv7, BPSec, and other DTN-related protocols. It will eventually be released as open-source but has to be reviewed and approved first.

@satveerbrar satveerbrar linked a pull request Dec 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants