From 2932596b65c36a63e79ab85d3349d404a1e16b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sun, 29 Nov 2015 15:22:36 +0000 Subject: IPv6: Add ipv6extprotostr() to ipproto.h Move ipv6_exthdr_check() to ipproto.c. Seems a better fit, prevents future code duplication. Change-Id: I84f247febd1499e334289e3057ec1d8ba32d5bcc Reviewed-on: https://code.wireshark.org/review/12283 Reviewed-by: Alexis La Goutte Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ipv6.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'epan/dissectors/packet-ipv6.c') diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index d8c9bd2b69..8d992cae36 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -448,31 +448,6 @@ ipv6_build_filter(packet_info *pinfo) address_to_str(pinfo->pool, &pinfo->net_dst)); } -/* https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#extension-header */ -static gboolean -ipv6_exthdr_check(int proto) { - switch (proto) { - /* fall through all cases */ - case 0: /* IPv6 Hop-by-Hop Option */ - case 43: /* Routing Header for IPv6 */ - case 44: /* Fragment Header for IPv6 */ - case 50: /* Encapsulating Security Payload */ - case 51: /* Authentication Header */ - case 60: /* Destination Options for IPv6 */ - case 135: /* Mobility Header */ - case 139: /* Host Identity Protocol */ - case 140: /* Shim6 Protocol */ - /* Experimental values ignored because they can collide with - * other experimental uses not relating to IPv6 parameters */ -/* case 253: */ /* Use for experimentation and testing */ -/* case 254: */ /* Use for experimentation and testing */ - return TRUE; - default: - break; - } - return FALSE; -} - static const fragment_items ipv6_frag_items = { &ett_ipv6_fragment, &ett_ipv6_fragments, @@ -2398,7 +2373,8 @@ again: break; default: - if (ipv6_exthdr_check(nxt) && !dissector_get_uint_handle(ip_dissector_table, nxt)) { + if ((ipv6extprotostr(nxt) != NULL) && + !dissector_get_uint_handle(ip_dissector_table, nxt)) { advance = dissect_unknown_exthdr(tvb, offset, ipv6_exthdr_tree); nxt = tvb_get_guint8(tvb, offset); offset += advance; -- cgit v1.2.3