Mercurial > hg > waaad
comparison extensions/radius_gw/sub_debug.c @ 432:cfb47f71e98c
Simplified RADIUS dump. To get attribute contents, use wireshark ;)
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 24 Jun 2009 17:43:52 +0900 |
parents | f7f89575faef |
children |
comparison
equal
deleted
inserted
replaced
431:1f16b74eabe2 | 432:cfb47f71e98c |
---|---|
89 { | 89 { |
90 unsigned char *auth; | 90 unsigned char *auth; |
91 size_t i; | 91 size_t i; |
92 | 92 |
93 auth = &(msg->hdr->authenticator[0]); | 93 auth = &(msg->hdr->authenticator[0]); |
94 log_debug(" --- Dump method 1:\n"); | |
95 | |
96 log_debug(" id : 0x%02hhx, code: %hhd (%s)\n", msg->hdr->identifier, msg->hdr->code, rgw_msg_code_str(msg->hdr->code)); | 94 log_debug(" id : 0x%02hhx, code: %hhd (%s)\n", msg->hdr->identifier, msg->hdr->code, rgw_msg_code_str(msg->hdr->code)); |
97 log_debug(" auth: %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", | 95 log_debug(" auth: %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", |
98 auth[0], auth[1], auth[2], auth[3], | 96 auth[0], auth[1], auth[2], auth[3], |
99 auth[4], auth[5], auth[6], auth[7]); | 97 auth[4], auth[5], auth[6], auth[7]); |
100 log_debug(" %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", | 98 log_debug(" %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", |
103 for (i = 0; i < msg->attr_used; i++) { | 101 for (i = 0; i < msg->attr_used; i++) { |
104 struct radius_attr_hdr *attr = (struct radius_attr_hdr *)(msg->buf + msg->attr_pos[i]); | 102 struct radius_attr_hdr *attr = (struct radius_attr_hdr *)(msg->buf + msg->attr_pos[i]); |
105 log_debug(" - len:%3hhu, type:0x%02hhx (%s)\n", attr->length, attr->type, rgw_msg_attrtype_str(attr->type)); | 103 log_debug(" - len:%3hhu, type:0x%02hhx (%s)\n", attr->length, attr->type, rgw_msg_attrtype_str(attr->type)); |
106 /* If we need to dump the value, it's better to call directly radius_msg_dump instead... */ | 104 /* If we need to dump the value, it's better to call directly radius_msg_dump instead... */ |
107 } | 105 } |
108 | |
109 log_debug(" --- Dump method 2:\n"); | |
110 radius_msg_dump(msg); | |
111 } | 106 } |
112 | 107 |
113 static int debug_rad_req(struct rga_conf_state * cs, sess_id_t * session, struct radius_msg * rad_req, struct radius_msg ** rad_ans, msg_t ** diam_fw, void * cli ) | 108 static int debug_rad_req(struct rga_conf_state * cs, sess_id_t * session, struct radius_msg * rad_req, struct radius_msg ** rad_ans, msg_t ** diam_fw, void * cli ) |
114 { | 109 { |
115 TRACE_ENTRY("%p %p %p %p %p %p", cs, session, rad_req, rad_ans, diam_fw, cli); | 110 TRACE_ENTRY("%p %p %p %p %p %p", cs, session, rad_req, rad_ans, diam_fw, cli); |
116 | 111 |
117 log_debug("sub_debug ( c:'%s' ) state dump start for incoming RADIUS message (session: %p)\n", cs->conffile, session); | 112 log_debug("------------- sub_debug ( c:'%s' )(session: %p) -------------\n", cs->conffile, session); |
118 | 113 |
119 if (!rad_req) { | 114 if (!rad_req) { |
120 log_debug(" RADIUS request: NULL pointer\n"); | 115 log_debug(" RADIUS request: NULL pointer\n"); |
121 } else { | 116 } else { |
122 log_debug(" RADIUS request (%p) DUMP:\n", rad_req); | 117 log_debug(" RADIUS request (%p) DUMP:\n", rad_req); |
135 } else { | 130 } else { |
136 log_debug(" Diameter message (%p) DUMP:\n", *diam_fw); | 131 log_debug(" Diameter message (%p) DUMP:\n", *diam_fw); |
137 (*cs->waaad_msg_dump_walk)(0, *diam_fw); | 132 (*cs->waaad_msg_dump_walk)(0, *diam_fw); |
138 } | 133 } |
139 | 134 |
140 log_debug("sub_debug ( c:'%s' ) state dump complete\n", cs->conffile); | 135 log_debug("=========== sub_debug ( c:'%s' ) complete =============\n", cs->conffile); |
141 | 136 |
142 return 0; | 137 return 0; |
143 } | 138 } |
144 | 139 |
145 static int debug_diam_ans(struct rga_conf_state * cs, sess_id_t * session, msg_t ** diam_ans, struct radius_msg ** rad_fw, void * cli ) | 140 static int debug_diam_ans(struct rga_conf_state * cs, sess_id_t * session, msg_t ** diam_ans, struct radius_msg ** rad_fw, void * cli ) |
146 { | 141 { |
147 TRACE_ENTRY("%p %p %p %p %p", cs, session, diam_ans, rad_fw, cli); | 142 TRACE_ENTRY("%p %p %p %p %p", cs, session, diam_ans, rad_fw, cli); |
148 CHECK_PARAMS(cs); | 143 CHECK_PARAMS(cs); |
149 log_debug("sub_debug ( c:'%s' ) state dump start for incoming Diameter answer (session: %p)\n", cs->conffile, session); | 144 log_debug("------------- sub_debug ( c:'%s' )(session: %p) -------------\n", cs->conffile, session); |
150 | 145 |
151 if (!diam_ans || ! *diam_ans) { | 146 if (!diam_ans || ! *diam_ans) { |
152 log_debug(" Diameter message: NULL pointer\n"); | 147 log_debug(" Diameter message: NULL pointer\n"); |
153 } else { | 148 } else { |
154 log_debug(" Diameter message (%p) DUMP:\n", *diam_ans); | 149 log_debug(" Diameter message (%p) DUMP:\n", *diam_ans); |
160 } else { | 155 } else { |
161 log_debug(" RADIUS answer (%p) DUMP:\n", *rad_fw); | 156 log_debug(" RADIUS answer (%p) DUMP:\n", *rad_fw); |
162 debug_dump_radius(*rad_fw); | 157 debug_dump_radius(*rad_fw); |
163 } | 158 } |
164 | 159 |
165 log_debug("sub_debug ( c:'%s' ) state dump complete\n", cs->conffile); | 160 log_debug("=========== sub_debug ( c:'%s' ) complete =============\n", cs->conffile); |
166 return 0; | 161 return 0; |
167 } | 162 } |
168 | 163 |
169 int rga_register(int version, waaad_api_t * waaad_api, struct radius_gw_api * api) | 164 int rga_register(int version, waaad_api_t * waaad_api, struct radius_gw_api * api) |
170 { | 165 { |