print-sll.c uses HAVE_NET_IF_H, which does not always work right: the
header is in POSIX.1-2001, but the result of if_indextoname() is
irrelevant if the current OS is not Linux, in which case the packet was
captured on a different host because libpcap produces DLT_LINUX_SLL2 on
Linux only. The result can be irrelevant on Linux too, but this does
not have an easy solution.
To reduce the problem space, switch print-sll.c to check for __linux__
instead. In tcpdump.c print the warning about interface names only if
sll2_if_print() would print interface names. Since HAVE_NET_IF_H has no
purpose now, remove the checks for <net/if.h>.
advance the packet data pointer
OSPF: Print more truncation indications
OSPF: Add more length checks
advance the packet data pointer
OSPF: Print more truncation indications
OSPF: Add more length checks
+ SLL2: Translate interface indices to names on Linux only.
TCP: Add support for the AE (AccECN) flag.
User interface:
Add optional unit suffix on -C file size.
TCP: Add support for the AE (AccECN) flag.
User interface:
Add optional unit suffix on -C file size.
# Header files.
#
check_include_file(rpc/rpc.h HAVE_RPC_RPC_H)
# Header files.
#
check_include_file(rpc/rpc.h HAVE_RPC_RPC_H)
-check_include_file(net/if.h HAVE_NET_IF_H)
if(HAVE_RPC_RPC_H)
check_include_files("rpc/rpc.h;rpc/rpcent.h" HAVE_RPC_RPCENT_H)
endif(HAVE_RPC_RPC_H)
if(HAVE_RPC_RPC_H)
check_include_files("rpc/rpc.h;rpc/rpcent.h" HAVE_RPC_RPCENT_H)
endif(HAVE_RPC_RPC_H)
/* Define to 1 if you have the `rpc' library (-lrpc). */
#cmakedefine HAVE_LIBRPC 1
/* Define to 1 if you have the `rpc' library (-lrpc). */
#cmakedefine HAVE_LIBRPC 1
-/* Define to 1 if you have the <net/if.h> header file. */
-#cmakedefine HAVE_NET_IF_H 1
-
/* Define to 1 if you have the `openat' function. */
#cmakedefine HAVE_OPENAT 1
/* Define to 1 if you have the `openat' function. */
#cmakedefine HAVE_OPENAT 1
fi
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
fi
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
-AC_CHECK_HEADERS(rpc/rpc.h rpc/rpcent.h net/if.h)
+AC_CHECK_HEADERS(rpc/rpc.h rpc/rpcent.h)
#
# Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
#
#
# Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
#
#include <net/if.h>
#endif
#include <net/if.h>
#endif
u_short ether_type;
int llc_hdrlen;
u_int hdrlen;
u_short ether_type;
int llc_hdrlen;
u_int hdrlen;
uint32_t if_index;
char ifname[IF_NAMESIZE];
#endif
uint32_t if_index;
char ifname[IF_NAMESIZE];
#endif
ND_TCHECK_LEN(p, SLL2_HDR_LEN);
sllp = (const struct sll2_header *)p;
ND_TCHECK_LEN(p, SLL2_HDR_LEN);
sllp = (const struct sll2_header *)p;
if_index = GET_BE_U_4(sllp->sll2_if_index);
if (!if_indextoname(if_index, ifname))
strncpy(ifname, "?", 2);
if_index = GET_BE_U_4(sllp->sll2_if_index);
if (!if_indextoname(if_index, ifname))
strncpy(ifname, "?", 2);
pcap_datalink_val_to_description(dlt));
}
fprintf(stderr, ", snapshot length %d\n", pcap_snapshot(pd));
pcap_datalink_val_to_description(dlt));
}
fprintf(stderr, ", snapshot length %d\n", pcap_snapshot(pd));
+#if defined(DLT_LINUX_SLL2) && defined(__linux__)
if (dlt == DLT_LINUX_SLL2)
fprintf(stderr, "Warning: interface names might be incorrect\n");
#endif
if (dlt == DLT_LINUX_SLL2)
fprintf(stderr, "Warning: interface names might be incorrect\n");
#endif