Extract errno value_strings from usb code
authorPeter Wu <peter@lekensteyn.nl>
Mon, 8 Aug 2016 12:51:38 +0000 (14:51 +0200)
committerAnders Broman <a.broman58@gmail.com>
Mon, 12 Jun 2017 06:34:16 +0000 (06:34 +0000)
The convention of returning negative errno codes from the Linux kernel
is not just limited to usb/usbip, it is also needed by netlink. Now
netlink error codes are properly dissected.

Also add ERFKILL and EHWPOISON (since 2009 and 2011) and change ESTALE
and ENOSYS to match the current description as of Linux 4.7. Fixed
header paths in comments too.

Used this command to generate the table (with fixups for gaps):

    cpp -dM -CC include/uapi/asm-generic/errno.h |
    perl -ne '/^#define (E[A-Z0-9]+) ([0-9]+) \/\* (.+) \*\// &&
    printf "    { -%-4s \"%s (-%s)\" },\n", "$2,", $3, $1' | sort -k2

Change-Id: I16fa41a42bd4201a8383ea8e70a0aa8a597b311d
Reviewed-on: https://code.wireshark.org/review/16952
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/CMakeLists.txt
epan/dissectors/Makefile.am
epan/dissectors/errno.c [new file with mode: 0644]
epan/dissectors/packet-netlink.c
epan/dissectors/packet-usb.c
epan/dissectors/packet-usb.h
epan/dissectors/packet-usbip.c

index f10850f38491cf585751569d8722798da7b15304..f5fda870d840bd19dcbe76914709d99a1d71e79b 100644 (file)
@@ -1427,6 +1427,7 @@ set(DISSECTOR_SRC
 )
 
 set(DISSECTOR_SUPPORT_SRC
+       errno.c
        packet-dcerpc-nt.c
        usb.c
        snort-config.c
index 4a8e20675cc9bdd13341e9a6c8229b624c9607ee..e24bcc4773e91a7f3fcad2c901a9f4e202ca8001 100644 (file)
@@ -1842,6 +1842,7 @@ DISSECTOR_INCLUDES = \
 # directory, but they're not dissectors themselves, i.e. they're not
 # used to generate "register.c").
 DISSECTOR_SUPPORT_SRC =        \
+       errno.c                 \
        packet-dcerpc-nt.c      \
        snort-config.c          \
        usb.c                   \
diff --git a/epan/dissectors/errno.c b/epan/dissectors/errno.c
new file mode 100644 (file)
index 0000000..ca40cd3
--- /dev/null
@@ -0,0 +1,182 @@
+/* errno.c
+ * String descriptions for errno values.
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <epan/value_string.h>
+
+/* Note: sorted in (unsigned) ascending order with no gaps to enable direct,
+ * array-indexed access. */
+static const value_string linux_negative_errno_vals[] = {
+    /* from include/uapi/asm-generic/errno.h */
+    { -133, "Memory page has hardware error (-EHWPOISON)" },
+    { -132, "Operation not possible due to RF-kill (-ERFKILL)" },
+    { -131, "State not recoverable (-ENOTRECOVERABLE)" },
+    { -130, "Owner died (-EOWNERDEAD)" },
+    { -129, "Key was rejected by service (-EKEYREJECTED)" },
+    { -128, "Key has been revoked (-EKEYREVOKED)" },
+    { -127, "Key has expired (-EKEYEXPIRED)" },
+    { -126, "Required key not available (-ENOKEY)" },
+    { -125, "Operation Canceled (-ECANCELED)" },
+    { -124, "Wrong medium type (-EMEDIUMTYPE)" },
+    { -123, "No medium found (-ENOMEDIUM)" },
+    { -122, "Quota exceeded (-EDQUOT)" },
+    { -121, "Remote I/O error (-EREMOTEIO)" },
+    { -120, "Is a named type file (-EISNAM)" },
+    { -119, "No XENIX semaphores available (-ENAVAIL)" },
+    { -118, "Not a XENIX named type file (-ENOTNAM)" },
+    { -117, "Structure needs cleaning (-EUCLEAN)" },
+    { -116, "Stale file handle (-ESTALE)" },
+    { -115, "Operation now in progress (-EINPROGRESS)" },
+    { -114, "Operation already in progress (-EALREADY)" },
+    { -113, "No route to host (-EHOSTUNREACH)" },
+    { -112, "Host is down (-EHOSTDOWN)" },
+    { -111, "Connection refused (-ECONNREFUSED)" },
+    { -110, "Connection timed out (-ETIMEDOUT)" },
+    { -109, "Too many references: cannot splice (-ETOOMANYREFS)" },
+    { -108, "Cannot send after transport endpoint shutdown (-ESHUTDOWN)" },
+    { -107, "Transport endpoint is not connected (-ENOTCONN)" },
+    { -106, "Transport endpoint is already connected (-EISCONN)" },
+    { -105, "No buffer space available (-ENOBUFS)" },
+    { -104, "Connection reset by peer (-ECONNRESET)" },
+    { -103, "Software caused connection abort (-ECONNABORTED)" },
+    { -102, "Network dropped connection because of reset (-ENETRESET)" },
+    { -101, "Network is unreachable (-ENETUNREACH)" },
+    { -100, "Network is down (-ENETDOWN)" },
+    { -99,  "Cannot assign requested address (-EADDRNOTAVAIL)" },
+    { -98,  "Address already in use (-EADDRINUSE)" },
+    { -97,  "Address family not supported by protocol (-EAFNOSUPPORT)" },
+    { -96,  "Protocol family not supported (-EPFNOSUPPORT)" },
+    { -95,  "Operation not supported on transport endpoint (-EOPNOTSUPP)" },
+    { -94,  "Socket type not supported (-ESOCKTNOSUPPORT)" },
+    { -93,  "Protocol not supported (-EPROTONOSUPPORT)" },
+    { -92,  "Protocol not available (-ENOPROTOOPT)" },
+    { -91,  "Protocol wrong type for socket (-EPROTOTYPE)" },
+    { -90,  "Message too long (-EMSGSIZE)" },
+    { -89,  "Destination address required (-EDESTADDRREQ)" },
+    { -88,  "Socket operation on non-socket (-ENOTSOCK)" },
+    { -87,  "Too many users (-EUSERS)" },
+    { -86,  "Streams pipe error (-ESTRPIPE)" },
+    { -85,  "Interrupted system call should be restarted (-ERESTART)" },
+    { -84,  "Illegal byte sequence (-EILSEQ)" },
+    { -83,  "Cannot exec a shared library directly (-ELIBEXEC)" },
+    { -82,  "Attempting to link in too many shared libraries (-ELIBMAX)" },
+    { -81,  ".lib section in a.out corrupted (-ELIBSCN)" },
+    { -80,  "Accessing a corrupted shared library (-ELIBBAD)" },
+    { -79,  "Can not access a needed shared library (-ELIBACC)" },
+    { -78,  "Remote address changed (-EREMCHG)" },
+    { -77,  "File descriptor in bad state (-EBADFD)" },
+    { -76,  "Name not unique on network (-ENOTUNIQ)" },
+    { -75,  "Value too large for defined data type (-EOVERFLOW)" },
+    { -74,  "Not a data message (-EBADMSG)" },
+    { -73,  "RFS specific error (-EDOTDOT)" },
+    { -72,  "Multihop attempted (-EMULTIHOP)" },
+    { -71,  "Protocol error (-EPROTO)" },
+    { -70,  "Communication error on send (-ECOMM)" },
+    { -69,  "Srmount error (-ESRMNT)" },
+    { -68,  "Advertise error (-EADV)" },
+    { -67,  "Link has been severed (-ENOLINK)" },
+    { -66,  "Object is remote (-EREMOTE)" },
+    { -65,  "Package not installed (-ENOPKG)" },
+    { -64,  "Machine is not on the network (-ENONET)" },
+    { -63,  "Out of streams resources (-ENOSR)" },
+    { -62,  "Timer expired (-ETIME)" },
+    { -61,  "No data available (-ENODATA)" },
+    { -60,  "Device not a stream (-ENOSTR)" },
+    { -59,  "Bad font file format (-EBFONT)" },
+    { -58,  "(-58 \?\?\?)" },   /* dummy so that there are no "gaps" */
+    { -57,  "Invalid slot (-EBADSLT)" },
+    { -56,  "Invalid request code (-EBADRQC)" },
+    { -55,  "No anode (-ENOANO)" },
+    { -54,  "Exchange full (-EXFULL)" },
+    { -53,  "Invalid request descriptor (-EBADR)" },
+    { -52,  "Invalid exchange (-EBADE)" },
+    { -51,  "Level 2 halted (-EL2HLT)" },
+    { -50,  "No CSI structure available (-ENOCSI)" },
+    { -49,  "Protocol driver not attached (-EUNATCH)" },
+    { -48,  "Link number out of range (-ELNRNG)" },
+    { -47,  "Level 3 reset (-EL3RST)" },
+    { -46,  "Level 3 halted (-EL3HLT)" },
+    { -45,  "Level 2 not synchronized (-EL2NSYNC)" },
+    { -44,  "Channel number out of range (-ECHRNG)" },
+    { -43,  "Identifier removed (-EIDRM)" },
+    { -42,  "No message of desired type (-ENOMSG)" },
+    { -41,  "(-41 \?\?\?)" },   /* dummy so that there are no "gaps" */
+    { -40,  "Too many symbolic links encountered (-ELOOP)" },
+    { -39,  "Directory not empty (-ENOTEMPTY)" },
+    { -38,  "Invalid system call number (-ENOSYS)" },
+    { -37,  "No record locks available (-ENOLCK)" },
+    { -36,  "File name too long (-ENAMETOOLONG)" },
+    { -35,  "Resource deadlock would occur (-EDEADLK)" },
+    /* from include/uapi/asm-generic/errno-base.h */
+    { -34,  "Math result not representable (-ERANGE)" },
+    { -33,  "Math argument out of domain of func (-EDOM)" },
+    { -32,  "Broken pipe (-EPIPE)" },
+    { -31,  "Too many links (-EMLINK)" },
+    { -30,  "Read-only file system (-EROFS)" },
+    { -29,  "Illegal seek (-ESPIPE)" },
+    { -28,  "No space left on device (-ENOSPC)" },
+    { -27,  "File too large (-EFBIG)" },
+    { -26,  "Text file busy (-ETXTBSY)" },
+    { -25,  "Not a typewriter (-ENOTTY)" },
+    { -24,  "Too many open files (-EMFILE)" },
+    { -23,  "File table overflow (-ENFILE)" },
+    { -22,  "Invalid argument (-EINVAL)" },
+    { -21,  "Is a directory (-EISDIR)" },
+    { -20,  "Not a directory (-ENOTDIR)" },
+    { -19,  "No such device (-ENODEV)" },
+    { -18,  "Cross-device link (-EXDEV)" },
+    { -17,  "File exists (-EEXIST)" },
+    { -16,  "Device or resource busy (-EBUSY)" },
+    { -15,  "Block device required (-ENOTBLK)" },
+    { -14,  "Bad address (-EFAULT)" },
+    { -13,  "Permission denied (-EACCES)" },
+    { -12,  "Out of memory (-ENOMEM)" },
+    { -11,  "Try again (-EAGAIN)" },
+    { -10,  "No child processes (-ECHILD)" },
+    { -9,   "Bad file number (-EBADF)" },
+    { -8,   "Exec format error (-ENOEXEC)" },
+    { -7,   "Argument list too long (-E2BIG)" },
+    { -6,   "No such device or address (-ENXIO)" },
+    { -5,   "I/O error (-EIO)" },
+    { -4,   "Interrupted system call (-EINTR)" },
+    { -3,   "No such process (-ESRCH)" },
+    { -2,   "No such file or directory (-ENOENT)" },
+    { -1,   "Operation not permitted (-EPERM)" },
+    { 0,    "Success" },
+    { 0, NULL }
+};
+
+value_string_ext linux_negative_errno_vals_ext = VALUE_STRING_EXT_INIT(linux_negative_errno_vals);
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
index a9c4078326694d2185e2074858125f43e6501748..34c3ff3c90873a1fc76015e87879529879020df5 100644 (file)
@@ -79,6 +79,8 @@ static const value_string ha_types[] = {
        { 0, NULL }
 };
 
+extern value_string_ext linux_negative_errno_vals_ext;
+
 static dissector_handle_t netlink_handle;
 
 static header_field_info *hfi_netlink = NULL;
@@ -192,8 +194,8 @@ static header_field_info hfi_netlink_attr_data NETLINK_HFI_INIT =
 
 /* TODO add a value_string for errno. */
 static header_field_info hfi_netlink_error NETLINK_HFI_INIT =
-       { "Error code", "netlink.error", FT_INT32, BASE_DEC,
-               NULL, 0x00, "Negative errno or 0 for acknowledgements", HFILL };
+       { "Error code", "netlink.error", FT_INT32, BASE_DEC | BASE_EXT_STRING,
+               &linux_negative_errno_vals_ext, 0x00, "Negative errno or 0 for acknowledgements", HFILL };
 
 static gint ett_netlink_cooked = -1;
 static gint ett_netlink_msghdr = -1;
index 942a3528d376ff2288ea8b447d0898d7b16f2c42..b3498c0fc44793f9937cd7846d5fb3c4326a3134 100644 (file)
@@ -772,6 +772,7 @@ static const value_string usb_endpoint_direction_vals[] = {
 extern value_string_ext ext_usb_vendors_vals;
 extern value_string_ext ext_usb_products_vals;
 extern value_string_ext ext_usb_com_subclass_vals;
+extern value_string_ext linux_negative_errno_vals_ext;
 
 /*
  * Standard descriptor types.
@@ -903,146 +904,6 @@ static const value_string usb_wMaxPacketSize_slots_vals[]  = {
     {0, NULL}
 };
 
-/* Note: sorted in (unsigned) ascending order */
-static const value_string usb_urb_status_vals[] = {
-    /* from linux/include/asm-generic/errno.h*/
-    { -131, "State not recoverable (-ENOTRECOVERABLE)" },
-    { -130, "Owner died (-EOWNERDEAD)" },
-    { -129, "Key was rejected by service (-EKEYREJECTED)" },
-    { -128, "Key has been revoked (-EKEYREVOKED)" },
-    { -127, "Key has expired (-EKEYEXPIRED)" },
-    { -126, "Required key not available (-ENOKEY)" },
-    { -125, "Operation Canceled (-ECANCELED)" },
-    { -124, "Wrong medium type (-EMEDIUMTYPE)" },
-    { -123, "No medium found (-ENOMEDIUM)" },
-    { -122, "Quota exceeded (-EDQUOT)" },
-    { -121, "Remote I/O error (-EREMOTEIO)" },
-    { -120, "Is a named type file (-EISNAM)" },
-    { -119, "No XENIX semaphores available (-ENAVAIL)" },
-    { -118, "Not a XENIX named type file (-ENOTNAM)" },
-    { -117, "Structure needs cleaning (-EUCLEAN)" },
-    { -116, "Stale NFS file handle (-ESTALE)" },
-    { -115, "Operation now in progress (-EINPROGRESS)" },
-    { -114, "Operation already in progress (-EALREADY)" },
-    { -113, "No route to host (-EHOSTUNREACH)" },
-    { -112, "Host is down (-EHOSTDOWN)" },
-    { -111, "Connection refused (-ECONNREFUSED)" },
-    { -110, "Connection timed out (-ETIMEDOUT)" },
-    { -109, "Too many references: cannot splice (-ETOOMANYREFS)" },
-    { -108, "Cannot send after transport endpoint shutdown (-ESHUTDOWN)" },
-    { -107, "Transport endpoint is not connected (-ENOTCONN)" },
-    { -106, "Transport endpoint is already connected (-EISCONN)" },
-    { -105, "No buffer space available (-ENOBUFS)" },
-    { -104, "Connection reset by peer (-ECONNRESET)" },
-    { -103, "Software caused connection abort (-ECONNABORTED)" },
-    { -102, "Network dropped connection because of reset (-ENETRESET)" },
-    { -101, "Network is unreachable (-ENETUNREACH)" },
-    { -100, "Network is down (-ENETDOWN)" },
-    { -99,  "Cannot assign requested address (-EADDRNOTAVAIL)" },
-    { -98,  "Address already in use (-EADDRINUSE)" },
-    { -97,  "Address family not supported by protocol (-EAFNOSUPPORT)" },
-    { -96,  "Protocol family not supported (-EPFNOSUPPORT)" },
-    { -95,  "Operation not supported on transport endpoint (-EOPNOTSUPP)" },
-    { -94,  "Socket type not supported (-ESOCKTNOSUPPORT)" },
-    { -93,  "Protocol not supported (-EPROTONOSUPPORT)" },
-    { -92,  "Protocol not available (-ENOPROTOOPT)" },
-    { -91,  "Protocol wrong type for socket (-EPROTOTYPE)" },
-    { -90,  "Message too long (-EMSGSIZE)" },
-    { -89,  "Destination address required (-EDESTADDRREQ)" },
-    { -88,  "Socket operation on non-socket (-ENOTSOCK)" },
-    { -87,  "Too many users (-EUSERS)" },
-    { -86,  "Streams pipe error (-ESTRPIPE)" },
-    { -85,  "Interrupted system call should be restarted (-ERESTART)" },
-    { -84,  "Illegal byte sequence (-EILSEQ)" },
-    { -83,  "Cannot exec a shared library directly (-ELIBEXEC)" },
-    { -82,  "Attempting to link in too many shared libraries (-ELIBMAX)" },
-    { -81,  ".lib section in a.out corrupted (-ELIBSCN)" },
-    { -80,  "Accessing a corrupted shared library (-ELIBBAD)" },
-    { -79,  "Can not access a needed shared library (-ELIBACC)" },
-    { -78,  "Remote address changed (-EREMCHG)" },
-    { -77,  "File descriptor in bad state (-EBADFD)" },
-    { -76,  "Name not unique on network (-ENOTUNIQ)" },
-    { -75,  "Value too large for defined data type (-EOVERFLOW)" },
-    { -74,  "Not a data message (-EBADMSG)" },
-    { -73,  "RFS specific error (-EDOTDOT)" },
-    { -72,  "Multihop attempted (-EMULTIHOP)" },
-    { -71,  "Protocol error (-EPROTO)" },
-    { -70,  "Communication error on send (-ECOMM)" },
-    { -69,  "Srmount error (-ESRMNT)" },
-    { -68,  "Advertise error (-EADV)" },
-    { -67,  "Link has been severed (-ENOLINK)" },
-    { -66,  "Object is remote (-EREMOTE)" },
-    { -65,  "Package not installed (-ENOPKG)" },
-    { -64,  "Machine is not on the network (-ENONET)" },
-    { -63,  "Out of streams resources (-ENOSR)" },
-    { -62,  "Timer expired (-ETIME)" },
-    { -61,  "No data available (-ENODATA)" },
-    { -60,  "Device not a stream (-ENOSTR)" },
-    { -59,  "Bad font file format (-EBFONT)" },
-    { -58,  "(-58 \?\?\?)" },   /* dummy so that there are no "gaps" */
-    { -57,  "Invalid slot (-EBADSLT)" },
-    { -56,  "Invalid request code (-EBADRQC)" },
-    { -55,  "No anode (-ENOANO)" },
-    { -54,  "Exchange full (-EXFULL)" },
-    { -53,  "Invalid request descriptor (-EBADR)" },
-    { -52,  "Invalid exchange (-EBADE)" },
-    { -51,  "Level 2 halted (-EL2HLT)" },
-    { -50,  "No CSI structure available (-ENOCSI)" },
-    { -49,  "Protocol driver not attached (-EUNATCH)" },
-    { -48,  "Link number out of range (-ELNRNG)" },
-    { -47,  "Level 3 reset (-EL3RST)" },
-    { -46,  "Level 3 halted (-EL3HLT)" },
-    { -45,  "Level 2 not synchronized (-EL2NSYNC)" },
-    { -44,  "Channel number out of range (-ECHRNG)" },
-    { -43,  "Identifier removed (-EIDRM)" },
-    { -42,  "No message of desired type (-ENOMSG)" },
-    { -41,  "(-41 \?\?\?)" },   /* dummy so that there are no "gaps" */
-    { -40,  "Too many symbolic links encountered (-ELOOP)" },
-    { -39,  "Directory not empty (-ENOTEMPTY)" },
-    { -38,  "Function not implemented (-ENOSYS)" },
-    { -37,  "No record locks available (-ENOLCK)" },
-    { -36,  "File name too long (-ENAMETOOLONG)" },
-    { -35,  "Resource deadlock would occur (-EDEADLK)" },
-    /* from linux/include/asm-generic/errno.h */
-    { -34,  "Math result not representable (-ERANGE)" },
-    { -33,  "Math argument out of domain of func (-EDOM)" },
-    { -32,  "Broken pipe (-EPIPE)" },
-    { -31,  "Too many links (-EMLINK)" },
-    { -30,  "Read-only file system (-EROFS)" },
-    { -29,  "Illegal seek (-ESPIPE)" },
-    { -28,  "No space left on device (-ENOSPC)" },
-    { -27,  "File too large (-EFBIG)" },
-    { -26,  "Text file busy (-ETXTBSY)" },
-    { -25,  "Not a typewriter (-ENOTTY)" },
-    { -24,  "Too many open files (-EMFILE)" },
-    { -23,  "File table overflow (-ENFILE)" },
-    { -22,  "Invalid argument (-EINVAL)" },
-    { -21,  "Is a directory (-EISDIR)" },
-    { -20,  "Not a directory (-ENOTDIR)" },
-    { -19,  "No such device (-ENODEV)" },
-    { -18,  "Cross-device link (-EXDEV)" },
-    { -17,  "File exists (-EEXIST)" },
-    { -16,  "Device or resource busy (-EBUSY)" },
-    { -15,  "Block device required (-ENOTBLK)" },
-    { -14,  "Bad address (-EFAULT)" },
-    { -13,  "Permission denied (-EACCES)" },
-    { -12,  "Out of memory (-ENOMEM)" },
-    { -11,  "Try again (-EAGAIN)" },
-    { -10,  "No child processes (-ECHILD)" },
-    { -9,   "Bad file number (-EBADF)" },
-    { -8,   "Exec format error (-ENOEXEC)" },
-    { -7,   "Argument list too long (-E2BIG)" },
-    { -6,   "No such device or address (-ENXIO)" },
-    { -5,   "I/O error (-EIO)" },
-    { -4,   "Interrupted system call (-EINTR)" },
-    { -3,   "No such process (-ESRCH)" },
-    { -2,   "No such file or directory (-ENOENT)" },
-    { -1,   "Operation not permitted (-EPERM)" },
-    { 0,    "Success"},
-    { 0, NULL }
-};
-value_string_ext usb_urb_status_vals_ext = VALUE_STRING_EXT_INIT(usb_urb_status_vals);
-
 #define USB_CONTROL_STAGE_SETUP  0x00
 #define USB_CONTROL_STAGE_DATA   0x01
 #define USB_CONTROL_STAGE_STATUS 0x02
@@ -3980,7 +3841,7 @@ dissect_linux_usb_iso_transfer(packet_info *pinfo _U_, proto_tree *urb_tree,
         tvb_memcpy(tvb, (guint8 *)&iso_len, offset+8,  4);
 
         iso_desc_ti = proto_tree_add_protocol_format(urb_tree, proto_usb, tvb, offset,
-                16, "USB isodesc %u [%s]", i, val_to_str_ext(iso_status, &usb_urb_status_vals_ext, "Error %d"));
+                16, "USB isodesc %u [%s]", i, val_to_str_ext(iso_status, &linux_negative_errno_vals_ext, "Error %d"));
         if (iso_len > 0)
             proto_item_append_text(iso_desc_ti, " (%u bytes)", iso_len);
         iso_desc_tree = proto_item_add_subtree(iso_desc_ti, ett_usb_isodesc);
@@ -4048,7 +3909,7 @@ dissect_usbip_iso_transfer(packet_info *pinfo _U_, proto_tree *urb_tree,
 
         iso_status = tvb_get_ntohl(tvb, desc_offset + 12);
         iso_desc_ti = proto_tree_add_protocol_format(urb_tree, proto_usb, tvb, desc_offset,
-                16, "USB isodesc %u [%s]", i, val_to_str_ext(iso_status, &usb_urb_status_vals_ext, "Error %d"));
+                16, "USB isodesc %u [%s]", i, val_to_str_ext(iso_status, &linux_negative_errno_vals_ext, "Error %d"));
         iso_desc_tree = proto_item_add_subtree(iso_desc_ti, ett_usb_isodesc);
 
         proto_tree_add_item_ret_uint(iso_desc_tree, hf_usb_iso_off, tvb, desc_offset, 4, ENC_BIG_ENDIAN, &iso_off);
@@ -4929,7 +4790,7 @@ proto_register_usb(void)
 
         { &hf_usb_urb_status,
           { "URB status", "usb.urb_status",
-            FT_INT32, BASE_DEC|BASE_EXT_STRING, &usb_urb_status_vals_ext, 0x0,
+            FT_INT32, BASE_DEC|BASE_EXT_STRING, &linux_negative_errno_vals_ext, 0x0,
             NULL, HFILL }},
 
         { &hf_usb_urb_len,
@@ -5205,7 +5066,7 @@ proto_register_usb(void)
         /* fields of struct mon_bin_isodesc from linux/drivers/usb/mon/mon_bin.c */
         { &hf_usb_iso_status,                     /* host endian byte order */
           { "Status", "usb.iso.iso_status",
-            FT_INT32, BASE_DEC|BASE_EXT_STRING, &usb_urb_status_vals_ext, 0x0,
+            FT_INT32, BASE_DEC|BASE_EXT_STRING, &linux_negative_errno_vals_ext, 0x0,
             "ISO descriptor status", HFILL }},
 
         { &hf_usb_iso_off,                        /* host endian byte order */
index 5f058fad9a1dfad963f0674a6d2fda926c32d6cd..6455016d6d1e8d24e3868527589bf85103ae8273 100644 (file)
@@ -235,8 +235,6 @@ extern const true_false_string tfs_endpoint_direction;
 
 extern value_string_ext usb_class_vals_ext;
 
-extern value_string_ext usb_urb_status_vals_ext;
-
 usb_conv_info_t *get_usb_iface_conv_info(packet_info *pinfo, guint8 interface_num);
 
 proto_item * dissect_usb_descriptor_header(proto_tree *tree,
index 38e0a443eeac18b1a45fb5c3723e9938d719fe2e..e6f632cbae3730d97d56f4f3ea1f226c43b4eb85 100644 (file)
@@ -164,6 +164,7 @@ static value_string_ext usbip_urb_vals_ext = VALUE_STRING_EXT_INIT(usbip_urb_val
 
 extern value_string_ext ext_usb_vendors_vals;
 extern value_string_ext ext_usb_products_vals;
+extern value_string_ext linux_negative_errno_vals_ext;
 
 static const value_string usb_endpoint_direction_vals[] = {
     {USBIP_DIR_OUT, "OUT"                        },
@@ -853,7 +854,7 @@ proto_register_usbip(void)
 
         {&hf_usbip_status,
          {"Status",                        "usbip.status",
-            FT_INT32, BASE_DEC | BASE_EXT_STRING, &usb_urb_status_vals_ext, 0,
+            FT_INT32, BASE_DEC | BASE_EXT_STRING, &linux_negative_errno_vals_ext, 0,
             "USBIP Status", HFILL}},
 
         {&hf_usbip_number_devices,