[OpenSIPS-Devel] [ opensips-Bugs-3522687 ] drouting: improper code return for do_routing()

SourceForge.net noreply at sourceforge.net
Fri May 4 19:23:29 CEST 2012


Bugs item #3522687, was opened at 2012-04-30 20:44
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3522687&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: 1.8.x
Status: Open
>Resolution: Fixed
Priority: 7
Private: No
Submitted By: Ovidiu Sas (osas)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: drouting: improper code return for do_routing()

Initial Comment:
When drouting dr_rules table is miss configured (the gwlist points to a non existing carrier), do_routing returns success and leaves the RURI unaltered.
This is causing looping.
I fixed the improper behaviour with the following patch:

Index: drouting.c
===================================================================
--- drouting.c  (revision 8972)
+++ drouting.c  (working copy)
@@ -1358,6 +1358,12 @@
        rt_info = get_prefix( (*rdata)->pt, &username , (unsigned int)grp_id,
                        &prefix_len, &rule_idx);

+       if (rt_info && rt_info->pgwa_len==0) {
+               LM_ERR("no gws for dr group %d, rule_idx %d, username %.*s\n",
+                       grp_id,rule_idx,username.len,username.s);
+               goto error2;
+       }
+
        if (flags & DR_PARAM_STRICT_LEN) {
                if (rt_info==NULL || prefix_len!=username.len)
                        goto error2;

Regards,
Ovidiu Sas

----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2012-05-04 10:23

Message:
Hi Ovidiu,

I made a fix on trunk only (for the moment) - could you please test rev
8983 to see if everything ok ? If so, I will do the backport.

Thanks and regards,
Bogdan 

----------------------------------------------------------------------

Comment By: Ovidiu Sas (osas)
Date: 2012-05-04 06:19

Message:
Hello Bogdan,

I see what are you trying to accomplish here.
I would like to have the default behaviour (no flag) to perform the actual
routing and to return an error on failure.
If a flag for checking the route is passed, then we can return success if
the route exists but there are no valid gcarriers/gateways.

Thanks,
Ovidiu

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2012-05-04 01:46

Message:
Hi Ovidiu,

actually that's not a bug, but a feature :) . The original idea was to
allow you to use DR for number detection (without any kind of routing) -
just to check if a number matches the rules. The returning OK even if there
GW is done on purpose.

I agree with you that this is a bit confusion - what I suggest as fix is to
add a new flag to do_routing() to explicitly indicate you want only
matching without routing. If flag is not set and if there are no GWs in the
list, err will be reported.

What do you think ?

Regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3522687&group_id=232389



More information about the Devel mailing list