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 Delegated-IPv6-Prefix Attribute"
60 * "RADIUS Filter Rule Attribute"
63 * "RADIUS Extension for Digest Authentication"
66 * "Dynamic Authorization Extensions to RADIUS"
69 * "Diameter Mobile IPv6"
72 * "Carrying Location Objects in RADIUS and Diameter"
75 * "RADIUS Support for Proxy Mobile IPv6"
78 * "Diameter Network Access Server Application"
80 * Alfredo Andres Omella (aandres@s21sec.com) v0.1 2000/09/15
82 * TODO: Among other things to print ok MacIntosh and Vendor values
89 #include "netdissect-stdinc.h"
93 #include "netdissect-ctype.h"
95 #include "netdissect.h"
96 #include "addrtoname.h"
102 #define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
104 #define PRINT_HEX(bytes_len, ptr_data) \
107 ND_PRINT("%02X", *ptr_data ); \
113 /* Radius packet codes */
114 #define RADCMD_ACCESS_REQ 1 /* Access-Request */
115 #define RADCMD_ACCESS_ACC 2 /* Access-Accept */
116 #define RADCMD_ACCESS_REJ 3 /* Access-Reject */
117 #define RADCMD_ACCOUN_REQ 4 /* Accounting-Request */
118 #define RADCMD_ACCOUN_RES 5 /* Accounting-Response */
119 #define RADCMD_ACCESS_CHA 11 /* Access-Challenge */
120 #define RADCMD_STATUS_SER 12 /* Status-Server */
121 #define RADCMD_STATUS_CLI 13 /* Status-Client */
122 #define RADCMD_DISCON_REQ 40 /* Disconnect-Request */
123 #define RADCMD_DISCON_ACK 41 /* Disconnect-ACK */
124 #define RADCMD_DISCON_NAK 42 /* Disconnect-NAK */
125 #define RADCMD_COA_REQ 43 /* CoA-Request */
126 #define RADCMD_COA_ACK 44 /* CoA-ACK */
127 #define RADCMD_COA_NAK 45 /* CoA-NAK */
128 #define RADCMD_RESERVED 255 /* Reserved */
130 static const struct tok radius_command_values
[] = {
131 { RADCMD_ACCESS_REQ
, "Access-Request" },
132 { RADCMD_ACCESS_ACC
, "Access-Accept" },
133 { RADCMD_ACCESS_REJ
, "Access-Reject" },
134 { RADCMD_ACCOUN_REQ
, "Accounting-Request" },
135 { RADCMD_ACCOUN_RES
, "Accounting-Response" },
136 { RADCMD_ACCESS_CHA
, "Access-Challenge" },
137 { RADCMD_STATUS_SER
, "Status-Server" },
138 { RADCMD_STATUS_CLI
, "Status-Client" },
139 { RADCMD_DISCON_REQ
, "Disconnect-Request" },
140 { RADCMD_DISCON_ACK
, "Disconnect-ACK" },
141 { RADCMD_DISCON_NAK
, "Disconnect-NAK" },
142 { RADCMD_COA_REQ
, "CoA-Request" },
143 { RADCMD_COA_ACK
, "CoA-ACK" },
144 { RADCMD_COA_NAK
, "CoA-NAK" },
145 { RADCMD_RESERVED
, "Reserved" },
149 /********************************/
150 /* Begin Radius Attribute types */
151 /********************************/
154 #define LOG_IPHOST 14
155 #define LOG_SERVICE 15
157 #define SESSION_TIMEOUT 27
158 #define IDLE_TIMEOUT 28
159 #define FRM_ATALK_LINK 37
160 #define FRM_ATALK_NETWORK 38
162 #define ACCT_DELAY 41
163 #define ACCT_SESSION_TIME 46
165 #define EGRESS_VLAN_ID 56
166 #define EGRESS_VLAN_NAME 58
168 #define TUNNEL_TYPE 64
169 #define TUNNEL_MEDIUM 65
170 #define TUNNEL_CLIENT_END 66
171 #define TUNNEL_SERVER_END 67
172 #define TUNNEL_PASS 69
175 #define ARAP_FEATURES 71
177 #define EAP_MESSAGE 79
179 #define TUNNEL_PRIV_GROUP 81
180 #define TUNNEL_ASSIGN_ID 82
181 #define TUNNEL_PREFERENCE 83
183 #define ARAP_CHALLENGE_RESP 84
184 #define ACCT_INT_INTERVAL 85
186 #define TUNNEL_CLIENT_AUTH 90
187 #define TUNNEL_SERVER_AUTH 91
189 #define ERROR_CAUSE 101
190 /********************************/
191 /* End Radius Attribute types */
192 /********************************/
194 #define RFC4675_TAGGED 0x31
195 #define RFC4675_UNTAGGED 0x32
197 static const struct tok rfc4675_tagged
[] = {
198 { RFC4675_TAGGED
, "Tagged" },
199 { RFC4675_UNTAGGED
, "Untagged" },
204 static void print_attr_string(netdissect_options
*, const u_char
*, u_int
, u_short
);
205 static void print_attr_num(netdissect_options
*, const u_char
*, u_int
, u_short
);
206 static void print_vendor_attr(netdissect_options
*, const u_char
*, u_int
, u_short
);
207 static void print_attr_address(netdissect_options
*, const u_char
*, u_int
, u_short
);
208 static void print_attr_address6(netdissect_options
*, const u_char
*, u_int
, u_short
);
209 static void print_attr_netmask6(netdissect_options
*, const u_char
*, u_int
, u_short
);
210 static void print_attr_mip6_home_link_prefix(netdissect_options
*, const u_char
*, u_int
, u_short
);
211 static void print_attr_operator_name(netdissect_options
*, const u_char
*, u_int
, u_short
);
212 static void print_attr_location_information(netdissect_options
*, const u_char
*, u_int
, u_short
);
213 static void print_attr_location_data(netdissect_options
*, const u_char
*, u_int
, u_short
);
214 static void print_basic_location_policy_rules(netdissect_options
*, const u_char
*, u_int
, u_short
);
215 static void print_attr_time(netdissect_options
*, const u_char
*, u_int
, u_short
);
216 static void print_attr_vector64(netdissect_options
*, register const u_char
*, u_int
, u_short
);
217 static void print_attr_strange(netdissect_options
*, const u_char
*, u_int
, u_short
);
220 struct radius_hdr
{ nd_uint8_t code
; /* Radius packet code */
221 nd_uint8_t id
; /* Radius packet id */
222 nd_uint16_t len
; /* Radius total length */
223 nd_byte auth
[16]; /* Authenticator */
226 #define MIN_RADIUS_LEN 20
228 struct radius_attr
{ nd_uint8_t type
; /* Attribute type */
229 nd_uint8_t len
; /* Attribute length */
233 /* Service-Type Attribute standard values */
234 static const char *serv_type
[]={ NULL
,
243 "Callback NAS Prompt",
245 "Callback Administrative",
248 /* Framed-Protocol Attribute standard values */
249 static const char *frm_proto
[]={ NULL
,
253 "Gandalf proprietary",
258 /* Framed-Routing Attribute standard values */
259 static const char *frm_routing
[]={ "None",
265 /* Framed-Compression Attribute standard values */
266 static const char *frm_comp
[]={ "None",
272 /* Login-Service Attribute standard values */
273 static const char *login_serv
[]={ "Telnet",
276 "PortMaster(proprietary)",
285 /* Termination-Action Attribute standard values */
286 static const char *term_action
[]={ "Default",
290 /* Ingress-Filters Attribute standard values */
291 static const char *ingress_filters
[]={ NULL
,
296 /* NAS-Port-Type Attribute standard values */
297 static const char *nas_port_type
[]={ "Async",
304 "HDLC Clear Channel",
316 "Wireless - IEEE 802.11",
319 /* Acct-Status-Type Accounting Attribute standard values */
320 static const char *acct_status
[]={ NULL
,
334 "Tunnel-Link-Reject",
338 /* Acct-Authentic Accounting Attribute standard values */
339 static const char *acct_auth
[]={ NULL
,
345 /* Acct-Terminate-Cause Accounting Attribute standard values */
346 static const char *acct_term
[]={ NULL
,
361 "Service Unavailable",
367 /* Tunnel-Type Attribute standard values */
368 static const char *tunnel_type
[]={ NULL
,
380 "IP-in-IP Tunneling",
384 /* Tunnel-Medium-Type Attribute standard values */
385 static const char *tunnel_medium
[]={ NULL
,
400 "E.164 with NSAP subaddress",
403 /* ARAP-Zone-Access Attribute standard values */
404 static const char *arap_zone
[]={ NULL
,
405 "Only access to dfl zone",
406 "Use zone filter inc.",
408 "Use zone filter exc.",
411 static const char *prompt
[]={ "No Echo",
415 /* Error-Cause standard values */
416 #define ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED 201
417 #define ERROR_CAUSE_INVALID_EAP_PACKET 202
418 #define ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE 401
419 #define ERROR_CAUSE_MISSING_ATTRIBUTE 402
420 #define ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH 403
421 #define ERROR_CAUSE_INVALID_REQUEST 404
422 #define ERROR_CAUSE_UNSUPPORTED_SERVICE 405
423 #define ERROR_CAUSE_UNSUPPORTED_EXTENSION 406
424 #define ERROR_CAUSE_INVALID_ATTRIBUTE_VALUE 407
425 #define ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED 501
426 #define ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE 502
427 #define ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND 503
428 #define ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE 504
429 #define ERROR_CAUSE_PROXY_PROCESSING_ERROR 505
430 #define ERROR_CAUSE_RESOURCES_UNAVAILABLE 506
431 #define ERROR_CAUSE_REQUEST_INITIATED 507
432 #define ERROR_CAUSE_MULTIPLE_SESSION_SELECTION_UNSUPPORTED 508
433 #define ERROR_CAUSE_LOCATION_INFO_REQUIRED 509
434 static const struct tok errorcausetype
[] = {
435 { ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED
, "Residual Session Context Removed" },
436 { ERROR_CAUSE_INVALID_EAP_PACKET
, "Invalid EAP Packet (Ignored)" },
437 { ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE
, "Unsupported Attribute" },
438 { ERROR_CAUSE_MISSING_ATTRIBUTE
, "Missing Attribute" },
439 { ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH
, "NAS Identification Mismatch" },
440 { ERROR_CAUSE_INVALID_REQUEST
, "Invalid Request" },
441 { ERROR_CAUSE_UNSUPPORTED_SERVICE
, "Unsupported Service" },
442 { ERROR_CAUSE_UNSUPPORTED_EXTENSION
, "Unsupported Extension" },
443 { ERROR_CAUSE_INVALID_ATTRIBUTE_VALUE
, "Invalid Attribute Value" },
444 { ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED
, "Administratively Prohibited" },
445 { ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE
, "Request Not Routable (Proxy)" },
446 { ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND
, "Session Context Not Found" },
447 { ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE
, "Session Context Not Removable" },
448 { ERROR_CAUSE_PROXY_PROCESSING_ERROR
, "Other Proxy Processing Error" },
449 { ERROR_CAUSE_RESOURCES_UNAVAILABLE
, "Resources Unavailable" },
450 { ERROR_CAUSE_REQUEST_INITIATED
, "Request Initiated" },
451 { ERROR_CAUSE_MULTIPLE_SESSION_SELECTION_UNSUPPORTED
, "Multiple Session Selection Unsupported" },
452 { ERROR_CAUSE_LOCATION_INFO_REQUIRED
, "Location Info Required" },
456 /* MIP6-Feature-Vector standard values */
457 /* https://www.iana.org/assignments/aaa-parameters/aaa-parameters.xhtml */
458 #define MIP6_INTEGRATED 0x0000000000000001
459 #define LOCAL_HOME_AGENT_ASSIGNMENT 0x0000000000000002
460 #define PMIP6_SUPPORTED 0x0000010000000000
461 #define IP4_HOA_SUPPORTED 0x0000020000000000
462 #define LOCAL_MAG_ROUTING_SUPPORTED 0x0000040000000000
463 #define ASSIGN_LOCAL_IP 0x0000080000000000
464 #define MIP4_SUPPORTED 0x0000100000000000
465 #define OPTIMIZED_IDLE_MODE_MOBILITY 0x0000200000000000
466 #define GTPv2_SUPPORTED 0x0000400000000000
467 #define IP4_TRANSPORT_SUPPORTED 0x0000800000000000
468 #define IP4_HOA_ONLY_SUPPORTED 0x0001000000000000
469 #define INTER_MAG_ROUTING_SUPPORTED 0x0002000000000000
470 static const struct mip6_feature_vector
{
473 } mip6_feature_vector
[] = {
474 { MIP6_INTEGRATED
, "MIP6_INTEGRATED" },
475 { LOCAL_HOME_AGENT_ASSIGNMENT
, "LOCAL_HOME_AGENT_ASSIGNMENT" },
476 { PMIP6_SUPPORTED
, "PMIP6_SUPPORTED" },
477 { IP4_HOA_SUPPORTED
, "IP4_HOA_SUPPORTED" },
478 { LOCAL_MAG_ROUTING_SUPPORTED
, "LOCAL_MAG_ROUTING_SUPPORTED" },
479 { ASSIGN_LOCAL_IP
, "ASSIGN_LOCAL_IP" },
480 { MIP4_SUPPORTED
, "MIP4_SUPPORTED" },
481 { OPTIMIZED_IDLE_MODE_MOBILITY
, "OPTIMIZED_IDLE_MODE_MOBILITY" },
482 { GTPv2_SUPPORTED
, "GTPv2_SUPPORTED" },
483 { IP4_TRANSPORT_SUPPORTED
, "IP4_TRANSPORT_SUPPORTED" },
484 { IP4_HOA_ONLY_SUPPORTED
, "IP4_HOA_ONLY_SUPPORTED" },
485 { INTER_MAG_ROUTING_SUPPORTED
, "INTER_MAG_ROUTING_SUPPORTED" },
488 #define OPERATOR_NAME_TADIG 0x30
489 #define OPERATOR_NAME_REALM 0x31
490 #define OPERATOR_NAME_E212 0x32
491 #define OPERATOR_NAME_ICC 0x33
492 static const struct tok operator_name_vector
[] = {
493 { OPERATOR_NAME_TADIG
, "TADIG" },
494 { OPERATOR_NAME_REALM
, "REALM" },
495 { OPERATOR_NAME_E212
, "E212" },
496 { OPERATOR_NAME_ICC
, "ICC" },
500 #define LOCATION_INFORMATION_CODE_CIVIC 0
501 #define LOCATION_INFORMATION_CODE_GEOSPATIAL 1
502 static const struct tok location_information_code_vector
[] = {
503 { LOCATION_INFORMATION_CODE_CIVIC
, "Civic" },
504 { LOCATION_INFORMATION_CODE_GEOSPATIAL
, "Geospatial" },
508 #define LOCATION_INFORMATION_ENTITY_USER 0
509 #define LOCATION_INFORMATION_ENTITY_RADIUS 1
510 static const struct tok location_information_entity_vector
[] = {
511 { LOCATION_INFORMATION_ENTITY_USER
, "User" },
512 { LOCATION_INFORMATION_ENTITY_RADIUS
, "RADIUS" },
516 static const struct tok blpr_bm
[] = {
517 { 0x0001, "MBZ-15" },
518 { 0x0002, "MBZ-14" },
519 { 0x0004, "MBZ-13" },
520 { 0x0008, "MBZ-12" },
521 { 0x0010, "MBZ-11" },
522 { 0x0020, "MBZ-10" },
532 { 0x8000, "Retransmission Allowed" },
536 static const struct attrtype
{
537 const char *name
; /* Attribute name */
538 const char **subtypes
; /* Standard Values (if any) */
539 u_char siz_subtypes
; /* Size of total standard values */
540 u_char first_subtype
; /* First standard value is 0 or 1 */
541 void (*print_func
)(netdissect_options
*, const u_char
*, u_int
, u_short
);
544 { NULL
, NULL
, 0, 0, NULL
},
545 { "User-Name", NULL
, 0, 0, print_attr_string
},
546 { "User-Password", NULL
, 0, 0, NULL
},
547 { "CHAP-Password", NULL
, 0, 0, NULL
},
548 { "NAS-IP-Address", NULL
, 0, 0, print_attr_address
},
549 { "NAS-Port", NULL
, 0, 0, print_attr_num
},
550 { "Service-Type", serv_type
, TAM_SIZE(serv_type
)-1, 1, print_attr_num
},
551 { "Framed-Protocol", frm_proto
, TAM_SIZE(frm_proto
)-1, 1, print_attr_num
},
552 { "Framed-IP-Address", NULL
, 0, 0, print_attr_address
},
553 { "Framed-IP-Netmask", NULL
, 0, 0, print_attr_address
},
554 { "Framed-Routing", frm_routing
, TAM_SIZE(frm_routing
), 0, print_attr_num
},
555 { "Filter-Id", NULL
, 0, 0, print_attr_string
},
556 { "Framed-MTU", NULL
, 0, 0, print_attr_num
},
557 { "Framed-Compression", frm_comp
, TAM_SIZE(frm_comp
), 0, print_attr_num
},
558 { "Login-IP-Host", NULL
, 0, 0, print_attr_address
},
559 { "Login-Service", login_serv
, TAM_SIZE(login_serv
), 0, print_attr_num
},
560 { "Login-TCP-Port", NULL
, 0, 0, print_attr_num
},
561 { "Unassigned", NULL
, 0, 0, NULL
}, /*17*/
562 { "Reply-Message", NULL
, 0, 0, print_attr_string
},
563 { "Callback-Number", NULL
, 0, 0, print_attr_string
},
564 { "Callback-Id", NULL
, 0, 0, print_attr_string
},
565 { "Unassigned", NULL
, 0, 0, NULL
}, /*21*/
566 { "Framed-Route", NULL
, 0, 0, print_attr_string
},
567 { "Framed-IPX-Network", NULL
, 0, 0, print_attr_num
},
568 { "State", NULL
, 0, 0, print_attr_string
},
569 { "Class", NULL
, 0, 0, print_attr_string
},
570 { "Vendor-Specific", NULL
, 0, 0, print_vendor_attr
},
571 { "Session-Timeout", NULL
, 0, 0, print_attr_num
},
572 { "Idle-Timeout", NULL
, 0, 0, print_attr_num
},
573 { "Termination-Action", term_action
, TAM_SIZE(term_action
), 0, print_attr_num
},
574 { "Called-Station-Id", NULL
, 0, 0, print_attr_string
},
575 { "Calling-Station-Id", NULL
, 0, 0, print_attr_string
},
576 { "NAS-Identifier", NULL
, 0, 0, print_attr_string
},
577 { "Proxy-State", NULL
, 0, 0, print_attr_string
},
578 { "Login-LAT-Service", NULL
, 0, 0, print_attr_string
},
579 { "Login-LAT-Node", NULL
, 0, 0, print_attr_string
},
580 { "Login-LAT-Group", NULL
, 0, 0, print_attr_string
},
581 { "Framed-AppleTalk-Link", NULL
, 0, 0, print_attr_num
},
582 { "Framed-AppleTalk-Network", NULL
, 0, 0, print_attr_num
},
583 { "Framed-AppleTalk-Zone", NULL
, 0, 0, print_attr_string
},
584 { "Acct-Status-Type", acct_status
, TAM_SIZE(acct_status
)-1, 1, print_attr_num
},
585 { "Acct-Delay-Time", NULL
, 0, 0, print_attr_num
},
586 { "Acct-Input-Octets", NULL
, 0, 0, print_attr_num
},
587 { "Acct-Output-Octets", NULL
, 0, 0, print_attr_num
},
588 { "Acct-Session-Id", NULL
, 0, 0, print_attr_string
},
589 { "Acct-Authentic", acct_auth
, TAM_SIZE(acct_auth
)-1, 1, print_attr_num
},
590 { "Acct-Session-Time", NULL
, 0, 0, print_attr_num
},
591 { "Acct-Input-Packets", NULL
, 0, 0, print_attr_num
},
592 { "Acct-Output-Packets", NULL
, 0, 0, print_attr_num
},
593 { "Acct-Terminate-Cause", acct_term
, TAM_SIZE(acct_term
)-1, 1, print_attr_num
},
594 { "Acct-Multi-Session-Id", NULL
, 0, 0, print_attr_string
},
595 { "Acct-Link-Count", NULL
, 0, 0, print_attr_num
},
596 { "Acct-Input-Gigawords", NULL
, 0, 0, print_attr_num
},
597 { "Acct-Output-Gigawords", NULL
, 0, 0, print_attr_num
},
598 { "Unassigned", NULL
, 0, 0, NULL
}, /*54*/
599 { "Event-Timestamp", NULL
, 0, 0, print_attr_time
},
600 { "Egress-VLANID", NULL
, 0, 0, print_attr_num
},
601 { "Ingress-Filters", ingress_filters
, TAM_SIZE(ingress_filters
)-1, 1, print_attr_num
},
602 { "Egress-VLAN-Name", NULL
, 0, 0, print_attr_string
},
603 { "User-Priority-Table", NULL
, 0, 0, NULL
},
604 { "CHAP-Challenge", NULL
, 0, 0, print_attr_string
},
605 { "NAS-Port-Type", nas_port_type
, TAM_SIZE(nas_port_type
), 0, print_attr_num
},
606 { "Port-Limit", NULL
, 0, 0, print_attr_num
},
607 { "Login-LAT-Port", NULL
, 0, 0, print_attr_string
}, /*63*/
608 { "Tunnel-Type", tunnel_type
, TAM_SIZE(tunnel_type
)-1, 1, print_attr_num
},
609 { "Tunnel-Medium-Type", tunnel_medium
, TAM_SIZE(tunnel_medium
)-1, 1, print_attr_num
},
610 { "Tunnel-Client-Endpoint", NULL
, 0, 0, print_attr_string
},
611 { "Tunnel-Server-Endpoint", NULL
, 0, 0, print_attr_string
},
612 { "Acct-Tunnel-Connection", NULL
, 0, 0, print_attr_string
},
613 { "Tunnel-Password", NULL
, 0, 0, print_attr_string
},
614 { "ARAP-Password", NULL
, 0, 0, print_attr_strange
},
615 { "ARAP-Features", NULL
, 0, 0, print_attr_strange
},
616 { "ARAP-Zone-Access", arap_zone
, TAM_SIZE(arap_zone
)-1, 1, print_attr_num
}, /*72*/
617 { "ARAP-Security", NULL
, 0, 0, print_attr_string
},
618 { "ARAP-Security-Data", NULL
, 0, 0, print_attr_string
},
619 { "Password-Retry", NULL
, 0, 0, print_attr_num
},
620 { "Prompt", prompt
, TAM_SIZE(prompt
), 0, print_attr_num
},
621 { "Connect-Info", NULL
, 0, 0, print_attr_string
},
622 { "Configuration-Token", NULL
, 0, 0, print_attr_string
},
623 { "EAP-Message", NULL
, 0, 0, print_attr_string
},
624 { "Message-Authenticator", NULL
, 0, 0, print_attr_string
}, /*80*/
625 { "Tunnel-Private-Group-ID", NULL
, 0, 0, print_attr_string
},
626 { "Tunnel-Assignment-ID", NULL
, 0, 0, print_attr_string
},
627 { "Tunnel-Preference", NULL
, 0, 0, print_attr_num
},
628 { "ARAP-Challenge-Response", NULL
, 0, 0, print_attr_strange
},
629 { "Acct-Interim-Interval", NULL
, 0, 0, print_attr_num
},
630 { "Acct-Tunnel-Packets-Lost", NULL
, 0, 0, print_attr_num
}, /*86*/
631 { "NAS-Port-Id", NULL
, 0, 0, print_attr_string
},
632 { "Framed-Pool", NULL
, 0, 0, print_attr_string
},
633 { "CUI", NULL
, 0, 0, print_attr_string
},
634 { "Tunnel-Client-Auth-ID", NULL
, 0, 0, print_attr_string
},
635 { "Tunnel-Server-Auth-ID", NULL
, 0, 0, print_attr_string
},
636 { "NAS-Filter-Rule", NULL
, 0, 0, print_attr_string
},
637 { "Unassigned", NULL
, 0, 0, NULL
}, /*93*/
638 { "Originating-Line-Info", NULL
, 0, 0, NULL
},
639 { "NAS-IPv6-Address", NULL
, 0, 0, print_attr_address6
},
640 { "Framed-Interface-ID", NULL
, 0, 0, NULL
},
641 { "Framed-IPv6-Prefix", NULL
, 0, 0, print_attr_netmask6
},
642 { "Login-IPv6-Host", NULL
, 0, 0, print_attr_address6
},
643 { "Framed-IPv6-Route", NULL
, 0, 0, print_attr_string
},
644 { "Framed-IPv6-Pool", NULL
, 0, 0, print_attr_string
},
645 { "Error-Cause", NULL
, 0, 0, print_attr_strange
},
646 { "EAP-Key-Name", NULL
, 0, 0, NULL
},
647 { "Digest-Response", NULL
, 0, 0, print_attr_string
},
648 { "Digest-Realm", NULL
, 0, 0, print_attr_string
},
649 { "Digest-Nonce", NULL
, 0, 0, print_attr_string
},
650 { "Digest-Response-Auth", NULL
, 0, 0, print_attr_string
},
651 { "Digest-Nextnonce", NULL
, 0, 0, print_attr_string
},
652 { "Digest-Method", NULL
, 0, 0, print_attr_string
},
653 { "Digest-URI", NULL
, 0, 0, print_attr_string
},
654 { "Digest-Qop", NULL
, 0, 0, print_attr_string
},
655 { "Digest-Algorithm", NULL
, 0, 0, print_attr_string
},
656 { "Digest-Entity-Body-Hash", NULL
, 0, 0, print_attr_string
},
657 { "Digest-CNonce", NULL
, 0, 0, print_attr_string
},
658 { "Digest-Nonce-Count", NULL
, 0, 0, print_attr_string
},
659 { "Digest-Username", NULL
, 0, 0, print_attr_string
},
660 { "Digest-Opaque", NULL
, 0, 0, print_attr_string
},
661 { "Digest-Auth-Param", NULL
, 0, 0, print_attr_string
},
662 { "Digest-AKA-Auts", NULL
, 0, 0, print_attr_string
},
663 { "Digest-Domain", NULL
, 0, 0, print_attr_string
},
664 { "Digest-Stale", NULL
, 0, 0, print_attr_string
},
665 { "Digest-HA1", NULL
, 0, 0, print_attr_string
},
666 { "SIP-AOR", NULL
, 0, 0, print_attr_string
},
667 { "Delegated-IPv6-Prefix", NULL
, 0, 0, print_attr_netmask6
},
668 { "MIP6-Feature-Vector", NULL
, 0, 0, print_attr_vector64
},
669 { "MIP6-Home-Link-Prefix", NULL
, 0, 0, print_attr_mip6_home_link_prefix
},
670 { "Operator-Name", NULL
, 0, 0, print_attr_operator_name
},
671 { "Location-Information", NULL
, 0, 0, print_attr_location_information
},
672 { "Location-Data", NULL
, 0, 0, print_attr_location_data
},
673 { "Basic-Location-Policy-Rules", NULL
, 0, 0, print_basic_location_policy_rules
}
677 /*****************************/
678 /* Print an attribute string */
679 /* value pointed by 'data' */
680 /* and 'length' size. */
681 /*****************************/
682 /* Returns nothing. */
683 /*****************************/
685 print_attr_string(netdissect_options
*ndo
,
686 const u_char
*data
, u_int length
, u_short attr_code
)
690 ND_TCHECK_LEN(data
, length
);
697 if (GET_U_1(data
) && (GET_U_1(data
) <= 0x1F))
698 ND_PRINT("Tag[%u] ", GET_U_1(data
));
700 ND_PRINT("Tag[Unused] ");
703 ND_PRINT("Salt %u ", GET_BE_U_2(data
));
707 case TUNNEL_CLIENT_END
:
708 case TUNNEL_SERVER_END
:
709 case TUNNEL_PRIV_GROUP
:
710 case TUNNEL_ASSIGN_ID
:
711 case TUNNEL_CLIENT_AUTH
:
712 case TUNNEL_SERVER_AUTH
:
713 if (GET_U_1(data
) <= 0x1F)
718 ND_PRINT("Tag[%u] ", GET_U_1(data
));
720 ND_PRINT("Tag[Unused] ");
725 case EGRESS_VLAN_NAME
:
728 ND_PRINT("%s (0x%02x) ",
729 tok2str(rfc4675_tagged
,"Unknown tag",GET_U_1(data
)),
737 eap_print(ndo
, data
, length
);
741 for (i
=0; i
< length
&& GET_U_1(data
); i
++, data
++)
742 ND_PRINT("%c", ND_ASCII_ISPRINT(GET_U_1(data
)) ? GET_U_1(data
) : '.');
751 * print vendor specific attributes
754 print_vendor_attr(netdissect_options
*ndo
,
755 const u_char
*data
, u_int length
, u_short attr_code _U_
)
765 vendor_id
= GET_BE_U_4(data
);
769 ND_PRINT("Vendor: %s (%u)",
770 tok2str(smi_values
,"Unknown",vendor_id
),
773 while (length
>= 2) {
776 vendor_type
= GET_U_1(data
);
777 vendor_length
= GET_U_1(data
+ 1);
779 if (vendor_length
< 2)
781 ND_PRINT("\n\t Vendor Attribute: %u, Length: %u (bogus, must be >= 2)",
786 if (vendor_length
> length
)
788 ND_PRINT("\n\t Vendor Attribute: %u, Length: %u (bogus, goes past end of vendor-specific attribute)",
796 ND_TCHECK_LEN(data
, vendor_length
);
798 ND_PRINT("\n\t Vendor Attribute: %u, Length: %u, Value: ",
801 for (idx
= 0; idx
< vendor_length
; idx
++, data
++)
802 ND_PRINT("%c", ND_ASCII_ISPRINT(GET_U_1(data
)) ? GET_U_1(data
) : '.');
803 length
-=vendor_length
;
811 /******************************/
812 /* Print an attribute numeric */
813 /* value pointed by 'data' */
814 /* and 'length' size. */
815 /******************************/
816 /* Returns nothing. */
817 /******************************/
819 print_attr_num(netdissect_options
*ndo
,
820 const u_char
*data
, u_int length
, u_short attr_code
)
826 ND_PRINT("ERROR: length %u != 4", length
);
831 /* This attribute has standard values */
832 if (attr_type
[attr_code
].siz_subtypes
)
834 static const char **table
;
836 table
= attr_type
[attr_code
].subtypes
;
838 if ( (attr_code
== TUNNEL_TYPE
) || (attr_code
== TUNNEL_MEDIUM
) )
841 ND_PRINT("Tag[Unused] ");
843 ND_PRINT("Tag[%u] ", GET_U_1(data
));
845 data_value
= GET_BE_U_3(data
);
849 data_value
= GET_BE_U_4(data
);
851 if ( data_value
<= (uint32_t)(attr_type
[attr_code
].siz_subtypes
- 1 +
852 attr_type
[attr_code
].first_subtype
) &&
853 data_value
>= attr_type
[attr_code
].first_subtype
)
854 ND_PRINT("%s", table
[data_value
]);
856 ND_PRINT("#%u", data_value
);
860 switch(attr_code
) /* Be aware of special cases... */
863 if (GET_BE_U_4(data
) == 0xFFFFFFFE )
864 ND_PRINT("NAS Select");
866 ND_PRINT("%u", GET_BE_U_4(data
));
869 case SESSION_TIMEOUT
:
872 case ACCT_SESSION_TIME
:
873 case ACCT_INT_INTERVAL
:
874 timeout
= GET_BE_U_4(data
);
876 ND_PRINT("%02d secs", timeout
);
879 if ( timeout
< 3600 )
880 ND_PRINT("%02d:%02d min",
881 timeout
/ 60, timeout
% 60);
883 ND_PRINT("%02d:%02d:%02d hours",
884 timeout
/ 3600, (timeout
% 3600) / 60,
890 if (GET_BE_U_4(data
))
891 ND_PRINT("%u", GET_BE_U_4(data
));
893 ND_PRINT("Unnumbered");
896 case FRM_ATALK_NETWORK
:
897 if (GET_BE_U_4(data
))
898 ND_PRINT("%u", GET_BE_U_4(data
));
900 ND_PRINT("NAS assigned");
903 case TUNNEL_PREFERENCE
:
905 ND_PRINT("Tag[%u] ", GET_U_1(data
));
907 ND_PRINT("Tag[Unused] ");
909 ND_PRINT("%u", GET_BE_U_3(data
));
913 ND_PRINT("%s (0x%02x) ",
914 tok2str(rfc4675_tagged
,"Unknown tag",GET_U_1(data
)),
917 ND_PRINT("%u", GET_BE_U_3(data
));
921 ND_PRINT("%u", GET_BE_U_4(data
));
934 /*****************************/
935 /* Print an attribute IPv4 */
936 /* address value pointed by */
937 /* 'data' and 'length' size. */
938 /*****************************/
939 /* Returns nothing. */
940 /*****************************/
942 print_attr_address(netdissect_options
*ndo
,
943 const u_char
*data
, u_int length
, u_short attr_code
)
947 ND_PRINT("ERROR: length %u != 4", length
);
957 if (GET_BE_U_4(data
) == 0xFFFFFFFF )
958 ND_PRINT("User Selected");
960 if (GET_BE_U_4(data
) == 0xFFFFFFFE )
961 ND_PRINT("NAS Select");
963 ND_PRINT("%s",GET_IPADDR_STRING(data
));
967 ND_PRINT("%s", GET_IPADDR_STRING(data
));
977 /*****************************/
978 /* Print an attribute IPv6 */
979 /* address value pointed by */
980 /* 'data' and 'length' size. */
981 /*****************************/
982 /* Returns nothing. */
983 /*****************************/
985 print_attr_address6(netdissect_options
*ndo
,
986 const u_char
*data
, u_int length
, u_short attr_code _U_
)
990 ND_PRINT("ERROR: length %u != 16", length
);
996 ND_PRINT("%s", GET_IP6ADDR_STRING(data
));
1001 nd_print_trunc(ndo
);
1005 print_attr_netmask6(netdissect_options
*ndo
,
1006 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1010 if (length
< 2 || length
> 18)
1012 ND_PRINT("ERROR: length %u not in range (2..18)", length
);
1015 ND_TCHECK_LEN(data
, length
);
1016 if (GET_U_1(data
+ 1) > 128)
1018 ND_PRINT("ERROR: netmask %u not in range (0..128)", GET_U_1(data
+ 1));
1022 memset(data2
, 0, sizeof(data2
));
1024 memcpy(data2
, data
+2, length
-2);
1026 ND_PRINT("%s/%u", ip6addr_string(ndo
, data2
), GET_U_1(data
+ 1));
1028 if (GET_U_1(data
+ 1) > 8 * (length
- 2))
1029 ND_PRINT(" (inconsistent prefix length)");
1034 nd_print_trunc(ndo
);
1038 print_attr_mip6_home_link_prefix(netdissect_options
*ndo
,
1039 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1043 ND_PRINT("ERROR: length %u != 17", length
);
1046 ND_TCHECK_LEN(data
, length
);
1047 if (GET_U_1(data
) > 128)
1049 ND_PRINT("ERROR: netmask %u not in range (0..128)", GET_U_1(data
));
1053 ND_PRINT("%s/%u", GET_IP6ADDR_STRING(data
+ 1), GET_U_1(data
));
1058 nd_print_trunc(ndo
);
1062 print_attr_operator_name(netdissect_options
*ndo
,
1063 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1065 u_int namespace_value
;
1067 ND_TCHECK_LEN(data
, length
);
1070 ND_PRINT("ERROR: length %u < 2", length
);
1073 namespace_value
= GET_U_1(data
);
1075 ND_PRINT("[%s] ", tok2str(operator_name_vector
, "unknown namespace %u", namespace_value
));
1077 nd_printn(ndo
, data
, length
- 1, NULL
);
1082 nd_print_trunc(ndo
);
1086 print_attr_location_information(netdissect_options
*ndo
,
1087 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1090 uint8_t code
, entity
;
1092 ND_TCHECK_LEN(data
, length
);
1095 ND_PRINT("ERROR: length %u < 21", length
);
1099 index
= GET_BE_U_2(data
);
1102 code
= GET_U_1(data
);
1105 entity
= GET_U_1(data
);
1108 ND_PRINT("index %u, code %s, entity %s, ",
1110 tok2str(location_information_code_vector
, "Unknown (%u)", code
),
1111 tok2str(location_information_entity_vector
, "Unknown (%u)", entity
)
1114 ND_PRINT("sighting time ");
1115 p_ntp_time(ndo
, (const struct l_fixedpt
*)data
);
1119 ND_PRINT("time to live ");
1120 p_ntp_time(ndo
, (const struct l_fixedpt
*)data
);
1124 ND_PRINT("method \"");
1125 nd_printn(ndo
, data
, length
- 20, NULL
);
1131 nd_print_trunc(ndo
);
1135 print_attr_location_data(netdissect_options
*ndo
,
1136 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1140 ND_TCHECK_LEN(data
, length
);
1143 ND_PRINT("ERROR: length %u < 3", length
);
1147 index
= GET_BE_U_2(data
);
1149 ND_PRINT("index %u, location", index
);
1151 /* The Location field of the String field of the Location-Data attribute
1152 * can have two completely different structures depending on the value of
1153 * the Code field of a Location-Info attribute, which supposedly precedes
1154 * the current attribute. Unfortunately, this choice of encoding makes it
1155 * non-trivial to decode the Location field without preserving some state
1156 * between the attributes.
1158 hex_and_ascii_print(ndo
, "\n\t ", data
, length
- 2);
1163 nd_print_trunc(ndo
);
1167 print_basic_location_policy_rules(netdissect_options
*ndo
,
1168 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1172 ND_TCHECK_LEN(data
, length
);
1175 ND_PRINT("ERROR: length %u < 10", length
);
1179 flags
= GET_BE_U_2(data
);
1181 ND_PRINT("flags [%s], ", bittok2str(blpr_bm
, "none", flags
));
1183 ND_PRINT("retention expires ");
1184 p_ntp_time(ndo
, (const struct l_fixedpt
*)data
);
1188 ND_PRINT(", note well \"");
1189 nd_printn(ndo
, data
, length
- 10, NULL
);
1196 nd_print_trunc(ndo
);
1200 /*************************************/
1201 /* Print an attribute of 'secs since */
1202 /* January 1, 1970 00:00 UTC' value */
1203 /* pointed by 'data' and 'length' */
1205 /*************************************/
1206 /* Returns nothing. */
1207 /*************************************/
1209 print_attr_time(netdissect_options
*ndo
,
1210 const u_char
*data
, u_int length
, u_short attr_code _U_
)
1217 ND_PRINT("ERROR: length %u != 4", length
);
1223 attr_time
= GET_BE_U_4(data
);
1224 strlcpy(string
, ctime(&attr_time
), sizeof(string
));
1225 /* Get rid of the newline */
1227 ND_PRINT("%.24s", string
);
1231 nd_print_trunc(ndo
);
1235 print_attr_vector64(netdissect_options
*ndo
,
1236 register const u_char
*data
, u_int length
, u_short attr_code _U_
)
1238 uint64_t data_value
, i
;
1239 const char *sep
= "";
1243 ND_PRINT("ERROR: length %u != 8", length
);
1249 data_value
= GET_BE_U_8(data
);
1250 /* Print the 64-bit field in a format similar to bittok2str(), less
1251 * flagging any unknown bits. This way it should be easier to replace
1252 * the custom code with a library function later.
1254 for (i
= 0; i
< TAM_SIZE(mip6_feature_vector
); i
++) {
1255 if (data_value
& mip6_feature_vector
[i
].v
) {
1256 ND_PRINT("%s%s", sep
, mip6_feature_vector
[i
].s
);
1266 /***********************************/
1267 /* Print an attribute of 'strange' */
1268 /* data format pointed by 'data' */
1269 /* and 'length' size. */
1270 /***********************************/
1271 /* Returns nothing. */
1272 /***********************************/
1274 print_attr_strange(netdissect_options
*ndo
,
1275 const u_char
*data
, u_int length
, u_short attr_code
)
1278 u_int error_cause_value
;
1285 ND_PRINT("ERROR: length %u != 16", length
);
1288 ND_PRINT("User_challenge (");
1291 PRINT_HEX(len_data
, data
);
1292 ND_PRINT(") User_resp(");
1295 PRINT_HEX(len_data
, data
);
1302 ND_PRINT("ERROR: length %u != 14", length
);
1307 ND_PRINT("User can change password");
1309 ND_PRINT("User cannot change password");
1312 ND_PRINT(", Min password length: %u", GET_U_1(data
));
1314 ND_PRINT(", created at: ");
1317 PRINT_HEX(len_data
, data
);
1318 ND_PRINT(", expires in: ");
1321 PRINT_HEX(len_data
, data
);
1322 ND_PRINT(", Current Time: ");
1325 PRINT_HEX(len_data
, data
);
1328 case ARAP_CHALLENGE_RESP
:
1331 ND_PRINT("ERROR: length %u != 8", length
);
1336 PRINT_HEX(len_data
, data
);
1342 ND_PRINT("Error: length %u != 4", length
);
1347 error_cause_value
= GET_BE_U_4(data
);
1348 ND_PRINT("Error cause %u: %s", error_cause_value
, tok2str(errorcausetype
, "Error-Cause %u not known", error_cause_value
));
1354 nd_print_trunc(ndo
);
1358 radius_attrs_print(netdissect_options
*ndo
,
1359 const u_char
*attr
, u_int length
)
1361 const struct radius_attr
*rad_attr
= (const struct radius_attr
*)attr
;
1362 const char *attr_string
;
1369 ND_TCHECK_SIZE(rad_attr
);
1371 type
= GET_U_1(rad_attr
->type
);
1372 len
= GET_U_1(rad_attr
->len
);
1373 if (type
!= 0 && type
< TAM_SIZE(attr_type
))
1374 attr_string
= attr_type
[type
].name
;
1376 attr_string
= "Unknown";
1378 ND_PRINT("\n\t %s Attribute (%u), length: %u",
1384 ND_PRINT(" (bogus, must be >= 2)");
1389 ND_PRINT(" (bogus, goes past end of packet)");
1392 ND_PRINT(", Value: ");
1394 if (type
< TAM_SIZE(attr_type
))
1398 if ( attr_type
[type
].print_func
)
1399 (*attr_type
[type
].print_func
)(
1400 ndo
, ((const u_char
*)(rad_attr
+1)),
1404 /* do we also want to see a hex dump ? */
1405 if (ndo
->ndo_vflag
> 1)
1406 print_unknown_data(ndo
, (const u_char
*)rad_attr
+2, "\n\t ", (len
)-2);
1409 rad_attr
= (const struct radius_attr
*)( ((const char *)(rad_attr
))+len
);
1414 nd_print_trunc(ndo
);
1418 radius_print(netdissect_options
*ndo
,
1419 const u_char
*dat
, u_int length
)
1421 const struct radius_hdr
*rad
;
1422 u_int len
, auth_idx
;
1424 ndo
->ndo_protocol
= "radius";
1425 ND_TCHECK_LEN(dat
, MIN_RADIUS_LEN
);
1426 rad
= (const struct radius_hdr
*)dat
;
1427 len
= GET_BE_U_2(rad
->len
);
1429 if (len
< MIN_RADIUS_LEN
)
1431 nd_print_trunc(ndo
);
1438 if (ndo
->ndo_vflag
< 1) {
1439 ND_PRINT("RADIUS, %s (%u), id: 0x%02x length: %u",
1440 tok2str(radius_command_values
,"Unknown Command",GET_U_1(rad
->code
)),
1447 ND_PRINT("RADIUS, length: %u\n\t%s (%u), id: 0x%02x, Authenticator: ",
1449 tok2str(radius_command_values
,"Unknown Command",GET_U_1(rad
->code
)),
1453 for(auth_idx
=0; auth_idx
< 16; auth_idx
++)
1454 ND_PRINT("%02x", rad
->auth
[auth_idx
]);
1457 if (len
> MIN_RADIUS_LEN
)
1458 radius_attrs_print(ndo
, dat
+ MIN_RADIUS_LEN
, len
- MIN_RADIUS_LEN
);
1462 nd_print_trunc(ndo
);