diff options
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-chdlc.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-eth.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-fr.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ip.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-ipv6.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-juniper.c | 243 | ||||
-rw-r--r-- | epan/dissectors/packet-juniper.h | 64 | ||||
-rw-r--r-- | epan/dissectors/packet-llc.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-mpls.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-osi.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-ppp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-q933.c | 2 |
13 files changed, 192 insertions, 163 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 053e757d53..05616a3bc7 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -1516,6 +1516,7 @@ DISSECTOR_INCLUDES = \ packet-isl.h \ packet-isup.h \ packet-iwarp-ddp-rdmap.h \ + packet-juniper.h \ packet-jxta.h \ packet-kerberos.h \ packet-klm.h \ diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c index 9f05a9407d..e36d7fa089 100644 --- a/epan/dissectors/packet-chdlc.c +++ b/epan/dissectors/packet-chdlc.c @@ -33,6 +33,7 @@ #include "packet-chdlc.h" #include "packet-ppp.h" #include "packet-ip.h" +#include "packet-juniper.h" /* * See section 4.3.1 of RFC 1547, and @@ -253,6 +254,7 @@ proto_reg_handoff_chdlc(void) chdlc_handle = find_dissector("chdlc"); dissector_add_uint("wtap_encap", WTAP_ENCAP_CHDLC, chdlc_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_CHDLC_WITH_PHDR, chdlc_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_CHDLC, chdlc_handle); } diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 7f87eef23c..6d0c162f33 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -39,6 +39,7 @@ #include "packet-llc.h" #include "packet-sll.h" #include "packet-usb.h" +#include "packet-juniper.h" #include <epan/crc32-tvb.h> #include <epan/tap.h> #include <wiretap/erf.h> @@ -1025,6 +1026,7 @@ proto_reg_handoff_eth(void) dissector_add_uint("erf.types.type", ERF_TYPE_ETH, eth_withoutfcs_handle); dissector_add_uint("chdlc.protocol", ETHERTYPE_ETHBRIDGE, eth_withoutfcs_handle); dissector_add_uint("gre.proto", ETHERTYPE_ETHBRIDGE, eth_withoutfcs_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_ETHER, eth_withoutfcs_handle); dissector_add_uint("sll.ltype", LINUX_SLL_P_ETHERNET, eth_withoutfcs_handle); diff --git a/epan/dissectors/packet-fr.c b/epan/dissectors/packet-fr.c index 6ca9e58dbc..c30de44990 100644 --- a/epan/dissectors/packet-fr.c +++ b/epan/dissectors/packet-fr.c @@ -48,6 +48,7 @@ #include "packet-ipv6.h" #include "packet-ppp.h" #include "packet-fr.h" +#include "packet-juniper.h" #include <epan/xdlc.h> #include <epan/etypes.h> #include <epan/oui.h> @@ -1008,6 +1009,7 @@ proto_reg_handoff_fr(void) fr_handle = find_dissector("fr"); dissector_add_uint("gre.proto", ETHERTYPE_RAW_FR, fr_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_FRELAY, fr_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_FRELAY, fr_handle); fr_phdr_handle = create_dissector_handle(dissect_fr_phdr, proto_fr); dissector_add_uint("wtap_encap", WTAP_ENCAP_FRELAY_WITH_PHDR, fr_phdr_handle); diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 89b9468572..a1f8dec434 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -53,6 +53,7 @@ #include <wiretap/erf.h> #include "packet-ip.h" +#include "packet-juniper.h" #ifdef HAVE_GEOIP #include <GeoIP.h> @@ -3103,6 +3104,8 @@ proto_reg_handoff_ip(void) dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IP_1051, ip_handle); dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IP_1201, ip_handle); dissector_add_uint("ax25.pid", AX25_P_IP, ip_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP, ip_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS_IP, ip_handle); dissector_add_for_decode_as("udp.port", ip_handle); heur_dissector_add("tipc", dissect_ip_heur, proto_ip); diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 3eb4ba7c49..9de8c8fb80 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -50,6 +50,7 @@ #include <wiretap/erf.h> #include "packet-ipv6.h" #include "packet-ip.h" +#include "packet-juniper.h" #ifdef HAVE_GEOIP_V6 #include <GeoIP.h> @@ -3037,6 +3038,8 @@ proto_reg_handoff_ipv6(void) dissector_add_uint("osinl.excl", NLPID_IP6, ipv6_handle); dissector_add_uint("x.25.spi", NLPID_IP6, ipv6_handle); dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IPv6, ipv6_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP6, ipv6_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS_IP6, ipv6_handle); ipv6_hopopts_handle = new_create_dissector_handle(dissect_hopopts, proto_ipv6_hopopts ); dissector_add_uint("ipv6.nxt", IP_PROTO_HOPOPTS, ipv6_hopopts_handle); diff --git a/epan/dissectors/packet-juniper.c b/epan/dissectors/packet-juniper.c index 247c817096..1749ecfff8 100644 --- a/epan/dissectors/packet-juniper.c +++ b/epan/dissectors/packet-juniper.c @@ -31,6 +31,7 @@ #include <epan/ppptypes.h> #include "packet-ppp.h" #include "packet-ip.h" +#include "packet-juniper.h" #include <epan/nlpid.h> void proto_register_juniper(void); @@ -384,18 +385,9 @@ static expert_field ei_juniper_no_magic = EI_INIT; static gint ett_juniper = -1; static dissector_handle_t ipv4_handle; -static dissector_handle_t ipv6_handle; -static dissector_handle_t mpls_handle; -static dissector_handle_t llc_handle; -static dissector_handle_t eth_handle; -static dissector_handle_t ppp_handle; -static dissector_handle_t q933_handle; -static dissector_handle_t frelay_handle; -static dissector_handle_t chdlc_handle; static dissector_handle_t data_handle; -static dissector_table_t osinl_incl_subdissector_table; -static dissector_table_t osinl_excl_subdissector_table; +static dissector_table_t payload_table; static int dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *juniper_subtree, guint proto, guint offset); static void dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 atm_pictype); @@ -404,51 +396,26 @@ static guint ip_heuristic_guess(guint8 ip_header_byte); static guint juniper_svc_cookie_len (guint64 cookie); static guint juniper_svc_cookie_proto (guint64 cookie, guint16 pictype, guint8 flags); -/* values < 200 are JUNOS internal proto values - * found in frames containing no link-layer header */ -enum { - PROTO_UNKNOWN = 0, - PROTO_IP = 2, - PROTO_MPLS_IP = 3, - PROTO_IP_MPLS = 4, - PROTO_MPLS = 5, - PROTO_IP6 = 6, - PROTO_MPLS_IP6 = 7, - PROTO_IP6_MPLS = 8, - PROTO_CLNP = 10, - PROTO_CLNP_MPLS = 32, - PROTO_MPLS_CLNP = 33, - PROTO_PPP = 200, - PROTO_ISO = 201, - PROTO_LLC = 202, - PROTO_LLC_SNAP = 203, - PROTO_ETHER = 204, - PROTO_OAM = 205, - PROTO_Q933 = 206, - PROTO_FRELAY = 207, - PROTO_CHDLC = 208 -}; - static const value_string juniper_proto_vals[] = { - {PROTO_IP, "IPv4"}, - {PROTO_MPLS_IP, "MPLS->IPv4"}, - {PROTO_IP_MPLS, "IPv4->MPLS"}, - {PROTO_IP6, "IPv6"}, - {PROTO_MPLS_IP6, "MPLS->IPv6"}, - {PROTO_IP6_MPLS, "IPv6->MPLS"}, - {PROTO_PPP, "PPP"}, - {PROTO_CLNP, "CLNP"}, - {PROTO_MPLS_CLNP, "MPLS->CLNP"}, - {PROTO_CLNP_MPLS, "CLNP->MPLS"}, - {PROTO_ISO, "OSI"}, - {PROTO_MPLS, "MPLS"}, - {PROTO_LLC, "LLC"}, - {PROTO_LLC_SNAP, "LLC/SNAP"}, - {PROTO_ETHER, "Ethernet"}, - {PROTO_OAM, "ATM OAM Cell"}, - {PROTO_Q933, "Q.933"}, - {PROTO_FRELAY, "Frame-Relay"}, - {PROTO_CHDLC, "C-HDLC"}, + {JUNIPER_PROTO_IP, "IPv4"}, + {JUNIPER_PROTO_MPLS_IP, "MPLS->IPv4"}, + {JUNIPER_PROTO_IP_MPLS, "IPv4->MPLS"}, + {JUNIPER_PROTO_IP6, "IPv6"}, + {JUNIPER_PROTO_MPLS_IP6, "MPLS->IPv6"}, + {JUNIPER_PROTO_IP6_MPLS, "IPv6->MPLS"}, + {JUNIPER_PROTO_PPP, "PPP"}, + {JUNIPER_PROTO_CLNP, "CLNP"}, + {JUNIPER_PROTO_MPLS_CLNP, "MPLS->CLNP"}, + {JUNIPER_PROTO_CLNP_MPLS, "CLNP->MPLS"}, + {JUNIPER_PROTO_ISO, "OSI"}, + {JUNIPER_PROTO_MPLS, "MPLS"}, + {JUNIPER_PROTO_LLC, "LLC"}, + {JUNIPER_PROTO_LLC_SNAP, "LLC/SNAP"}, + {JUNIPER_PROTO_ETHER, "Ethernet"}, + {JUNIPER_PROTO_OAM, "ATM OAM Cell"}, + {JUNIPER_PROTO_Q933, "Q.933"}, + {JUNIPER_PROTO_FRELAY, "Frame-Relay"}, + {JUNIPER_PROTO_CHDLC, "C-HDLC"}, {0, NULL} }; @@ -615,66 +582,27 @@ dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre { proto_item *ti; tvbuff_t *next_tvb; - guint8 nlpid; ti = proto_tree_add_uint(juniper_subtree, hf_juniper_payload_type, tvb, offset, 0, proto); PROTO_ITEM_SET_GENERATED(ti); - next_tvb = tvb_new_subset_remaining(tvb, offset); - - switch (proto) { - case PROTO_IP: - case PROTO_MPLS_IP: - call_dissector(ipv4_handle, next_tvb, pinfo, tree); - break; - case PROTO_IP6: - case PROTO_MPLS_IP6: - call_dissector(ipv6_handle, next_tvb, pinfo, tree); - break; - case PROTO_MPLS: - case PROTO_IP_MPLS: - case PROTO_IP6_MPLS: - case PROTO_CLNP_MPLS: - call_dissector(mpls_handle, next_tvb, pinfo, tree); - break; - case PROTO_PPP: - call_dissector(ppp_handle, next_tvb, pinfo, tree); - break; - case PROTO_ETHER: - call_dissector(eth_handle, next_tvb, pinfo, tree); - break; - case PROTO_LLC: - case PROTO_LLC_SNAP: - call_dissector(llc_handle, next_tvb, pinfo, tree); - break; - case PROTO_ISO: - case PROTO_CLNP: - case PROTO_MPLS_CLNP: - nlpid = tvb_get_guint8(tvb, offset); - if(dissector_try_uint(osinl_incl_subdissector_table, nlpid, next_tvb, pinfo, tree)) - return 0; - next_tvb = tvb_new_subset_remaining(tvb, offset+1); - if(dissector_try_uint(osinl_excl_subdissector_table, nlpid, next_tvb, pinfo, tree)) - return 0; - break; - case PROTO_Q933: - call_dissector(q933_handle, next_tvb, pinfo, tree); - break; - case PROTO_FRELAY: - call_dissector(frelay_handle, next_tvb, pinfo, tree); - break; - case PROTO_CHDLC: - call_dissector(chdlc_handle, next_tvb, pinfo, tree); - break; - case 0xa248: + if (proto == 0xa248) + { proto_tree_add_item(juniper_subtree, hf_juniper_unknown_data, tvb, offset, 4, ENC_NA); next_tvb = tvb_new_subset_remaining(tvb, offset+4); call_dissector(ipv4_handle, next_tvb, pinfo, tree); - break; - case PROTO_OAM: /* FIXME call OAM disector without leading HEC byte */ - default: - call_dissector(data_handle, next_tvb, pinfo, tree); - break; + } + else + { + next_tvb = tvb_new_subset_remaining(tvb, offset); + + if (!dissector_try_uint(payload_table, proto, next_tvb, pinfo, tree)) + { + /* XXX - left in for posterity, dissection was never done */ + /* case JUNIPER_PROTO_OAM: FIXME call OAM disector without leading HEC byte */ + + call_dissector(data_handle, next_tvb, pinfo, tree); + } } return 0; @@ -728,10 +656,10 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* AS-PIC IS-IS */ if (cookie_len == AS_PIC_COOKIE_LEN && - proto == PROTO_UNKNOWN && + proto == JUNIPER_PROTO_UNKNOWN && tvb_get_guint8(tvb,offset) == JUNIPER_HDR_LLC_UI) { offset += 1; - proto = PROTO_ISO; + proto = JUNIPER_PROTO_ISO; } /* LS-PIC IS-IS */ @@ -754,7 +682,7 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(juniper_subtree, hf_juniper_mlpic_cookie, tvb, offset, ML_PIC_COOKIE_LEN, mlpic_cookie); offset += 3; - proto = PROTO_Q933; + proto = JUNIPER_PROTO_Q933; } /* child link of an ML-, LS-, AS-PIC bundle / ML-PIC bundle ? */ @@ -765,7 +693,7 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(juniper_subtree, hf_juniper_mlpic_cookie, tvb, offset, ML_PIC_COOKIE_LEN, mlpic_cookie); offset += 4; - proto = PROTO_ISO; + proto = JUNIPER_PROTO_ISO; } } @@ -775,7 +703,7 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(juniper_subtree, hf_juniper_mlpic_cookie, tvb, offset, ML_PIC_COOKIE_LEN, mlpic_cookie); offset += 3; - proto = PROTO_ISO; + proto = JUNIPER_PROTO_ISO; } ti = proto_tree_add_uint(juniper_subtree, hf_juniper_cookie_len, tvb, offset, 0, cookie_len); @@ -833,13 +761,13 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* child link of an LS-PIC bundle ? */ if (cookie_len == 0 && tvb_get_ntohs(tvb, offset) == JUNIPER_HDR_PPP) { - proto = PROTO_PPP; + proto = JUNIPER_PROTO_PPP; offset += 2; } /* ML-PIC ? */ if (cookie_len == 0 && ppp_heuristic_guess(tvb_get_ntohs(tvb, offset+2))) { - proto = PROTO_PPP; + proto = JUNIPER_PROTO_PPP; cookie_len = 2; mlpic_cookie = tvb_get_ntohs(tvb, offset); proto_tree_add_uint(juniper_subtree, hf_juniper_mlpic_cookie, @@ -848,7 +776,7 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* child link of an ML-PIC bundle ? */ if (cookie_len == 0 && ppp_heuristic_guess(tvb_get_ntohs(tvb, offset))) { - proto = PROTO_PPP; + proto = JUNIPER_PROTO_PPP; } ti = proto_tree_add_uint(juniper_subtree, hf_juniper_cookie_len, tvb, offset, 0, cookie_len); @@ -884,7 +812,7 @@ dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ETHER, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_ETHER, offset); } @@ -912,7 +840,7 @@ dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ETHER, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_ETHER, offset); } @@ -940,7 +868,7 @@ dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_PPP, offset+2); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_PPP, offset+2); } @@ -968,7 +896,7 @@ dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_FRELAY, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_FRELAY, offset); } @@ -994,7 +922,7 @@ dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_CHDLC, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_CHDLC, offset); } @@ -1020,7 +948,7 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 { proto_item *ti; proto_tree* juniper_subtree; - guint8 next_proto = PROTO_UNKNOWN,atm1_header_len,atm2_header_len,flags; + guint8 next_proto = JUNIPER_PROTO_UNKNOWN,atm1_header_len,atm2_header_len,flags; guint32 cookie1, proto; guint64 cookie2; guint offset = 0; @@ -1067,19 +995,19 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 proto_tree_add_uint(juniper_subtree, hf_juniper_atm1_cookie, tvb, offset, 4, cookie1); offset += atm1_header_len; if ((cookie1 >> 24) == 0x80) /* OAM cell ? */ - next_proto = PROTO_OAM; + next_proto = JUNIPER_PROTO_OAM; } else { /* JUNIPER_PIC_ATM2 */ proto_tree_add_uint64(juniper_subtree, hf_juniper_atm2_cookie, tvb, offset, 8, cookie2); offset += atm2_header_len; if (cookie2 & 0x70) /* OAM cell ? */ - next_proto = PROTO_OAM; + next_proto = JUNIPER_PROTO_OAM; } next_tvb = tvb_new_subset_remaining(tvb, offset); - if (next_proto == PROTO_OAM) { - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_OAM, offset); + if (next_proto == JUNIPER_PROTO_OAM) { + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_OAM, offset); return; } @@ -1090,7 +1018,7 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * This begins with something that appears to be an LLC header for * OSI; is this LLC-multiplexed traffic? */ - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_LLC, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_LLC, offset); return; } @@ -1099,14 +1027,14 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * This begins with something that appears to be an LLC header for * SNAP; is this LLC-multiplexed traffic? */ - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_LLC_SNAP, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_LLC_SNAP, offset); return; } if ((flags & JUNIPER_FLAG_PKT_IN) != JUNIPER_FLAG_PKT_IN && /* ether-over-1483 encaps ? */ (cookie1 & JUNIPER_ATM2_GAP_COUNT_MASK) && atm_pictype != JUNIPER_PIC_ATM1) { - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ETHER, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_ETHER, offset); return; } @@ -1120,7 +1048,7 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * That's not supported on ATM1 PICs. */ proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_encap_type, tvb, offset, 0, 0, "VC-MUX"); - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_PPP, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_PPP, offset); return; } @@ -1132,18 +1060,18 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * Is the 0x03 an LLC UI control field? */ proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_encap_type, tvb, offset, 1, 1, "Cisco NLPID"); - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ISO , offset+1); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_ISO, offset+1); return; } next_proto = ip_heuristic_guess( (guint8) proto); - if (next_proto != PROTO_UNKNOWN) { /* last resort: VC-MUX encaps ? */ + if (next_proto != JUNIPER_PROTO_UNKNOWN) { /* last resort: VC-MUX encaps ? */ /* * This begins with something that might be the first byte of * an IPv4 or IPv6 packet; is this VC-multiplexed IP? */ proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_encap_type, tvb, offset, 0, 2, "VC-MUX"); - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, next_proto , offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, next_proto, offset); return; } @@ -1210,7 +1138,7 @@ static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr * For the future there should be sufficient space in the 18-byte * empty header before payload starts. */ - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_IP, offset+18); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_IP, offset+18); } /* Wrapper for Juniper service PIC coookie dissector */ @@ -1236,13 +1164,13 @@ dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset+=bytes_processed; if (flags & JUNIPER_FLAG_PKT_IN) { - proto_tree_add_uint(juniper_subtree, hf_juniper_proto, tvb, offset, 2, PROTO_IP); + proto_tree_add_uint(juniper_subtree, hf_juniper_proto, tvb, offset, 2, JUNIPER_PROTO_IP); offset += 16; } else { offset += 12; } - dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_IP, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, JUNIPER_PROTO_IP, offset); } /* list of Juniper supported PPP proto IDs */ @@ -1289,7 +1217,7 @@ ip_heuristic_guess(guint8 ip_header_byte) { case 0x4d: case 0x4e: case 0x4f: - return PROTO_IP; + return JUNIPER_PROTO_IP; case 0x60: case 0x61: case 0x62: @@ -1306,9 +1234,9 @@ ip_heuristic_guess(guint8 ip_header_byte) { case 0x6d: case 0x6e: case 0x6f: - return PROTO_IP6; + return JUNIPER_PROTO_IP6; default: - return PROTO_UNKNOWN; /* did not find a ip header */ + return JUNIPER_PROTO_UNKNOWN; /* did not find a ip header */ } } @@ -1347,11 +1275,11 @@ juniper_svc_cookie_proto (guint64 cookie, guint16 pictype, guint8 flags) { case 0x54: switch (pictype) { case JUNIPER_PIC_MLPPP: - return PROTO_PPP; + return JUNIPER_PROTO_PPP; case JUNIPER_PIC_MLFR: - return PROTO_ISO; + return JUNIPER_PROTO_ISO; default: - return PROTO_UNKNOWN; + return JUNIPER_PROTO_UNKNOWN; } case GSP_SVC_REQ_APOLLO: case GSP_SVC_REQ_LSQ: @@ -1364,28 +1292,28 @@ juniper_svc_cookie_proto (guint64 cookie, guint16 pictype, guint8 flags) { */ if ((flags & JUNIPER_FLAG_PKT_IN) == JUNIPER_FLAG_PKT_IN && lsq_dir != (LSQ_COOKIE_RE|LSQ_COOKIE_DIR)) - return PROTO_PPP; + return JUNIPER_PROTO_PPP; else - return PROTO_IP; + return JUNIPER_PROTO_IP; case JUNIPER_PIC_MLFR: if (lsq_dir == (LSQ_COOKIE_RE|LSQ_COOKIE_DIR)) - return PROTO_UNKNOWN; + return JUNIPER_PROTO_UNKNOWN; else - return PROTO_IP; + return JUNIPER_PROTO_IP; default: - return PROTO_UNKNOWN; + return JUNIPER_PROTO_UNKNOWN; } case LSQ_L3_PROTO_IPV6: - return PROTO_IP6; + return JUNIPER_PROTO_IP6; case LSQ_L3_PROTO_MPLS: - return PROTO_MPLS; + return JUNIPER_PROTO_MPLS; case LSQ_L3_PROTO_ISO: - return PROTO_ISO; + return JUNIPER_PROTO_ISO; default: - return PROTO_UNKNOWN; + return JUNIPER_PROTO_UNKNOWN; } default: - return PROTO_UNKNOWN; + return JUNIPER_PROTO_UNKNOWN; } } @@ -1479,6 +1407,8 @@ proto_register_juniper(void) expert_juniper = expert_register_protocol(proto_juniper); expert_register_field_array(expert_juniper, ei, array_length(ei)); + payload_table = register_dissector_table("juniper.proto", "Juniper payload dissectors", FT_UINT32, BASE_HEX); + } void @@ -1497,18 +1427,7 @@ proto_reg_handoff_juniper(void) dissector_handle_t juniper_vp_handle; dissector_handle_t juniper_svcs_handle; - osinl_incl_subdissector_table = find_dissector_table("osinl.incl"); - osinl_excl_subdissector_table = find_dissector_table("osinl.excl"); - - eth_handle = find_dissector("eth_withoutfcs"); - ppp_handle = find_dissector("ppp"); - llc_handle = find_dissector("llc"); ipv4_handle = find_dissector("ip"); - ipv6_handle = find_dissector("ipv6"); - mpls_handle = find_dissector("mpls"); - q933_handle = find_dissector("q933"); - frelay_handle = find_dissector("fr"); - chdlc_handle = find_dissector("chdlc"); data_handle = find_dissector("data"); juniper_atm2_handle = create_dissector_handle(dissect_juniper_atm2, proto_juniper); diff --git a/epan/dissectors/packet-juniper.h b/epan/dissectors/packet-juniper.h new file mode 100644 index 0000000000..bd9172ca2d --- /dev/null +++ b/epan/dissectors/packet-juniper.h @@ -0,0 +1,64 @@ +/* packet-juniper.h + * Routines for Juniper Networks, Inc. packet disassembly + * + * 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. + */ + +#ifndef _PACKET_JUNIPER_H +#define _PACKET_JUNIPER_H + +/* values < 200 are JUNOS internal proto values + * found in frames containing no link-layer header */ +enum { + JUNIPER_PROTO_UNKNOWN = 0, + JUNIPER_PROTO_IP = 2, + JUNIPER_PROTO_MPLS_IP = 3, + JUNIPER_PROTO_IP_MPLS = 4, + JUNIPER_PROTO_MPLS = 5, + JUNIPER_PROTO_IP6 = 6, + JUNIPER_PROTO_MPLS_IP6 = 7, + JUNIPER_PROTO_IP6_MPLS = 8, + JUNIPER_PROTO_CLNP = 10, + JUNIPER_PROTO_CLNP_MPLS = 32, + JUNIPER_PROTO_MPLS_CLNP = 33, + JUNIPER_PROTO_PPP = 200, + JUNIPER_PROTO_ISO = 201, + JUNIPER_PROTO_LLC = 202, + JUNIPER_PROTO_LLC_SNAP = 203, + JUNIPER_PROTO_ETHER = 204, + JUNIPER_PROTO_OAM = 205, + JUNIPER_PROTO_Q933 = 206, + JUNIPER_PROTO_FRELAY = 207, + JUNIPER_PROTO_CHDLC = 208 +}; + +#endif /* _PACKET_JUNIPER_H */ + +/* + * 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: + */ diff --git a/epan/dissectors/packet-llc.c b/epan/dissectors/packet-llc.c index 01e78dfb52..2246af9331 100644 --- a/epan/dissectors/packet-llc.c +++ b/epan/dissectors/packet-llc.c @@ -42,6 +42,7 @@ #include "packet-netbios.h" #include "packet-vines.h" #include "packet-sll.h" +#include "packet-juniper.h" #include <epan/sna-utils.h> #include "packet-llc.h" @@ -946,6 +947,9 @@ proto_reg_handoff_llc(void) dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_BACNET, llc_handle); dissector_add_uint("ethertype", ETHERTYPE_JUMBO_LLC, llc_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_LLC, llc_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_LLC_SNAP, llc_handle); + /* * Register all the fields for PIDs for various OUIs. */ diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index ebc10428b4..51b3190d0c 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -63,6 +63,7 @@ #include "packet-mpls.h" #include "packet-pw-common.h" #include "packet-bfd.h" +#include "packet-juniper.h" void proto_register_mpls(void); void proto_reg_handoff_mpls(void); @@ -833,6 +834,10 @@ proto_reg_handoff_mpls(void) dissector_add_uint("gre.proto", ETHERTYPE_MPLS, mpls_handle); dissector_add_uint("gre.proto", ETHERTYPE_MPLS_MULTI, mpls_handle); dissector_add_uint("ip.proto", IP_PROTO_MPLS_IN_IP, mpls_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS, mpls_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP_MPLS, mpls_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP6_MPLS, mpls_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_CLNP_MPLS, mpls_handle); mpls_handle = find_dissector("mplspwcw"); dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_handle ); diff --git a/epan/dissectors/packet-osi.c b/epan/dissectors/packet-osi.c index 9abb99b628..b9ab88a209 100644 --- a/epan/dissectors/packet-osi.c +++ b/epan/dissectors/packet-osi.c @@ -38,6 +38,7 @@ #include <epan/ipproto.h> #include "packet-osi.h" #include "packet-tpkt.h" +#include "packet-juniper.h" void proto_reg_handoff_osi(void); void proto_register_osi(void); @@ -456,6 +457,19 @@ dissect_osi_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_tpkt_encap(tvb, pinfo, tree, tpkt_desegment, osi_handle); } +static void dissect_osi_juniper(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint8 nlpid; + tvbuff_t *next_tvb; + + nlpid = tvb_get_guint8(tvb, 0); + if(dissector_try_uint(osinl_incl_subdissector_table, nlpid, tvb, pinfo, tree)) + return; + + next_tvb = tvb_new_subset_remaining(tvb, 1); + dissector_try_uint(osinl_excl_subdissector_table, nlpid, next_tvb, pinfo, tree); +} + static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 nlpid; @@ -498,7 +512,7 @@ void proto_reg_handoff_osi(void) { static gboolean osi_prefs_initialized = FALSE; - static dissector_handle_t osi_tpkt_handle; + static dissector_handle_t osi_tpkt_handle, osi_juniper_handle; static guint tcp_port_osi_over_tpkt; if (!osi_prefs_initialized) { @@ -513,6 +527,12 @@ proto_reg_handoff_osi(void) dissector_add_uint("null.type", BSD_AF_ISO, osi_handle); dissector_add_uint("gre.proto", SAP_OSINL5, osi_handle); dissector_add_uint("ip.proto", IP_PROTO_ISOIP, osi_handle); /* ISO-TP4 ISO Transport Protocol Class 4 [RFC905,RC77] */ + + osi_juniper_handle = create_dissector_handle(dissect_osi_juniper, proto_osi); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_ISO, osi_juniper_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_CLNP, osi_juniper_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS_CLNP, osi_juniper_handle); + data_handle = find_dissector("data"); ppp_handle = find_dissector("ppp"); diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 70989d8ec5..1061c33580 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -48,6 +48,7 @@ #include <epan/oui.h> #include "packet-usb.h" #include "packet-sll.h" +#include "packet-juniper.h" void proto_register_ppp_raw_hdlc(void); void proto_reg_handoff_ppp_raw_hdlc(void); @@ -5486,6 +5487,7 @@ proto_reg_handoff_ppp(void) dissector_add_uint("sll.ltype", LINUX_SLL_P_PPPHDLC, ppp_hdlc_handle); dissector_add_uint("osinl.excl", NLPID_PPP, ppp_handle); dissector_add_uint("gre.proto", ETHERTYPE_PPP, ppp_hdlc_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_PPP, ppp_handle); } void diff --git a/epan/dissectors/packet-q933.c b/epan/dissectors/packet-q933.c index 88d96f3160..78fa31cca4 100644 --- a/epan/dissectors/packet-q933.c +++ b/epan/dissectors/packet-q933.c @@ -28,6 +28,7 @@ #include <epan/expert.h> #include <epan/strutil.h> #include <epan/nlpid.h> +#include "packet-juniper.h" void proto_register_q933(void); void proto_reg_handoff_q933(void); @@ -2245,6 +2246,7 @@ proto_reg_handoff_q933(void) q933_handle = find_dissector("q933"); dissector_add_uint("fr.osinl", NLPID_Q_933, q933_handle); + dissector_add_uint("juniper.proto", JUNIPER_PROTO_Q933, q933_handle); } /* |