Navigation


Changeset 518:2c097ed9d0ea in freeDiameter


Ignore:
Timestamp:
Aug 27, 2010, 11:25:46 AM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fix the dump function

Location:
extensions/app_radgw
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_radgw/radius.c

    r516 r518  
    224224        int i, len;
    225225        unsigned char *pos;
     226        u8 attrtype;
    226227
    227228        attr = radius_get_attr_type(hdr->type);
    228229
    229230        if (attr == NULL)
    230                 return;
     231                attrtype = RADIUS_ATTR_HEXDUMP;
     232        else
     233                attrtype = attr->data_type;
    231234
    232235        len = hdr->length - sizeof(struct radius_attr_hdr);
    233236        pos = (unsigned char *) (hdr + 1);
    234237
    235         switch (attr->data_type) {
     238        switch (attrtype) {
    236239        case RADIUS_ATTR_TEXT:
    237240                printf("      Value: '");
     
    250253                break;
    251254
    252 #ifdef CONFIG_IPV6
    253255        case RADIUS_ATTR_IPV6:
    254256                if (len == 16) {
     
    261263                        printf("      Invalid IPv6 address length %d\n", len);
    262264                break;
    263 #endif /* CONFIG_IPV6 */
    264 
    265         case RADIUS_ATTR_HEXDUMP:
    266         case RADIUS_ATTR_UNDIST:
    267                 printf("      Value:");
    268                 for (i = 0; i < len; i++)
    269                         printf(" %02x", pos[i]);
    270                 printf("\n");
    271                 break;
    272265
    273266        case RADIUS_ATTR_INT32:
     
    278271                break;
    279272
     273        case RADIUS_ATTR_HEXDUMP:
     274        case RADIUS_ATTR_UNDIST:
    280275        default:
     276                printf("      Value:");
     277                for (i = 0; i < len; i++)
     278                        printf(" %02x", pos[i]);
     279                printf("\n");
    281280                break;
    282281        }
  • extensions/app_radgw/rgw_msg.c

    r517 r518  
    9999        for (i = 0; i < msg->radius.attr_used; i++) {
    100100                struct radius_attr_hdr *attr = (struct radius_attr_hdr *)(msg->radius.buf + msg->radius.attr_pos[i]);
    101                 fd_log_debug("    - type: 0x%02hhx (%s)\n       len: %3hhu,", attr->length, attr->type, rgw_msg_attrtype_str(attr->type));
     101                fd_log_debug("    - Type: 0x%02hhx (%s)\n       Len: %-3hhu", attr->type, rgw_msg_attrtype_str(attr->type), attr->length);
    102102                radius_msg_dump_attr_val(attr);
    103103        }
Note: See TracChangeset for help on using the changeset viewer.