]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ipoib.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-ipoib.c
index 5ebefd6cae2a87feee34aafe681cd7541fb43a6f..3d43123505a1151c1f430fe2b7396fc20d1f53ac 100644 (file)
@@ -31,8 +31,6 @@
 
 #include "netdissect-stdinc.h"
 
 
 #include "netdissect-stdinc.h"
 
-#include <stdio.h>
-
 #include "netdissect.h"
 #include "extract.h"
 #include "addrtoname.h"
 #include "netdissect.h"
 #include "extract.h"
 #include "addrtoname.h"
@@ -74,8 +72,15 @@ ipoib_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
        u_int orig_length;
        u_short ether_type;
 
        u_int orig_length;
        u_short ether_type;
 
-       if (caplen < IPOIB_HDRLEN || length < IPOIB_HDRLEN) {
+       if (caplen < IPOIB_HDRLEN) {
+               nd_print_trunc(ndo);
+               ndo->ndo_ll_hdr_len += caplen;
+               return;
+       }
+
+       if (length < IPOIB_HDRLEN) {
                nd_print_trunc(ndo);
                nd_print_trunc(ndo);
+               ndo->ndo_ll_hdr_len += length;
                return;
        }
 
                return;
        }
 
@@ -87,6 +92,7 @@ ipoib_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
        }
        orig_length = length;
 
        }
        orig_length = length;
 
+       ndo->ndo_ll_hdr_len += IPOIB_HDRLEN;
        length -= IPOIB_HDRLEN;
        caplen -= IPOIB_HDRLEN;
        ether_type = GET_BE_U_2(p + 40);
        length -= IPOIB_HDRLEN;
        caplen -= IPOIB_HDRLEN;
        ether_type = GET_BE_U_2(p + 40);
@@ -111,11 +117,9 @@ ipoib_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 ipoib_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        ndo->ndo_protocol = "ipoib";
        ipoib_print(ndo, p, h->len, h->caplen, NULL, NULL);
 ipoib_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        ndo->ndo_protocol = "ipoib";
        ipoib_print(ndo, p, h->len, h->caplen, NULL, NULL);
-
-       return (IPOIB_HDRLEN);
 }
 }