summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-corosync-totemsrp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-19 14:22:54 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-19 21:23:33 +0000
commitb936dbd7eec66459c650e0c6354cb402a3867221 (patch)
tree7a4cbe2f0f4d663b725168591e0e4512d35ce20e /epan/dissectors/packet-corosync-totemsrp.c
parent9e81d5820a8eb8d7d05d5c5845e6a07d98659ce1 (diff)
downloadwireshark-b936dbd7eec66459c650e0c6354cb402a3867221.tar.gz
Protocols sending the OS's AF_INET6 value are OS-specific or broken.
Check for all the different AF_INET6 values that are on various OSes. If Totem is, and will forever be, used *ONLY* on one particular OS, feel free to remove the uses of other _AF_INET6 values (but do *not* change back to using the OS's AF_INET6; this should dissect the protocol correctly on *all* OSes). Add a common AF_INET definition to epan/aftypes.h while we're at it, and use that; as most OSes picked up 4.2BSD's AF_INET value, most if not all of them use 2, but IPv6 came out after 4.2BSD, and various OSes all picked their own values for AF_INET6. Change-Id: Iae15dfdd15203ed3ecd078a6499821dc09139a98 Reviewed-on: https://code.wireshark.org/review/2458 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-corosync-totemsrp.c')
-rw-r--r--epan/dissectors/packet-corosync-totemsrp.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/epan/dissectors/packet-corosync-totemsrp.c b/epan/dissectors/packet-corosync-totemsrp.c
index f272e04c85..10cdf9c2eb 100644
--- a/epan/dissectors/packet-corosync-totemsrp.c
+++ b/epan/dissectors/packet-corosync-totemsrp.c
@@ -27,22 +27,25 @@
Y.AMIR, L.E.MOSER, P.M.MELLIAR-SMITH, D.A.AGARWAL, P.CIARFELLA.
"The Totem Single-Ring Ordering and Membership Protocol"*/
+/*
+ * NOTE: the source code at www.corosync.org looks as if it will not
+ * work with multiple OSes in a cluster if it uses IPv6, as it appears
+ * to use the OS's AF_ values in packets, and the value of AF_INET6
+ * is ***NOT*** the same in all OSes.
+ *
+ * (It'll work with IPv4, because AF_INET came out of 4.2BSD and
+ * most if not all OSes just picked up BSD's value of 2.)
+ *
+ * So we just check for all the AF_INET6 values we know about.
+ *
+ * We get the AF_ values from epan/aftypes.h, *not* from the OS
+ * we happen to be built for.
+ */
# include "config.h"
#include <epan/packet.h>
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
+#include <epan/aftypes.h>
/*
* Utilities for subdissectors of corosync_totemsrp.
@@ -179,8 +182,13 @@ static const value_string corosync_totemsrp_message_header_encapsulated[] = {
static const value_string corosync_totemsrp_ip_address_family[] = {
- { AF_INET, "AF_INET" },
- { AF_INET6, "AF_INET6" },
+ { COMMON_AF_INET, "AF_INET" },
+ { BSD_AF_INET6_BSD, "AF_INET6 (most BSD)" },
+ { BSD_AF_INET6_FREEBSD, "AF_INET6 (FreeBSD)" },
+ { BSD_AF_INET6_DARWIN, "AF_INET6 (OS X and iOS)" },
+ { LINUX_AF_INET6, "AF_INET6 (Linux)" },
+ { SOLARIS_AF_INET6, "AF_INET6 (Solaris)" },
+ { WINSOCK_AF_INET6, "AF_INET6 (Windows)" },
{ 0, NULL }
};
@@ -260,11 +268,16 @@ dissect_corosync_totemsrp_ip_address(tvbuff_t *tvb,
switch (family)
{
- case AF_INET:
+ case COMMON_AF_INET:
len = 4;
proto_tree_add_item(tree, hf_corosync_totemsrp_ip_address_addr4, tvb, offset, len, ENC_BIG_ENDIAN);
break;
- case AF_INET6:
+ case BSD_AF_INET6_BSD:
+ case BSD_AF_INET6_FREEBSD:
+ case BSD_AF_INET6_DARWIN:
+ case LINUX_AF_INET6:
+ case SOLARIS_AF_INET6:
+ case WINSOCK_AF_INET6:
len = sizeof(struct e_in6_addr);
proto_tree_add_item(tree, hf_corosync_totemsrp_ip_address_addr6, tvb, offset, len, ENC_NA);
break;