kuzaxak left a comment (kamailio/kamailio#4799)

Thank you. Yes, I used an LLM to help format the initial issue text. Below is 
raw evidence from a local reproducer. I redacted IP addresses as `<local-ip>`, 
`<bad-ruri-ip>` and `<fallback-ip>`. There are no phone numbers in this repro.

Setup:
  - Kamailio 6.0.6, aarch64/linux, id `2d742a`
  - `use_dns_cache=on`, `use_dns_failover=on`
  - local UAC request generated with an R-URI containing a leading space: `sip: 
<bad-ruri-ip>:5060`
  - outbound URI resolves via DNS to two A records so FR timeout enters DNS 
failover

Raw log excerpt:

```text
  INFO: <script>: tm dns failover repro: sending local OPTIONS
  DEBUG: tm [uac.c:520]: t_uac_prepare(): next_hop=<sip:failover.local:5060>
  DEBUG: <core> [core/parser/parse_fline.c:267]: parse_first_line(): parsed so 
far: OPTIONS sip: <bad-ruri-ip>:5060
  ERROR: <core> [core/parser/parse_fline.c:274]: parse_first_line(): 
parse_first_line: bad message (offset: 30)
  ERROR: <core> [core/parser/msg_parser.c:794]: parse_msg(): ERROR: parse_msg: 
message=<OPTIONS sip: <bad-ruri-ip>:5060 SIP/2.0
  Via: SIP/2.0/UDP 
<local-ip>;branch=z9hG4bK1c22.8dade0f2000000000000000000000000.0
  To: <sip:[email protected]>
  From: <sip:[email protected]>;tag=c96ac9bd2dec950329c8cbcde0102c75-bc568971
  CSeq: 10 OPTIONS
  Call-ID: tm-dns-failover-repro
  Max-Forwards: 70
  Content-Length: 0
  User-Agent: kamailio (6.0.6 (aarch64/linux))

  >
  ERROR: <core> [core/msg_translator.c:3463]: build_sip_msg_from_buf(): parsing 
failed
  WARNING: tm [uac.c:637]: t_uac_prepare(): failed to build uas for failover
  DEBUG: tm [uac.c:767]: send_prepared_request_impl(): uac: 0xffffb53c00a0  
branch: 0  to <fallback-ip>:5060
  DEBUG: tm [timer.c:453]: final_response_handler(): send on branch 0 failed, 
adding another branch
  DEBUG: <core> [core/dns_cache.c:3258]: dns_srv_sip_resolve(): ( 
<bad-ruri-ip>, 0, 1), ip, ret=0
  ALERT: <core> [main.c:815]: handle_sigs(): child process 8 exited by a signal 
11
  ALERT: <core> [main.c:819]: handle_sigs(): core was generated
```

`bt full` from the generated core:

```
  Core was generated by `/usr/local/sbin/kamailio -DD -E -w /cores -f 
/cfg/kamailio.cfg'.
  Program terminated with signal SIGSEGV, Segmentation fault.

  #0  branch_builder(hash_index=8897, label=0,
      char_v=0xffffb53c007c "8dade0f2...", branch=1,
      branch_str=0x628 <error: Cannot access memory at address 0x628>,
      len=0x664) at core/msg_translator.c:2861
          begin = 0x628 <error: Cannot access memory at address 0x628>
          size = 58
  #1  t_calc_branch(t=0xffffb53bfdd0, b=1,
      branch=0x628 <error: Cannot access memory at address 0x628>,
      branch_len=0x664) at t_msgbuilder.c:1819
  #2  print_uac_request_from_buf(t=0xffffb53bfdd0, i_req=0x0, branch=1,
      uri=0xffffb53c02b0, len=0xffffde683c70, dst=0xffffb53c0388,
      buf=0xffffb53c2070 "OPTIONS sip: <bad-ruri-ip>:5060 SIP/2.0...",
      buf_len=363) at t_fwd.c:655
          shbuf = 0x0
          branch_str = {s = 0x0, len = 0}
          via_len = 0
  #3  add_uac_from_buf(t=0xffffb53bfdd0, request=0x0, uri=0xffffb53c02b0,
      path=0xffffb53c02c0, fsocket=0x0, proto=1,
      buf=0xffffb53c2070 "OPTIONS sip: <bad-ruri-ip>:5060 SIP/2.0...",
      buf_len=363, instance=0xffffb53c02d0, ruid=0xffffb53c02e0,
      location_ua=0xffffb53c02f0) at t_fwd.c:900
          ret = 65535
          branch = 1
          shbuf = 0xffffb53c0290 ""
          len = 2
  #4  add_uac_dns_fallback(t=0xffffb53bfdd0, msg=0x0,
      old_uac=0xffffb53c00a0, lock_replies=0) at t_fwd.c:1056
          ret = -1
  #5  final_response_handler(r_buf=0xffffb53c00b0, t=0xffffb53bfdd0)
      at timer.c:455
          silent = 0
          branch_ret = 43690
  #6  retr_buf_handler(ticks=707631818, tl=0xffffb53c00d0, p=0xfa0)
      at timer.c:534
          rbuf = 0xffffb53c00b0
          t = 0xffffb53bfdd0
  #7  slow_timer_main() at core/timer.c:1105
  #8  main_loop() at main.c:1996
  #9  main(argc=7, argv=0xffffde684658) at main.c:3407
```

I can share a harness (based on Docker) that I used to reproduce the issue 
locally. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4799#issuecomment-4863816096
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/4799/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to