changeset 518:2c097ed9d0ea

Fix the dump function
author Sebastien Decugis <sdecugis@nict.go.jp>
date Fri, 27 Aug 2010 11:25:46 +0900
parents d5383f28b96e
children 3f43713be92d
files extensions/app_radgw/radius.c extensions/app_radgw/rgw_msg.c
diffstat 2 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}
 }
--- 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");
"Welcome to our mercurial repository"