# HG changeset patch # User Sebastien Decugis # Date 1282875946 -32400 # Node ID 2c097ed9d0ea2c40e80bf5a3913b6c59ce0f5589 # Parent d5383f28b96edc2c53627392da1dd3fd03f52587 Fix the dump function diff -r d5383f28b96e -r 2c097ed9d0ea extensions/app_radgw/radius.c --- a/extensions/app_radgw/radius.c Fri Aug 27 11:14:17 2010 +0900 +++ b/extensions/app_radgw/radius.c Fri Aug 27 11:25:46 2010 +0900 @@ -223,16 +223,19 @@ struct radius_attr_type *attr; int i, len; unsigned char *pos; + u8 attrtype; attr = radius_get_attr_type(hdr->type); if (attr == NULL) - return; + attrtype = RADIUS_ATTR_HEXDUMP; + else + attrtype = attr->data_type; len = hdr->length - sizeof(struct radius_attr_hdr); pos = (unsigned char *) (hdr + 1); - switch (attr->data_type) { + switch (attrtype) { case RADIUS_ATTR_TEXT: printf(" Value: '"); for (i = 0; i < len; i++) @@ -249,7 +252,6 @@ printf(" Invalid IP address length %d\n", len); break; -#ifdef CONFIG_IPV6 case RADIUS_ATTR_IPV6: if (len == 16) { char buf[128]; @@ -260,15 +262,6 @@ } else printf(" Invalid IPv6 address length %d\n", len); break; -#endif /* CONFIG_IPV6 */ - - case RADIUS_ATTR_HEXDUMP: - case RADIUS_ATTR_UNDIST: - printf(" Value:"); - for (i = 0; i < len; i++) - printf(" %02x", pos[i]); - printf("\n"); - break; case RADIUS_ATTR_INT32: if (len == 4) @@ -277,7 +270,13 @@ printf(" Invalid INT32 length %d\n", len); break; + case RADIUS_ATTR_HEXDUMP: + case RADIUS_ATTR_UNDIST: default: + printf(" Value:"); + for (i = 0; i < len; i++) + printf(" %02x", pos[i]); + printf("\n"); break; } } diff -r d5383f28b96e -r 2c097ed9d0ea extensions/app_radgw/rgw_msg.c --- a/extensions/app_radgw/rgw_msg.c Fri Aug 27 11:14:17 2010 +0900 +++ b/extensions/app_radgw/rgw_msg.c Fri Aug 27 11:25:46 2010 +0900 @@ -98,7 +98,7 @@ auth[12], auth[13], auth[14], auth[15]); for (i = 0; i < msg->radius.attr_used; i++) { struct radius_attr_hdr *attr = (struct radius_attr_hdr *)(msg->radius.buf + msg->radius.attr_pos[i]); - fd_log_debug(" - type: 0x%02hhx (%s)\n len: %3hhu,", attr->length, attr->type, rgw_msg_attrtype_str(attr->type)); + fd_log_debug(" - Type: 0x%02hhx (%s)\n Len: %-3hhu", attr->type, rgw_msg_attrtype_str(attr->type), attr->length); radius_msg_dump_attr_val(attr); } fd_log_debug("-----------------------------\n");