Skip to content

NAME

ltpcancel - LTP Cancel Segment injection utility for testing

SYNOPSIS

ltpcancel segment_type dest_host dest_port source_engine_id session_number

DESCRIPTION

ltpcancel is a testing utility that crafts and sends artificial LTP Cancel Segments to a specified destination. It is primarily used for testing and debugging LTP cancel segment handling, particularly the acknowledgment behavior for cancel segments.

The utility constructs a minimal valid LTP Cancel Segment with the specified parameters and sends it via UDP to the target LTP engine. This allows testing of cancel segment processing without requiring an actual LTP session to be in progress.

Note: This is a testing/debugging tool and should not be used in production environments. Injecting cancel segments for non-existent or arbitrary sessions may cause unexpected behavior in the receiving LTP engine.

ARGUMENTS

  • segment_type

    The type of cancel segment to send:

    • CS

      Cancel Segment from sender (segment type code 12). This indicates the sending engine is canceling the session.

    • CR

      Cancel Segment from receiver (segment type code 14). This indicates the receiving engine is canceling the session.

  • dest_host

    The hostname or IP address of the target LTP engine. Can be a DNS name (e.g., "localhost", "node2.example.com") or an IP address (e.g., "127.0.0.1", "192.168.1.100").

  • dest_port

    The UDP port number on which the target LTP engine is listening. This is typically the port configured for the LTP link service input (LSI) on the target node.

  • source_engine_id

    The LTP engine ID to use as the source of the cancel segment. This should match the engine ID that the target expects for incoming segments (i.e., it should be an engine ID that corresponds to a configured span on the target).

  • session_number

    The session number to include in the cancel segment. For testing cancel acknowledgment behavior, this can be any session number, including sessions that don't exist on the target.

EXIT STATUS

  • "0"

    The cancel segment was successfully sent.

  • "1"

    An error occurred. Possible causes include:

    • Invalid arguments or missing required parameters
    • Invalid segment type (must be CS or CR)
    • Unable to resolve destination hostname
    • Socket creation or transmission failure

EXAMPLES

  • ltpcancel CS localhost 2113 2 12345

    Send a Cancel-by-Sender (CS) segment to localhost port 2113, appearing to come from engine ID 2, for session number 12345.

  • ltpcancel CR 192.168.1.100 1113 1 99

    Send a Cancel-by-Receiver (CR) segment to 192.168.1.100 port 1113, appearing to come from engine ID 1, for session number 99.

  • ltpcancel CS node2.local 2113 3 1

    Send a CS segment to node2.local, from engine 3, session 1.

OUTPUT

On successful transmission, ltpcancel prints:

Sent CS segment: 6 bytes to localhost:2113
  Source Engine ID: 2
  Session Number: 12345

The byte count reflects the actual size of the LTP segment sent, which varies based on the SDNV encoding of the engine ID and session number.

TECHNICAL DETAILS

The cancel segment is constructed according to the LTP specification (RFC 5326) with the following structure:

  • Version/Type byte: Version 0, type 12 (CS) or 14 (CR)
  • Source Engine ID: SDNV-encoded engine ID
  • Session Number: SDNV-encoded session number
  • Extension count: 0 (no extensions)
  • Reason code: 0 (LtpCancelByUser)

The segment is sent as a single UDP datagram to the specified destination.

FILES

No configuration files are needed.

ENVIRONMENT

No environment variables are used.

DIAGNOSTICS

  • Error: segment_type must be CS or CR

    The first argument must be either "CS" or "CR" (case-sensitive).

  • Error: Could not resolve host hostname

    The specified destination hostname could not be resolved via DNS. Check the hostname spelling or use an IP address instead.

  • socket: error message

    Failed to create a UDP socket. Check system resources and network configuration.

  • sendto: error message

    Failed to send the UDP packet. This may indicate network connectivity issues or firewall restrictions.

NOTES

  • This utility does not require ION or LTP to be running on the local machine. It operates independently by directly constructing and sending UDP packets.
  • The cancel reason code is always set to 0 (LtpCancelByUser). Other reason codes are not currently supported.
  • No response is expected or waited for. To verify that the target processed the cancel segment, check the target's LTP logs or use ltpwatch to observe session state changes.
  • SDNV (Self-Delimiting Numeric Value) encoding is used for the engine ID and session number, as required by the LTP specification. Values up to 2,097,151 are supported.

BUGS

Report bugs to <https://github.com/nasa-jpl/ION-DTN/issues>

SEE ALSO

ltpadmin(1), ltpwatch(1), ltp(3), ltprc(5)