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"
47 * "IEEE 802.1X Remote Authentication Dial In User Service (RADIUS)"
51 * "Diameter Extensible Authentication Protocol (EAP) Application"
54 * "RADIUS Attributes for Virtual LAN and Priority Support"
57 * "RADIUS Filter Rule Attribute"
60 * "RADIUS Extension for Digest Authentication"
63 * "Dynamic Authorization Extensions to RADIUS"
66 * "Carrying Location Objects in RADIUS and Diameter"
69 * "Diameter Network Access Server Application"
71 * Alfredo Andres Omella (aandres@s21sec.com) v0.1 2000/09/15
73 * TODO: Among other things to print ok MacIntosh and Vendor values
80 #include <netdissect-stdinc.h>
84 #include "netdissect.h"
85 #include "addrtoname.h"
89 static const char tstr
[] = " [|radius]";
91 #define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
93 #define PRINT_HEX(bytes_len, ptr_data) \
96 ND_PRINT((ndo, "%02X", *ptr_data )); \
102 /* Radius packet codes */
103 #define RADCMD_ACCESS_REQ 1 /* Access-Request */
104 #define RADCMD_ACCESS_ACC 2 /* Access-Accept */
105 #define RADCMD_ACCESS_REJ 3 /* Access-Reject */
106 #define RADCMD_ACCOUN_REQ 4 /* Accounting-Request */
107 #define RADCMD_ACCOUN_RES 5 /* Accounting-Response */
108 #define RADCMD_ACCESS_CHA 11 /* Access-Challenge */
109 #define RADCMD_STATUS_SER 12 /* Status-Server */
110 #define RADCMD_STATUS_CLI 13 /* Status-Client */
111 #define RADCMD_DISCON_REQ 40 /* Disconnect-Request */
112 #define RADCMD_DISCON_ACK 41 /* Disconnect-ACK */
113 #define RADCMD_DISCON_NAK 42 /* Disconnect-NAK */
114 #define RADCMD_COA_REQ 43 /* CoA-Request */
115 #define RADCMD_COA_ACK 44 /* CoA-ACK */
116 #define RADCMD_COA_NAK 45 /* CoA-NAK */
117 #define RADCMD_RESERVED 255 /* Reserved */
119 static const struct tok radius_command_values
[] = {
120 { RADCMD_ACCESS_REQ
, "Access-Request" },
121 { RADCMD_ACCESS_ACC
, "Access-Accept" },
122 { RADCMD_ACCESS_REJ
, "Access-Reject" },
123 { RADCMD_ACCOUN_REQ
, "Accounting-Request" },
124 { RADCMD_ACCOUN_RES
, "Accounting-Response" },
125 { RADCMD_ACCESS_CHA
, "Access-Challenge" },
126 { RADCMD_STATUS_SER
, "Status-Server" },
127 { RADCMD_STATUS_CLI
, "Status-Client" },
128 { RADCMD_DISCON_REQ
, "Disconnect-Request" },
129 { RADCMD_DISCON_ACK
, "Disconnect-ACK" },
130 { RADCMD_DISCON_NAK
, "Disconnect-NAK" },
131 { RADCMD_COA_REQ
, "CoA-Request" },
132 { RADCMD_COA_ACK
, "CoA-ACK" },
133 { RADCMD_COA_NAK
, "CoA-NAK" },
134 { RADCMD_RESERVED
, "Reserved" },
138 /********************************/
139 /* Begin Radius Attribute types */
140 /********************************/
143 #define LOG_IPHOST 14
144 #define LOG_SERVICE 15
146 #define SESSION_TIMEOUT 27
147 #define IDLE_TIMEOUT 28
148 #define FRM_ATALK_LINK 37
149 #define FRM_ATALK_NETWORK 38
151 #define ACCT_DELAY 41
152 #define ACCT_SESSION_TIME 46
154 #define EGRESS_VLAN_ID 56
155 #define EGRESS_VLAN_NAME 58
157 #define TUNNEL_TYPE 64
158 #define TUNNEL_MEDIUM 65
159 #define TUNNEL_CLIENT_END 66
160 #define TUNNEL_SERVER_END 67
161 #define TUNNEL_PASS 69
164 #define ARAP_FEATURES 71
166 #define TUNNEL_PRIV_GROUP 81
167 #define TUNNEL_ASSIGN_ID 82
168 #define TUNNEL_PREFERENCE 83
170 #define ARAP_CHALLENGE_RESP 84
171 #define ACCT_INT_INTERVAL 85
173 #define TUNNEL_CLIENT_AUTH 90
174 #define TUNNEL_SERVER_AUTH 91
176 #define ERROR_CAUSE 101
177 /********************************/
178 /* End Radius Attribute types */
179 /********************************/
181 #define RFC4675_TAGGED 0x31
182 #define RFC4675_UNTAGGED 0x32
184 static const struct tok rfc4675_tagged
[] = {
185 { RFC4675_TAGGED
, "Tagged" },
186 { RFC4675_UNTAGGED
, "Untagged" },
191 static void print_attr_string(netdissect_options
*, register const u_char
*, u_int
, u_short
);
192 static void print_attr_num(netdissect_options
*, register const u_char
*, u_int
, u_short
);
193 static void print_vendor_attr(netdissect_options
*, register const u_char
*, u_int
, u_short
);
194 static void print_attr_address(netdissect_options
*, register const u_char
*, u_int
, u_short
);
195 static void print_attr_address6(netdissect_options
*, register const u_char
*, u_int
, u_short
);
196 static void print_attr_netmask6(netdissect_options
*, register const u_char
*, u_int
, u_short
);
197 static void print_attr_time(netdissect_options
*, register const u_char
*, u_int
, u_short
);
198 static void print_attr_strange(netdissect_options
*, register const u_char
*, u_int
, u_short
);
201 struct radius_hdr
{ uint8_t code
; /* Radius packet code */
202 uint8_t id
; /* Radius packet id */
203 uint16_t len
; /* Radius total length */
204 uint8_t auth
[16]; /* Authenticator */
207 #define MIN_RADIUS_LEN 20
209 struct radius_attr
{ uint8_t type
; /* Attribute type */
210 uint8_t len
; /* Attribute length */
214 /* Service-Type Attribute standard values */
215 static const char *serv_type
[]={ NULL
,
224 "Callback NAS Prompt",
226 "Callback Administrative",
229 /* Framed-Protocol Attribute standard values */
230 static const char *frm_proto
[]={ NULL
,
234 "Gandalf proprietary",
239 /* Framed-Routing Attribute standard values */
240 static const char *frm_routing
[]={ "None",
246 /* Framed-Compression Attribute standard values */
247 static const char *frm_comp
[]={ "None",
253 /* Login-Service Attribute standard values */
254 static const char *login_serv
[]={ "Telnet",
257 "PortMaster(proprietary)",
266 /* Termination-Action Attribute standard values */
267 static const char *term_action
[]={ "Default",
271 /* Ingress-Filters Attribute standard values */
272 static const char *ingress_filters
[]={ NULL
,
277 /* NAS-Port-Type Attribute standard values */
278 static const char *nas_port_type
[]={ "Async",
285 "HDLC Clear Channel",
297 "Wireless - IEEE 802.11",
300 /* Acct-Status-Type Accounting Attribute standard values */
301 static const char *acct_status
[]={ NULL
,
315 "Tunnel-Link-Reject",
319 /* Acct-Authentic Accounting Attribute standard values */
320 static const char *acct_auth
[]={ NULL
,
326 /* Acct-Terminate-Cause Accounting Attribute standard values */
327 static const char *acct_term
[]={ NULL
,
342 "Service Unavailable",
348 /* Tunnel-Type Attribute standard values */
349 static const char *tunnel_type
[]={ NULL
,
361 "IP-in-IP Tunneling",
365 /* Tunnel-Medium-Type Attribute standard values */
366 static const char *tunnel_medium
[]={ NULL
,
381 "E.164 with NSAP subaddress",
384 /* ARAP-Zone-Access Attribute standard values */
385 static const char *arap_zone
[]={ NULL
,
386 "Only access to dfl zone",
387 "Use zone filter inc.",
389 "Use zone filter exc.",
392 static const char *prompt
[]={ "No Echo",
396 /* Error-Cause standard values */
397 #define ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED 201
398 #define ERROR_CAUSE_INVALID_EAP_PACKET 202
399 #define ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE 401
400 #define ERROR_CAUSE_MISSING_ATTRIBUTE 402
401 #define ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH 403
402 #define ERROR_CAUSE_INVALID_REQUEST 404
403 #define ERROR_CAUSE_UNSUPPORTED_SERVICE 405
404 #define ERROR_CAUSE_UNSUPPORTED_EXTENSION 406
405 #define ERROR_CAUSE_INVALID_ATTRIBUTE_VALUE 407
406 #define ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED 501
407 #define ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE 502
408 #define ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND 503
409 #define ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE 504
410 #define ERROR_CAUSE_PROXY_PROCESSING_ERROR 505
411 #define ERROR_CAUSE_RESOURCES_UNAVAILABLE 506
412 #define ERROR_CAUSE_REQUEST_INITIATED 507
413 #define ERROR_CAUSE_MULTIPLE_SESSION_SELECTION_UNSUPPORTED 508
414 #define ERROR_CAUSE_LOCATION_INFO_REQUIRED 509
415 static const struct tok errorcausetype
[] = {
416 { ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED
, "Residual Session Context Removed" },
417 { ERROR_CAUSE_INVALID_EAP_PACKET
, "Invalid EAP Packet (Ignored)" },
418 { ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE
, "Unsupported Attribute" },
419 { ERROR_CAUSE_MISSING_ATTRIBUTE
, "Missing Attribute" },
420 { ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH
, "NAS Identification Mismatch" },
421 { ERROR_CAUSE_INVALID_REQUEST
, "Invalid Request" },
422 { ERROR_CAUSE_UNSUPPORTED_SERVICE
, "Unsupported Service" },
423 { ERROR_CAUSE_UNSUPPORTED_EXTENSION
, "Unsupported Extension" },
424 { ERROR_CAUSE_INVALID_ATTRIBUTE_VALUE
, "Invalid Attribute Value" },
425 { ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED
, "Administratively Prohibited" },
426 { ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE
, "Request Not Routable (Proxy)" },
427 { ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND
, "Session Context Not Found" },
428 { ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE
, "Session Context Not Removable" },
429 { ERROR_CAUSE_PROXY_PROCESSING_ERROR
, "Other Proxy Processing Error" },
430 { ERROR_CAUSE_RESOURCES_UNAVAILABLE
, "Resources Unavailable" },
431 { ERROR_CAUSE_REQUEST_INITIATED
, "Request Initiated" },
432 { ERROR_CAUSE_MULTIPLE_SESSION_SELECTION_UNSUPPORTED
, "Multiple Session Selection Unsupported" },
433 { ERROR_CAUSE_LOCATION_INFO_REQUIRED
, "Location Info Required" },
438 static struct attrtype
{
439 const char *name
; /* Attribute name */
440 const char **subtypes
; /* Standard Values (if any) */
441 u_char siz_subtypes
; /* Size of total standard values */
442 u_char first_subtype
; /* First standard value is 0 or 1 */
443 void (*print_func
)(netdissect_options
*, register const u_char
*, u_int
, u_short
);
446 { NULL
, NULL
, 0, 0, NULL
},
447 { "User-Name", NULL
, 0, 0, print_attr_string
},
448 { "User-Password", NULL
, 0, 0, NULL
},
449 { "CHAP-Password", NULL
, 0, 0, NULL
},
450 { "NAS-IP-Address", NULL
, 0, 0, print_attr_address
},
451 { "NAS-Port", NULL
, 0, 0, print_attr_num
},
452 { "Service-Type", serv_type
, TAM_SIZE(serv_type
)-1, 1, print_attr_num
},
453 { "Framed-Protocol", frm_proto
, TAM_SIZE(frm_proto
)-1, 1, print_attr_num
},
454 { "Framed-IP-Address", NULL
, 0, 0, print_attr_address
},
455 { "Framed-IP-Netmask", NULL
, 0, 0, print_attr_address
},
456 { "Framed-Routing", frm_routing
, TAM_SIZE(frm_routing
), 0, print_attr_num
},
457 { "Filter-Id", NULL
, 0, 0, print_attr_string
},
458 { "Framed-MTU", NULL
, 0, 0, print_attr_num
},
459 { "Framed-Compression", frm_comp
, TAM_SIZE(frm_comp
), 0, print_attr_num
},
460 { "Login-IP-Host", NULL
, 0, 0, print_attr_address
},
461 { "Login-Service", login_serv
, TAM_SIZE(login_serv
), 0, print_attr_num
},
462 { "Login-TCP-Port", NULL
, 0, 0, print_attr_num
},
463 { "Unassigned", NULL
, 0, 0, NULL
}, /*17*/
464 { "Reply-Message", NULL
, 0, 0, print_attr_string
},
465 { "Callback-Number", NULL
, 0, 0, print_attr_string
},
466 { "Callback-Id", NULL
, 0, 0, print_attr_string
},
467 { "Unassigned", NULL
, 0, 0, NULL
}, /*21*/
468 { "Framed-Route", NULL
, 0, 0, print_attr_string
},
469 { "Framed-IPX-Network", NULL
, 0, 0, print_attr_num
},
470 { "State", NULL
, 0, 0, print_attr_string
},
471 { "Class", NULL
, 0, 0, print_attr_string
},
472 { "Vendor-Specific", NULL
, 0, 0, print_vendor_attr
},
473 { "Session-Timeout", NULL
, 0, 0, print_attr_num
},
474 { "Idle-Timeout", NULL
, 0, 0, print_attr_num
},
475 { "Termination-Action", term_action
, TAM_SIZE(term_action
), 0, print_attr_num
},
476 { "Called-Station-Id", NULL
, 0, 0, print_attr_string
},
477 { "Calling-Station-Id", NULL
, 0, 0, print_attr_string
},
478 { "NAS-Identifier", NULL
, 0, 0, print_attr_string
},
479 { "Proxy-State", NULL
, 0, 0, print_attr_string
},
480 { "Login-LAT-Service", NULL
, 0, 0, print_attr_string
},
481 { "Login-LAT-Node", NULL
, 0, 0, print_attr_string
},
482 { "Login-LAT-Group", NULL
, 0, 0, print_attr_string
},
483 { "Framed-AppleTalk-Link", NULL
, 0, 0, print_attr_num
},
484 { "Framed-AppleTalk-Network", NULL
, 0, 0, print_attr_num
},
485 { "Framed-AppleTalk-Zone", NULL
, 0, 0, print_attr_string
},
486 { "Acct-Status-Type", acct_status
, TAM_SIZE(acct_status
)-1, 1, print_attr_num
},
487 { "Acct-Delay-Time", NULL
, 0, 0, print_attr_num
},
488 { "Acct-Input-Octets", NULL
, 0, 0, print_attr_num
},
489 { "Acct-Output-Octets", NULL
, 0, 0, print_attr_num
},
490 { "Acct-Session-Id", NULL
, 0, 0, print_attr_string
},
491 { "Acct-Authentic", acct_auth
, TAM_SIZE(acct_auth
)-1, 1, print_attr_num
},
492 { "Acct-Session-Time", NULL
, 0, 0, print_attr_num
},
493 { "Acct-Input-Packets", NULL
, 0, 0, print_attr_num
},
494 { "Acct-Output-Packets", NULL
, 0, 0, print_attr_num
},
495 { "Acct-Terminate-Cause", acct_term
, TAM_SIZE(acct_term
)-1, 1, print_attr_num
},
496 { "Acct-Multi-Session-Id", NULL
, 0, 0, print_attr_string
},
497 { "Acct-Link-Count", NULL
, 0, 0, print_attr_num
},
498 { "Acct-Input-Gigawords", NULL
, 0, 0, print_attr_num
},
499 { "Acct-Output-Gigawords", NULL
, 0, 0, print_attr_num
},
500 { "Unassigned", NULL
, 0, 0, NULL
}, /*54*/
501 { "Event-Timestamp", NULL
, 0, 0, print_attr_time
},
502 { "Egress-VLANID", NULL
, 0, 0, print_attr_num
},
503 { "Ingress-Filters", ingress_filters
, TAM_SIZE(ingress_filters
)-1, 1, print_attr_num
},
504 { "Egress-VLAN-Name", NULL
, 0, 0, print_attr_string
},
505 { "User-Priority-Table", NULL
, 0, 0, NULL
},
506 { "CHAP-Challenge", NULL
, 0, 0, print_attr_string
},
507 { "NAS-Port-Type", nas_port_type
, TAM_SIZE(nas_port_type
), 0, print_attr_num
},
508 { "Port-Limit", NULL
, 0, 0, print_attr_num
},
509 { "Login-LAT-Port", NULL
, 0, 0, print_attr_string
}, /*63*/
510 { "Tunnel-Type", tunnel_type
, TAM_SIZE(tunnel_type
)-1, 1, print_attr_num
},
511 { "Tunnel-Medium-Type", tunnel_medium
, TAM_SIZE(tunnel_medium
)-1, 1, print_attr_num
},
512 { "Tunnel-Client-Endpoint", NULL
, 0, 0, print_attr_string
},
513 { "Tunnel-Server-Endpoint", NULL
, 0, 0, print_attr_string
},
514 { "Acct-Tunnel-Connection", NULL
, 0, 0, print_attr_string
},
515 { "Tunnel-Password", NULL
, 0, 0, print_attr_string
},
516 { "ARAP-Password", NULL
, 0, 0, print_attr_strange
},
517 { "ARAP-Features", NULL
, 0, 0, print_attr_strange
},
518 { "ARAP-Zone-Access", arap_zone
, TAM_SIZE(arap_zone
)-1, 1, print_attr_num
}, /*72*/
519 { "ARAP-Security", NULL
, 0, 0, print_attr_string
},
520 { "ARAP-Security-Data", NULL
, 0, 0, print_attr_string
},
521 { "Password-Retry", NULL
, 0, 0, print_attr_num
},
522 { "Prompt", prompt
, TAM_SIZE(prompt
), 0, print_attr_num
},
523 { "Connect-Info", NULL
, 0, 0, print_attr_string
},
524 { "Configuration-Token", NULL
, 0, 0, print_attr_string
},
525 { "EAP-Message", NULL
, 0, 0, print_attr_string
},
526 { "Message-Authenticator", NULL
, 0, 0, print_attr_string
}, /*80*/
527 { "Tunnel-Private-Group-ID", NULL
, 0, 0, print_attr_string
},
528 { "Tunnel-Assignment-ID", NULL
, 0, 0, print_attr_string
},
529 { "Tunnel-Preference", NULL
, 0, 0, print_attr_num
},
530 { "ARAP-Challenge-Response", NULL
, 0, 0, print_attr_strange
},
531 { "Acct-Interim-Interval", NULL
, 0, 0, print_attr_num
},
532 { "Acct-Tunnel-Packets-Lost", NULL
, 0, 0, print_attr_num
}, /*86*/
533 { "NAS-Port-Id", NULL
, 0, 0, print_attr_string
},
534 { "Framed-Pool", NULL
, 0, 0, print_attr_string
},
535 { "CUI", NULL
, 0, 0, print_attr_string
},
536 { "Tunnel-Client-Auth-ID", NULL
, 0, 0, print_attr_string
},
537 { "Tunnel-Server-Auth-ID", NULL
, 0, 0, print_attr_string
},
538 { "NAS-Filter-Rule", NULL
, 0, 0, print_attr_string
},
539 { "Unassigned", NULL
, 0, 0, NULL
}, /*93*/
540 { "Originating-Line-Info", NULL
, 0, 0, NULL
},
541 { "NAS-IPv6-Address", NULL
, 0, 0, print_attr_address6
},
542 { "Framed-Interface-ID", NULL
, 0, 0, NULL
},
543 { "Framed-IPv6-Prefix", NULL
, 0, 0, print_attr_netmask6
},
544 { "Login-IPv6-Host", NULL
, 0, 0, print_attr_address6
},
545 { "Framed-IPv6-Route", NULL
, 0, 0, print_attr_string
},
546 { "Framed-IPv6-Pool", NULL
, 0, 0, print_attr_string
},
547 { "Error-Cause", NULL
, 0, 0, print_attr_strange
},
548 { "EAP-Key-Name", NULL
, 0, 0, NULL
},
549 { "Digest-Response", NULL
, 0, 0, print_attr_string
},
550 { "Digest-Realm", NULL
, 0, 0, print_attr_string
},
551 { "Digest-Nonce", NULL
, 0, 0, print_attr_string
},
552 { "Digest-Response-Auth", NULL
, 0, 0, print_attr_string
},
553 { "Digest-Nextnonce", NULL
, 0, 0, print_attr_string
},
554 { "Digest-Method", NULL
, 0, 0, print_attr_string
},
555 { "Digest-URI", NULL
, 0, 0, print_attr_string
},
556 { "Digest-Qop", NULL
, 0, 0, print_attr_string
},
557 { "Digest-Algorithm", NULL
, 0, 0, print_attr_string
},
558 { "Digest-Entity-Body-Hash", NULL
, 0, 0, print_attr_string
},
559 { "Digest-CNonce", NULL
, 0, 0, print_attr_string
},
560 { "Digest-Nonce-Count", NULL
, 0, 0, print_attr_string
},
561 { "Digest-Username", NULL
, 0, 0, print_attr_string
},
562 { "Digest-Opaque", NULL
, 0, 0, print_attr_string
},
563 { "Digest-Auth-Param", NULL
, 0, 0, print_attr_string
},
564 { "Digest-AKA-Auts", NULL
, 0, 0, print_attr_string
},
565 { "Digest-Domain", NULL
, 0, 0, print_attr_string
},
566 { "Digest-Stale", NULL
, 0, 0, print_attr_string
},
567 { "Digest-HA1", NULL
, 0, 0, print_attr_string
},
568 { "SIP-AOR", NULL
, 0, 0, print_attr_string
}
572 /*****************************/
573 /* Print an attribute string */
574 /* value pointed by 'data' */
575 /* and 'length' size. */
576 /*****************************/
577 /* Returns nothing. */
578 /*****************************/
580 print_attr_string(netdissect_options
*ndo
,
581 register const u_char
*data
, u_int length
, u_short attr_code
)
585 ND_TCHECK2(data
[0],length
);
592 if (*data
&& (*data
<=0x1F) )
593 ND_PRINT((ndo
, "Tag[%u] ", *data
));
595 ND_PRINT((ndo
, "Tag[Unused] "));
598 ND_PRINT((ndo
, "Salt %u ", EXTRACT_16BITS(data
)));
602 case TUNNEL_CLIENT_END
:
603 case TUNNEL_SERVER_END
:
604 case TUNNEL_PRIV_GROUP
:
605 case TUNNEL_ASSIGN_ID
:
606 case TUNNEL_CLIENT_AUTH
:
607 case TUNNEL_SERVER_AUTH
:
613 ND_PRINT((ndo
, "Tag[%u] ", *data
));
615 ND_PRINT((ndo
, "Tag[Unused] "));
620 case EGRESS_VLAN_NAME
:
623 ND_PRINT((ndo
, "%s (0x%02x) ",
624 tok2str(rfc4675_tagged
,"Unknown tag",*data
),
631 for (i
=0; i
< length
&& *data
; i
++, data
++)
632 ND_PRINT((ndo
, "%c", (*data
< 32 || *data
> 126) ? '.' : *data
));
637 ND_PRINT((ndo
, "%s", tstr
));
641 * print vendor specific attributes
644 print_vendor_attr(netdissect_options
*ndo
,
645 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
654 ND_TCHECK2(*data
, 4);
655 vendor_id
= EXTRACT_32BITS(data
);
659 ND_PRINT((ndo
, "Vendor: %s (%u)",
660 tok2str(smi_values
,"Unknown",vendor_id
),
663 while (length
>= 2) {
664 ND_TCHECK2(*data
, 2);
666 vendor_type
= *(data
);
667 vendor_length
= *(data
+1);
669 if (vendor_length
< 2)
671 ND_PRINT((ndo
, "\n\t Vendor Attribute: %u, Length: %u (bogus, must be >= 2)",
676 if (vendor_length
> length
)
678 ND_PRINT((ndo
, "\n\t Vendor Attribute: %u, Length: %u (bogus, goes past end of vendor-specific attribute)",
686 ND_TCHECK2(*data
, vendor_length
);
688 ND_PRINT((ndo
, "\n\t Vendor Attribute: %u, Length: %u, Value: ",
691 for (idx
= 0; idx
< vendor_length
; idx
++, data
++)
692 ND_PRINT((ndo
, "%c", (*data
< 32 || *data
> 126) ? '.' : *data
));
693 length
-=vendor_length
;
698 ND_PRINT((ndo
, "%s", tstr
));
701 /******************************/
702 /* Print an attribute numeric */
703 /* value pointed by 'data' */
704 /* and 'length' size. */
705 /******************************/
706 /* Returns nothing. */
707 /******************************/
709 print_attr_num(netdissect_options
*ndo
,
710 register const u_char
*data
, u_int length
, u_short attr_code
)
716 ND_PRINT((ndo
, "ERROR: length %u != 4", length
));
720 ND_TCHECK2(data
[0],4);
721 /* This attribute has standard values */
722 if (attr_type
[attr_code
].siz_subtypes
)
724 static const char **table
;
726 table
= attr_type
[attr_code
].subtypes
;
728 if ( (attr_code
== TUNNEL_TYPE
) || (attr_code
== TUNNEL_MEDIUM
) )
731 ND_PRINT((ndo
, "Tag[Unused] "));
733 ND_PRINT((ndo
, "Tag[%d] ", *data
));
735 data_value
= EXTRACT_24BITS(data
);
739 data_value
= EXTRACT_32BITS(data
);
741 if ( data_value
<= (uint32_t)(attr_type
[attr_code
].siz_subtypes
- 1 +
742 attr_type
[attr_code
].first_subtype
) &&
743 data_value
>= attr_type
[attr_code
].first_subtype
)
744 ND_PRINT((ndo
, "%s", table
[data_value
]));
746 ND_PRINT((ndo
, "#%u", data_value
));
750 switch(attr_code
) /* Be aware of special cases... */
753 if (EXTRACT_32BITS( data
) == 0xFFFFFFFE )
754 ND_PRINT((ndo
, "NAS Select"));
756 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
759 case SESSION_TIMEOUT
:
762 case ACCT_SESSION_TIME
:
763 case ACCT_INT_INTERVAL
:
764 timeout
= EXTRACT_32BITS( data
);
766 ND_PRINT((ndo
, "%02d secs", timeout
));
769 if ( timeout
< 3600 )
770 ND_PRINT((ndo
, "%02d:%02d min",
771 timeout
/ 60, timeout
% 60));
773 ND_PRINT((ndo
, "%02d:%02d:%02d hours",
774 timeout
/ 3600, (timeout
% 3600) / 60,
780 if (EXTRACT_32BITS(data
) )
781 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
783 ND_PRINT((ndo
, "Unnumbered"));
786 case FRM_ATALK_NETWORK
:
787 if (EXTRACT_32BITS(data
) )
788 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
790 ND_PRINT((ndo
, "NAS assigned"));
793 case TUNNEL_PREFERENCE
:
795 ND_PRINT((ndo
, "Tag[%d] ", *data
));
797 ND_PRINT((ndo
, "Tag[Unused] "));
799 ND_PRINT((ndo
, "%d", EXTRACT_24BITS(data
)));
803 ND_PRINT((ndo
, "%s (0x%02x) ",
804 tok2str(rfc4675_tagged
,"Unknown tag",*data
),
807 ND_PRINT((ndo
, "%d", EXTRACT_24BITS(data
)));
811 ND_PRINT((ndo
, "%d", EXTRACT_32BITS(data
)));
821 ND_PRINT((ndo
, "%s", tstr
));
824 /*****************************/
825 /* Print an attribute IPv4 */
826 /* address value pointed by */
827 /* 'data' and 'length' size. */
828 /*****************************/
829 /* Returns nothing. */
830 /*****************************/
832 print_attr_address(netdissect_options
*ndo
,
833 register const u_char
*data
, u_int length
, u_short attr_code
)
837 ND_PRINT((ndo
, "ERROR: length %u != 4", length
));
841 ND_TCHECK2(data
[0],4);
847 if (EXTRACT_32BITS(data
) == 0xFFFFFFFF )
848 ND_PRINT((ndo
, "User Selected"));
850 if (EXTRACT_32BITS(data
) == 0xFFFFFFFE )
851 ND_PRINT((ndo
, "NAS Select"));
853 ND_PRINT((ndo
, "%s",ipaddr_string(ndo
, data
)));
857 ND_PRINT((ndo
, "%s", ipaddr_string(ndo
, data
)));
864 ND_PRINT((ndo
, "%s", tstr
));
867 /*****************************/
868 /* Print an attribute IPv6 */
869 /* address value pointed by */
870 /* 'data' and 'length' size. */
871 /*****************************/
872 /* Returns nothing. */
873 /*****************************/
875 print_attr_address6(netdissect_options
*ndo
,
876 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
880 ND_PRINT((ndo
, "ERROR: length %u != 16", length
));
884 ND_TCHECK2(data
[0], 16);
886 ND_PRINT((ndo
, "%s", ip6addr_string(ndo
, data
)));
891 ND_PRINT((ndo
, "%s", tstr
));
895 print_attr_netmask6(netdissect_options
*ndo
,
896 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
900 if (length
< 2 || length
> 18)
902 ND_PRINT((ndo
, "ERROR: length %u not in range (2..18)", length
));
905 else if (data
[1] > 128)
907 ND_PRINT((ndo
, "ERROR: netmask %u not in range (0..128)", data
[1]));
911 ND_TCHECK2(data
[0], length
);
912 memset(data2
, 0, sizeof(data2
));
914 memcpy(data2
, data
+2, length
-2);
916 ND_PRINT((ndo
, "%s/%u", ip6addr_string(ndo
, data2
), data
[1]));
921 ND_PRINT((ndo
, "%s", tstr
));
924 /*************************************/
925 /* Print an attribute of 'secs since */
926 /* January 1, 1970 00:00 UTC' value */
927 /* pointed by 'data' and 'length' */
929 /*************************************/
930 /* Returns nothing. */
931 /*************************************/
933 print_attr_time(netdissect_options
*ndo
,
934 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
941 ND_PRINT((ndo
, "ERROR: length %u != 4", length
));
945 ND_TCHECK2(data
[0],4);
947 attr_time
= EXTRACT_32BITS(data
);
948 strlcpy(string
, ctime(&attr_time
), sizeof(string
));
949 /* Get rid of the newline */
951 ND_PRINT((ndo
, "%.24s", string
));
955 ND_PRINT((ndo
, "%s", tstr
));
958 /***********************************/
959 /* Print an attribute of 'strange' */
960 /* data format pointed by 'data' */
961 /* and 'length' size. */
962 /***********************************/
963 /* Returns nothing. */
964 /***********************************/
966 print_attr_strange(netdissect_options
*ndo
,
967 register const u_char
*data
, u_int length
, u_short attr_code
)
970 u_int error_cause_value
;
977 ND_PRINT((ndo
, "ERROR: length %u != 16", length
));
980 ND_PRINT((ndo
, "User_challenge ("));
981 ND_TCHECK2(data
[0],8);
983 PRINT_HEX(len_data
, data
);
984 ND_PRINT((ndo
, ") User_resp("));
985 ND_TCHECK2(data
[0],8);
987 PRINT_HEX(len_data
, data
);
988 ND_PRINT((ndo
, ")"));
994 ND_PRINT((ndo
, "ERROR: length %u != 14", length
));
997 ND_TCHECK2(data
[0],1);
999 ND_PRINT((ndo
, "User can change password"));
1001 ND_PRINT((ndo
, "User cannot change password"));
1003 ND_TCHECK2(data
[0],1);
1004 ND_PRINT((ndo
, ", Min password length: %d", *data
));
1006 ND_PRINT((ndo
, ", created at: "));
1007 ND_TCHECK2(data
[0],4);
1009 PRINT_HEX(len_data
, data
);
1010 ND_PRINT((ndo
, ", expires in: "));
1011 ND_TCHECK2(data
[0],4);
1013 PRINT_HEX(len_data
, data
);
1014 ND_PRINT((ndo
, ", Current Time: "));
1015 ND_TCHECK2(data
[0],4);
1017 PRINT_HEX(len_data
, data
);
1020 case ARAP_CHALLENGE_RESP
:
1023 ND_PRINT((ndo
, "ERROR: length %u != 8", length
));
1026 ND_TCHECK2(data
[0],8);
1028 PRINT_HEX(len_data
, data
);
1034 ND_PRINT((ndo
, "Error: length %u != 4", length
));
1037 ND_TCHECK2(data
[0],4);
1039 error_cause_value
= EXTRACT_32BITS(data
);
1040 ND_PRINT((ndo
, "Error cause %u: %s", error_cause_value
, tok2str(errorcausetype
, "Error-Cause %u not known", error_cause_value
)));
1046 ND_PRINT((ndo
, "%s", tstr
));
1050 radius_attrs_print(netdissect_options
*ndo
,
1051 register const u_char
*attr
, u_int length
)
1053 register const struct radius_attr
*rad_attr
= (const struct radius_attr
*)attr
;
1054 const char *attr_string
;
1060 ND_TCHECK(*rad_attr
);
1062 if (rad_attr
->type
> 0 && rad_attr
->type
< TAM_SIZE(attr_type
))
1063 attr_string
= attr_type
[rad_attr
->type
].name
;
1065 attr_string
= "Unknown";
1066 if (rad_attr
->len
< 2)
1068 ND_PRINT((ndo
, "\n\t %s Attribute (%u), length: %u (bogus, must be >= 2)",
1074 if (rad_attr
->len
> length
)
1076 ND_PRINT((ndo
, "\n\t %s Attribute (%u), length: %u (bogus, goes past end of packet)",
1082 ND_PRINT((ndo
, "\n\t %s Attribute (%u), length: %u, Value: ",
1087 if (rad_attr
->type
< TAM_SIZE(attr_type
))
1089 if (rad_attr
->len
> 2)
1091 if ( attr_type
[rad_attr
->type
].print_func
)
1092 (*attr_type
[rad_attr
->type
].print_func
)(
1093 ndo
, ((const u_char
*)(rad_attr
+1)),
1094 rad_attr
->len
- 2, rad_attr
->type
);
1097 /* do we also want to see a hex dump ? */
1098 if (ndo
->ndo_vflag
> 1)
1099 print_unknown_data(ndo
, (const u_char
*)rad_attr
+2, "\n\t ", (rad_attr
->len
)-2);
1101 length
-=(rad_attr
->len
);
1102 rad_attr
= (const struct radius_attr
*)( ((const char *)(rad_attr
))+rad_attr
->len
);
1107 ND_PRINT((ndo
, "%s", tstr
));
1111 radius_print(netdissect_options
*ndo
,
1112 const u_char
*dat
, u_int length
)
1114 register const struct radius_hdr
*rad
;
1115 u_int len
, auth_idx
;
1117 ND_TCHECK2(*dat
, MIN_RADIUS_LEN
);
1118 rad
= (const struct radius_hdr
*)dat
;
1119 len
= EXTRACT_16BITS(&rad
->len
);
1121 if (len
< MIN_RADIUS_LEN
)
1123 ND_PRINT((ndo
, "%s", tstr
));
1130 if (ndo
->ndo_vflag
< 1) {
1131 ND_PRINT((ndo
, "RADIUS, %s (%u), id: 0x%02x length: %u",
1132 tok2str(radius_command_values
,"Unknown Command",rad
->code
),
1139 ND_PRINT((ndo
, "RADIUS, length: %u\n\t%s (%u), id: 0x%02x, Authenticator: ",
1141 tok2str(radius_command_values
,"Unknown Command",rad
->code
),
1145 for(auth_idx
=0; auth_idx
< 16; auth_idx
++)
1146 ND_PRINT((ndo
, "%02x", rad
->auth
[auth_idx
]));
1149 if (len
> MIN_RADIUS_LEN
)
1150 radius_attrs_print(ndo
, dat
+ MIN_RADIUS_LEN
, len
- MIN_RADIUS_LEN
);
1154 ND_PRINT((ndo
, "%s", tstr
));