[Devel] [ openser-Bugs-1596427 ] acc module + RADIUS values issue

SourceForge.net noreply at sourceforge.net
Thu Nov 16 15:52:50 CET 2006


Bugs item #1596427, was opened at 2006-11-14 17:47
Message generated for change (Comment added) made by phsultan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1596427&group_id=139143

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: ver devel
Status: Open
Resolution: Fixed
Priority: 7
Private: No
Submitted By: Philippe Sultan (phsultan)
Assigned to: Bogdan (bogdan_iancu)
Summary: acc module + RADIUS values issue

Initial Comment:
Hi,

starting openser along with acc compiled for RADIUS
fails with the following message :
 0(0) ACC - initializing
 0(0) ERROR: acc: can't get code for the  attribute value
 0(0) ERROR:acc:mod_init: failed to init radius
 0(0) init_mod(): Error while initializing module acc


In modules/acc/dict.h, the INIT_AV macro takes V_MAX as
the maximum value to look into the rd_vals struct
defined in modules/acc/acc.c. Actually, rd_vals has its
max number defined in modules/acc/acc.c :
RV_STATIC_MAX, which conflicts with V_MAX to my
understanding.

A simple patch is attached to solve this issue.

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

>Comment By: Philippe Sultan (phsultan)
Date: 2006-11-16 15:52

Message:
Logged In: YES 
user_id=1645271
Originator: YES

Works like a charm, thank you Bogdan.

Philippe

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

Comment By: Bogdan (bogdan_iancu)
Date: 2006-11-16 14:19

Message:
Logged In: YES 
user_id=1275325
Originator: NO

I just committed a fix on the CVS. Please update and let me know if it
solved the problem on your side.

regards,
bogdan

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

Comment By: Bogdan (bogdan_iancu)
Date: 2006-11-16 13:47

Message:
Logged In: YES 
user_id=1275325
Originator: NO

Hi Philippe,

thanks for report - indeed, it seams to be a bug, but in my case there was
no side effects to help me in spotting it sooner. I will take care of it in
the days.

Thanks and regards,
Bogdan

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

Comment By: Philippe Sultan (phsultan)
Date: 2006-11-15 21:00

Message:
Logged In: YES 
user_id=1645271
Originator: YES

Really replace RV_* values with V_* in acc.c !

Index: modules/acc/acc.c
===================================================================
RCS file: /cvsroot/openser/sip-server/modules/acc/acc.c,v
retrieving revision 1.19
diff -u -r1.19 acc.c
--- modules/acc/acc.c   27 Oct 2006 11:28:28 -0000      1.19
+++ modules/acc/acc.c   15 Nov 2006 19:54:42 -0000
@@ -426,11 +426,9 @@
 #ifdef RAD_ACC
 enum { RA_ACCT_STATUS_TYPE=0, RA_SERVICE_TYPE, RA_SIP_RESPONSE_CODE,
        RA_SIP_METHOD, RA_TIME_STAMP, RA_STATIC_MAX};
-enum {RV_STATUS_START=0, RV_STATUS_STOP, RV_STATUS_FAILED,
-       RV_SIP_SESSION, RV_STATIC_MAX};
 static struct attr
        rd_attrs[RA_STATIC_MAX+ACC_CORE_LEN-2+MAX_ACC_EXTRA+MAX_ACC_LEG];
-static struct val rd_vals[RV_STATIC_MAX];
+static struct val rd_vals[V_MAX];
 
 int init_acc_rad(char *rad_cfg, int srv_type)
 {
@@ -449,10 +447,10 @@
        rd_attrs[n++].n                  = "Sip-To-Tag";
        rd_attrs[n++].n                  = "Acct-Session-Id";
 
-       rd_vals[RV_STATUS_START].n        = "Start";
-       rd_vals[RV_STATUS_STOP].n         = "Stop";
-       rd_vals[RV_STATUS_FAILED].n       = "Failed";
-       rd_vals[RV_SIP_SESSION].n         = "Sip-Session";
+       rd_vals[V_STATUS_START].n        = "Start";
+       rd_vals[V_STATUS_STOP].n         = "Stop";
+       rd_vals[V_STATUS_FAILED].n       = "Failed";
+       rd_vals[V_SIP_SESSION].n         = "Sip-Session";
 
        /* add and count the extras as attributes */
        n += extra2attrs( rad_extra, rd_attrs, n);
@@ -483,13 +481,13 @@
 static inline UINT4 rad_status( struct sip_msg *req, int code )
 {
        if (code==0)
-               return rd_vals[RV_STATUS_FAILED].v;
+               return rd_vals[V_STATUS_FAILED].v;
        if ((req->REQ_METHOD==METHOD_INVITE ||
req->REQ_METHOD==METHOD_ACK)
                                && code>=200 && code<300)
-               return rd_vals[RV_STATUS_START].v;
+               return rd_vals[V_STATUS_START].v;
        if ((req->REQ_METHOD==METHOD_BYE ||
req->REQ_METHOD==METHOD_CANCEL))
-               return rd_vals[RV_STATUS_STOP].v;
-       return rd_vals[RV_STATUS_FAILED].v;
+               return rd_vals[V_STATUS_STOP].v;
+       return rd_vals[V_STATUS_FAILED].v;
 }
 
 #define ADD_RAD_AVPAIR(_attr,_val,_len) \
@@ -518,7 +516,7 @@
        av_type = rad_status( req, acc_env.code); /* RADIUS status */
        ADD_RAD_AVPAIR( RA_ACCT_STATUS_TYPE, &av_type, -1);
 
-       av_type = rd_vals[RV_SIP_SESSION].v; /* session*/
+       av_type = rd_vals[V_SIP_SESSION].v; /* session*/
        ADD_RAD_AVPAIR( RA_SERVICE_TYPE, &av_type, -1);
 
        av_type = (UINT4)acc_env.code; /* status=integer */


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

Comment By: Philippe Sultan (phsultan)
Date: 2006-11-15 20:27

Message:
Logged In: YES 
user_id=1645271
Originator: YES

Oops. Realized that INIT_AV is used by other modules which don't know
anything about RV_STATIC_MAX, which prevents compilation :
authrad_mod.c
avp_radius.c
grouprad_mod.c
urirad_mod.c

New patch modifies acc.c to iterate through rd_vals with the scope defined
in dict.h. I am not sure how you guys want to handle that though :
Index: modules/acc/acc.c
===================================================================
RCS file: /cvsroot/openser/sip-server/modules/acc/acc.c,v
retrieving revision 1.19
diff -u -r1.19 acc.c
--- modules/acc/acc.c   27 Oct 2006 11:28:28 -0000      1.19
+++ modules/acc/acc.c   15 Nov 2006 19:16:11 -0000
@@ -426,8 +426,6 @@
 #ifdef RAD_ACC
 enum { RA_ACCT_STATUS_TYPE=0, RA_SERVICE_TYPE, RA_SIP_RESPONSE_CODE,
        RA_SIP_METHOD, RA_TIME_STAMP, RA_STATIC_MAX};
-enum {RV_STATUS_START=0, RV_STATUS_STOP, RV_STATUS_FAILED,
-       RV_SIP_SESSION, RV_STATIC_MAX};
 static struct attr
        rd_attrs[RA_STATIC_MAX+ACC_CORE_LEN-2+MAX_ACC_EXTRA+MAX_ACC_LEG];
 static struct val rd_vals[RV_STATIC_MAX];
@@ -449,10 +447,10 @@
        rd_attrs[n++].n                  = "Sip-To-Tag";
        rd_attrs[n++].n                  = "Acct-Session-Id";
 
-       rd_vals[RV_STATUS_START].n        = "Start";
-       rd_vals[RV_STATUS_STOP].n         = "Stop";
-       rd_vals[RV_STATUS_FAILED].n       = "Failed";
-       rd_vals[RV_SIP_SESSION].n         = "Sip-Session";
+       rd_vals[V_STATUS_START].n        = "Start";
+       rd_vals[V_STATUS_STOP].n         = "Stop";
+       rd_vals[V_STATUS_FAILED].n       = "Failed";
+       rd_vals[V_SIP_SESSION].n         = "Sip-Session";
 
        /* add and count the extras as attributes */
        n += extra2attrs( rad_extra, rd_attrs, n);


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1596427&group_id=139143



More information about the Devel mailing list