Skip to main content

Module rfc5118

Module rfc5118 

Source
Expand description

The RFC 5118 IPv6 SIP torture-test corpus.

RFC 5118 is the IPv6 twin of RFC 4475: ten sections of messages built to break parsers that guess at where an IPv6 reference ends. Almost all of them are valid, which is the point — the document exists because implementations were rejecting messages they were obliged to accept, and because a colon means two different things inside [...] and after it.

The messages are recovered from the bit-exact archive in that RFC’s Appendix A by scripts/import-rfc5118-corpus.sh, not retyped. Retyping is a worse idea here than for RFC 4475: every case turns on the exact placement of :, [ and ], and two of the messages are wrapped across lines in the RFC’s body text with an <allOneLine> convention that a transcriber has to unwrap by hand. Run the script with --check to verify the committed corpus still matches the RFC.

§The archive is not wire bytes

One difference from RFC 4475 has to be handled rather than admired. The files in RFC 5118’s archive are terminated with bare LF, not CRLF — there is not one CR octet in any of the twelve — and the two §4.10 files carry no terminating blank line at all. SIP requires CRLF (RFC 3261 §7), so the archived bytes are not a legal SIP message as shipped.

On top of that, the three messages carrying SDP declare a Content-Length that matches no convention — see Case::wire for the numbers.

The corpus on disk is kept bit-exact anyway, because that is what --check verifies against the RFC. Case::wire performs the documented transformations needed to get on-the-wire bytes, and Case::bytes remains the archive’s own content. Those transformations touch only line terminators and the digits of one header value; every octet of every IPv6 reference, URI and body is the RFC’s.

§What the classification is for

Each case carries an Expect naming which layer must object to it, and the tests assert against that rather than a bare pass/fail. The vocabulary is crate::rfc4475’s, imported rather than redefined: a reader comparing the two corpora is then comparing like with like, and there is exactly one definition of what ParseOk claims.

Unlike RFC 4475, this corpus is almost entirely ParseOk. Only §4.2 is invalid, and the RFC says so in its title. The other nine sections are demonstrations that a parser must accept things it may not expect, so the converse assertion — that nothing valid is rejected — is where the value of this corpus lies.

Re-exports§

pub use crate::rfc4475::Expect;
pub use crate::rfc4475::Fault;

Structs§

Case
One message from the corpus.
Deviation
A place where sipx currently departs from what RFC 5118 requires.

Statics§

CASES
Every message in the corpus, in RFC section order.
DEVIATIONS
Every known departure from RFC 5118. None: sipx conforms to all twelve messages.

Functions§

case
Look up a case by its RFC name.
classified
Every case the parser tests assert on.
conforming
Cases that behave as RFC 5118 requires — every case except the recorded deviations.
deviates
Whether a case is one sipx is known to handle contrary to the RFC.
deviation
The recorded deviation for a case, if it has one.
expecting
Cases matching a given expectation.
with_sdp
Cases carrying an SDP body.