Deal with OPTION requests that have Max-Forwards=0

This commit is contained in:
Thomas Ries 2018-01-22 19:52:42 +00:00
parent 59c58117c8
commit f6cebcdeff
3 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,8 @@
0.8.3dev 0.8.3dev
======== ========
17-Jan-2018: - Deal with OPTION requests that have Max-Forwards=0
(RFC3261, "11.2 Processing of OPTIONS Request" and
"16.3 Request Validation, step 3")
30-Sep-2017: - plugin_fix_fbox_anoncall: better handling of multiple 30-Sep-2017: - plugin_fix_fbox_anoncall: better handling of multiple
registered numbers on same device registered numbers on same device
27-Sep-2017: - resized URLMAP_SIZE=512, RTPPROXY_SIZE=1024 27-Sep-2017: - resized URLMAP_SIZE=512, RTPPROXY_SIZE=1024

View File

@ -430,7 +430,7 @@ int is_sipuri_local (sip_ticket_t *ticket) {
/* need name resolution */ /* need name resolution */
sts=get_ip_by_host(sip->req_uri->host, &addr_uri); sts=get_ip_by_host(sip->req_uri->host, &addr_uri);
if (sts == STS_FAILURE) { if (sts == STS_FAILURE) {
DEBUGC(DBCLASS_PROXY, "sip_gen_response: cannot resolve request uri [%s]", DEBUGC(DBCLASS_PROXY, "is_sipuri_local: cannot resolve request uri [%s]",
sip->req_uri->host); sip->req_uri->host);
return STS_FALSE; return STS_FALSE;
} }

View File

@ -490,9 +490,19 @@ int main (int argc, char *argv[])
DEBUGC(DBCLASS_PROXY,"checking Max-Forwards (=%i)",forwards_count); DEBUGC(DBCLASS_PROXY,"checking Max-Forwards (=%i)",forwards_count);
if (forwards_count <= 0) { if (forwards_count <= 0) {
DEBUGC(DBCLASS_SIP, "Forward count reached 0 -> 483 response"); if (MSG_IS_REQUEST(ticket.sipmsg) && MSG_IS_OPTIONS(ticket.sipmsg)) {
sip_gen_response(&ticket, 483 /*Too many hops*/); // special treatment for an OPTIONS message with Max-Forwards=0
goto end_loop; /* skip and free resources */ // -> RFC3261, 11.2 Processing of OPTIONS Request
// and 16.3 Request Validation, step 3
// as this may be a request directed to us as proxy, reply to it.
DEBUGC(DBCLASS_SIP, "OPTION request with Max-Forwards=0 -> 200 response");
sip_gen_response(&ticket, 200);
goto end_loop; /* skip and free resources */
} else {
DEBUGC(DBCLASS_SIP, "Forward count reached 0 -> 483 response");
sip_gen_response(&ticket, 483 /*Too many hops*/);
goto end_loop; /* skip and free resources */
}
} }
} }