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

### Description
According to [RFC3261](https://www.ietf.org/rfc/rfc3261.html#section-18.3) 
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](https://github.com/user-attachments/files/20838024/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 or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4290
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/4...@github.com>
_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to