Currently, dissect_mpls() (packet-mpls.c) assumes that the packet
contents are IP and always passes the payload to the IP dissector.
I've attached a patch against the CVS code which will make it
check the IP version field and call either the IPv6 or IP dissector
as appropriate.
(I think theoretically MPLS (being Multi-Protocol Label Switching)
could all sorts of protocols, but I don't know a generalized way
to determine which one is in use. So this is not perfect, but
an improvement over assuming IPv4.)
thanks,
Hamish
--
Hamish Moffatt VK3SB <hamish@xxxxxxxxxx> <hamish@xxxxxxxxxxxx>
Index: packet-mpls.c
===================================================================
RCS file: /cvsroot/ethereal/packet-mpls.c,v
retrieving revision 1.21
diff -u -r1.21 packet-mpls.c
--- packet-mpls.c 2001/06/18 02:17:49 1.21
+++ packet-mpls.c 2001/11/07 12:38:36
@@ -108,7 +108,8 @@
"", HFILL }},
};
-static dissector_handle_t ip_handle;
+static dissector_handle_t ipv4_handle;
+static dissector_handle_t ipv6_handle;
/*
* Given a 4-byte MPLS label starting at offset "offset", in tvbuff "tvb",
@@ -138,6 +139,7 @@
guint8 exp;
guint8 bos;
guint8 ttl;
+ guint8 ipvers;
proto_tree *mpls_tree;
proto_item *ti;
@@ -180,7 +182,13 @@
if (bos) break;
}
next_tvb = tvb_new_subset(tvb, offset, -1, -1);
- call_dissector(ip_handle, next_tvb, pinfo, tree);
+
+ ipvers = (tvb_get_guint8(tvb, offset) >> 4) & 0x0F;
+ if (ipvers == 6) {
+ call_dissector(ipv6_handle, next_tvb, pinfo, tree);
+ } else {
+ call_dissector(ipv4_handle, next_tvb, pinfo, tree);
+ }
}
void
@@ -200,9 +208,10 @@
proto_reg_handoff_mpls(void)
{
/*
- * Get a handle for the IP dissector.
+ * Get a handle for the IPv4 and IPv6 dissectors.
*/
- ip_handle = find_dissector("ip");
+ ipv4_handle = find_dissector("ip");
+ ipv6_handle = find_dissector("ipv6");
dissector_add("ethertype", ETHERTYPE_MPLS, dissect_mpls, proto_mpls);
dissector_add("ppp.protocol", PPP_MPLS_UNI, dissect_mpls, proto_mpls);