X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/26f04f1f168a6e3df7ab808846b9cd243a981b0d..d9a787e4995b4b5101e410ed1e93367907ab9fe2:/print-radius.c diff --git a/print-radius.c b/print-radius.c index 8128b98f..6bdcd504 100644 --- a/print-radius.c +++ b/print-radius.c @@ -96,6 +96,7 @@ #include "addrtoname.h" #include "extract.h" #include "oui.h" +#include "ntp.h" #define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) ) @@ -110,6 +111,7 @@ /* Radius packet codes */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-27 */ #define RADCMD_ACCESS_REQ 1 /* Access-Request */ #define RADCMD_ACCESS_ACC 2 /* Access-Accept */ #define RADCMD_ACCESS_REJ 3 /* Access-Reject */ @@ -230,6 +232,7 @@ struct radius_attr { nd_uint8_t type; /* Attribute type */ /* Service-Type Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-4 */ static const char *serv_type[]={ NULL, "Login", "Framed", @@ -240,11 +243,22 @@ static const char *serv_type[]={ NULL, "NAS Prompt", "Authenticate Only", "Callback NAS Prompt", + /* ^ [0, 9] ^ */ "Call Check", "Callback Administrative", + "Voice", + "Fax", + "Modem Relay", + "IAPP-Register", + "IAPP-AP-Check", + "Authorize Only", + "Framed-Management", + "Additional-Authorization", + /* ^ [10, 19] ^ */ }; /* Framed-Protocol Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-5 */ static const char *frm_proto[]={ NULL, "PPP", "SLIP", @@ -252,9 +266,11 @@ static const char *frm_proto[]={ NULL, "Gandalf proprietary", "Xylogics IPX/SLIP", "X.75 Synchronous", + "GPRS PDP Context", }; /* Framed-Routing Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-6 */ static const char *frm_routing[]={ "None", "Send", "Listen", @@ -262,6 +278,7 @@ static const char *frm_routing[]={ "None", }; /* Framed-Compression Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-7 */ static const char *frm_comp[]={ "None", "VJ TCP/IP", "IPX", @@ -269,6 +286,7 @@ static const char *frm_comp[]={ "None", }; /* Login-Service Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-8 */ static const char *login_serv[]={ "Telnet", "Rlogin", "TCP Clear", @@ -282,6 +300,7 @@ static const char *login_serv[]={ "Telnet", /* Termination-Action Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-9 */ static const char *term_action[]={ "Default", "RADIUS-Request", }; @@ -293,6 +312,7 @@ static const char *ingress_filters[]={ NULL, }; /* NAS-Port-Type Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-13 */ static const char *nas_port_type[]={ "Async", "Sync", "ISDN Sync", @@ -303,6 +323,7 @@ static const char *nas_port_type[]={ "Async", "HDLC Clear Channel", "X.25", "X.75", + /* ^ [0, 9] ^ */ "G.3 Fax", "SDSL", "ADSL-CAP", @@ -313,9 +334,37 @@ static const char *nas_port_type[]={ "Async", "Cable", "Wireless - Other", "Wireless - IEEE 802.11", + /* ^ [10, 19] ^ */ + "Token-Ring", + "FDDI", + "Wireless - CDMA200", + "Wireless - UMTS", + "Wireless - 1X-EV", + "IAPP", + "FTTP", + "Wireless - IEEE 802.16", + "Wireless - IEEE 802.20", + "Wireless - IEEE 802.22", + /* ^ [20, 29] ^ */ + "PPPoA", + "PPPoEoA", + "PPPoEoE", + "PPPoEoVLAN", + "PPPoEoQinQ", + "xPON", + "Wireless - XGP", + "WiMAX Pre-Release 8 IWK Function", + "WIMAX-WIFI-IWK", + "WIMAX-SFF", + /* ^ [30, 39] ^ */ + "WIMAX-HA-LMA", + "WIMAX-DHCP", + "WIMAX-LBS", + "WIMAX-WVS", }; /* Acct-Status-Type Accounting Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-10 */ static const char *acct_status[]={ NULL, "Start", "Stop", @@ -326,6 +375,7 @@ static const char *acct_status[]={ NULL, "Accounting-On", "Accounting-Off", "Tunnel-Start", + /* ^ [0, 9] ^ */ "Tunnel-Stop", "Tunnel-Reject", "Tunnel-Link-Start", @@ -335,13 +385,16 @@ static const char *acct_status[]={ NULL, }; /* Acct-Authentic Accounting Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-11 */ static const char *acct_auth[]={ NULL, "RADIUS", "Local", "Remote", + "Diameter", }; /* Acct-Terminate-Cause Accounting Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-12 */ static const char *acct_term[]={ NULL, "User Request", "Lost Carrier", @@ -352,6 +405,7 @@ static const char *acct_term[]={ NULL, "Admin Reboot", "Port Error", "NAS Error", + /* ^ [0, 9] ^ */ "NAS Request", "NAS Reboot", "Port Unneeded", @@ -361,9 +415,16 @@ static const char *acct_term[]={ NULL, "Callback", "User Error", "Host Request", + "Supplicant Restart", + /* ^ [10, 19] ^ */ + "Reauthentication Failure", + "Port Reinitialized", + "Port Administratively Disabled", + "Lost Power", }; /* Tunnel-Type Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-14 */ static const char *tunnel_type[]={ NULL, "PPTP", "L2F", @@ -374,6 +435,7 @@ static const char *tunnel_type[]={ NULL, "IP-IP", "MIN-IP-IP", "ESP", + /* ^ [0, 9] ^ */ "GRE", "DVS", "IP-in-IP Tunneling", @@ -381,6 +443,7 @@ static const char *tunnel_type[]={ NULL, }; /* Tunnel-Medium-Type Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-15 */ static const char *tunnel_medium[]={ NULL, "IPv4", "IPv6", @@ -391,6 +454,7 @@ static const char *tunnel_medium[]={ NULL, "E.163", "E.164", "F.69", + /* ^ [0, 9] ^ */ "X.121", "IPX", "Appletalk", @@ -400,6 +464,7 @@ static const char *tunnel_medium[]={ NULL, }; /* ARAP-Zone-Access Attribute standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-16 */ static const char *arap_zone[]={ NULL, "Only access to dfl zone", "Use zone filter inc.", @@ -407,11 +472,13 @@ static const char *arap_zone[]={ NULL, "Use zone filter exc.", }; +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-17 */ static const char *prompt[]={ "No Echo", "Echo", }; /* Error-Cause standard values */ +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-18 */ #define ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED 201 #define ERROR_CAUSE_INVALID_EAP_PACKET 202 #define ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE 401 @@ -484,6 +551,7 @@ static const struct mip6_feature_vector { { INTER_MAG_ROUTING_SUPPORTED, "INTER_MAG_ROUTING_SUPPORTED" }, }; +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-19 */ #define OPERATOR_NAME_TADIG 0x30 #define OPERATOR_NAME_REALM 0x31 #define OPERATOR_NAME_E212 0x32 @@ -496,6 +564,7 @@ static const struct tok operator_name_vector[] = { { 0, NULL } }; +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-20 */ #define LOCATION_INFORMATION_CODE_CIVIC 0 #define LOCATION_INFORMATION_CODE_GEOSPATIAL 1 static const struct tok location_information_code_vector[] = { @@ -504,6 +573,7 @@ static const struct tok location_information_code_vector[] = { { 0, NULL } }; +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-21 */ #define LOCATION_INFORMATION_ENTITY_USER 0 #define LOCATION_INFORMATION_ENTITY_RADIUS 1 static const struct tok location_information_entity_vector[] = { @@ -512,6 +582,28 @@ static const struct tok location_information_entity_vector[] = { { 0, NULL } }; +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-22 */ +static const struct tok blpr_bm[] = { + { 0x0001, "MBZ-15" }, + { 0x0002, "MBZ-14" }, + { 0x0004, "MBZ-13" }, + { 0x0008, "MBZ-12" }, + { 0x0010, "MBZ-11" }, + { 0x0020, "MBZ-10" }, + { 0x0040, "MBZ-9" }, + { 0x0080, "MBZ-8" }, + { 0x0100, "MBZ-7" }, + { 0x0200, "MBZ-6" }, + { 0x0400, "MBZ-5" }, + { 0x0800, "MBZ-4" }, + { 0x1000, "MBZ-3" }, + { 0x2000, "MBZ-2" }, + { 0x4000, "MBZ-1" }, + { 0x8000, "Retransmission Allowed" }, + { 0, NULL } + }; + +/* https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-2 */ static const struct attrtype { const char *name; /* Attribute name */ const char **subtypes; /* Standard Values (if any) */ @@ -530,6 +622,7 @@ static const struct attrtype { { "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 }, + /* ^ [0, 9] ^ */ { "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 }, @@ -540,6 +633,7 @@ static const struct attrtype { { "Unassigned", NULL, 0, 0, NULL }, /*17*/ { "Reply-Message", NULL, 0, 0, print_attr_string }, { "Callback-Number", NULL, 0, 0, print_attr_string }, + /* ^ [10, 19] ^ */ { "Callback-Id", NULL, 0, 0, print_attr_string }, { "Unassigned", NULL, 0, 0, NULL }, /*21*/ { "Framed-Route", NULL, 0, 0, print_attr_string }, @@ -550,6 +644,7 @@ static const struct attrtype { { "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 }, + /* ^ [20, 29] ^ */ { "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 }, @@ -560,6 +655,7 @@ static const struct attrtype { { "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 }, + /* ^ [30, 39] ^ */ { "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 }, @@ -570,6 +666,7 @@ static const struct attrtype { { "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 }, + /* ^ [40, 49] ^ */ { "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 }, @@ -580,6 +677,7 @@ static const struct attrtype { { "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 }, + /* ^ [50, 59] ^ */ { "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 }, @@ -590,6 +688,7 @@ static const struct attrtype { { "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 }, + /* ^ [60, 69] ^ */ { "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*/ @@ -600,6 +699,7 @@ static const struct attrtype { { "Connect-Info", NULL, 0, 0, print_attr_string }, { "Configuration-Token", NULL, 0, 0, print_attr_string }, { "EAP-Message", NULL, 0, 0, print_attr_string }, + /* ^ [70, 79] ^ */ { "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 }, @@ -610,6 +710,7 @@ static const struct attrtype { { "NAS-Port-Id", NULL, 0, 0, print_attr_string }, { "Framed-Pool", NULL, 0, 0, print_attr_string }, { "CUI", NULL, 0, 0, print_attr_string }, + /* ^ [80, 89] ^ */ { "Tunnel-Client-Auth-ID", NULL, 0, 0, print_attr_string }, { "Tunnel-Server-Auth-ID", NULL, 0, 0, print_attr_string }, { "NAS-Filter-Rule", NULL, 0, 0, print_attr_string }, @@ -620,6 +721,7 @@ static const struct attrtype { { "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 }, + /* ^ [90, 99] ^ */ { "Framed-IPv6-Pool", NULL, 0, 0, print_attr_string }, { "Error-Cause", NULL, 0, 0, print_attr_strange }, { "EAP-Key-Name", NULL, 0, 0, NULL }, @@ -630,6 +732,7 @@ static const struct attrtype { { "Digest-Nextnonce", NULL, 0, 0, print_attr_string }, { "Digest-Method", NULL, 0, 0, print_attr_string }, { "Digest-URI", NULL, 0, 0, print_attr_string }, + /* ^ [100, 109] ^ */ { "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 }, @@ -640,6 +743,7 @@ static const struct attrtype { { "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 }, + /* ^ [110, 119] ^ */ { "Digest-Stale", NULL, 0, 0, print_attr_string }, { "Digest-HA1", NULL, 0, 0, print_attr_string }, { "SIP-AOR", NULL, 0, 0, print_attr_string }, @@ -650,6 +754,7 @@ static const struct attrtype { { "Location-Information", NULL, 0, 0, print_attr_location_information }, { "Location-Data", NULL, 0, 0, print_attr_location_data }, { "Basic-Location-Policy-Rules", NULL, 0, 0, print_basic_location_policy_rules } + /* ^ [120, 129] ^ */ }; @@ -740,7 +845,6 @@ print_vendor_attr(netdissect_options *ndo, if (length < 4) goto trunc; - ND_TCHECK_4(data); vendor_id = GET_BE_U_4(data); data+=4; length-=4; @@ -750,8 +854,6 @@ print_vendor_attr(netdissect_options *ndo, vendor_id); while (length >= 2) { - ND_TCHECK_2(data); - vendor_type = GET_U_1(data); vendor_length = GET_U_1(data + 1); @@ -806,7 +908,6 @@ print_attr_num(netdissect_options *ndo, return; } - ND_TCHECK_4(data); /* This attribute has standard values */ if (attr_type[attr_code].siz_subtypes) { @@ -903,11 +1004,6 @@ print_attr_num(netdissect_options *ndo, } /* switch */ } /* if-else */ - - return; - - trunc: - nd_print_trunc(ndo); } /*****************************/ @@ -927,8 +1023,6 @@ print_attr_address(netdissect_options *ndo, return; } - ND_TCHECK_4(data); - switch(attr_code) { case FRM_IPADDR: @@ -946,11 +1040,6 @@ print_attr_address(netdissect_options *ndo, ND_PRINT("%s", GET_IPADDR_STRING(data)); break; } - - return; - - trunc: - nd_print_trunc(ndo); } /*****************************/ @@ -970,14 +1059,7 @@ print_attr_address6(netdissect_options *ndo, return; } - ND_TCHECK_16(data); - ND_PRINT("%s", GET_IP6ADDR_STRING(data)); - - return; - - trunc: - nd_print_trunc(ndo); } static void @@ -1041,7 +1123,6 @@ static void print_attr_operator_name(netdissect_options *ndo, const u_char *data, u_int length, u_short attr_code _U_) { - u_int i; u_int namespace_value; ND_TCHECK_LEN(data, length); @@ -1050,12 +1131,11 @@ print_attr_operator_name(netdissect_options *ndo, ND_PRINT("ERROR: length %u < 2", length); return; } - namespace_value = EXTRACT_U_1(data); + namespace_value = GET_U_1(data); data++; - ND_PRINT("[%s] ", tok2str(operator_name_vector, "Namespace %u not known", namespace_value)); + ND_PRINT("[%s] ", tok2str(operator_name_vector, "unknown namespace %u", namespace_value)); - for (i=0; i < length-1 && EXTRACT_U_1(data); i++, data++) - ND_PRINT("%c", ND_ASCII_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.'); + nd_printjn(ndo, data, length - 1); return; @@ -1067,10 +1147,8 @@ static void print_attr_location_information(netdissect_options *ndo, const u_char *data, u_int length, u_short attr_code _U_) { - u_int i; - u_int16_t index; - u_int8_t code, entity; - u_int64_t sighting_time, time_to_live; + uint16_t index; + uint8_t code, entity; ND_TCHECK_LEN(data, length); if (length < 21) @@ -1079,31 +1157,34 @@ print_attr_location_information(netdissect_options *ndo, return; } - index = EXTRACT_BE_U_2(data); + index = GET_BE_U_2(data); data += 2; - code = EXTRACT_U_1(data); + code = GET_U_1(data); data++; - entity = EXTRACT_U_1(data); + entity = GET_U_1(data); data++; - sighting_time = EXTRACT_BE_U_8(data); - data += 8; + ND_PRINT("index %u, code %s, entity %s, ", + index, + tok2str(location_information_code_vector, "Unknown (%u)", code), + tok2str(location_information_entity_vector, "Unknown (%u)", entity) + ); - time_to_live = EXTRACT_BE_U_8(data); + ND_PRINT("sighting time "); + p_ntp_time(ndo, (const struct l_fixedpt *)data); + ND_PRINT(", "); data += 8; - ND_PRINT("Index %u, code %s, entity %s, sighting time %llu, time to live %llu: ", - index, - tok2str(location_information_code_vector, "Code %u not known", code), - tok2str(location_information_entity_vector, "Entity %u not known", entity), - sighting_time, // FIXME: NTP format, should share code from print-ntp.c? - time_to_live // FIXME: NTP format, should share code from print-ntp.c? - ); + ND_PRINT("time to live "); + p_ntp_time(ndo, (const struct l_fixedpt *)data); + ND_PRINT(", "); + data += 8; - for (i=0; i < length-20 && EXTRACT_U_1(data); i++, data++) - ND_PRINT("%c", ND_ASCII_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.'); + ND_PRINT("method \""); + nd_printjn(ndo, data, length - 20); + ND_PRINT("\""); return; @@ -1115,8 +1196,7 @@ static void print_attr_location_data(netdissect_options *ndo, const u_char *data, u_int length, u_short attr_code _U_) { - u_int i; - u_int16_t index; + uint16_t index; ND_TCHECK_LEN(data, length); if (length < 3) @@ -1125,12 +1205,18 @@ print_attr_location_data(netdissect_options *ndo, return; } - index = EXTRACT_BE_U_2(data); + index = GET_BE_U_2(data); data += 2; - ND_PRINT("Index %u: ", index); - - for (i=0; i < length-2 && EXTRACT_U_1(data); i++, data++) - ND_PRINT("%c", ND_ASCII_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.'); + ND_PRINT("index %u, location", index); + + /* The Location field of the String field of the Location-Data attribute + * can have two completely different structures depending on the value of + * the Code field of a Location-Info attribute, which supposedly precedes + * the current attribute. Unfortunately, this choice of encoding makes it + * non-trivial to decode the Location field without preserving some state + * between the attributes. + */ + hex_and_ascii_print(ndo, "\n\t ", data, length - 2); return; @@ -1142,9 +1228,7 @@ static void print_basic_location_policy_rules(netdissect_options *ndo, const u_char *data, u_int length, u_short attr_code _U_) { - u_int i; - u_int16_t flags; - u_int64_t retention_expires; + uint16_t flags; ND_TCHECK_LEN(data, length); if (length < 10) @@ -1153,19 +1237,19 @@ print_basic_location_policy_rules(netdissect_options *ndo, return; } - flags = EXTRACT_BE_U_2(data); + flags = GET_BE_U_2(data); data += 2; + ND_PRINT("flags [%s], ", bittok2str(blpr_bm, "none", flags)); - retention_expires = EXTRACT_BE_U_8(data); + ND_PRINT("retention expires "); + p_ntp_time(ndo, (const struct l_fixedpt *)data); data += 8; - ND_PRINT("Flags: %s, retention expires %llu: ", - flags & 0x8000 ? "Retransmission Allowed" : "none", - retention_expires - ); - - for (i=0; i < length-10 && EXTRACT_U_1(data); i++, data++) - ND_PRINT("%c", ND_ASCII_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.'); + if (length > 10) { + ND_PRINT(", note well \""); + nd_printjn(ndo, data, length - 10); + ND_PRINT("\""); + } return; @@ -1195,17 +1279,11 @@ print_attr_time(netdissect_options *ndo, return; } - ND_TCHECK_4(data); - attr_time = GET_BE_U_4(data); strlcpy(string, ctime(&attr_time), sizeof(string)); /* Get rid of the newline */ string[24] = '\0'; ND_PRINT("%.24s", string); - return; - - trunc: - nd_print_trunc(ndo); } static void @@ -1236,8 +1314,6 @@ print_attr_vector64(netdissect_options *ndo, } ND_PRINT("]"); - - return; } /***********************************/ @@ -1279,13 +1355,11 @@ print_attr_strange(netdissect_options *ndo, ND_PRINT("ERROR: length %u != 14", length); return; } - ND_TCHECK_1(data); if (GET_U_1(data)) ND_PRINT("User can change password"); else ND_PRINT("User cannot change password"); data++; - ND_TCHECK_1(data); ND_PRINT(", Min password length: %u", GET_U_1(data)); data++; ND_PRINT(", created at: "); @@ -1319,7 +1393,6 @@ print_attr_strange(netdissect_options *ndo, ND_PRINT("Error: length %u != 4", length); return; } - ND_TCHECK_4(data); error_cause_value = GET_BE_U_4(data); ND_PRINT("Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value));