looks like branch flags get corrupted

4 messages Options
Embed this post
Permalink
Juha Heinanen

looks like branch flags get corrupted

Reply Threaded More More options
Print post
Permalink
i started to wonder why my proxy is calling fix_natted_contact() in
onreply route even when called ua is not behind nat.  the function is
called under condition

        if (isbflagset("TO_NATED") &&
                        t_check_status("18[0-9]|2[0-9][0-9]|3[0-9][0-9]")) {
            xlog("L_INFO", "Fixing nated contact in onreply_route\n");
                fix_nated_contact();
        };

i then added xlog telling if "TO_NATED" flags is set when request is
sent out:

        if (isbflagset("TO_NATED")) {
                xlog("L_INFO", "Flag to_nated is set before t_relay\n");
    } else {
                xlog("L_INFO", "Flag to_nated is NOT set before t_relay\n");
        }

it turns out that sometimes TO_NATED flag is set and sometimes not even
when the calls are exactly identical.

here is my example call: "jh" (behind nat) calls "foo", "foo" has forwarding
on in the proxy to "test", which causes the request to be sent back to sr at
127.0.0.1:5070 (and then to "test", but the error has happened
already and that is not shown).

first example call where TO_NATED flag is set although it should not
have been:

Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: INVITE <sip:[hidden email]> is authorized
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Unconditional forwarding to <sip:[hidden email]>
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Fixing nated contact in handle_caller_nat
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Routing initial INVITE <sip:[hidden email]> to <sip:127.0.0.1:5070>
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Flag to_nated is set before t_relay
...

second example call that works as it should:

Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: INVITE <sip:[hidden email]> is authorized
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Unconditional forwarding to <sip:[hidden email]>
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Fixing nated contact in handle_caller_nat
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Routing initial INVITE <sip:[hidden email]> to <sip:127.0.0.1:5070>
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Flag to_nated is NOT set before t_relay
...

the only conclusion that i can draw is that branch flags sometimes
get somehow corrupted.

let me know if you need more info or have ideas on how to find the cause
of the problem.  i do also have pcap traces.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

looks like branch flags get corrupted

Reply Threaded More More options
Print post
Permalink
Juha Heinanen writes:

 > it turns out that sometimes TO_NATED flag is set and sometimes not even
 > when the calls are exactly identical.

i added this to the beginning of my script:

route { # main route block (initial tasks)

        xlog("L_INFO", "Initial bflags <$bF>\n");

and many times it produces

Oct 31 07:45:41 localhost /usr/sbin/sip-proxy[4689]: INFO: Initial bflags <0000000a>

looks like it remembers them from previous invocation of the script,
i.e., branch flags are not properly initialized.

i read kex REAEDME and there is no function to reset all branch flags.
i'm pretty sure that this was done automatically in k.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Andrei Pelinescu-Onciul

Re: looks like branch flags get corrupted

Reply Threaded More More options
Print post
Permalink
On Oct 31, 2009 at 07:52, Juha Heinanen <[hidden email]> wrote:

> Juha Heinanen writes:
>
>  > it turns out that sometimes TO_NATED flag is set and sometimes not even
>  > when the calls are exactly identical.
>
> i added this to the beginning of my script:
>
> route { # main route block (initial tasks)
>
> xlog("L_INFO", "Initial bflags <$bF>\n");
>
> and many times it produces
>
> Oct 31 07:45:41 localhost /usr/sbin/sip-proxy[4689]: INFO: Initial bflags <0000000a>
>
> looks like it remembers them from previous invocation of the script,
> i.e., branch flags are not properly initialized.

Yes, the branch flags for the 0 branch (ruri_bflags) were not
re-initialized.
It should be fixed now on the latest sr_3.0.

Thanks,
Andrei

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like branch flags get corrupted

Reply Threaded More More options
Print post
Permalink
Andrei Pelinescu-Onciul writes:

 > Yes, the branch flags for the 0 branch (ruri_bflags) were not
 > re-initialized.
 > It should be fixed now on the latest sr_3.0.

yes, thanks.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev