Add LINKTYPE_IPMI_HPM_2/DLT_IPMI_HPM_2.
Don't treat 65535 as the maximum snapshot length.

Make it 131072, instead; the MTU on the Linux loopback interface, in at
least some versions of the kernel, is 65536, and that doesn't count the
fake Ethernet header, so we need a value bigger than 65536.  We don't
want a value that's *too* large, so that it causes attempts to allocate
huge amounts of memory, however.

Make it a #define while we're at it.
Boost the maximum snapshot length to 262144, for USBPcap.
Expand a comment (extra information taken from tcpdump's equivalent comment).
changes for 1.6.0 release prep
updated VERSION file
updated VERSION file for trunk
Don't build the USB probing code if we don't have <linux/usbdevice_fs.h>.

That code requires a structure from that header, so, if the header is
missing, don't build it and don't call it.
Check whether we have -lusb-1.0 and it has libusb_init().

Don't just check for the libusb header file - apparently at least some
Linux distributions can't install both the 32-bit and 64-bit developer
versions of the libusb library, so you might have the libusb header, and
the library for one bit-width, but not the library for the other
bit-width, so the configure would succeed for the other bit-width but
the build would fail.
Check for the libusb header *and* library.

Belt and suspenders, just in case some Linux distribution rudely
surprises us.
Fail if the user asks for --enable-{sniffing type} and we can't provide it.

Treat --enable-{sniffing type} as a demand that we provide it; if we
can't do so, fail, don't just warn about its absence (with a message
that might well get lost amongst the other configure-script output) and
drive on.  If they don't demand it, provide it if we can, warn and drive
on if we can't.
diff --git a/configure b/configure
index 9c222a5..dc4d131 100755
--- a/configure
+++ b/configure
@@ -8000,7 +8000,7 @@ esac
 if test "${enable_bluetooth+set}" = set; then :
   enableval=$enable_bluetooth;
 else
-  enable_bluetooth=yes
+  enable_bluetooth=ifsupportavailable
 fi

@@ -8094,18 +8094,30 @@ $as_echo "#define PCAP_SUPPORT_BT_MONITOR /**/" >>confdefs.h
 			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
 		      fi
 		    fi
+		    ac_lbl_bluetooth_available=yes

 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
-$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
+  ac_lbl_bluetooth_available=no

 fi

+		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
+		    if test "x$enable_bluetooth" = "xyes" ; then
+			as_fn_error $? "Bluetooth sniffing is not supported; install bluez-lib devel to enable it" "$LINENO" 5
+		    else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
+$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
+		    fi
+		fi
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
+		if test "x$enable_bluetooth" = "xyes" ; then
+		    as_fn_error $? "no Bluetooth sniffing support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
 $as_echo "$as_me: no Bluetooth sniffing support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac

@@ -8117,7 +8129,7 @@ fi
 if test "${enable_canusb+set}" = set; then :
   enableval=$enable_canusb;
 else
-  enable_canusb=yes
+  enable_canusb=ifsupportavailable
 fi

@@ -8170,27 +8182,39 @@ $as_echo "#define PCAP_SUPPORT_CANUSB 1" >>confdefs.h

 			CANUSB_SRC=pcap-canusb-linux.c
 			LIBS="-lusb-1.0 -lpthread $LIBS"
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
-$as_echo "$as_me: canusb sniffing is supported" >&6;}
+			ac_lbl_has_libusb=yes

 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
-$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+  ac_lbl_has_libusb=no

 fi

 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
-$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+  ac_lbl_has_libusb=no

 fi

+		if test "x$ac_lbl_has_libusb" = "xyes" ; then
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
+$as_echo "$as_me: canusb sniffing is supported" >&6;}
+		else
+		    if test "x$enable_canusb" = "xyes" ; then
+			as_fn_error $? "canusb sniffing is not supported; install libusb1.0 lib devel to enable it" "$LINENO" 5
+		    else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
+$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+		    fi
+		fi
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
+		if test "x$enable_canusb" = "xyes" ; then
+		    as_fn_error $? "no canusb support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
 $as_echo "$as_me: no canusb support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac

@@ -8213,21 +8237,33 @@ if test "x$enable_can" != "xno" ; then
 "
 if test "x$ac_cv_header_linux_can_h" = xyes; then :

+
 $as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h

-			CAN_SRC=pcap-can-linux.c
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
+			    CAN_SRC=pcap-can-linux.c
+			    { $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
 $as_echo "$as_me: CAN sniffing is supported" >&6;}
+
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
+
+			    if test "x$enable_can" = "xyes" ; then
+				as_fn_error $? "CAN sniffing is not supported" "$LINENO" 5
+			    else
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
 $as_echo "$as_me: CAN sniffing is not supported" >&6;}
+			    fi
+
 fi

 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
+		if test "x$enable_can" = "xyes" ; then
+		    as_fn_error $? "no CAN sniffing support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
 $as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac

diff --git a/configure.in b/configure.in
index 8634825..5897e9e 100644
--- a/configure.in
+++ b/configure.in
@@ -1455,7 +1455,7 @@ AC_SUBST(NETFILTER_SRC)
 AC_ARG_ENABLE([bluetooth],
 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_bluetooth=yes])
+    [enable_bluetooth=ifsupportavailable])

 if test "x$enable_bluetooth" != "xno" ; then
 	dnl check for Bluetooth sniffing support
@@ -1506,12 +1506,24 @@ if test "x$enable_bluetooth" != "xno" ; then
 			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
 		      fi
 		    fi
+		    ac_lbl_bluetooth_available=yes
 		],
-		AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		ac_lbl_bluetooth_available=no
 		)
+		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
+		    if test "x$enable_bluetooth" = "xyes" ; then
+			AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		    else
+			AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		    fi
+		fi
 		;;
 	*)
-		AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
+		if test "x$enable_bluetooth" = "xyes" ; then
+		    AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_BT)
@@ -1522,7 +1534,7 @@ fi
 AC_ARG_ENABLE([canusb],
 [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_canusb=yes])
+    [enable_canusb=ifsupportavailable])

 if test "x$enable_canusb" != "xno" ; then
 	dnl check for canusb support
@@ -1535,16 +1547,29 @@ if test "x$enable_canusb" != "xno" ; then
 			AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
 			CANUSB_SRC=pcap-canusb-linux.c
 			LIBS="-lusb-1.0 -lpthread $LIBS"
-			AC_MSG_NOTICE(canusb sniffing is supported)
+			ac_lbl_has_libusb=yes
 		    ],
-		    AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    ac_lbl_has_libusb=no
 		    )
 		],
-		AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		ac_lbl_has_libusb=no
 		)
+		if test "x$ac_lbl_has_libusb" = "xyes" ; then
+		    AC_MSG_NOTICE(canusb sniffing is supported)
+		else
+		    if test "x$enable_canusb" = "xyes" ; then
+			AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    else
+			AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    fi
+		fi
 		;;
 	*)
-		AC_MSG_NOTICE(no canusb support implemented for $host_os)
+		if test "x$enable_canusb" = "xyes" ; then
+		    AC_MSG_ERROR(no canusb support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no canusb support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_CANUSB)
@@ -1561,15 +1586,27 @@ if test "x$enable_can" != "xno" ; then
 	case "$host_os" in
 	linux*)
 		AC_CHECK_HEADER(linux/can.h,
-			[ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
-			CAN_SRC=pcap-can-linux.c
-			AC_MSG_NOTICE(CAN sniffing is supported)],
-			AC_MSG_NOTICE(CAN sniffing is not supported),
+			[
+			    AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
+			    CAN_SRC=pcap-can-linux.c
+			    AC_MSG_NOTICE(CAN sniffing is supported)
+			],
+			[
+			    if test "x$enable_can" = "xyes" ; then
+				AC_MSG_ERROR(CAN sniffing is not supported)
+			    else
+				AC_MSG_NOTICE(CAN sniffing is not supported)
+			    fi
+			],
 			[#include <sys/socket.h>]
 		   )
 		;;
 	*)
-		AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
+		if test "x$enable_can" = "xyes" ; then
+		    AC_MSG_ERROR(no CAN sniffing support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_CAN)
Don't fail if --enable-can wasn't specified and we can't support CAN sniffing.
Return the right figure of merit for the "any" device.

Thanks and a tip of the Hatlo hat to Coverity Scan for picking up this
one; we were picking the right value for "any", and then overriding it
with a value determined by parsing the name.
Add the UP and RUNNING flags to the "any" device.

That way, code that looks at those flags will make the "any" device look
like regular devices; as long as there's at least one network interface
up and running, or could be up and running at some point in the future,
the "any" device can be considered up and running, so that's
appropriate.
Only treat *trailing* digits as an instance number.

Some devices might have digits in the middle of their name (I think some
gigabit Ethernet devices on Solaris do, namely a "1000" in the name,
presumably meaning "1000 megabits/second"), so we don't want to treat
those digits as an instance number.
Fix addition of UP and RUNNING to the "any" device.
Check for MON_IOCH_MFLUSH failing.

It shouldn't fail, but, just in case it does, report the error.

Failure to check the return value was noticed by Coverity.
Cast away return values if we're not checking them.

When destroying a ring buffer, there's not much we can do if the call to
destroy the ring buffer fails, so we just ignore the return value of
setsockopt(); cast it to void, to explicitly indicate that we're
ignoring it, in the hopes that Coverity will no longer complain that
we're ignoring it.  Add a comment noting this.

Do the same with the return value of munmap(), as we're ignoring it for
the same reason (even though Coverity, for some unknown reason, didn't
complain about it).
Add some more error checking.

Most of these are "should not fail" cases, but let's at least report
their failures as fatal errors.
Fix copy-and-pasteos.