- int caplen = h->caplen;
- int length = h->len;
- u_short ether_type;
- u_short extracted_ethertype;
- u_short *bp;
-
- ts_print(&h->ts);
-
- if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
- printf("[|cip]");
- goto out;
- }
-
- if (eflag)
- cip_print(p, length);
-
- /*
- * Some printers want to get back at the ethernet addresses,
- * and/or check that they're not walking off the end of the packet.
- * Rather than pass them all the way down, we set these globals.
- */
- packetp = p;
- snapend = p + caplen;
-
- if (memcmp(rfcllc, p, sizeof(rfcllc))==0) {
- length -= RFC1483LLC_LEN;
- caplen -= RFC1483LLC_LEN;
- bp = (u_short*)p;
- p += RFC1483LLC_LEN;
- ether_type = ntohs(bp[3]);
- } else
- ether_type = ETHERTYPE_IP;
-
- /*
- * Is it (gag) an 802.3 encapsulation?
- */
- extracted_ethertype = 0;
- if (ether_type < ETHERMTU) {
- /* Try to print the LLC-layer header & higher layers */
- if (llc_print(p, length, caplen, NULL, NULL)==0) {
- /* ether_type not known, print raw packet */
- if (!eflag)
- cip_print((u_char *)bp, length);
- if (extracted_ethertype) {
- printf("(LLC %s) ",
- etherproto_string(htons(extracted_ethertype)));
- }
- if (!xflag && !qflag)
- default_print(p, caplen);
+ u_int caplen = h->caplen;
+ u_int length = h->len;
+ int llc_hdrlen;
+
+ ndo->ndo_protocol = "cip";
+
+ if (ndo->ndo_eflag)
+ /*
+ * There is no MAC-layer header, so just print the length.
+ */
+ ND_PRINT("%u: ", length);
+
+ ND_TCHECK_LEN(p, sizeof(rfcllc));
+ if (memcmp(rfcllc, p, sizeof(rfcllc)) == 0) {
+ /*
+ * LLC header is present. Try to print it & higher layers.
+ */
+ llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
+ if (!ndo->ndo_suppress_default_print)
+ ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;