2 * Copyright (C) 2000 Alfredo Andres Omella. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
14 * 3. The names of the authors may not be used to endorse or promote
15 * products derived from this software without specific prior
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 /* \summary: Radius protocol printer */
26 * Radius printer routines as specified on:
29 * "Remote Authentication Dial In User Service (RADIUS)"
35 * "RADIUS Accounting Modifications for Tunnel Protocol Support"
38 * "RADIUS Attributes for Tunnel Protocol Support"
44 * "IEEE 802.1X Remote Authentication Dial In User Service (RADIUS)"
48 * "RADIUS Attributes for Virtual LAN and Priority Support"
51 * "RADIUS Filter Rule Attribute"
54 * "Dynamic Authorization Extensions to RADIUS"
57 * "Diameter Network Access Server Application"
59 * Alfredo Andres Omella (aandres@s21sec.com) v0.1 2000/09/15
61 * TODO: Among other things to print ok MacIntosh and Vendor values
68 #include <netdissect-stdinc.h>
72 #include "netdissect.h"
73 #include "addrtoname.h"
77 static const char tstr
[] = " [|radius]";
79 #define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
81 #define PRINT_HEX(bytes_len, ptr_data) \
84 ND_PRINT((ndo, "%02X", *ptr_data )); \
90 /* Radius packet codes */
91 #define RADCMD_ACCESS_REQ 1 /* Access-Request */
92 #define RADCMD_ACCESS_ACC 2 /* Access-Accept */
93 #define RADCMD_ACCESS_REJ 3 /* Access-Reject */
94 #define RADCMD_ACCOUN_REQ 4 /* Accounting-Request */
95 #define RADCMD_ACCOUN_RES 5 /* Accounting-Response */
96 #define RADCMD_ACCESS_CHA 11 /* Access-Challenge */
97 #define RADCMD_STATUS_SER 12 /* Status-Server */
98 #define RADCMD_STATUS_CLI 13 /* Status-Client */
99 #define RADCMD_DISCON_REQ 40 /* Disconnect-Request */
100 #define RADCMD_DISCON_ACK 41 /* Disconnect-ACK */
101 #define RADCMD_DISCON_NAK 42 /* Disconnect-NAK */
102 #define RADCMD_COA_REQ 43 /* CoA-Request */
103 #define RADCMD_COA_ACK 44 /* CoA-ACK */
104 #define RADCMD_COA_NAK 45 /* CoA-NAK */
105 #define RADCMD_RESERVED 255 /* Reserved */
107 static const struct tok radius_command_values
[] = {
108 { RADCMD_ACCESS_REQ
, "Access-Request" },
109 { RADCMD_ACCESS_ACC
, "Access-Accept" },
110 { RADCMD_ACCESS_REJ
, "Access-Reject" },
111 { RADCMD_ACCOUN_REQ
, "Accounting-Request" },
112 { RADCMD_ACCOUN_RES
, "Accounting-Response" },
113 { RADCMD_ACCESS_CHA
, "Access-Challenge" },
114 { RADCMD_STATUS_SER
, "Status-Server" },
115 { RADCMD_STATUS_CLI
, "Status-Client" },
116 { RADCMD_DISCON_REQ
, "Disconnect-Request" },
117 { RADCMD_DISCON_ACK
, "Disconnect-ACK" },
118 { RADCMD_DISCON_NAK
, "Disconnect-NAK" },
119 { RADCMD_COA_REQ
, "CoA-Request" },
120 { RADCMD_COA_ACK
, "CoA-ACK" },
121 { RADCMD_COA_NAK
, "CoA-NAK" },
122 { RADCMD_RESERVED
, "Reserved" },
126 /********************************/
127 /* Begin Radius Attribute types */
128 /********************************/
131 #define LOG_IPHOST 14
132 #define LOG_SERVICE 15
134 #define SESSION_TIMEOUT 27
135 #define IDLE_TIMEOUT 28
136 #define FRM_ATALK_LINK 37
137 #define FRM_ATALK_NETWORK 38
139 #define ACCT_DELAY 41
140 #define ACCT_SESSION_TIME 46
142 #define EGRESS_VLAN_ID 56
143 #define EGRESS_VLAN_NAME 58
145 #define TUNNEL_TYPE 64
146 #define TUNNEL_MEDIUM 65
147 #define TUNNEL_CLIENT_END 66
148 #define TUNNEL_SERVER_END 67
149 #define TUNNEL_PASS 69
152 #define ARAP_FEATURES 71
154 #define TUNNEL_PRIV_GROUP 81
155 #define TUNNEL_ASSIGN_ID 82
156 #define TUNNEL_PREFERENCE 83
158 #define ARAP_CHALLENGE_RESP 84
159 #define ACCT_INT_INTERVAL 85
161 #define TUNNEL_CLIENT_AUTH 90
162 #define TUNNEL_SERVER_AUTH 91
163 /********************************/
164 /* End Radius Attribute types */
165 /********************************/
167 #define RFC4675_TAGGED 0x31
168 #define RFC4675_UNTAGGED 0x32
170 static const struct tok rfc4675_tagged
[] = {
171 { RFC4675_TAGGED
, "Tagged" },
172 { RFC4675_UNTAGGED
, "Untagged" },
177 static void print_attr_string(netdissect_options
*, register const u_char
*, u_int
, u_short
);
178 static void print_attr_num(netdissect_options
*, register const u_char
*, u_int
, u_short
);
179 static void print_vendor_attr(netdissect_options
*, register const u_char
*, u_int
, u_short
);
180 static void print_attr_address(netdissect_options
*, register const u_char
*, u_int
, u_short
);
181 static void print_attr_time(netdissect_options
*, register const u_char
*, u_int
, u_short
);
182 static void print_attr_strange(netdissect_options
*, register const u_char
*, u_int
, u_short
);
185 struct radius_hdr
{ uint8_t code
; /* Radius packet code */
186 uint8_t id
; /* Radius packet id */
187 uint16_t len
; /* Radius total length */
188 uint8_t auth
[16]; /* Authenticator */
191 #define MIN_RADIUS_LEN 20
193 struct radius_attr
{ uint8_t type
; /* Attribute type */
194 uint8_t len
; /* Attribute length */
198 /* Service-Type Attribute standard values */
199 static const char *serv_type
[]={ NULL
,
208 "Callback NAS Prompt",
210 "Callback Administrative",
213 /* Framed-Protocol Attribute standard values */
214 static const char *frm_proto
[]={ NULL
,
218 "Gandalf proprietary",
223 /* Framed-Routing Attribute standard values */
224 static const char *frm_routing
[]={ "None",
230 /* Framed-Compression Attribute standard values */
231 static const char *frm_comp
[]={ "None",
237 /* Login-Service Attribute standard values */
238 static const char *login_serv
[]={ "Telnet",
241 "PortMaster(proprietary)",
250 /* Termination-Action Attribute standard values */
251 static const char *term_action
[]={ "Default",
255 /* Ingress-Filters Attribute standard values */
256 static const char *ingress_filters
[]={ NULL
,
261 /* NAS-Port-Type Attribute standard values */
262 static const char *nas_port_type
[]={ "Async",
269 "HDLC Clear Channel",
281 "Wireless - IEEE 802.11",
284 /* Acct-Status-Type Accounting Attribute standard values */
285 static const char *acct_status
[]={ NULL
,
299 "Tunnel-Link-Reject",
303 /* Acct-Authentic Accounting Attribute standard values */
304 static const char *acct_auth
[]={ NULL
,
310 /* Acct-Terminate-Cause Accounting Attribute standard values */
311 static const char *acct_term
[]={ NULL
,
326 "Service Unavailable",
332 /* Tunnel-Type Attribute standard values */
333 static const char *tunnel_type
[]={ NULL
,
345 "IP-in-IP Tunneling",
349 /* Tunnel-Medium-Type Attribute standard values */
350 static const char *tunnel_medium
[]={ NULL
,
365 "E.164 with NSAP subaddress",
368 /* ARAP-Zone-Access Attribute standard values */
369 static const char *arap_zone
[]={ NULL
,
370 "Only access to dfl zone",
371 "Use zone filter inc.",
373 "Use zone filter exc.",
376 static const char *prompt
[]={ "No Echo",
381 static struct attrtype
{
382 const char *name
; /* Attribute name */
383 const char **subtypes
; /* Standard Values (if any) */
384 u_char siz_subtypes
; /* Size of total standard values */
385 u_char first_subtype
; /* First standard value is 0 or 1 */
386 void (*print_func
)(netdissect_options
*, register const u_char
*, u_int
, u_short
);
389 { NULL
, NULL
, 0, 0, NULL
},
390 { "User-Name", NULL
, 0, 0, print_attr_string
},
391 { "User-Password", NULL
, 0, 0, NULL
},
392 { "CHAP-Password", NULL
, 0, 0, NULL
},
393 { "NAS-IP-Address", NULL
, 0, 0, print_attr_address
},
394 { "NAS-Port", NULL
, 0, 0, print_attr_num
},
395 { "Service-Type", serv_type
, TAM_SIZE(serv_type
)-1, 1, print_attr_num
},
396 { "Framed-Protocol", frm_proto
, TAM_SIZE(frm_proto
)-1, 1, print_attr_num
},
397 { "Framed-IP-Address", NULL
, 0, 0, print_attr_address
},
398 { "Framed-IP-Netmask", NULL
, 0, 0, print_attr_address
},
399 { "Framed-Routing", frm_routing
, TAM_SIZE(frm_routing
), 0, print_attr_num
},
400 { "Filter-Id", NULL
, 0, 0, print_attr_string
},
401 { "Framed-MTU", NULL
, 0, 0, print_attr_num
},
402 { "Framed-Compression", frm_comp
, TAM_SIZE(frm_comp
), 0, print_attr_num
},
403 { "Login-IP-Host", NULL
, 0, 0, print_attr_address
},
404 { "Login-Service", login_serv
, TAM_SIZE(login_serv
), 0, print_attr_num
},
405 { "Login-TCP-Port", NULL
, 0, 0, print_attr_num
},
406 { "Unassigned", NULL
, 0, 0, NULL
}, /*17*/
407 { "Reply-Message", NULL
, 0, 0, print_attr_string
},
408 { "Callback-Number", NULL
, 0, 0, print_attr_string
},
409 { "Callback-Id", NULL
, 0, 0, print_attr_string
},
410 { "Unassigned", NULL
, 0, 0, NULL
}, /*21*/
411 { "Framed-Route", NULL
, 0, 0, print_attr_string
},
412 { "Framed-IPX-Network", NULL
, 0, 0, print_attr_num
},
413 { "State", NULL
, 0, 0, print_attr_string
},
414 { "Class", NULL
, 0, 0, print_attr_string
},
415 { "Vendor-Specific", NULL
, 0, 0, print_vendor_attr
},
416 { "Session-Timeout", NULL
, 0, 0, print_attr_num
},
417 { "Idle-Timeout", NULL
, 0, 0, print_attr_num
},
418 { "Termination-Action", term_action
, TAM_SIZE(term_action
), 0, print_attr_num
},
419 { "Called-Station-Id", NULL
, 0, 0, print_attr_string
},
420 { "Calling-Station-Id", NULL
, 0, 0, print_attr_string
},
421 { "NAS-Identifier", NULL
, 0, 0, print_attr_string
},
422 { "Proxy-State", NULL
, 0, 0, print_attr_string
},
423 { "Login-LAT-Service", NULL
, 0, 0, print_attr_string
},
424 { "Login-LAT-Node", NULL
, 0, 0, print_attr_string
},
425 { "Login-LAT-Group", NULL
, 0, 0, print_attr_string
},
426 { "Framed-AppleTalk-Link", NULL
, 0, 0, print_attr_num
},
427 { "Framed-AppleTalk-Network", NULL
, 0, 0, print_attr_num
},
428 { "Framed-AppleTalk-Zone", NULL
, 0, 0, print_attr_string
},
429 { "Acct-Status-Type", acct_status
, TAM_SIZE(acct_status
)-1, 1, print_attr_num
},
430 { "Acct-Delay-Time", NULL
, 0, 0, print_attr_num
},
431 { "Acct-Input-Octets", NULL
, 0, 0, print_attr_num
},
432 { "Acct-Output-Octets", NULL
, 0, 0, print_attr_num
},
433 { "Acct-Session-Id", NULL
, 0, 0, print_attr_string
},
434 { "Acct-Authentic", acct_auth
, TAM_SIZE(acct_auth
)-1, 1, print_attr_num
},
435 { "Acct-Session-Time", NULL
, 0, 0, print_attr_num
},
436 { "Acct-Input-Packets", NULL
, 0, 0, print_attr_num
},
437 { "Acct-Output-Packets", NULL
, 0, 0, print_attr_num
},
438 { "Acct-Terminate-Cause", acct_term
, TAM_SIZE(acct_term
)-1, 1, print_attr_num
},
439 { "Acct-Multi-Session-Id", NULL
, 0, 0, print_attr_string
},
440 { "Acct-Link-Count", NULL
, 0, 0, print_attr_num
},
441 { "Acct-Input-Gigawords", NULL
, 0, 0, print_attr_num
},
442 { "Acct-Output-Gigawords", NULL
, 0, 0, print_attr_num
},
443 { "Unassigned", NULL
, 0, 0, NULL
}, /*54*/
444 { "Event-Timestamp", NULL
, 0, 0, print_attr_time
},
445 { "Egress-VLANID", NULL
, 0, 0, print_attr_num
},
446 { "Ingress-Filters", ingress_filters
, TAM_SIZE(ingress_filters
)-1, 1, print_attr_num
},
447 { "Egress-VLAN-Name", NULL
, 0, 0, print_attr_string
},
448 { "User-Priority-Table", NULL
, 0, 0, NULL
},
449 { "CHAP-Challenge", NULL
, 0, 0, print_attr_string
},
450 { "NAS-Port-Type", nas_port_type
, TAM_SIZE(nas_port_type
), 0, print_attr_num
},
451 { "Port-Limit", NULL
, 0, 0, print_attr_num
},
452 { "Login-LAT-Port", NULL
, 0, 0, print_attr_string
}, /*63*/
453 { "Tunnel-Type", tunnel_type
, TAM_SIZE(tunnel_type
)-1, 1, print_attr_num
},
454 { "Tunnel-Medium-Type", tunnel_medium
, TAM_SIZE(tunnel_medium
)-1, 1, print_attr_num
},
455 { "Tunnel-Client-Endpoint", NULL
, 0, 0, print_attr_string
},
456 { "Tunnel-Server-Endpoint", NULL
, 0, 0, print_attr_string
},
457 { "Acct-Tunnel-Connection", NULL
, 0, 0, print_attr_string
},
458 { "Tunnel-Password", NULL
, 0, 0, print_attr_string
},
459 { "ARAP-Password", NULL
, 0, 0, print_attr_strange
},
460 { "ARAP-Features", NULL
, 0, 0, print_attr_strange
},
461 { "ARAP-Zone-Access", arap_zone
, TAM_SIZE(arap_zone
)-1, 1, print_attr_num
}, /*72*/
462 { "ARAP-Security", NULL
, 0, 0, print_attr_string
},
463 { "ARAP-Security-Data", NULL
, 0, 0, print_attr_string
},
464 { "Password-Retry", NULL
, 0, 0, print_attr_num
},
465 { "Prompt", prompt
, TAM_SIZE(prompt
), 0, print_attr_num
},
466 { "Connect-Info", NULL
, 0, 0, print_attr_string
},
467 { "Configuration-Token", NULL
, 0, 0, print_attr_string
},
468 { "EAP-Message", NULL
, 0, 0, print_attr_string
},
469 { "Message-Authenticator", NULL
, 0, 0, print_attr_string
}, /*80*/
470 { "Tunnel-Private-Group-ID", NULL
, 0, 0, print_attr_string
},
471 { "Tunnel-Assignment-ID", NULL
, 0, 0, print_attr_string
},
472 { "Tunnel-Preference", NULL
, 0, 0, print_attr_num
},
473 { "ARAP-Challenge-Response", NULL
, 0, 0, print_attr_strange
},
474 { "Acct-Interim-Interval", NULL
, 0, 0, print_attr_num
},
475 { "Acct-Tunnel-Packets-Lost", NULL
, 0, 0, print_attr_num
}, /*86*/
476 { "NAS-Port-Id", NULL
, 0, 0, print_attr_string
},
477 { "Framed-Pool", NULL
, 0, 0, print_attr_string
},
478 { "CUI", NULL
, 0, 0, print_attr_string
},
479 { "Tunnel-Client-Auth-ID", NULL
, 0, 0, print_attr_string
},
480 { "Tunnel-Server-Auth-ID", NULL
, 0, 0, print_attr_string
},
481 { "NAS-Filter-Rule", NULL
, 0, 0, print_attr_string
},
482 { "Unassigned", NULL
, 0, 0, NULL
}, /*93*/
483 { "Originating-Line-Info", NULL
, 0, 0, NULL
}
487 /*****************************/
488 /* Print an attribute string */
489 /* value pointed by 'data' */
490 /* and 'length' size. */
491 /*****************************/
492 /* Returns nothing. */
493 /*****************************/
495 print_attr_string(netdissect_options
*ndo
,
496 register const u_char
*data
, u_int length
, u_short attr_code
)
500 ND_TCHECK2(data
[0],length
);
507 if (*data
&& (*data
<=0x1F) )
508 ND_PRINT((ndo
, "Tag[%u] ", *data
));
510 ND_PRINT((ndo
, "Tag[Unused] "));
513 ND_PRINT((ndo
, "Salt %u ", EXTRACT_16BITS(data
)));
517 case TUNNEL_CLIENT_END
:
518 case TUNNEL_SERVER_END
:
519 case TUNNEL_PRIV_GROUP
:
520 case TUNNEL_ASSIGN_ID
:
521 case TUNNEL_CLIENT_AUTH
:
522 case TUNNEL_SERVER_AUTH
:
528 ND_PRINT((ndo
, "Tag[%u] ", *data
));
530 ND_PRINT((ndo
, "Tag[Unused] "));
535 case EGRESS_VLAN_NAME
:
538 ND_PRINT((ndo
, "%s (0x%02x) ",
539 tok2str(rfc4675_tagged
,"Unknown tag",*data
),
546 for (i
=0; i
< length
&& *data
; i
++, data
++)
547 ND_PRINT((ndo
, "%c", (*data
< 32 || *data
> 126) ? '.' : *data
));
552 ND_PRINT((ndo
, "%s", tstr
));
556 * print vendor specific attributes
559 print_vendor_attr(netdissect_options
*ndo
,
560 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
569 ND_TCHECK2(*data
, 4);
570 vendor_id
= EXTRACT_32BITS(data
);
574 ND_PRINT((ndo
, "Vendor: %s (%u)",
575 tok2str(smi_values
,"Unknown",vendor_id
),
578 while (length
>= 2) {
579 ND_TCHECK2(*data
, 2);
581 vendor_type
= *(data
);
582 vendor_length
= *(data
+1);
584 if (vendor_length
< 2)
586 ND_PRINT((ndo
, "\n\t Vendor Attribute: %u, Length: %u (bogus, must be >= 2)",
591 if (vendor_length
> length
)
593 ND_PRINT((ndo
, "\n\t Vendor Attribute: %u, Length: %u (bogus, goes past end of vendor-specific attribute)",
601 ND_TCHECK2(*data
, vendor_length
);
603 ND_PRINT((ndo
, "\n\t Vendor Attribute: %u, Length: %u, Value: ",
606 for (idx
= 0; idx
< vendor_length
; idx
++, data
++)
607 ND_PRINT((ndo
, "%c", (*data
< 32 || *data
> 126) ? '.' : *data
));
608 length
-=vendor_length
;
613 ND_PRINT((ndo
, "%s", tstr
));
616 /******************************/
617 /* Print an attribute numeric */
618 /* value pointed by 'data' */
619 /* and 'length' size. */
620 /******************************/
621 /* Returns nothing. */
622 /******************************/
624 print_attr_num(netdissect_options
*ndo
,
625 register const u_char
*data
, u_int length
, u_short attr_code
)
631 ND_PRINT((ndo
, "ERROR: length %u != 4", length
));
635 ND_TCHECK2(data
[0],4);
636 /* This attribute has standard values */
637 if (attr_type
[attr_code
].siz_subtypes
)
639 static const char **table
;
641 table
= attr_type
[attr_code
].subtypes
;
643 if ( (attr_code
== TUNNEL_TYPE
) || (attr_code
== TUNNEL_MEDIUM
) )
646 ND_PRINT((ndo
, "Tag[Unused] "));
648 ND_PRINT((ndo
, "Tag[%d] ", *data
));
650 data_value
= EXTRACT_24BITS(data
);
654 data_value
= EXTRACT_32BITS(data
);
656 if ( data_value
<= (uint32_t)(attr_type
[attr_code
].siz_subtypes
- 1 +
657 attr_type
[attr_code
].first_subtype
) &&
658 data_value
>= attr_type
[attr_code
].first_subtype
)
659 ND_PRINT((ndo
, "%s", table
[data_value
]));
661 ND_PRINT((ndo
, "#%u", data_value
));
665 switch(attr_code
) /* Be aware of special cases... */
668 if (EXTRACT_32BITS( data
) == 0xFFFFFFFE )
669 ND_PRINT((ndo
, "NAS Select"));
671 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
674 case SESSION_TIMEOUT
:
677 case ACCT_SESSION_TIME
:
678 case ACCT_INT_INTERVAL
:
679 timeout
= EXTRACT_32BITS( data
);
681 ND_PRINT((ndo
, "%02d secs", timeout
));
684 if ( timeout
< 3600 )
685 ND_PRINT((ndo
, "%02d:%02d min",
686 timeout
/ 60, timeout
% 60));
688 ND_PRINT((ndo
, "%02d:%02d:%02d hours",
689 timeout
/ 3600, (timeout
% 3600) / 60,
695 if (EXTRACT_32BITS(data
) )
696 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
698 ND_PRINT((ndo
, "Unnumbered"));
701 case FRM_ATALK_NETWORK
:
702 if (EXTRACT_32BITS(data
) )
703 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
705 ND_PRINT((ndo
, "NAS assigned"));
708 case TUNNEL_PREFERENCE
:
710 ND_PRINT((ndo
, "Tag[%d] ", *data
));
712 ND_PRINT((ndo
, "Tag[Unused] "));
714 ND_PRINT((ndo
, "%d", EXTRACT_24BITS(data
)));
718 ND_PRINT((ndo
, "%s (0x%02x) ",
719 tok2str(rfc4675_tagged
,"Unknown tag",*data
),
722 ND_PRINT((ndo
, "%d", EXTRACT_24BITS(data
)));
726 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
736 ND_PRINT((ndo
, "%s", tstr
));
739 /*****************************/
740 /* Print an attribute IPv4 */
741 /* address value pointed by */
742 /* 'data' and 'length' size. */
743 /*****************************/
744 /* Returns nothing. */
745 /*****************************/
747 print_attr_address(netdissect_options
*ndo
,
748 register const u_char
*data
, u_int length
, u_short attr_code
)
752 ND_PRINT((ndo
, "ERROR: length %u != 4", length
));
756 ND_TCHECK2(data
[0],4);
762 if (EXTRACT_32BITS(data
) == 0xFFFFFFFF )
763 ND_PRINT((ndo
, "User Selected"));
765 if (EXTRACT_32BITS(data
) == 0xFFFFFFFE )
766 ND_PRINT((ndo
, "NAS Select"));
768 ND_PRINT((ndo
, "%s",ipaddr_string(ndo
, data
)));
772 ND_PRINT((ndo
, "%s", ipaddr_string(ndo
, data
)));
779 ND_PRINT((ndo
, "%s", tstr
));
782 /*************************************/
783 /* Print an attribute of 'secs since */
784 /* January 1, 1970 00:00 UTC' value */
785 /* pointed by 'data' and 'length' */
787 /*************************************/
788 /* Returns nothing. */
789 /*************************************/
791 print_attr_time(netdissect_options
*ndo
,
792 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
799 ND_PRINT((ndo
, "ERROR: length %u != 4", length
));
803 ND_TCHECK2(data
[0],4);
805 attr_time
= EXTRACT_32BITS(data
);
806 strlcpy(string
, ctime(&attr_time
), sizeof(string
));
807 /* Get rid of the newline */
809 ND_PRINT((ndo
, "%.24s", string
));
813 ND_PRINT((ndo
, "%s", tstr
));
816 /***********************************/
817 /* Print an attribute of 'strange' */
818 /* data format pointed by 'data' */
819 /* and 'length' size. */
820 /***********************************/
821 /* Returns nothing. */
822 /***********************************/
824 print_attr_strange(netdissect_options
*ndo
,
825 register const u_char
*data
, u_int length
, u_short attr_code
)
834 ND_PRINT((ndo
, "ERROR: length %u != 16", length
));
837 ND_PRINT((ndo
, "User_challenge ("));
838 ND_TCHECK2(data
[0],8);
840 PRINT_HEX(len_data
, data
);
841 ND_PRINT((ndo
, ") User_resp("));
842 ND_TCHECK2(data
[0],8);
844 PRINT_HEX(len_data
, data
);
845 ND_PRINT((ndo
, ")"));
851 ND_PRINT((ndo
, "ERROR: length %u != 14", length
));
854 ND_TCHECK2(data
[0],1);
856 ND_PRINT((ndo
, "User can change password"));
858 ND_PRINT((ndo
, "User cannot change password"));
860 ND_TCHECK2(data
[0],1);
861 ND_PRINT((ndo
, ", Min password length: %d", *data
));
863 ND_PRINT((ndo
, ", created at: "));
864 ND_TCHECK2(data
[0],4);
866 PRINT_HEX(len_data
, data
);
867 ND_PRINT((ndo
, ", expires in: "));
868 ND_TCHECK2(data
[0],4);
870 PRINT_HEX(len_data
, data
);
871 ND_PRINT((ndo
, ", Current Time: "));
872 ND_TCHECK2(data
[0],4);
874 PRINT_HEX(len_data
, data
);
877 case ARAP_CHALLENGE_RESP
:
880 ND_PRINT((ndo
, "ERROR: length %u != 8", length
));
883 ND_TCHECK2(data
[0],8);
885 PRINT_HEX(len_data
, data
);
891 ND_PRINT((ndo
, "%s", tstr
));
895 radius_attrs_print(netdissect_options
*ndo
,
896 register const u_char
*attr
, u_int length
)
898 register const struct radius_attr
*rad_attr
= (const struct radius_attr
*)attr
;
899 const char *attr_string
;
905 ND_TCHECK(*rad_attr
);
907 if (rad_attr
->type
> 0 && rad_attr
->type
< TAM_SIZE(attr_type
))
908 attr_string
= attr_type
[rad_attr
->type
].name
;
910 attr_string
= "Unknown";
911 if (rad_attr
->len
< 2)
913 ND_PRINT((ndo
, "\n\t %s Attribute (%u), length: %u (bogus, must be >= 2)",
919 if (rad_attr
->len
> length
)
921 ND_PRINT((ndo
, "\n\t %s Attribute (%u), length: %u (bogus, goes past end of packet)",
927 ND_PRINT((ndo
, "\n\t %s Attribute (%u), length: %u, Value: ",
932 if (rad_attr
->type
< TAM_SIZE(attr_type
))
934 if (rad_attr
->len
> 2)
936 if ( attr_type
[rad_attr
->type
].print_func
)
937 (*attr_type
[rad_attr
->type
].print_func
)(
938 ndo
, ((const u_char
*)(rad_attr
+1)),
939 rad_attr
->len
- 2, rad_attr
->type
);
942 /* do we also want to see a hex dump ? */
943 if (ndo
->ndo_vflag
> 1)
944 print_unknown_data(ndo
, (const u_char
*)rad_attr
+2, "\n\t ", (rad_attr
->len
)-2);
946 length
-=(rad_attr
->len
);
947 rad_attr
= (const struct radius_attr
*)( ((const char *)(rad_attr
))+rad_attr
->len
);
952 ND_PRINT((ndo
, "%s", tstr
));
956 radius_print(netdissect_options
*ndo
,
957 const u_char
*dat
, u_int length
)
959 register const struct radius_hdr
*rad
;
962 ND_TCHECK2(*dat
, MIN_RADIUS_LEN
);
963 rad
= (const struct radius_hdr
*)dat
;
964 len
= EXTRACT_16BITS(&rad
->len
);
966 if (len
< MIN_RADIUS_LEN
)
968 ND_PRINT((ndo
, "%s", tstr
));
975 if (ndo
->ndo_vflag
< 1) {
976 ND_PRINT((ndo
, "RADIUS, %s (%u), id: 0x%02x length: %u",
977 tok2str(radius_command_values
,"Unknown Command",rad
->code
),
984 ND_PRINT((ndo
, "RADIUS, length: %u\n\t%s (%u), id: 0x%02x, Authenticator: ",
986 tok2str(radius_command_values
,"Unknown Command",rad
->code
),
990 for(auth_idx
=0; auth_idx
< 16; auth_idx
++)
991 ND_PRINT((ndo
, "%02x", rad
->auth
[auth_idx
]));
994 if (len
> MIN_RADIUS_LEN
)
995 radius_attrs_print(ndo
, dat
+ MIN_RADIUS_LEN
, len
- MIN_RADIUS_LEN
);
999 ND_PRINT((ndo
, "%s", tstr
));