• Home
  • Raw
  • Download

Lines Matching +full:print +full:- +full:flags +full:. +full:pcap

7  * the documentation or other materials provided with the distribution.
11 * FOR A PARTICULAR PURPOSE.
13 * Original code by Hannes Gredler (hannes@juniper.net)
18 …"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.22 2006/05/10 22:42:46 guy Exp $ (L…
22 #include "config.h"
25 #include <tcpdump-stdinc.h>
27 #include <pcap.h>
28 #include <stdio.h>
30 #include "interface.h"
31 #include "addrtoname.h"
32 #include "extract.h"
33 #include "ppp.h"
34 #include "llc.h"
35 #include "nlpid.h"
36 #include "ethertype.h"
37 #include "atm.h"
63 { JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE, "ESP ENCR-AUTH" },
64 { JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE, "ESP ENCR-AH AUTH" },
170 u_int8_t flags; in juniper_ggsn_print() member
176 l2info.pictype = DLT_JUNIPER_GGSN; in juniper_ggsn_print()
178 return l2info.header_len; in juniper_ggsn_print()
180 p+=l2info.header_len; in juniper_ggsn_print()
185 tok2str(juniper_protocol_values,"Unknown",gh->proto), in juniper_ggsn_print()
186 gh->proto, in juniper_ggsn_print()
187 EXTRACT_16BITS(&gh->vlan_id[0])); in juniper_ggsn_print()
189 switch (gh->proto) { in juniper_ggsn_print()
191 ip_print(gndo, p, l2info.length); in juniper_ggsn_print()
195 ip6_print(p, l2info.length); in juniper_ggsn_print()
200 printf("unknown GGSN proto (%u)", gh->proto); in juniper_ggsn_print()
203 return l2info.header_len; in juniper_ggsn_print()
223 l2info.pictype = DLT_JUNIPER_ES; in juniper_es_print()
225 return l2info.header_len; in juniper_es_print()
227 p+=l2info.header_len; in juniper_es_print()
230 switch (ih->type) { in juniper_es_print()
243 ih->type, in juniper_es_print()
244 l2info.length); in juniper_es_print()
245 return l2info.header_len; in juniper_es_print()
248 l2info.length-=rewrite_len; in juniper_es_print()
254 EXTRACT_16BITS(&ih->sa_index), in juniper_es_print()
255 ih->ttl, in juniper_es_print()
256 tok2str(juniper_ipsec_type_values,"Unknown",ih->type), in juniper_es_print()
257 ih->type, in juniper_es_print()
258 EXTRACT_32BITS(&ih->spi), in juniper_es_print()
259 ipaddr_string(EXTRACT_32BITS(&ih->src_ip)), in juniper_es_print()
260 ipaddr_string(EXTRACT_32BITS(&ih->dst_ip)), in juniper_es_print()
261 l2info.length); in juniper_es_print()
264 EXTRACT_16BITS(&ih->sa_index), in juniper_es_print()
265 ih->ttl, in juniper_es_print()
266 tok2str(juniper_ipsec_type_values,"Unknown",ih->type), in juniper_es_print()
267 ih->type, in juniper_es_print()
268 l2info.length); in juniper_es_print()
272 ip_print(gndo, p, l2info.length); in juniper_es_print()
273 return l2info.header_len; in juniper_es_print()
290 l2info.pictype = DLT_JUNIPER_MONITOR; in juniper_monitor_print()
292 return l2info.header_len; in juniper_monitor_print()
294 p+=l2info.header_len; in juniper_monitor_print()
298 printf("service-id %u, iif %u, pkt-type %u: ", in juniper_monitor_print()
299 EXTRACT_32BITS(&mh->service_id), in juniper_monitor_print()
300 EXTRACT_16BITS(&mh->iif), in juniper_monitor_print()
301 mh->pkt_type); in juniper_monitor_print()
303 /* no proto field - lets guess by first byte of IP header*/ in juniper_monitor_print()
304 ip_heuristic_guess(p, l2info.length); in juniper_monitor_print()
306 return l2info.header_len; in juniper_monitor_print()
323 l2info.pictype = DLT_JUNIPER_SERVICES; in juniper_services_print()
325 return l2info.header_len; in juniper_services_print()
327 p+=l2info.header_len; in juniper_services_print()
331 printf("service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ", in juniper_services_print()
332 sh->svc_id, in juniper_services_print()
333 sh->flags_len, in juniper_services_print()
334 EXTRACT_16BITS(&sh->svc_set_id), in juniper_services_print()
335 EXTRACT_24BITS(&sh->dir_iif[1])); in juniper_services_print()
337 /* no proto field - lets guess by first byte of IP header*/ in juniper_services_print()
338 ip_heuristic_guess(p, l2info.length); in juniper_services_print()
340 return l2info.header_len; in juniper_services_print()
350 l2info.pictype = DLT_JUNIPER_PPPOE; in juniper_pppoe_print()
352 return l2info.header_len; in juniper_pppoe_print()
354 p+=l2info.header_len; in juniper_pppoe_print()
356 ether_print(p, l2info.length, l2info.caplen); in juniper_pppoe_print()
357 return l2info.header_len; in juniper_pppoe_print()
367 l2info.pictype = DLT_JUNIPER_ETHER; in juniper_ether_print()
369 return l2info.header_len; in juniper_ether_print()
371 p+=l2info.header_len; in juniper_ether_print()
373 ether_print(p, l2info.length, l2info.caplen); in juniper_ether_print()
374 return l2info.header_len; in juniper_ether_print()
384 l2info.pictype = DLT_JUNIPER_PPP; in juniper_ppp_print()
386 return l2info.header_len; in juniper_ppp_print()
388 p+=l2info.header_len; in juniper_ppp_print()
390 ppp_print(p, l2info.length); in juniper_ppp_print()
391 return l2info.header_len; in juniper_ppp_print()
401 l2info.pictype = DLT_JUNIPER_FRELAY; in juniper_frelay_print()
403 return l2info.header_len; in juniper_frelay_print()
405 p+=l2info.header_len; in juniper_frelay_print()
406 /* this DLT contains nothing but raw frame-relay frames */ in juniper_frelay_print()
407 fr_print(p, l2info.length); in juniper_frelay_print()
408 return l2info.header_len; in juniper_frelay_print()
418 l2info.pictype = DLT_JUNIPER_CHDLC; in juniper_chdlc_print()
420 return l2info.header_len; in juniper_chdlc_print()
422 p+=l2info.header_len; in juniper_chdlc_print()
423 /* this DLT contains nothing but raw c-hdlc frames */ in juniper_chdlc_print()
424 chdlc_print(p, l2info.length); in juniper_chdlc_print()
425 return l2info.header_len; in juniper_chdlc_print()
436 l2info.pictype = DLT_JUNIPER_PPPOE_ATM; in juniper_pppoe_atm_print()
438 return l2info.header_len; in juniper_pppoe_atm_print()
440 p+=l2info.header_len; in juniper_pppoe_atm_print()
447 l2info.length-ETHERTYPE_LEN, in juniper_pppoe_atm_print()
448 l2info.caplen-ETHERTYPE_LEN, in juniper_pppoe_atm_print()
453 return l2info.header_len; in juniper_pppoe_atm_print()
463 l2info.pictype = DLT_JUNIPER_MLPPP; in juniper_mlppp_print()
465 return l2info.header_len; in juniper_mlppp_print()
467 /* suppress Bundle-ID if frame was captured on a child-link in juniper_mlppp_print()
470 EXTRACT_16BITS(&l2info.cookie) != PPP_OSI && in juniper_mlppp_print()
471 EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL)) in juniper_mlppp_print()
472 printf("Bundle-ID %u: ",l2info.bundle); in juniper_mlppp_print()
474 p+=l2info.header_len; in juniper_mlppp_print()
477 switch(l2info.proto) { in juniper_mlppp_print()
480 * -> this must be incoming IS-IS over PPP in juniper_mlppp_print()
482 if (l2info.cookie[4] == (JUNIPER_LSQ_COOKIE_RE|JUNIPER_LSQ_COOKIE_DIR)) in juniper_mlppp_print()
483 ppp_print(p, l2info.length); in juniper_mlppp_print()
485 ip_print(gndo, p, l2info.length); in juniper_mlppp_print()
486 return l2info.header_len; in juniper_mlppp_print()
489 ip6_print(p,l2info.length); in juniper_mlppp_print()
490 return l2info.header_len; in juniper_mlppp_print()
493 mpls_print(p,l2info.length); in juniper_mlppp_print()
494 return l2info.header_len; in juniper_mlppp_print()
496 isoclns_print(p,l2info.length,l2info.caplen); in juniper_mlppp_print()
497 return l2info.header_len; in juniper_mlppp_print()
503 switch (EXTRACT_16BITS(&l2info.cookie)) { in juniper_mlppp_print()
505 ppp_print(p-2,l2info.length+2); in juniper_mlppp_print()
509 ppp_print(p,l2info.length); in juniper_mlppp_print()
513 return l2info.header_len; in juniper_mlppp_print()
524 l2info.pictype = DLT_JUNIPER_MFR; in juniper_mfr_print()
526 return l2info.header_len; in juniper_mfr_print()
528 p+=l2info.header_len; in juniper_mfr_print()
530 /* child-link ? */ in juniper_mfr_print()
531 if (l2info.cookie_len == 0) { in juniper_mfr_print()
532 mfr_print(p,l2info.length); in juniper_mfr_print()
533 return l2info.header_len; in juniper_mfr_print()
537 if (l2info.cookie_len == AS_PIC_COOKIE_LEN) { in juniper_mfr_print()
538 switch(l2info.proto) { in juniper_mfr_print()
540 ip_print(gndo, p, l2info.length); in juniper_mfr_print()
541 return l2info.header_len; in juniper_mfr_print()
544 ip6_print(p,l2info.length); in juniper_mfr_print()
545 return l2info.header_len; in juniper_mfr_print()
548 mpls_print(p,l2info.length); in juniper_mfr_print()
549 return l2info.header_len; in juniper_mfr_print()
551 isoclns_print(p,l2info.length,l2info.caplen); in juniper_mfr_print()
552 return l2info.header_len; in juniper_mfr_print()
556 return l2info.header_len; in juniper_mfr_print()
559 /* suppress Bundle-ID if frame was captured on a child-link */ in juniper_mfr_print()
560 if (eflag && EXTRACT_32BITS(l2info.cookie) != 1) printf("Bundle-ID %u, ",l2info.bundle); in juniper_mfr_print()
561 switch (l2info.proto) { in juniper_mfr_print()
563 isoclns_print(p+1, l2info.length-1, l2info.caplen-1); in juniper_mfr_print()
568 /* pass IP{4,6} to the OSI layer for proper link-layer printing */ in juniper_mfr_print()
569 isoclns_print(p-1, l2info.length+1, l2info.caplen+1); in juniper_mfr_print()
572 printf("unknown protocol 0x%04x, length %u",l2info.proto, l2info.length); in juniper_mfr_print()
575 return l2info.header_len; in juniper_mfr_print()
585 l2info.pictype = DLT_JUNIPER_MLFR; in juniper_mlfr_print()
587 return l2info.header_len; in juniper_mlfr_print()
589 p+=l2info.header_len; in juniper_mlfr_print()
591 /* suppress Bundle-ID if frame was captured on a child-link */ in juniper_mlfr_print()
592 if (eflag && EXTRACT_32BITS(l2info.cookie) != 1) printf("Bundle-ID %u, ",l2info.bundle); in juniper_mlfr_print()
593 switch (l2info.proto) { in juniper_mlfr_print()
596 isoclns_print(p, l2info.length, l2info.caplen); in juniper_mlfr_print()
601 /* pass IP{4,6} to the OSI layer for proper link-layer printing */ in juniper_mlfr_print()
602 isoclns_print(p-1, l2info.length+1, l2info.caplen+1); in juniper_mlfr_print()
605 printf("unknown protocol 0x%04x, length %u",l2info.proto, l2info.length); in juniper_mlfr_print()
608 return l2info.header_len; in juniper_mlfr_print()
615 * +-----+-------------------------+-------------------------------+
617 * +-----+-------------------------+-------------------------------+
628 l2info.pictype = DLT_JUNIPER_ATM1; in juniper_atm1_print()
630 return l2info.header_len; in juniper_atm1_print()
632 p+=l2info.header_len; in juniper_atm1_print()
634 if (l2info.cookie[0] == 0x80) { /* OAM cell ? */ in juniper_atm1_print()
635 oam_print(p,l2info.length,ATM_OAM_NOHEC); in juniper_atm1_print()
636 return l2info.header_len; in juniper_atm1_print()
642 if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL, in juniper_atm1_print()
644 return l2info.header_len; in juniper_atm1_print()
648 isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1); in juniper_atm1_print()
650 return l2info.header_len; in juniper_atm1_print()
653 if(ip_heuristic_guess(p, l2info.length) != 0) /* last try - vcmux encaps ? */ in juniper_atm1_print()
654 return l2info.header_len; in juniper_atm1_print()
656 return l2info.header_len; in juniper_atm1_print()
663 * +-------------------------------+---------+---+-----+-----------+
665 * +-------------------------------+---------+---+-----+-----------+
676 l2info.pictype = DLT_JUNIPER_ATM2; in juniper_atm2_print()
678 return l2info.header_len; in juniper_atm2_print()
680 p+=l2info.header_len; in juniper_atm2_print()
682 if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */ in juniper_atm2_print()
683 oam_print(p,l2info.length,ATM_OAM_NOHEC); in juniper_atm2_print()
684 return l2info.header_len; in juniper_atm2_print()
690 if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL, in juniper_atm2_print()
692 return l2info.header_len; in juniper_atm2_print()
695 if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */ in juniper_atm2_print()
696 (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { in juniper_atm2_print()
697 ether_print(p, l2info.length, l2info.caplen); in juniper_atm2_print()
698 return l2info.header_len; in juniper_atm2_print()
702 isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1); in juniper_atm2_print()
704 return l2info.header_len; in juniper_atm2_print()
707 if(juniper_ppp_heuristic_guess(p, l2info.length) != 0) /* PPPoA vcmux encaps ? */ in juniper_atm2_print()
708 return l2info.header_len; in juniper_atm2_print()
710 if(ip_heuristic_guess(p, l2info.length) != 0) /* last try - vcmux encaps ? */ in juniper_atm2_print()
711 return l2info.header_len; in juniper_atm2_print()
713 return l2info.header_len; in juniper_atm2_print()
802 l2info->header_len = 0; in juniper_parse_header()
803 l2info->cookie_len = 0; in juniper_parse_header()
804 l2info->proto = 0; in juniper_parse_header()
807 l2info->length = h->len; in juniper_parse_header()
808 l2info->caplen = h->caplen; in juniper_parse_header()
809 l2info->direction = p[3]&JUNIPER_BPF_PKT_IN; in juniper_parse_header()
813 printf("no magic-number found!"); in juniper_parse_header()
817 if (eflag) /* print direction */ in juniper_parse_header()
818 printf("%3s ",tok2str(juniper_direction_values,"---",l2info->direction)); in juniper_parse_header()
820 /* extensions present ? - calculate how much bytes to skip */ in juniper_parse_header()
824 printf("ext-len %u, ",EXTRACT_16BITS(p+4)); in juniper_parse_header()
830 printf("no-L2-hdr, "); in juniper_parse_header()
832 /* there is no link-layer present - in juniper_parse_header()
837 if(ip_heuristic_guess(p+offset+4,l2info->length-(offset+4)) == 0) in juniper_parse_header()
838 printf("no IP-hdr found!"); in juniper_parse_header()
840 l2info->header_len=offset+4; in juniper_parse_header()
844 l2info->header_len = offset; in juniper_parse_header()
845 p+=l2info->header_len; in juniper_parse_header()
846 l2info->length -= l2info->header_len; in juniper_parse_header()
847 l2info->caplen -= l2info->header_len; in juniper_parse_header()
850 while (lp->s != NULL) { in juniper_parse_header()
851 if (lp->pictype == l2info->pictype) { in juniper_parse_header()
853 l2info->cookie_len += lp->cookie_len; in juniper_parse_header()
857 l2info->cookie_type = LS_COOKIE_ID; in juniper_parse_header()
858 l2info->cookie_len += 2; in juniper_parse_header()
861 l2info->cookie_type = AS_COOKIE_ID; in juniper_parse_header()
862 l2info->cookie_len = 8; in juniper_parse_header()
866 l2info->bundle = l2info->cookie[0]; in juniper_parse_header()
873 if (l2info->pictype == DLT_JUNIPER_MFR && in juniper_parse_header()
875 l2info->cookie_len = 0; in juniper_parse_header()
879 l2info->header_len += l2info->cookie_len; in juniper_parse_header()
880 l2info->length -= l2info->cookie_len; in juniper_parse_header()
881 l2info->caplen -= l2info->cookie_len; in juniper_parse_header()
884 printf("%s-PIC, cookie-len %u", in juniper_parse_header()
885 lp->s, in juniper_parse_header()
886 l2info->cookie_len); in juniper_parse_header()
888 if (l2info->cookie_len > 0) { in juniper_parse_header()
889 TCHECK2(p[0],l2info->cookie_len); in juniper_parse_header()
892 for (idx = 0; idx < l2info->cookie_len; idx++) { in juniper_parse_header()
893 l2info->cookie[idx] = p[idx]; /* copy cookie data */ in juniper_parse_header()
898 if (eflag) printf(": "); /* print demarc b/w L2/L3*/ in juniper_parse_header()
901 l2info->proto = EXTRACT_16BITS(p+l2info->cookie_len); in juniper_parse_header()
906 p+=l2info->cookie_len; in juniper_parse_header()
909 switch(l2info->pictype) { in juniper_parse_header()
912 switch (l2info->cookie_type) { in juniper_parse_header()
914 l2info->bundle = l2info->cookie[1]; in juniper_parse_header()
917 l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; in juniper_parse_header()
918 l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; in juniper_parse_header()
921 l2info->bundle = l2info->cookie[0]; in juniper_parse_header()
928 switch (l2info->cookie_type) { in juniper_parse_header()
930 l2info->bundle = l2info->cookie[1]; in juniper_parse_header()
931 l2info->proto = EXTRACT_16BITS(p); in juniper_parse_header()
932 l2info->header_len += 2; in juniper_parse_header()
933 l2info->length -= 2; in juniper_parse_header()
934 l2info->caplen -= 2; in juniper_parse_header()
937 l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; in juniper_parse_header()
938 l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; in juniper_parse_header()
941 l2info->bundle = l2info->cookie[0]; in juniper_parse_header()
942 l2info->header_len += 2; in juniper_parse_header()
943 l2info->length -= 2; in juniper_parse_header()
944 l2info->caplen -= 2; in juniper_parse_header()
951 switch (l2info->cookie_type) { in juniper_parse_header()
953 l2info->bundle = l2info->cookie[1]; in juniper_parse_header()
954 l2info->proto = EXTRACT_16BITS(p); in juniper_parse_header()
955 l2info->header_len += 2; in juniper_parse_header()
956 l2info->length -= 2; in juniper_parse_header()
957 l2info->caplen -= 2; in juniper_parse_header()
960 l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; in juniper_parse_header()
961 l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; in juniper_parse_header()
964 l2info->bundle = l2info->cookie[0]; in juniper_parse_header()
973 if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) { in juniper_parse_header()
978 case 0x08000000: /* < JUNOS 7.4 control-word */ in juniper_parse_header()
980 l2info->header_len += 4; in juniper_parse_header()
987 printf("control-word 0x%08x ", control_word); in juniper_parse_header()
1013 printf("Unknown Juniper DLT_ type %u: ", l2info->pictype); in juniper_parse_header()
1018 printf("hlen %u, proto 0x%04x, ",l2info->header_len,l2info->proto); in juniper_parse_header()
1020 return 1; /* everything went ok so far. continue parsing */ in juniper_parse_header()
1022 printf("[|juniper_hdr], length %u",h->len); in juniper_parse_header()
1029 * c-style: whitesmith
1030 * c-basic-offset: 4