#516 drouting: improper code return for do_routing()

1.8.x
closed-fixed
modules (454)
7
2012-05-05
2012-05-01
Ovidiu Sas
No

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

Discussion

  • Bogdan-Andrei Iancu

    • priority: 5 --> 7
    • assigned_to: nobody --> bogdan_iancu
     
  • Bogdan-Andrei Iancu

    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

     
  • Ovidiu Sas

    Ovidiu Sas - 2012-05-04

    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

     
  • Bogdan-Andrei Iancu

    • status: open --> open-fixed
     
  • Bogdan-Andrei Iancu

    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

     
  • Ovidiu Sas

    Ovidiu Sas - 2012-05-05

    The new flag works ok.

    Regards,
    Ovidiu Sas

     
  • Ovidiu Sas

    Ovidiu Sas - 2012-05-05
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks