sergey-safarov created an issue (kamailio/kamailio#4290)

Description

According to RFC3261 Section 18.3

   In the case of message-oriented transports (such as UDP), if the
   message has a Content-Length header field, the message body is
   assumed to contain that many bytes.  If there are additional bytes in
   the transport packet beyond the end of the body, they MUST be
   discarded.

In the current Kamailio implementation, extra bytes are analyzed, and this triggers a failed sanity check.

Troubleshooting

Reproduction

To reproduce required prepare config file

listen=udp:127.0.0.1:5060

loadmodule "xlog.so"
loadmodule "sl.so"
loadmodule "sanity.so"

modparam("sanity", "autodrop", 0)
modparam("sanity", "noreply", 1)

route{
	if(sanity_check()) {
		sl_send_reply("200", "OK");
		exit;
	}

	xerr("sanity checks failed\n");
	sanity_reply();
	drop;
}

And start using a command like

kamailio -DD -E -f kamailio.cfg 

Then need to send options using a command like

cat options-extra.txt | nc -u 127.0.0.1 5060

Where options-extra.txt is a file from the attached archive

options.tar.gz

If you remove extra bytes after the OPTIONS message, then Kamailio does not generate an error.
This can be tested using the command

cat options-normal.txt | nc -u 127.0.0.1 5060


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/4290@github.com>