123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #ifdef HAVE_CONFIG_H
- #include "config.h"
- #endif
- #include <string.h>
- #include <netdissect-stdinc.h>
- #include "netdissect.h"
- #include "addrtoname.h"
- static const unsigned char rfcllc[] = {
- 0xaa,
- 0xaa,
- 0x03,
- 0x00,
- 0x00,
- 0x00 };
- static inline void
- cip_print(netdissect_options *ndo, u_int length)
- {
-
- ND_PRINT((ndo, "%u: ", length));
- }
- u_int
- cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
- {
- u_int caplen = h->caplen;
- u_int length = h->len;
- size_t cmplen;
- int llc_hdrlen;
- cmplen = sizeof(rfcllc);
- if (cmplen > caplen)
- cmplen = caplen;
- if (cmplen > length)
- cmplen = length;
- if (ndo->ndo_eflag)
- cip_print(ndo, length);
- if (cmplen == 0) {
- ND_PRINT((ndo, "[|cip]"));
- return 0;
- }
- if (memcmp(rfcllc, p, cmplen) == 0) {
-
- llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
- if (llc_hdrlen < 0) {
-
- if (!ndo->ndo_suppress_default_print)
- ND_DEFAULTPRINT(p, caplen);
- llc_hdrlen = -llc_hdrlen;
- }
- } else {
-
- llc_hdrlen = 0;
- ip_print(ndo, p, length);
- }
- return (llc_hdrlen);
- }
|