2001-10-22 14:58:33 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000 Alfredo Andres Omella. All rights reserved.
|
2002-06-12 01:08:37 +08:00
|
|
|
*
|
2001-10-22 14:58:33 +08:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
2002-06-12 01:08:37 +08:00
|
|
|
*
|
2001-10-22 14:58:33 +08:00
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. The names of the authors may not be used to endorse or promote
|
|
|
|
* products derived from this software without specific prior
|
|
|
|
* written permission.
|
2002-06-12 01:08:37 +08:00
|
|
|
*
|
2001-10-22 14:58:33 +08:00
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*/
|
2016-08-14 21:42:19 +08:00
|
|
|
|
|
|
|
/* \summary: Radius protocol printer */
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
/*
|
|
|
|
* Radius printer routines as specified on:
|
|
|
|
*
|
|
|
|
* RFC 2865:
|
|
|
|
* "Remote Authentication Dial In User Service (RADIUS)"
|
|
|
|
*
|
|
|
|
* RFC 2866:
|
|
|
|
* "RADIUS Accounting"
|
|
|
|
*
|
|
|
|
* RFC 2867:
|
|
|
|
* "RADIUS Accounting Modifications for Tunnel Protocol Support"
|
|
|
|
*
|
|
|
|
* RFC 2868:
|
|
|
|
* "RADIUS Attributes for Tunnel Protocol Support"
|
|
|
|
*
|
|
|
|
* RFC 2869:
|
|
|
|
* "RADIUS Extensions"
|
|
|
|
*
|
2015-06-25 21:14:46 +08:00
|
|
|
* RFC 3162:
|
|
|
|
* "RADIUS and IPv6"
|
|
|
|
*
|
2015-07-22 16:47:57 +08:00
|
|
|
* RFC 3580:
|
|
|
|
* "IEEE 802.1X Remote Authentication Dial In User Service (RADIUS)"
|
|
|
|
* "Usage Guidelines"
|
|
|
|
*
|
2015-07-03 14:28:22 +08:00
|
|
|
* RFC 4072:
|
|
|
|
* "Diameter Extensible Authentication Protocol (EAP) Application"
|
|
|
|
*
|
2014-10-06 19:54:23 +08:00
|
|
|
* RFC 4675:
|
|
|
|
* "RADIUS Attributes for Virtual LAN and Priority Support"
|
|
|
|
*
|
2015-07-03 18:33:47 +08:00
|
|
|
* RFC 4818:
|
|
|
|
* "RADIUS Delegated-IPv6-Prefix Attribute"
|
|
|
|
*
|
2015-06-16 21:30:42 +08:00
|
|
|
* RFC 4849:
|
|
|
|
* "RADIUS Filter Rule Attribute"
|
|
|
|
*
|
2015-07-03 17:46:18 +08:00
|
|
|
* RFC 5090:
|
|
|
|
* "RADIUS Extension for Digest Authentication"
|
|
|
|
*
|
2014-10-06 20:06:18 +08:00
|
|
|
* RFC 5176:
|
|
|
|
* "Dynamic Authorization Extensions to RADIUS"
|
|
|
|
*
|
2015-07-03 00:36:14 +08:00
|
|
|
* RFC 5580:
|
|
|
|
* "Carrying Location Objects in RADIUS and Diameter"
|
|
|
|
*
|
2015-06-16 21:30:42 +08:00
|
|
|
* RFC 7155:
|
|
|
|
* "Diameter Network Access Server Application"
|
|
|
|
*
|
2000-12-18 16:16:58 +08:00
|
|
|
* Alfredo Andres Omella (aandres@s21sec.com) v0.1 2000/09/15
|
2000-10-06 14:49:20 +08:00
|
|
|
*
|
2002-06-12 01:08:37 +08:00
|
|
|
* TODO: Among other things to print ok MacIntosh and Vendor values
|
2000-10-06 14:49:20 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2015-09-10 04:42:38 +08:00
|
|
|
#include <netdissect-stdinc.h>
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2002-08-01 16:52:55 +08:00
|
|
|
#include <string.h>
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2015-09-06 05:35:58 +08:00
|
|
|
#include "netdissect.h"
|
2000-10-06 14:49:20 +08:00
|
|
|
#include "addrtoname.h"
|
|
|
|
#include "extract.h"
|
2003-11-26 16:49:14 +08:00
|
|
|
#include "oui.h"
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2013-12-26 22:08:06 +08:00
|
|
|
static const char tstr[] = " [|radius]";
|
|
|
|
|
2000-10-08 16:48:48 +08:00
|
|
|
#define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
#define PRINT_HEX(bytes_len, ptr_data) \
|
|
|
|
while(bytes_len) \
|
|
|
|
{ \
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%02X", *ptr_data ); \
|
2000-10-06 14:49:20 +08:00
|
|
|
ptr_data++; \
|
|
|
|
bytes_len--; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Radius packet codes */
|
|
|
|
#define RADCMD_ACCESS_REQ 1 /* Access-Request */
|
|
|
|
#define RADCMD_ACCESS_ACC 2 /* Access-Accept */
|
|
|
|
#define RADCMD_ACCESS_REJ 3 /* Access-Reject */
|
|
|
|
#define RADCMD_ACCOUN_REQ 4 /* Accounting-Request */
|
|
|
|
#define RADCMD_ACCOUN_RES 5 /* Accounting-Response */
|
|
|
|
#define RADCMD_ACCESS_CHA 11 /* Access-Challenge */
|
|
|
|
#define RADCMD_STATUS_SER 12 /* Status-Server */
|
|
|
|
#define RADCMD_STATUS_CLI 13 /* Status-Client */
|
2014-10-06 20:06:18 +08:00
|
|
|
#define RADCMD_DISCON_REQ 40 /* Disconnect-Request */
|
|
|
|
#define RADCMD_DISCON_ACK 41 /* Disconnect-ACK */
|
|
|
|
#define RADCMD_DISCON_NAK 42 /* Disconnect-NAK */
|
|
|
|
#define RADCMD_COA_REQ 43 /* CoA-Request */
|
|
|
|
#define RADCMD_COA_ACK 44 /* CoA-ACK */
|
|
|
|
#define RADCMD_COA_NAK 45 /* CoA-NAK */
|
2000-10-06 14:49:20 +08:00
|
|
|
#define RADCMD_RESERVED 255 /* Reserved */
|
|
|
|
|
2013-09-25 00:46:24 +08:00
|
|
|
static const struct tok radius_command_values[] = {
|
2014-11-06 21:40:56 +08:00
|
|
|
{ RADCMD_ACCESS_REQ, "Access-Request" },
|
|
|
|
{ RADCMD_ACCESS_ACC, "Access-Accept" },
|
|
|
|
{ RADCMD_ACCESS_REJ, "Access-Reject" },
|
|
|
|
{ RADCMD_ACCOUN_REQ, "Accounting-Request" },
|
|
|
|
{ RADCMD_ACCOUN_RES, "Accounting-Response" },
|
|
|
|
{ RADCMD_ACCESS_CHA, "Access-Challenge" },
|
|
|
|
{ RADCMD_STATUS_SER, "Status-Server" },
|
|
|
|
{ RADCMD_STATUS_CLI, "Status-Client" },
|
|
|
|
{ RADCMD_DISCON_REQ, "Disconnect-Request" },
|
|
|
|
{ RADCMD_DISCON_ACK, "Disconnect-ACK" },
|
|
|
|
{ RADCMD_DISCON_NAK, "Disconnect-NAK" },
|
|
|
|
{ RADCMD_COA_REQ, "CoA-Request" },
|
|
|
|
{ RADCMD_COA_ACK, "CoA-ACK" },
|
|
|
|
{ RADCMD_COA_NAK, "CoA-NAK" },
|
2003-11-26 16:49:14 +08:00
|
|
|
{ RADCMD_RESERVED, "Reserved" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* Begin Radius Attribute types */
|
|
|
|
/********************************/
|
|
|
|
#define SERV_TYPE 6
|
|
|
|
#define FRM_IPADDR 8
|
|
|
|
#define LOG_IPHOST 14
|
|
|
|
#define LOG_SERVICE 15
|
|
|
|
#define FRM_IPX 23
|
|
|
|
#define SESSION_TIMEOUT 27
|
|
|
|
#define IDLE_TIMEOUT 28
|
|
|
|
#define FRM_ATALK_LINK 37
|
|
|
|
#define FRM_ATALK_NETWORK 38
|
|
|
|
|
|
|
|
#define ACCT_DELAY 41
|
|
|
|
#define ACCT_SESSION_TIME 46
|
|
|
|
|
2014-10-06 19:54:23 +08:00
|
|
|
#define EGRESS_VLAN_ID 56
|
|
|
|
#define EGRESS_VLAN_NAME 58
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
#define TUNNEL_TYPE 64
|
|
|
|
#define TUNNEL_MEDIUM 65
|
|
|
|
#define TUNNEL_CLIENT_END 66
|
|
|
|
#define TUNNEL_SERVER_END 67
|
|
|
|
#define TUNNEL_PASS 69
|
|
|
|
|
|
|
|
#define ARAP_PASS 70
|
|
|
|
#define ARAP_FEATURES 71
|
|
|
|
|
|
|
|
#define TUNNEL_PRIV_GROUP 81
|
|
|
|
#define TUNNEL_ASSIGN_ID 82
|
|
|
|
#define TUNNEL_PREFERENCE 83
|
|
|
|
|
|
|
|
#define ARAP_CHALLENGE_RESP 84
|
|
|
|
#define ACCT_INT_INTERVAL 85
|
|
|
|
|
|
|
|
#define TUNNEL_CLIENT_AUTH 90
|
|
|
|
#define TUNNEL_SERVER_AUTH 91
|
2015-07-03 00:36:14 +08:00
|
|
|
|
|
|
|
#define ERROR_CAUSE 101
|
2000-10-06 14:49:20 +08:00
|
|
|
/********************************/
|
|
|
|
/* End Radius Attribute types */
|
|
|
|
/********************************/
|
|
|
|
|
2014-10-06 19:54:23 +08:00
|
|
|
#define RFC4675_TAGGED 0x31
|
|
|
|
#define RFC4675_UNTAGGED 0x32
|
|
|
|
|
|
|
|
static const struct tok rfc4675_tagged[] = {
|
|
|
|
{ RFC4675_TAGGED, "Tagged" },
|
|
|
|
{ RFC4675_UNTAGGED, "Untagged" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2017-12-14 02:17:47 +08:00
|
|
|
static void print_attr_string(netdissect_options *, const u_char *, u_int, u_short );
|
|
|
|
static void print_attr_num(netdissect_options *, const u_char *, u_int, u_short );
|
|
|
|
static void print_vendor_attr(netdissect_options *, const u_char *, u_int, u_short );
|
|
|
|
static void print_attr_address(netdissect_options *, const u_char *, u_int, u_short);
|
|
|
|
static void print_attr_address6(netdissect_options *, const u_char *, u_int, u_short);
|
|
|
|
static void print_attr_netmask6(netdissect_options *, const u_char *, u_int, u_short);
|
|
|
|
static void print_attr_time(netdissect_options *, const u_char *, u_int, u_short);
|
|
|
|
static void print_attr_strange(netdissect_options *, const u_char *, u_int, u_short);
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
|
2017-12-31 10:20:26 +08:00
|
|
|
struct radius_hdr { nd_uint8_t code; /* Radius packet code */
|
|
|
|
nd_uint8_t id; /* Radius packet id */
|
|
|
|
nd_uint16_t len; /* Radius total length */
|
|
|
|
nd_byte auth[16]; /* Authenticator */
|
2002-12-11 15:13:49 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2001-06-18 17:16:28 +08:00
|
|
|
#define MIN_RADIUS_LEN 20
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2017-12-31 10:20:26 +08:00
|
|
|
struct radius_attr { nd_uint8_t type; /* Attribute type */
|
|
|
|
nd_uint8_t len; /* Attribute length */
|
2002-12-11 15:13:49 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
|
2002-06-12 01:08:37 +08:00
|
|
|
/* Service-Type Attribute standard values */
|
2000-10-06 14:49:20 +08:00
|
|
|
static const char *serv_type[]={ NULL,
|
|
|
|
"Login",
|
2002-06-12 01:08:37 +08:00
|
|
|
"Framed",
|
2000-10-06 14:49:20 +08:00
|
|
|
"Callback Login",
|
|
|
|
"Callback Framed",
|
|
|
|
"Outbound",
|
|
|
|
"Administrative",
|
2002-06-12 01:08:37 +08:00
|
|
|
"NAS Prompt",
|
2000-10-06 14:49:20 +08:00
|
|
|
"Authenticate Only",
|
|
|
|
"Callback NAS Prompt",
|
|
|
|
"Call Check",
|
|
|
|
"Callback Administrative",
|
2002-06-12 01:08:37 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
/* Framed-Protocol Attribute standard values */
|
|
|
|
static const char *frm_proto[]={ NULL,
|
|
|
|
"PPP",
|
|
|
|
"SLIP",
|
|
|
|
"ARAP",
|
|
|
|
"Gandalf proprietary",
|
|
|
|
"Xylogics IPX/SLIP",
|
|
|
|
"X.75 Synchronous",
|
2002-06-12 01:08:37 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
/* Framed-Routing Attribute standard values */
|
|
|
|
static const char *frm_routing[]={ "None",
|
|
|
|
"Send",
|
|
|
|
"Listen",
|
|
|
|
"Send&Listen",
|
2002-06-12 01:08:37 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
/* Framed-Compression Attribute standard values */
|
|
|
|
static const char *frm_comp[]={ "None",
|
|
|
|
"VJ TCP/IP",
|
|
|
|
"IPX",
|
|
|
|
"Stac-LZS",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Login-Service Attribute standard values */
|
|
|
|
static const char *login_serv[]={ "Telnet",
|
|
|
|
"Rlogin",
|
|
|
|
"TCP Clear",
|
|
|
|
"PortMaster(proprietary)",
|
|
|
|
"LAT",
|
|
|
|
"X.25-PAD",
|
|
|
|
"X.25-T3POS",
|
|
|
|
"Unassigned",
|
|
|
|
"TCP Clear Quiet",
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Termination-Action Attribute standard values */
|
|
|
|
static const char *term_action[]={ "Default",
|
|
|
|
"RADIUS-Request",
|
|
|
|
};
|
|
|
|
|
2014-10-06 19:54:23 +08:00
|
|
|
/* Ingress-Filters Attribute standard values */
|
|
|
|
static const char *ingress_filters[]={ NULL,
|
|
|
|
"Enabled",
|
|
|
|
"Disabled",
|
|
|
|
};
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
/* NAS-Port-Type Attribute standard values */
|
|
|
|
static const char *nas_port_type[]={ "Async",
|
|
|
|
"Sync",
|
|
|
|
"ISDN Sync",
|
|
|
|
"ISDN Async V.120",
|
|
|
|
"ISDN Async V.110",
|
|
|
|
"Virtual",
|
|
|
|
"PIAFS",
|
|
|
|
"HDLC Clear Channel",
|
|
|
|
"X.25",
|
|
|
|
"X.75",
|
|
|
|
"G.3 Fax",
|
|
|
|
"SDSL",
|
|
|
|
"ADSL-CAP",
|
|
|
|
"ADSL-DMT",
|
|
|
|
"ISDN-DSL",
|
|
|
|
"Ethernet",
|
|
|
|
"xDSL",
|
|
|
|
"Cable",
|
|
|
|
"Wireless - Other",
|
|
|
|
"Wireless - IEEE 802.11",
|
2002-06-12 01:08:37 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
/* Acct-Status-Type Accounting Attribute standard values */
|
|
|
|
static const char *acct_status[]={ NULL,
|
|
|
|
"Start",
|
|
|
|
"Stop",
|
|
|
|
"Interim-Update",
|
|
|
|
"Unassigned",
|
|
|
|
"Unassigned",
|
|
|
|
"Unassigned",
|
|
|
|
"Accounting-On",
|
|
|
|
"Accounting-Off",
|
|
|
|
"Tunnel-Start",
|
|
|
|
"Tunnel-Stop",
|
|
|
|
"Tunnel-Reject",
|
|
|
|
"Tunnel-Link-Start",
|
|
|
|
"Tunnel-Link-Stop",
|
|
|
|
"Tunnel-Link-Reject",
|
|
|
|
"Failed",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Acct-Authentic Accounting Attribute standard values */
|
|
|
|
static const char *acct_auth[]={ NULL,
|
|
|
|
"RADIUS",
|
|
|
|
"Local",
|
|
|
|
"Remote",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Acct-Terminate-Cause Accounting Attribute standard values */
|
|
|
|
static const char *acct_term[]={ NULL,
|
|
|
|
"User Request",
|
|
|
|
"Lost Carrier",
|
|
|
|
"Lost Service",
|
|
|
|
"Idle Timeout",
|
|
|
|
"Session Timeout",
|
|
|
|
"Admin Reset",
|
|
|
|
"Admin Reboot",
|
|
|
|
"Port Error",
|
|
|
|
"NAS Error",
|
|
|
|
"NAS Request",
|
|
|
|
"NAS Reboot",
|
|
|
|
"Port Unneeded",
|
|
|
|
"Port Preempted",
|
|
|
|
"Port Suspended",
|
|
|
|
"Service Unavailable",
|
|
|
|
"Callback",
|
|
|
|
"User Error",
|
|
|
|
"Host Request",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Tunnel-Type Attribute standard values */
|
|
|
|
static const char *tunnel_type[]={ NULL,
|
|
|
|
"PPTP",
|
|
|
|
"L2F",
|
|
|
|
"L2TP",
|
|
|
|
"ATMP",
|
|
|
|
"VTP",
|
|
|
|
"AH",
|
|
|
|
"IP-IP",
|
|
|
|
"MIN-IP-IP",
|
|
|
|
"ESP",
|
|
|
|
"GRE",
|
|
|
|
"DVS",
|
|
|
|
"IP-in-IP Tunneling",
|
2015-07-22 16:47:57 +08:00
|
|
|
"VLAN",
|
2000-10-06 14:49:20 +08:00
|
|
|
};
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
/* Tunnel-Medium-Type Attribute standard values */
|
|
|
|
static const char *tunnel_medium[]={ NULL,
|
|
|
|
"IPv4",
|
|
|
|
"IPv6",
|
|
|
|
"NSAP",
|
|
|
|
"HDLC",
|
|
|
|
"BBN 1822",
|
|
|
|
"802",
|
|
|
|
"E.163",
|
|
|
|
"E.164",
|
|
|
|
"F.69",
|
|
|
|
"X.121",
|
|
|
|
"IPX",
|
|
|
|
"Appletalk",
|
|
|
|
"Decnet IV",
|
|
|
|
"Banyan Vines",
|
|
|
|
"E.164 with NSAP subaddress",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ARAP-Zone-Access Attribute standard values */
|
|
|
|
static const char *arap_zone[]={ NULL,
|
|
|
|
"Only access to dfl zone",
|
|
|
|
"Use zone filter inc.",
|
|
|
|
"Not used",
|
|
|
|
"Use zone filter exc.",
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *prompt[]={ "No Echo",
|
|
|
|
"Echo",
|
|
|
|
};
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2015-07-03 00:36:14 +08:00
|
|
|
/* Error-Cause standard values */
|
|
|
|
#define ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED 201
|
|
|
|
#define ERROR_CAUSE_INVALID_EAP_PACKET 202
|
|
|
|
#define ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE 401
|
|
|
|
#define ERROR_CAUSE_MISSING_ATTRIBUTE 402
|
|
|
|
#define ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH 403
|
|
|
|
#define ERROR_CAUSE_INVALID_REQUEST 404
|
|
|
|
#define ERROR_CAUSE_UNSUPPORTED_SERVICE 405
|
|
|
|
#define ERROR_CAUSE_UNSUPPORTED_EXTENSION 406
|
|
|
|
#define ERROR_CAUSE_INVALID_ATTRIBUTE_VALUE 407
|
|
|
|
#define ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED 501
|
|
|
|
#define ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE 502
|
|
|
|
#define ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND 503
|
|
|
|
#define ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE 504
|
|
|
|
#define ERROR_CAUSE_PROXY_PROCESSING_ERROR 505
|
|
|
|
#define ERROR_CAUSE_RESOURCES_UNAVAILABLE 506
|
|
|
|
#define ERROR_CAUSE_REQUEST_INITIATED 507
|
|
|
|
#define ERROR_CAUSE_MULTIPLE_SESSION_SELECTION_UNSUPPORTED 508
|
|
|
|
#define ERROR_CAUSE_LOCATION_INFO_REQUIRED 509
|
|
|
|
static const struct tok errorcausetype[] = {
|
|
|
|
{ ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED, "Residual Session Context Removed" },
|
|
|
|
{ ERROR_CAUSE_INVALID_EAP_PACKET, "Invalid EAP Packet (Ignored)" },
|
|
|
|
{ ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE, "Unsupported Attribute" },
|
|
|
|
{ ERROR_CAUSE_MISSING_ATTRIBUTE, "Missing Attribute" },
|
|
|
|
{ ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH, "NAS Identification Mismatch" },
|
|
|
|
{ ERROR_CAUSE_INVALID_REQUEST, "Invalid Request" },
|
|
|
|
{ ERROR_CAUSE_UNSUPPORTED_SERVICE, "Unsupported Service" },
|
|
|
|
{ ERROR_CAUSE_UNSUPPORTED_EXTENSION, "Unsupported Extension" },
|
|
|
|
{ ERROR_CAUSE_INVALID_ATTRIBUTE_VALUE, "Invalid Attribute Value" },
|
|
|
|
{ ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED, "Administratively Prohibited" },
|
|
|
|
{ ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE, "Request Not Routable (Proxy)" },
|
|
|
|
{ ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND, "Session Context Not Found" },
|
|
|
|
{ ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE, "Session Context Not Removable" },
|
|
|
|
{ ERROR_CAUSE_PROXY_PROCESSING_ERROR, "Other Proxy Processing Error" },
|
|
|
|
{ ERROR_CAUSE_RESOURCES_UNAVAILABLE, "Resources Unavailable" },
|
|
|
|
{ ERROR_CAUSE_REQUEST_INITIATED, "Request Initiated" },
|
|
|
|
{ ERROR_CAUSE_MULTIPLE_SESSION_SELECTION_UNSUPPORTED, "Multiple Session Selection Unsupported" },
|
|
|
|
{ ERROR_CAUSE_LOCATION_INFO_REQUIRED, "Location Info Required" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2016-09-12 03:45:26 +08:00
|
|
|
static struct attrtype {
|
|
|
|
const char *name; /* Attribute name */
|
2000-10-06 14:49:20 +08:00
|
|
|
const char **subtypes; /* Standard Values (if any) */
|
|
|
|
u_char siz_subtypes; /* Size of total standard values */
|
|
|
|
u_char first_subtype; /* First standard value is 0 or 1 */
|
2017-12-14 02:17:47 +08:00
|
|
|
void (*print_func)(netdissect_options *, const u_char *, u_int, u_short);
|
2000-10-06 14:49:20 +08:00
|
|
|
} attr_type[]=
|
|
|
|
{
|
2003-11-26 16:49:14 +08:00
|
|
|
{ NULL, NULL, 0, 0, NULL },
|
2014-11-06 21:40:56 +08:00
|
|
|
{ "User-Name", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "User-Password", NULL, 0, 0, NULL },
|
|
|
|
{ "CHAP-Password", NULL, 0, 0, NULL },
|
|
|
|
{ "NAS-IP-Address", NULL, 0, 0, print_attr_address },
|
|
|
|
{ "NAS-Port", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Service-Type", serv_type, TAM_SIZE(serv_type)-1, 1, print_attr_num },
|
|
|
|
{ "Framed-Protocol", frm_proto, TAM_SIZE(frm_proto)-1, 1, print_attr_num },
|
|
|
|
{ "Framed-IP-Address", NULL, 0, 0, print_attr_address },
|
|
|
|
{ "Framed-IP-Netmask", NULL, 0, 0, print_attr_address },
|
|
|
|
{ "Framed-Routing", frm_routing, TAM_SIZE(frm_routing), 0, print_attr_num },
|
|
|
|
{ "Filter-Id", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Framed-MTU", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Framed-Compression", frm_comp, TAM_SIZE(frm_comp), 0, print_attr_num },
|
|
|
|
{ "Login-IP-Host", NULL, 0, 0, print_attr_address },
|
|
|
|
{ "Login-Service", login_serv, TAM_SIZE(login_serv), 0, print_attr_num },
|
|
|
|
{ "Login-TCP-Port", NULL, 0, 0, print_attr_num },
|
2003-11-26 16:49:14 +08:00
|
|
|
{ "Unassigned", NULL, 0, 0, NULL }, /*17*/
|
2014-11-07 14:50:20 +08:00
|
|
|
{ "Reply-Message", NULL, 0, 0, print_attr_string },
|
2014-11-06 21:40:56 +08:00
|
|
|
{ "Callback-Number", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Callback-Id", NULL, 0, 0, print_attr_string },
|
2003-11-26 16:49:14 +08:00
|
|
|
{ "Unassigned", NULL, 0, 0, NULL }, /*21*/
|
2014-11-06 21:40:56 +08:00
|
|
|
{ "Framed-Route", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Framed-IPX-Network", NULL, 0, 0, print_attr_num },
|
2003-11-26 16:49:14 +08:00
|
|
|
{ "State", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Class", NULL, 0, 0, print_attr_string },
|
2014-11-06 21:40:56 +08:00
|
|
|
{ "Vendor-Specific", NULL, 0, 0, print_vendor_attr },
|
|
|
|
{ "Session-Timeout", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Idle-Timeout", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Termination-Action", term_action, TAM_SIZE(term_action), 0, print_attr_num },
|
|
|
|
{ "Called-Station-Id", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Calling-Station-Id", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "NAS-Identifier", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Proxy-State", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Login-LAT-Service", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Login-LAT-Node", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Login-LAT-Group", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Framed-AppleTalk-Link", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Framed-AppleTalk-Network", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Framed-AppleTalk-Zone", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Acct-Status-Type", acct_status, TAM_SIZE(acct_status)-1, 1, print_attr_num },
|
|
|
|
{ "Acct-Delay-Time", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Input-Octets", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Output-Octets", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Session-Id", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Acct-Authentic", acct_auth, TAM_SIZE(acct_auth)-1, 1, print_attr_num },
|
|
|
|
{ "Acct-Session-Time", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Input-Packets", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Output-Packets", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Terminate-Cause", acct_term, TAM_SIZE(acct_term)-1, 1, print_attr_num },
|
|
|
|
{ "Acct-Multi-Session-Id", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Acct-Link-Count", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Input-Gigawords", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Output-Gigawords", NULL, 0, 0, print_attr_num },
|
2003-11-26 16:49:14 +08:00
|
|
|
{ "Unassigned", NULL, 0, 0, NULL }, /*54*/
|
2014-11-06 21:40:56 +08:00
|
|
|
{ "Event-Timestamp", NULL, 0, 0, print_attr_time },
|
|
|
|
{ "Egress-VLANID", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Ingress-Filters", ingress_filters, TAM_SIZE(ingress_filters)-1, 1, print_attr_num },
|
|
|
|
{ "Egress-VLAN-Name", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "User-Priority-Table", NULL, 0, 0, NULL },
|
|
|
|
{ "CHAP-Challenge", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "NAS-Port-Type", nas_port_type, TAM_SIZE(nas_port_type), 0, print_attr_num },
|
|
|
|
{ "Port-Limit", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Login-LAT-Port", NULL, 0, 0, print_attr_string }, /*63*/
|
|
|
|
{ "Tunnel-Type", tunnel_type, TAM_SIZE(tunnel_type)-1, 1, print_attr_num },
|
|
|
|
{ "Tunnel-Medium-Type", tunnel_medium, TAM_SIZE(tunnel_medium)-1, 1, print_attr_num },
|
|
|
|
{ "Tunnel-Client-Endpoint", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Tunnel-Server-Endpoint", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Acct-Tunnel-Connection", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Tunnel-Password", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "ARAP-Password", NULL, 0, 0, print_attr_strange },
|
|
|
|
{ "ARAP-Features", NULL, 0, 0, print_attr_strange },
|
|
|
|
{ "ARAP-Zone-Access", arap_zone, TAM_SIZE(arap_zone)-1, 1, print_attr_num }, /*72*/
|
|
|
|
{ "ARAP-Security", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "ARAP-Security-Data", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Password-Retry", NULL, 0, 0, print_attr_num },
|
2003-11-26 16:49:14 +08:00
|
|
|
{ "Prompt", prompt, TAM_SIZE(prompt), 0, print_attr_num },
|
2014-11-06 21:40:56 +08:00
|
|
|
{ "Connect-Info", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Configuration-Token", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "EAP-Message", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Message-Authenticator", NULL, 0, 0, print_attr_string }, /*80*/
|
|
|
|
{ "Tunnel-Private-Group-ID", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Tunnel-Assignment-ID", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Tunnel-Preference", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "ARAP-Challenge-Response", NULL, 0, 0, print_attr_strange },
|
|
|
|
{ "Acct-Interim-Interval", NULL, 0, 0, print_attr_num },
|
|
|
|
{ "Acct-Tunnel-Packets-Lost", NULL, 0, 0, print_attr_num }, /*86*/
|
|
|
|
{ "NAS-Port-Id", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Framed-Pool", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "CUI", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Tunnel-Client-Auth-ID", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Tunnel-Server-Auth-ID", NULL, 0, 0, print_attr_string },
|
2015-06-16 21:30:42 +08:00
|
|
|
{ "NAS-Filter-Rule", NULL, 0, 0, print_attr_string },
|
2015-06-16 21:30:42 +08:00
|
|
|
{ "Unassigned", NULL, 0, 0, NULL }, /*93*/
|
2015-06-25 21:14:46 +08:00
|
|
|
{ "Originating-Line-Info", NULL, 0, 0, NULL },
|
|
|
|
{ "NAS-IPv6-Address", NULL, 0, 0, print_attr_address6 },
|
|
|
|
{ "Framed-Interface-ID", NULL, 0, 0, NULL },
|
|
|
|
{ "Framed-IPv6-Prefix", NULL, 0, 0, print_attr_netmask6 },
|
|
|
|
{ "Login-IPv6-Host", NULL, 0, 0, print_attr_address6 },
|
|
|
|
{ "Framed-IPv6-Route", NULL, 0, 0, print_attr_string },
|
2015-07-03 00:36:14 +08:00
|
|
|
{ "Framed-IPv6-Pool", NULL, 0, 0, print_attr_string },
|
2015-07-03 14:28:22 +08:00
|
|
|
{ "Error-Cause", NULL, 0, 0, print_attr_strange },
|
2015-07-03 17:46:18 +08:00
|
|
|
{ "EAP-Key-Name", NULL, 0, 0, NULL },
|
|
|
|
{ "Digest-Response", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Realm", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Nonce", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Response-Auth", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Nextnonce", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Method", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-URI", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Qop", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Algorithm", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Entity-Body-Hash", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-CNonce", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Nonce-Count", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Username", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Opaque", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Auth-Param", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-AKA-Auts", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Domain", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-Stale", NULL, 0, 0, print_attr_string },
|
|
|
|
{ "Digest-HA1", NULL, 0, 0, print_attr_string },
|
2015-07-03 18:33:47 +08:00
|
|
|
{ "SIP-AOR", NULL, 0, 0, print_attr_string },
|
2017-10-10 03:36:26 +08:00
|
|
|
{ "Delegated-IPv6-Prefix", NULL, 0, 0, print_attr_netmask6 },
|
2002-06-12 01:08:37 +08:00
|
|
|
};
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/* Print an attribute string */
|
|
|
|
/* value pointed by 'data' */
|
|
|
|
/* and 'length' size. */
|
|
|
|
/*****************************/
|
|
|
|
/* Returns nothing. */
|
|
|
|
/*****************************/
|
|
|
|
static void
|
2014-03-18 20:09:00 +08:00
|
|
|
print_attr_string(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2017-12-14 02:17:47 +08:00
|
|
|
u_int i;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2017-12-11 19:46:51 +08:00
|
|
|
ND_TCHECK_LEN(data, length);
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
switch(attr_code)
|
|
|
|
{
|
|
|
|
case TUNNEL_PASS:
|
2005-09-26 09:01:55 +08:00
|
|
|
if (length < 3)
|
2017-03-23 06:38:02 +08:00
|
|
|
goto trunc;
|
2017-12-09 18:40:36 +08:00
|
|
|
if (EXTRACT_U_1(data) && (EXTRACT_U_1(data) <= 0x1F))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[%u] ", EXTRACT_U_1(data));
|
2014-09-09 02:50:57 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[Unused] ");
|
2000-10-06 14:49:20 +08:00
|
|
|
data++;
|
2005-09-26 09:01:55 +08:00
|
|
|
length--;
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Salt %u ", EXTRACT_BE_U_2(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
data+=2;
|
|
|
|
length-=2;
|
|
|
|
break;
|
|
|
|
case TUNNEL_CLIENT_END:
|
|
|
|
case TUNNEL_SERVER_END:
|
|
|
|
case TUNNEL_PRIV_GROUP:
|
|
|
|
case TUNNEL_ASSIGN_ID:
|
|
|
|
case TUNNEL_CLIENT_AUTH:
|
|
|
|
case TUNNEL_SERVER_AUTH:
|
2017-12-05 05:45:01 +08:00
|
|
|
if (EXTRACT_U_1(data) <= 0x1F)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2005-09-26 09:01:55 +08:00
|
|
|
if (length < 1)
|
2017-03-23 06:38:02 +08:00
|
|
|
goto trunc;
|
2017-12-09 18:40:36 +08:00
|
|
|
if (EXTRACT_U_1(data))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[%u] ", EXTRACT_U_1(data));
|
2014-09-09 02:50:57 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[Unused] ");
|
2000-10-06 14:49:20 +08:00
|
|
|
data++;
|
|
|
|
length--;
|
|
|
|
}
|
|
|
|
break;
|
2014-10-06 19:54:23 +08:00
|
|
|
case EGRESS_VLAN_NAME:
|
2017-03-23 06:38:02 +08:00
|
|
|
if (length < 1)
|
|
|
|
goto trunc;
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s (0x%02x) ",
|
2017-11-23 06:54:09 +08:00
|
|
|
tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)),
|
2018-01-07 18:47:30 +08:00
|
|
|
EXTRACT_U_1(data));
|
2014-10-06 19:54:23 +08:00
|
|
|
data++;
|
|
|
|
length--;
|
|
|
|
break;
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
2017-11-23 06:54:09 +08:00
|
|
|
for (i=0; i < length && EXTRACT_U_1(data); i++, data++)
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%c", ND_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.');
|
2000-10-06 14:49:20 +08:00
|
|
|
|
|
|
|
return;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2002-06-12 01:08:37 +08:00
|
|
|
}
|
2000-10-06 14:49:20 +08:00
|
|
|
|
2003-11-26 16:49:14 +08:00
|
|
|
/*
|
|
|
|
* print vendor specific attributes
|
|
|
|
*/
|
|
|
|
static void
|
2014-03-18 20:09:00 +08:00
|
|
|
print_vendor_attr(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code _U_)
|
2003-11-26 16:49:14 +08:00
|
|
|
{
|
|
|
|
u_int idx;
|
|
|
|
u_int vendor_id;
|
|
|
|
u_int vendor_type;
|
|
|
|
u_int vendor_length;
|
|
|
|
|
2005-09-26 09:01:55 +08:00
|
|
|
if (length < 4)
|
|
|
|
goto trunc;
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2017-11-23 06:54:09 +08:00
|
|
|
vendor_id = EXTRACT_BE_U_4(data);
|
2003-11-26 16:49:14 +08:00
|
|
|
data+=4;
|
|
|
|
length-=4;
|
|
|
|
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Vendor: %s (%u)",
|
2004-01-25 17:56:15 +08:00
|
|
|
tok2str(smi_values,"Unknown",vendor_id),
|
2018-01-07 18:47:30 +08:00
|
|
|
vendor_id);
|
2003-11-26 16:49:14 +08:00
|
|
|
|
|
|
|
while (length >= 2) {
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_2(data);
|
2004-01-25 17:31:14 +08:00
|
|
|
|
2017-12-09 16:56:29 +08:00
|
|
|
vendor_type = EXTRACT_U_1(data);
|
2017-11-23 06:54:09 +08:00
|
|
|
vendor_length = EXTRACT_U_1(data + 1);
|
2004-01-25 17:31:14 +08:00
|
|
|
|
2005-09-26 09:01:55 +08:00
|
|
|
if (vendor_length < 2)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("\n\t Vendor Attribute: %u, Length: %u (bogus, must be >= 2)",
|
2005-09-26 09:01:55 +08:00
|
|
|
vendor_type,
|
2018-01-07 18:47:30 +08:00
|
|
|
vendor_length);
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (vendor_length > length)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("\n\t Vendor Attribute: %u, Length: %u (bogus, goes past end of vendor-specific attribute)",
|
2005-09-26 09:01:55 +08:00
|
|
|
vendor_type,
|
2018-01-07 18:47:30 +08:00
|
|
|
vendor_length);
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
|
|
|
}
|
2003-11-26 16:49:14 +08:00
|
|
|
data+=2;
|
2005-09-26 09:01:55 +08:00
|
|
|
vendor_length-=2;
|
|
|
|
length-=2;
|
2017-12-11 19:46:51 +08:00
|
|
|
ND_TCHECK_LEN(data, vendor_length);
|
2004-01-25 17:31:14 +08:00
|
|
|
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("\n\t Vendor Attribute: %u, Length: %u, Value: ",
|
2003-11-26 16:49:14 +08:00
|
|
|
vendor_type,
|
2018-01-07 18:47:30 +08:00
|
|
|
vendor_length);
|
2003-11-26 16:49:14 +08:00
|
|
|
for (idx = 0; idx < vendor_length ; idx++, data++)
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%c", ND_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.');
|
2003-11-26 16:49:14 +08:00
|
|
|
length-=vendor_length;
|
|
|
|
}
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2003-11-26 16:49:14 +08:00
|
|
|
}
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
/******************************/
|
|
|
|
/* Print an attribute numeric */
|
|
|
|
/* value pointed by 'data' */
|
|
|
|
/* and 'length' size. */
|
|
|
|
/******************************/
|
|
|
|
/* Returns nothing. */
|
|
|
|
/******************************/
|
|
|
|
static void
|
2014-03-18 20:09:00 +08:00
|
|
|
print_attr_num(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2014-04-23 15:20:40 +08:00
|
|
|
uint32_t timeout;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-12-04 04:31:26 +08:00
|
|
|
if (length != 4)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 4", length);
|
2000-12-04 04:31:26 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2000-10-06 14:49:20 +08:00
|
|
|
/* This attribute has standard values */
|
2002-06-12 01:08:37 +08:00
|
|
|
if (attr_type[attr_code].siz_subtypes)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
|
|
|
static const char **table;
|
2014-04-23 15:20:40 +08:00
|
|
|
uint32_t data_value;
|
2000-10-06 14:49:20 +08:00
|
|
|
table = attr_type[attr_code].subtypes;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
if ( (attr_code == TUNNEL_TYPE) || (attr_code == TUNNEL_MEDIUM) )
|
|
|
|
{
|
2017-12-09 18:40:36 +08:00
|
|
|
if (!EXTRACT_U_1(data))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[Unused] ");
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[%u] ", EXTRACT_U_1(data));
|
Get rid of some includes, and use "u_int8_t" and "u_int16_t" in packet
layout definitions, as per Alfredo Andrs's suggestion.
Don't use expressions with side effects inside EXTRACT macros - the
arguments of those macros are used more than once, so the side-effects
(incrementing the pointer) occurs more than once, and they occur in a
sequence that may not be the same for all compilers.
When printing a UNIX time value, extract the value into a "time_t"
variable, and then pass a pointer to that variable to "ctime()", don't
cast the result of "EXTRACT_32BITS()" to a pointer. Also, when printing
the result of "ctime()", print only the first 24 characters, so that the
newline at the end isn't printed.
Cast the first argument passed to "radius_attr_print()", and the
argument passed to the print function for an attribute, to "u_char *",
not "char *", as those routines expect a "u_char *".
2000-10-10 13:14:35 +08:00
|
|
|
data++;
|
2017-11-23 06:54:09 +08:00
|
|
|
data_value = EXTRACT_BE_U_3(data);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
else
|
Get rid of some includes, and use "u_int8_t" and "u_int16_t" in packet
layout definitions, as per Alfredo Andrs's suggestion.
Don't use expressions with side effects inside EXTRACT macros - the
arguments of those macros are used more than once, so the side-effects
(incrementing the pointer) occurs more than once, and they occur in a
sequence that may not be the same for all compilers.
When printing a UNIX time value, extract the value into a "time_t"
variable, and then pass a pointer to that variable to "ctime()", don't
cast the result of "EXTRACT_32BITS()" to a pointer. Also, when printing
the result of "ctime()", print only the first 24 characters, so that the
newline at the end isn't printed.
Cast the first argument passed to "radius_attr_print()", and the
argument passed to the print function for an attribute, to "u_char *",
not "char *", as those routines expect a "u_char *".
2000-10-10 13:14:35 +08:00
|
|
|
{
|
2017-11-23 06:54:09 +08:00
|
|
|
data_value = EXTRACT_BE_U_4(data);
|
Get rid of some includes, and use "u_int8_t" and "u_int16_t" in packet
layout definitions, as per Alfredo Andrs's suggestion.
Don't use expressions with side effects inside EXTRACT macros - the
arguments of those macros are used more than once, so the side-effects
(incrementing the pointer) occurs more than once, and they occur in a
sequence that may not be the same for all compilers.
When printing a UNIX time value, extract the value into a "time_t"
variable, and then pass a pointer to that variable to "ctime()", don't
cast the result of "EXTRACT_32BITS()" to a pointer. Also, when printing
the result of "ctime()", print only the first 24 characters, so that the
newline at the end isn't printed.
Cast the first argument passed to "radius_attr_print()", and the
argument passed to the print function for an attribute, to "u_char *",
not "char *", as those routines expect a "u_char *".
2000-10-10 13:14:35 +08:00
|
|
|
}
|
2014-04-23 15:20:40 +08:00
|
|
|
if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 +
|
2002-07-04 00:27:12 +08:00
|
|
|
attr_type[attr_code].first_subtype) &&
|
|
|
|
data_value >= attr_type[attr_code].first_subtype )
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", table[data_value]);
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("#%u", data_value);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(attr_code) /* Be aware of special cases... */
|
|
|
|
{
|
|
|
|
case FRM_IPX:
|
2017-11-23 06:54:09 +08:00
|
|
|
if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE )
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("NAS Select");
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%u", EXTRACT_BE_U_4(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SESSION_TIMEOUT:
|
|
|
|
case IDLE_TIMEOUT:
|
|
|
|
case ACCT_DELAY:
|
|
|
|
case ACCT_SESSION_TIME:
|
|
|
|
case ACCT_INT_INTERVAL:
|
2017-11-23 06:54:09 +08:00
|
|
|
timeout = EXTRACT_BE_U_4(data);
|
2000-10-06 14:49:20 +08:00
|
|
|
if ( timeout < 60 )
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%02d secs", timeout);
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( timeout < 3600 )
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%02d:%02d min",
|
|
|
|
timeout / 60, timeout % 60);
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%02d:%02d:%02d hours",
|
2002-06-12 01:08:37 +08:00
|
|
|
timeout / 3600, (timeout % 3600) / 60,
|
2018-01-07 18:47:30 +08:00
|
|
|
timeout % 60);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FRM_ATALK_LINK:
|
2017-11-23 06:54:09 +08:00
|
|
|
if (EXTRACT_BE_U_4(data))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%u", EXTRACT_BE_U_4(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Unnumbered");
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
case FRM_ATALK_NETWORK:
|
2017-11-23 06:54:09 +08:00
|
|
|
if (EXTRACT_BE_U_4(data))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%u", EXTRACT_BE_U_4(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("NAS assigned");
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TUNNEL_PREFERENCE:
|
2017-12-09 18:40:36 +08:00
|
|
|
if (EXTRACT_U_1(data))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[%u] ", EXTRACT_U_1(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Tag[Unused] ");
|
2014-09-09 02:50:57 +08:00
|
|
|
data++;
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%u", EXTRACT_BE_U_3(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
|
|
|
|
2014-10-06 19:54:23 +08:00
|
|
|
case EGRESS_VLAN_ID:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s (0x%02x) ",
|
2017-11-23 06:54:09 +08:00
|
|
|
tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)),
|
2018-01-07 18:47:30 +08:00
|
|
|
EXTRACT_U_1(data));
|
2014-10-06 19:54:23 +08:00
|
|
|
data++;
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%u", EXTRACT_BE_U_3(data));
|
2014-10-06 19:54:23 +08:00
|
|
|
break;
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
default:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%u", EXTRACT_BE_U_4(data));
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
} /* switch */
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
} /* if-else */
|
|
|
|
|
|
|
|
return;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/* Print an attribute IPv4 */
|
|
|
|
/* address value pointed by */
|
|
|
|
/* 'data' and 'length' size. */
|
|
|
|
/*****************************/
|
|
|
|
/* Returns nothing. */
|
|
|
|
/*****************************/
|
|
|
|
static void
|
2014-03-18 20:09:00 +08:00
|
|
|
print_attr_address(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2000-12-04 04:31:26 +08:00
|
|
|
if (length != 4)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 4", length);
|
2000-12-04 04:31:26 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
switch(attr_code)
|
|
|
|
{
|
|
|
|
case FRM_IPADDR:
|
|
|
|
case LOG_IPHOST:
|
2017-11-23 06:54:09 +08:00
|
|
|
if (EXTRACT_BE_U_4(data) == 0xFFFFFFFF )
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("User Selected");
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2017-11-23 06:54:09 +08:00
|
|
|
if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE )
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("NAS Select");
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s",ipaddr_string(ndo, data));
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
default:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", ipaddr_string(ndo, data));
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
|
|
|
}
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
return;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
2015-06-25 21:14:46 +08:00
|
|
|
/*****************************/
|
|
|
|
/* Print an attribute IPv6 */
|
|
|
|
/* address value pointed by */
|
|
|
|
/* 'data' and 'length' size. */
|
|
|
|
/*****************************/
|
|
|
|
/* Returns nothing. */
|
|
|
|
/*****************************/
|
|
|
|
static void
|
|
|
|
print_attr_address6(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code _U_)
|
2015-06-25 21:14:46 +08:00
|
|
|
{
|
|
|
|
if (length != 16)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 16", length);
|
2015-06-25 21:14:46 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_16(data);
|
2015-06-25 21:14:46 +08:00
|
|
|
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", ip6addr_string(ndo, data));
|
2015-06-25 21:14:46 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2015-06-25 21:14:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_attr_netmask6(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code _U_)
|
2015-06-25 21:14:46 +08:00
|
|
|
{
|
2017-09-24 21:10:26 +08:00
|
|
|
u_char data2[16];
|
2015-06-25 21:14:46 +08:00
|
|
|
|
|
|
|
if (length < 2 || length > 18)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u not in range (2..18)", length);
|
2015-06-25 21:14:46 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-12-11 19:46:51 +08:00
|
|
|
ND_TCHECK_LEN(data, length);
|
2017-12-02 21:19:13 +08:00
|
|
|
if (EXTRACT_U_1(data + 1) > 128)
|
2015-06-25 21:14:46 +08:00
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: netmask %u not in range (0..128)", EXTRACT_U_1(data + 1));
|
2015-06-25 21:14:46 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(data2, 0, sizeof(data2));
|
|
|
|
if (length > 2)
|
|
|
|
memcpy(data2, data+2, length-2);
|
|
|
|
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s/%u", ip6addr_string(ndo, data2), EXTRACT_U_1(data + 1));
|
2015-06-25 21:14:46 +08:00
|
|
|
|
2017-12-02 21:19:13 +08:00
|
|
|
if (EXTRACT_U_1(data + 1) > 8 * (length - 2))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(" (inconsistent prefix length)");
|
2017-09-24 21:10:26 +08:00
|
|
|
|
2015-06-25 21:14:46 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2015-06-25 21:14:46 +08:00
|
|
|
}
|
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
/*************************************/
|
|
|
|
/* Print an attribute of 'secs since */
|
|
|
|
/* January 1, 1970 00:00 UTC' value */
|
|
|
|
/* pointed by 'data' and 'length' */
|
|
|
|
/* size. */
|
|
|
|
/*************************************/
|
|
|
|
/* Returns nothing. */
|
|
|
|
/*************************************/
|
2014-03-18 20:09:00 +08:00
|
|
|
static void
|
|
|
|
print_attr_time(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code _U_)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
Get rid of some includes, and use "u_int8_t" and "u_int16_t" in packet
layout definitions, as per Alfredo Andrs's suggestion.
Don't use expressions with side effects inside EXTRACT macros - the
arguments of those macros are used more than once, so the side-effects
(incrementing the pointer) occurs more than once, and they occur in a
sequence that may not be the same for all compilers.
When printing a UNIX time value, extract the value into a "time_t"
variable, and then pass a pointer to that variable to "ctime()", don't
cast the result of "EXTRACT_32BITS()" to a pointer. Also, when printing
the result of "ctime()", print only the first 24 characters, so that the
newline at the end isn't printed.
Cast the first argument passed to "radius_attr_print()", and the
argument passed to the print function for an attribute, to "u_char *",
not "char *", as those routines expect a "u_char *".
2000-10-10 13:14:35 +08:00
|
|
|
time_t attr_time;
|
2000-12-04 04:31:26 +08:00
|
|
|
char string[26];
|
|
|
|
|
|
|
|
if (length != 4)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 4", length);
|
2000-12-04 04:31:26 +08:00
|
|
|
return;
|
|
|
|
}
|
Get rid of some includes, and use "u_int8_t" and "u_int16_t" in packet
layout definitions, as per Alfredo Andrs's suggestion.
Don't use expressions with side effects inside EXTRACT macros - the
arguments of those macros are used more than once, so the side-effects
(incrementing the pointer) occurs more than once, and they occur in a
sequence that may not be the same for all compilers.
When printing a UNIX time value, extract the value into a "time_t"
variable, and then pass a pointer to that variable to "ctime()", don't
cast the result of "EXTRACT_32BITS()" to a pointer. Also, when printing
the result of "ctime()", print only the first 24 characters, so that the
newline at the end isn't printed.
Cast the first argument passed to "radius_attr_print()", and the
argument passed to the print function for an attribute, to "u_char *",
not "char *", as those routines expect a "u_char *".
2000-10-10 13:14:35 +08:00
|
|
|
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2017-11-23 06:54:09 +08:00
|
|
|
attr_time = EXTRACT_BE_U_4(data);
|
2001-06-26 05:13:33 +08:00
|
|
|
strlcpy(string, ctime(&attr_time), sizeof(string));
|
2000-12-04 04:31:26 +08:00
|
|
|
/* Get rid of the newline */
|
|
|
|
string[24] = '\0';
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%.24s", string);
|
2000-10-06 14:49:20 +08:00
|
|
|
return;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* Print an attribute of 'strange' */
|
|
|
|
/* data format pointed by 'data' */
|
|
|
|
/* and 'length' size. */
|
|
|
|
/***********************************/
|
|
|
|
/* Returns nothing. */
|
|
|
|
/***********************************/
|
2014-03-18 20:09:00 +08:00
|
|
|
static void
|
|
|
|
print_attr_strange(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *data, u_int length, u_short attr_code)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2000-12-04 04:31:26 +08:00
|
|
|
u_short len_data;
|
2015-07-03 00:36:14 +08:00
|
|
|
u_int error_cause_value;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
switch(attr_code)
|
|
|
|
{
|
|
|
|
case ARAP_PASS:
|
2000-12-04 04:31:26 +08:00
|
|
|
if (length != 16)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 16", length);
|
2000-12-04 04:31:26 +08:00
|
|
|
return;
|
|
|
|
}
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("User_challenge (");
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_8(data);
|
2000-12-04 04:31:26 +08:00
|
|
|
len_data = 8;
|
2000-10-06 14:49:20 +08:00
|
|
|
PRINT_HEX(len_data, data);
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(") User_resp(");
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_8(data);
|
2000-12-04 04:31:26 +08:00
|
|
|
len_data = 8;
|
2000-10-06 14:49:20 +08:00
|
|
|
PRINT_HEX(len_data, data);
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(")");
|
2000-10-06 14:49:20 +08:00
|
|
|
break;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
case ARAP_FEATURES:
|
2000-12-04 04:31:26 +08:00
|
|
|
if (length != 14)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 14", length);
|
2000-12-04 04:31:26 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_1(data);
|
2017-12-09 18:40:36 +08:00
|
|
|
if (EXTRACT_U_1(data))
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("User can change password");
|
2000-10-06 14:49:20 +08:00
|
|
|
else
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("User cannot change password");
|
2000-10-06 14:49:20 +08:00
|
|
|
data++;
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_1(data);
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(", Min password length: %u", EXTRACT_U_1(data));
|
2000-12-04 04:31:26 +08:00
|
|
|
data++;
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(", created at: ");
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2000-12-04 04:31:26 +08:00
|
|
|
len_data = 4;
|
2000-10-06 14:49:20 +08:00
|
|
|
PRINT_HEX(len_data, data);
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(", expires in: ");
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2000-12-04 04:31:26 +08:00
|
|
|
len_data = 4;
|
2000-10-06 14:49:20 +08:00
|
|
|
PRINT_HEX(len_data, data);
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(", Current Time: ");
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2005-09-26 09:01:55 +08:00
|
|
|
len_data = 4;
|
2000-10-06 14:49:20 +08:00
|
|
|
PRINT_HEX(len_data, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARAP_CHALLENGE_RESP:
|
2000-12-04 04:31:26 +08:00
|
|
|
if (length < 8)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("ERROR: length %u != 8", length);
|
2000-12-04 04:31:26 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_8(data);
|
2000-12-04 04:31:26 +08:00
|
|
|
len_data = 8;
|
2000-10-06 14:49:20 +08:00
|
|
|
PRINT_HEX(len_data, data);
|
|
|
|
break;
|
2015-07-03 00:36:14 +08:00
|
|
|
|
|
|
|
case ERROR_CAUSE:
|
|
|
|
if (length != 4)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Error: length %u != 4", length);
|
2015-07-03 00:36:14 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-11-25 05:48:55 +08:00
|
|
|
ND_TCHECK_4(data);
|
2015-07-03 00:36:14 +08:00
|
|
|
|
2017-11-23 06:54:09 +08:00
|
|
|
error_cause_value = EXTRACT_BE_U_4(data);
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value));
|
2015-07-03 00:36:14 +08:00
|
|
|
break;
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-03-18 20:09:00 +08:00
|
|
|
radius_attrs_print(netdissect_options *ndo,
|
2017-12-14 02:17:47 +08:00
|
|
|
const u_char *attr, u_int length)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2017-12-14 02:17:47 +08:00
|
|
|
const struct radius_attr *rad_attr = (const struct radius_attr *)attr;
|
2005-09-26 09:01:55 +08:00
|
|
|
const char *attr_string;
|
2017-12-31 10:20:26 +08:00
|
|
|
uint8_t type, len;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2000-10-06 14:49:20 +08:00
|
|
|
while (length > 0)
|
|
|
|
{
|
2005-09-26 09:01:55 +08:00
|
|
|
if (length < 2)
|
|
|
|
goto trunc;
|
2018-01-04 04:32:07 +08:00
|
|
|
ND_TCHECK_SIZE(rad_attr);
|
2014-01-02 10:27:54 +08:00
|
|
|
|
2017-12-31 10:20:26 +08:00
|
|
|
type = EXTRACT_U_1(rad_attr->type);
|
|
|
|
len = EXTRACT_U_1(rad_attr->len);
|
|
|
|
if (type != 0 && type < TAM_SIZE(attr_type))
|
|
|
|
attr_string = attr_type[type].name;
|
2005-09-26 09:01:55 +08:00
|
|
|
else
|
|
|
|
attr_string = "Unknown";
|
2017-12-31 10:20:26 +08:00
|
|
|
if (len < 2)
|
2001-06-18 17:16:28 +08:00
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("\n\t %s Attribute (%u), length: %u (bogus, must be >= 2)",
|
2005-09-26 09:01:55 +08:00
|
|
|
attr_string,
|
2017-12-31 10:20:26 +08:00
|
|
|
type,
|
2018-01-07 18:47:30 +08:00
|
|
|
len);
|
2002-06-12 01:08:37 +08:00
|
|
|
return;
|
2001-06-18 17:16:28 +08:00
|
|
|
}
|
2017-12-31 10:20:26 +08:00
|
|
|
if (len > length)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("\n\t %s Attribute (%u), length: %u (bogus, goes past end of packet)",
|
2005-09-26 09:01:55 +08:00
|
|
|
attr_string,
|
2017-12-31 10:20:26 +08:00
|
|
|
type,
|
2018-01-07 18:47:30 +08:00
|
|
|
len);
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
|
|
|
}
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("\n\t %s Attribute (%u), length: %u, Value: ",
|
2005-09-26 09:01:55 +08:00
|
|
|
attr_string,
|
2017-12-31 10:20:26 +08:00
|
|
|
type,
|
2018-01-07 18:47:30 +08:00
|
|
|
len);
|
2003-11-26 16:49:14 +08:00
|
|
|
|
2017-12-31 10:20:26 +08:00
|
|
|
if (type < TAM_SIZE(attr_type))
|
2005-09-26 09:01:55 +08:00
|
|
|
{
|
2017-12-31 10:20:26 +08:00
|
|
|
if (len > 2)
|
2005-09-26 09:01:55 +08:00
|
|
|
{
|
2017-12-31 10:20:26 +08:00
|
|
|
if ( attr_type[type].print_func )
|
|
|
|
(*attr_type[type].print_func)(
|
2015-04-27 08:24:42 +08:00
|
|
|
ndo, ((const u_char *)(rad_attr+1)),
|
2017-12-31 10:20:26 +08:00
|
|
|
len - 2, type);
|
2003-11-26 16:49:14 +08:00
|
|
|
}
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
2004-07-22 05:45:47 +08:00
|
|
|
/* do we also want to see a hex dump ? */
|
2014-03-18 20:09:00 +08:00
|
|
|
if (ndo->ndo_vflag> 1)
|
2017-12-31 10:20:26 +08:00
|
|
|
print_unknown_data(ndo, (const u_char *)rad_attr+2, "\n\t ", (len)-2);
|
2003-12-15 21:52:15 +08:00
|
|
|
|
2017-12-31 10:20:26 +08:00
|
|
|
length-=(len);
|
|
|
|
rad_attr = (const struct radius_attr *)( ((const char *)(rad_attr))+len);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-03-18 20:09:00 +08:00
|
|
|
radius_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat, u_int length)
|
2000-10-06 14:49:20 +08:00
|
|
|
{
|
2017-12-14 02:17:47 +08:00
|
|
|
const struct radius_hdr *rad;
|
2003-11-26 16:49:14 +08:00
|
|
|
u_int len, auth_idx;
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2017-12-11 19:46:51 +08:00
|
|
|
ND_TCHECK_LEN(dat, MIN_RADIUS_LEN);
|
2015-04-27 08:24:42 +08:00
|
|
|
rad = (const struct radius_hdr *)dat;
|
2017-12-31 10:20:26 +08:00
|
|
|
len = EXTRACT_BE_U_2(rad->len);
|
2001-06-18 17:16:28 +08:00
|
|
|
|
|
|
|
if (len < MIN_RADIUS_LEN)
|
|
|
|
{
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2001-06-18 17:16:28 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-26 09:01:55 +08:00
|
|
|
if (len > length)
|
|
|
|
len = length;
|
2001-06-18 17:16:28 +08:00
|
|
|
|
2014-03-18 20:09:00 +08:00
|
|
|
if (ndo->ndo_vflag < 1) {
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("RADIUS, %s (%u), id: 0x%02x length: %u",
|
2017-12-31 10:20:26 +08:00
|
|
|
tok2str(radius_command_values,"Unknown Command",EXTRACT_U_1(rad->code)),
|
|
|
|
EXTRACT_U_1(rad->code),
|
|
|
|
EXTRACT_U_1(rad->id),
|
2018-01-07 18:47:30 +08:00
|
|
|
len);
|
2003-11-26 16:49:14 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("RADIUS, length: %u\n\t%s (%u), id: 0x%02x, Authenticator: ",
|
2005-09-26 09:01:55 +08:00
|
|
|
len,
|
2017-12-31 10:20:26 +08:00
|
|
|
tok2str(radius_command_values,"Unknown Command",EXTRACT_U_1(rad->code)),
|
|
|
|
EXTRACT_U_1(rad->code),
|
2018-01-07 18:47:30 +08:00
|
|
|
EXTRACT_U_1(rad->id));
|
2003-11-26 16:49:14 +08:00
|
|
|
|
|
|
|
for(auth_idx=0; auth_idx < 16; auth_idx++)
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%02x", rad->auth[auth_idx]);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|
2002-06-12 01:08:37 +08:00
|
|
|
|
2005-09-26 09:01:55 +08:00
|
|
|
if (len > MIN_RADIUS_LEN)
|
2014-03-18 20:09:00 +08:00
|
|
|
radius_attrs_print(ndo, dat + MIN_RADIUS_LEN, len - MIN_RADIUS_LEN);
|
2005-09-26 09:01:55 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("%s", tstr);
|
2000-10-06 14:49:20 +08:00
|
|
|
}
|