X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/3820594d702f863088754f590546f21cfe3c562c..7781ecd3a2fd0ba1c28f8f5caa5bbbcdbf99bb3f:/print-juniper.c diff --git a/print-juniper.c b/print-juniper.c index b8a70d4e..1789fb51 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -1,3 +1,5 @@ +/* NetBSD: print-juniper.c,v 1.2 2007/07/24 11:53:45 drochner Exp */ + /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code @@ -15,7 +17,9 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.31 2006-03-10 23:43:29 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.34 2007-08-29 02:31:44 mcr Exp $ (LBL)"; +#else +__RCSID("NetBSD: print-juniper.c,v 1.3 2007/07/25 06:31:32 dogcow Exp "); #endif #ifdef HAVE_CONFIG_H @@ -61,7 +65,7 @@ static const char rcsid[] _U_ = #define JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE 4 #define JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE 5 -static struct tok juniper_ipsec_type_values[] = { +static const struct tok juniper_ipsec_type_values[] = { { JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE, "ESP ENCR-AUTH" }, { JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE, "ESP ENCR-AH AUTH" }, { JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE, "ESP AUTH" }, @@ -70,7 +74,7 @@ static struct tok juniper_ipsec_type_values[] = { { 0, NULL} }; -static struct tok juniper_direction_values[] = { +static const struct tok juniper_direction_values[] = { { JUNIPER_BPF_IN, "In"}, { JUNIPER_BPF_OUT, "Out"}, { 0, NULL} @@ -91,7 +95,7 @@ enum { /* 1 byte type and 1-byte length */ #define JUNIPER_EXT_TLV_OVERHEAD 2 -struct tok jnx_ext_tlv_values[] = { +static const struct tok jnx_ext_tlv_values[] = { { JUNIPER_EXT_TLV_IFD_IDX, "Device Interface Index" }, { JUNIPER_EXT_TLV_IFD_NAME,"Device Interface Name" }, { JUNIPER_EXT_TLV_IFD_MEDIATYPE, "Device Media Type" }, @@ -103,7 +107,7 @@ struct tok jnx_ext_tlv_values[] = { { 0, NULL } }; -struct tok jnx_flag_values[] = { +static const struct tok jnx_flag_values[] = { { JUNIPER_BPF_EXT, "Ext" }, { JUNIPER_BPF_FILTER, "Filter" }, { JUNIPER_BPF_IIF, "IIF" }, @@ -173,7 +177,7 @@ struct tok jnx_flag_values[] = { #define JUNIPER_IFML_DFC 59 #define JUNIPER_IFML_PICPEER 60 -struct tok juniper_ifmt_values[] = { +static const struct tok juniper_ifmt_values[] = { { JUNIPER_IFML_ETHER, "Ethernet" }, { JUNIPER_IFML_FDDI, "FDDI" }, { JUNIPER_IFML_TOKENRING, "Token-Ring" }, @@ -296,7 +300,7 @@ struct tok juniper_ifmt_values[] = { #define JUNIPER_IFLE_DFC 66 #define JUNIPER_IFLE_PICPEER 67 -struct tok juniper_ifle_values[] = { +static const struct tok juniper_ifle_values[] = { { JUNIPER_IFLE_AGGREGATOR, "Aggregator" }, { JUNIPER_IFLE_ATM_CCC, "CCC over ATM" }, { JUNIPER_IFLE_ATM_CELLRELAY_CCC, "ATM CCC Cell Relay" }, @@ -435,7 +439,7 @@ struct juniper_l2info_t { #define MFR_BE_MASK 0xc0 -static struct tok juniper_protocol_values[] = { +static const struct tok juniper_protocol_values[] = { { JUNIPER_PROTO_NULL, "Null" }, { JUNIPER_PROTO_IPV4, "IPv4" }, { JUNIPER_PROTO_IPV6, "IPv6" }, @@ -467,13 +471,14 @@ juniper_ggsn_print(const struct pcap_pkthdr *h, register const u_char *p) return l2info.header_len; p+=l2info.header_len; - gh = (struct juniper_ggsn_header *)p; + gh = (struct juniper_ggsn_header *)&l2info.cookie; - if (eflag) + if (eflag) { printf("proto %s (%u), vlan %u: ", tok2str(juniper_protocol_values,"Unknown",gh->proto), gh->proto, EXTRACT_16BITS(&gh->vlan_id[0])); + } switch (gh->proto) { case JUNIPER_PROTO_IPV4: @@ -481,7 +486,7 @@ juniper_ggsn_print(const struct pcap_pkthdr *h, register const u_char *p) break; #ifdef INET6 case JUNIPER_PROTO_IPV6: - ip6_print(p, l2info.length); + ip6_print(gndo, p, l2info.length); break; #endif /* INET6 */ default: @@ -545,8 +550,8 @@ juniper_es_print(const struct pcap_pkthdr *h, register const u_char *p) tok2str(juniper_ipsec_type_values,"Unknown",ih->type), ih->type, EXTRACT_32BITS(&ih->spi), - ipaddr_string(EXTRACT_32BITS(&ih->src_ip)), - ipaddr_string(EXTRACT_32BITS(&ih->dst_ip)), + ipaddr_string(&ih->src_ip), + ipaddr_string(&ih->dst_ip), l2info.length); } else { printf("ES SA, index %u, ttl %u type %s (%u), length %u\n", @@ -642,7 +647,7 @@ juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p) p+=l2info.header_len; /* this DLT contains nothing but raw ethernet frames */ - ether_print(p, l2info.length, l2info.caplen); + ether_print(gndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } #endif @@ -659,7 +664,7 @@ juniper_ether_print(const struct pcap_pkthdr *h, register const u_char *p) p+=l2info.header_len; /* this DLT contains nothing but raw Ethernet frames */ - ether_print(p, l2info.length, l2info.caplen); + ether_print(gndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } #endif @@ -731,11 +736,10 @@ juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p) extracted_ethertype = EXTRACT_16BITS(p); /* this DLT contains nothing but raw PPPoE frames, * prepended with a type field*/ - if (ether_encap_print(extracted_ethertype, + if (ethertype_print(gndo, extracted_ethertype, p+ETHERTYPE_LEN, l2info.length-ETHERTYPE_LEN, - l2info.caplen-ETHERTYPE_LEN, - &extracted_ethertype) == 0) + l2info.caplen-ETHERTYPE_LEN) == 0) /* ether_type not known, probably it wasn't one */ printf("unknown ethertype 0x%04x", extracted_ethertype); @@ -775,7 +779,7 @@ juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p) return l2info.header_len; #ifdef INET6 case JUNIPER_LSQ_L3_PROTO_IPV6: - ip6_print(p,l2info.length); + ip6_print(gndo, p,l2info.length); return l2info.header_len; #endif case JUNIPER_LSQ_L3_PROTO_MPLS: @@ -830,7 +834,7 @@ juniper_mfr_print(const struct pcap_pkthdr *h, register const u_char *p) return l2info.header_len; #ifdef INET6 case JUNIPER_LSQ_L3_PROTO_IPV6: - ip6_print(p,l2info.length); + ip6_print(gndo, p,l2info.length); return l2info.header_len; #endif case JUNIPER_LSQ_L3_PROTO_MPLS: @@ -983,7 +987,7 @@ juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p) if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */ (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { - ether_print(p, l2info.length, l2info.caplen); + ether_print(gndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } @@ -1069,7 +1073,7 @@ ip_heuristic_guess(register const u_char *p, u_int length) { case 0x6d: case 0x6e: case 0x6f: - ip6_print(p, length); + ip6_print(gndo, p, length); break; #endif default: @@ -1404,6 +1408,10 @@ juniper_parse_header (const u_char *p, const struct pcap_pkthdr *h, struct junip } break; #endif +#ifdef DLT_JUNIPER_GGSN + case DLT_JUNIPER_GGSN: + break; +#endif #ifdef DLT_JUNIPER_ATM1 case DLT_JUNIPER_ATM1: break;