Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for extensions/app_radgw/rgwx_acct.c


Ignore:
Timestamp:
Feb 9, 2011, 3:26:58 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Large UNTESTED commit with the following changes:

  • Improved DiameterIdentity? handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7)
  • Cleanup in the session module to free only unreferenced sessions (#16)
  • Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
  • Improved peer state machine algorithm to counter SCTP multistream race condition.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_radgw/rgwx_acct.c

    r705 r706  
    306306        const char * prefix = "Diameter/";
    307307        size_t pref_len;
    308         uint8_t * si = NULL;
     308        os0_t si = NULL;
    309309        size_t si_len = 0;
    310         uint8_t * un = NULL;
     310        os0_t un = NULL;
    311311        size_t un_len = 0;
    312312       
     
    487487        /* Create the Session-Id AVP if needed */
    488488        if (!*session) {
    489                 CHECK_FCT( fd_sess_fromsid ( (char *)/* cast should be removed later */si, si_len, session, NULL) );
     489                CHECK_FCT( fd_sess_fromsid ( si, si_len, session, NULL) );
    490490               
    491491                TRACE_DEBUG(FULL, "[acct.rgwx] Translating new accounting message for session '%.*s'...", si_len, si);
     
    663663                                        char * attr_val, *auth_val;
    664664                                        attr_val = (char *)(attr + 1);
    665                                         auth_val = attr_val + strlen(CLASS_AAI_PREFIX);
    666                                         if (    (attr->length > sizeof(struct radius_attr_hdr) + strlen(CLASS_AAI_PREFIX)  )
    667                                                 && (attr->length < sizeof(struct radius_attr_hdr) + strlen(CLASS_AAI_PREFIX) + sizeof(buf))
    668                                                 && ! strncmp(attr_val, CLASS_AAI_PREFIX, strlen(CLASS_AAI_PREFIX))) {
     665                                        auth_val = attr_val + CONSTSTRLEN(CLASS_AAI_PREFIX);
     666                                        if (    (attr->length > sizeof(struct radius_attr_hdr) + CONSTSTRLEN(CLASS_AAI_PREFIX)  )
     667                                                && (attr->length < sizeof(struct radius_attr_hdr) + CONSTSTRLEN(CLASS_AAI_PREFIX) + sizeof(buf))
     668                                                && ! strncmp(attr_val, CLASS_AAI_PREFIX, CONSTSTRLEN(CLASS_AAI_PREFIX))) {
    669669                                       
    670670                                                memset(buf, 0, sizeof(buf));
    671                                                 memcpy(buf, auth_val, attr->length - sizeof(struct radius_attr_hdr) - strlen(CLASS_AAI_PREFIX));
     671                                                memcpy(buf, auth_val, attr->length - sizeof(struct radius_attr_hdr) - CONSTSTRLEN(CLASS_AAI_PREFIX));
    672672                                                if (sscanf(buf, "%u", &auth_appl) == 1) {
    673673                                                        TRACE_DEBUG(ANNOYING, "Found Class attribute with '%s' prefix (attr #%d), AAI:%u.", CLASS_AAI_PREFIX, idx, auth_appl);
     
    13011301                struct msg * str = NULL;
    13021302                struct msg_hdr * hdr = NULL;
    1303                 char * fqdn;
    1304                 char * realm;
     1303                DiamId_t fqdn;
     1304                size_t fqdn_len;
     1305                DiamId_t realm;
     1306                size_t realm_len;
    13051307                union avp_value avp_val;
    13061308               
     
    13231325
    13241326                /* Get information on the NAS */
    1325                 CHECK_FCT( rgw_clients_get_origin(cli, &fqdn, &realm) );
     1327                CHECK_FCT( rgw_clients_get_origin(cli, &fqdn, &fqdn_len, &realm, &realm_len) );
    13261328
    13271329                /* Add the Origin-Host as next AVP */
     
    13291331                memset(&avp_val, 0, sizeof(avp_val));
    13301332                avp_val.os.data = (unsigned char *)fqdn;
    1331                 avp_val.os.len = strlen(fqdn);
     1333                avp_val.os.len = fqdn_len;
    13321334                CHECK_FCT( fd_msg_avp_setvalue ( avp, &avp_val ) );
    13331335                CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) );
     
    13371339                memset(&avp_val, 0, sizeof(avp_val));
    13381340                avp_val.os.data = (unsigned char *)realm;
    1339                 avp_val.os.len = strlen(realm);
     1341                avp_val.os.len = realm_len;
    13401342                CHECK_FCT( fd_msg_avp_setvalue ( avp, &avp_val ) );
    13411343                CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) );
Note: See TracChangeset for help on using the changeset viewer.