Merge ^/head r312968 through r313054.
This commit is contained in:
commit
71fe94fdb1
@ -238,6 +238,24 @@ translator ipinfo_t < uint8_t *p > {
|
||||
inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
|
||||
};
|
||||
|
||||
#pragma D binding "1.13" translator
|
||||
translator ipinfo_t < struct mbuf *m > {
|
||||
ip_ver = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v;
|
||||
ip_plength = m == NULL ? 0 :
|
||||
((struct ip *)m->m_data)->ip_v == 4 ?
|
||||
ntohs(((struct ip *)m->m_data)->ip_len) -
|
||||
(((struct ip *)m->m_data)->ip_hl << 2):
|
||||
ntohs(((struct ip6_hdr *)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen);
|
||||
ip_saddr = m == NULL ? 0 :
|
||||
((struct ip *)m->m_data)->ip_v == 4 ?
|
||||
inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) :
|
||||
inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src);
|
||||
ip_daddr = m == NULL ? 0 :
|
||||
((struct ip *)m->m_data)->ip_v == 4 ?
|
||||
inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) :
|
||||
inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst);
|
||||
};
|
||||
|
||||
#pragma D binding "1.5" IFF_LOOPBACK
|
||||
inline int IFF_LOOPBACK = 0x8;
|
||||
|
||||
|
@ -2789,6 +2789,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
|
||||
{ "crnor", XL(19,33), XL_MASK, COM, { BT, BA, BB } },
|
||||
{ "rfmci", X(19,38), 0xffffffff, PPCRFMCI, { 0 } },
|
||||
|
||||
{ "rfdi", XL(19,39), 0xffffffff, BOOKE, { 0 } },
|
||||
{ "rfi", XL(19,50), 0xffffffff, COM, { 0 } },
|
||||
{ "rfci", XL(19,51), 0xffffffff, PPC403 | BOOKE, { 0 } },
|
||||
|
||||
|
@ -50,12 +50,14 @@ INTERCEPTOR(void, free, void *ptr) {
|
||||
asan_free(ptr, &stack, FROM_MALLOC);
|
||||
}
|
||||
|
||||
#if SANITIZER_INTERCEPT_CFREE
|
||||
INTERCEPTOR(void, cfree, void *ptr) {
|
||||
GET_STACK_TRACE_FREE;
|
||||
if (UNLIKELY(IsInDlsymAllocPool(ptr)))
|
||||
return;
|
||||
asan_free(ptr, &stack, FROM_MALLOC);
|
||||
}
|
||||
#endif // SANITIZER_INTERCEPT_CFREE
|
||||
|
||||
INTERCEPTOR(void*, malloc, uptr size) {
|
||||
if (UNLIKELY(!asan_inited))
|
||||
@ -91,22 +93,24 @@ INTERCEPTOR(void*, realloc, void *ptr, uptr size) {
|
||||
return asan_realloc(ptr, size, &stack);
|
||||
}
|
||||
|
||||
#if SANITIZER_INTERCEPT_MEMALIGN
|
||||
INTERCEPTOR(void*, memalign, uptr boundary, uptr size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
return asan_memalign(boundary, size, &stack, FROM_MALLOC);
|
||||
}
|
||||
|
||||
INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
return asan_memalign(boundary, size, &stack, FROM_MALLOC);
|
||||
}
|
||||
|
||||
INTERCEPTOR(void*, __libc_memalign, uptr boundary, uptr size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
void *res = asan_memalign(boundary, size, &stack, FROM_MALLOC);
|
||||
DTLS_on_libc_memalign(res, size);
|
||||
return res;
|
||||
}
|
||||
#endif // SANITIZER_INTERCEPT_MEMALIGN
|
||||
|
||||
INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
return asan_memalign(boundary, size, &stack, FROM_MALLOC);
|
||||
}
|
||||
|
||||
INTERCEPTOR(uptr, malloc_usable_size, void *ptr) {
|
||||
GET_CURRENT_PC_BP_SP;
|
||||
@ -114,6 +118,7 @@ INTERCEPTOR(uptr, malloc_usable_size, void *ptr) {
|
||||
return asan_malloc_usable_size(ptr, pc, bp);
|
||||
}
|
||||
|
||||
#if SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO
|
||||
// We avoid including malloc.h for portability reasons.
|
||||
// man mallinfo says the fields are "long", but the implementation uses int.
|
||||
// It doesn't matter much -- we just need to make sure that the libc's mallinfo
|
||||
@ -131,6 +136,7 @@ INTERCEPTOR(struct fake_mallinfo, mallinfo, void) {
|
||||
INTERCEPTOR(int, mallopt, int cmd, int value) {
|
||||
return -1;
|
||||
}
|
||||
#endif // SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO
|
||||
|
||||
INTERCEPTOR(int, posix_memalign, void **memptr, uptr alignment, uptr size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
@ -143,10 +149,12 @@ INTERCEPTOR(void*, valloc, uptr size) {
|
||||
return asan_valloc(size, &stack);
|
||||
}
|
||||
|
||||
#if SANITIZER_INTERCEPT_PVALLOC
|
||||
INTERCEPTOR(void*, pvalloc, uptr size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
return asan_pvalloc(size, &stack);
|
||||
}
|
||||
#endif // SANITIZER_INTERCEPT_PVALLOC
|
||||
|
||||
INTERCEPTOR(void, malloc_stats, void) {
|
||||
__asan_print_accumulated_stats();
|
||||
|
@ -55,11 +55,6 @@ void _free_base(void *ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
ALLOCATION_FUNCTION_ATTRIBUTE
|
||||
void cfree(void *ptr) {
|
||||
CHECK(!"cfree() should not be used on Windows");
|
||||
}
|
||||
|
||||
ALLOCATION_FUNCTION_ATTRIBUTE
|
||||
void *malloc(size_t size) {
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_internal_defs.h"
|
||||
#include "sanitizer_common/sanitizer_linux.h"
|
||||
#include "sanitizer_common/sanitizer_platform_interceptors.h"
|
||||
#include "sanitizer_common/sanitizer_platform_limits_posix.h"
|
||||
#include "sanitizer_common/sanitizer_tls_get_addr.h"
|
||||
#include "lsan.h"
|
||||
@ -86,11 +87,26 @@ INTERCEPTOR(void*, realloc, void *q, uptr size) {
|
||||
return Reallocate(stack, q, size, 1);
|
||||
}
|
||||
|
||||
#if SANITIZER_INTERCEPT_MEMALIGN
|
||||
INTERCEPTOR(void*, memalign, uptr alignment, uptr size) {
|
||||
ENSURE_LSAN_INITED;
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
return Allocate(stack, size, alignment, kAlwaysClearMemory);
|
||||
}
|
||||
#define LSAN_MAYBE_INTERCEPT_MEMALIGN INTERCEPT_FUNCTION(memalign)
|
||||
|
||||
INTERCEPTOR(void *, __libc_memalign, uptr alignment, uptr size) {
|
||||
ENSURE_LSAN_INITED;
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
void *res = Allocate(stack, size, alignment, kAlwaysClearMemory);
|
||||
DTLS_on_libc_memalign(res, size);
|
||||
return res;
|
||||
}
|
||||
#define LSAN_MAYBE_INTERCEPT___LIBC_MEMALIGN INTERCEPT_FUNCTION(__libc_memalign)
|
||||
#else
|
||||
#define LSAN_MAYBE_INTERCEPT_MEMALIGN
|
||||
#define LSAN_MAYBE_INTERCEPT___LIBC_MEMALIGN
|
||||
#endif // SANITIZER_INTERCEPT_MEMALIGN
|
||||
|
||||
INTERCEPTOR(void*, aligned_alloc, uptr alignment, uptr size) {
|
||||
ENSURE_LSAN_INITED;
|
||||
@ -106,14 +122,6 @@ INTERCEPTOR(int, posix_memalign, void **memptr, uptr alignment, uptr size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
INTERCEPTOR(void *, __libc_memalign, uptr alignment, uptr size) {
|
||||
ENSURE_LSAN_INITED;
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
void *res = Allocate(stack, size, alignment, kAlwaysClearMemory);
|
||||
DTLS_on_libc_memalign(res, size);
|
||||
return res;
|
||||
}
|
||||
|
||||
INTERCEPTOR(void*, valloc, uptr size) {
|
||||
ENSURE_LSAN_INITED;
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
@ -127,6 +135,7 @@ INTERCEPTOR(uptr, malloc_usable_size, void *ptr) {
|
||||
return GetMallocUsableSize(ptr);
|
||||
}
|
||||
|
||||
#if SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO
|
||||
struct fake_mallinfo {
|
||||
int x[10];
|
||||
};
|
||||
@ -136,11 +145,18 @@ INTERCEPTOR(struct fake_mallinfo, mallinfo, void) {
|
||||
internal_memset(&res, 0, sizeof(res));
|
||||
return res;
|
||||
}
|
||||
#define LSAN_MAYBE_INTERCEPT_MALLINFO INTERCEPT_FUNCTION(mallinfo)
|
||||
|
||||
INTERCEPTOR(int, mallopt, int cmd, int value) {
|
||||
return -1;
|
||||
}
|
||||
#define LSAN_MAYBE_INTERCEPT_MALLOPT INTERCEPT_FUNCTION(mallopt)
|
||||
#else
|
||||
#define LSAN_MAYBE_INTERCEPT_MALLINFO
|
||||
#define LSAN_MAYBE_INTERCEPT_MALLOPT
|
||||
#endif // SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO
|
||||
|
||||
#if SANITIZER_INTERCEPT_PVALLOC
|
||||
INTERCEPTOR(void*, pvalloc, uptr size) {
|
||||
ENSURE_LSAN_INITED;
|
||||
GET_STACK_TRACE_MALLOC;
|
||||
@ -152,8 +168,17 @@ INTERCEPTOR(void*, pvalloc, uptr size) {
|
||||
}
|
||||
return Allocate(stack, size, GetPageSizeCached(), kAlwaysClearMemory);
|
||||
}
|
||||
#define LSAN_MAYBE_INTERCEPT_PVALLOC INTERCEPT_FUNCTION(pvalloc)
|
||||
#else
|
||||
#define LSAN_MAYBE_INTERCEPT_PVALLOC
|
||||
#endif // SANITIZER_INTERCEPT_PVALLOC
|
||||
|
||||
#if SANITIZER_INTERCEPT_CFREE
|
||||
INTERCEPTOR(void, cfree, void *p) ALIAS(WRAPPER_NAME(free));
|
||||
#define LSAN_MAYBE_INTERCEPT_CFREE INTERCEPT_FUNCTION(cfree)
|
||||
#else
|
||||
#define LSAN_MAYBE_INTERCEPT_CFREE
|
||||
#endif // SANITIZER_INTERCEPT_CFREE
|
||||
|
||||
#define OPERATOR_NEW_BODY \
|
||||
ENSURE_LSAN_INITED; \
|
||||
@ -277,17 +302,18 @@ namespace __lsan {
|
||||
void InitializeInterceptors() {
|
||||
INTERCEPT_FUNCTION(malloc);
|
||||
INTERCEPT_FUNCTION(free);
|
||||
INTERCEPT_FUNCTION(cfree);
|
||||
LSAN_MAYBE_INTERCEPT_CFREE;
|
||||
INTERCEPT_FUNCTION(calloc);
|
||||
INTERCEPT_FUNCTION(realloc);
|
||||
INTERCEPT_FUNCTION(memalign);
|
||||
LSAN_MAYBE_INTERCEPT_MEMALIGN;
|
||||
LSAN_MAYBE_INTERCEPT___LIBC_MEMALIGN;
|
||||
INTERCEPT_FUNCTION(aligned_alloc);
|
||||
INTERCEPT_FUNCTION(posix_memalign);
|
||||
INTERCEPT_FUNCTION(__libc_memalign);
|
||||
INTERCEPT_FUNCTION(valloc);
|
||||
INTERCEPT_FUNCTION(pvalloc);
|
||||
LSAN_MAYBE_INTERCEPT_PVALLOC;
|
||||
INTERCEPT_FUNCTION(malloc_usable_size);
|
||||
INTERCEPT_FUNCTION(mallinfo);
|
||||
INTERCEPT_FUNCTION(mallopt);
|
||||
LSAN_MAYBE_INTERCEPT_MALLINFO;
|
||||
LSAN_MAYBE_INTERCEPT_MALLOPT;
|
||||
INTERCEPT_FUNCTION(pthread_create);
|
||||
INTERCEPT_FUNCTION(pthread_join);
|
||||
|
||||
|
@ -316,4 +316,9 @@
|
||||
#define SANITIZER_INTERCEPT_UTMP SI_NOT_WINDOWS && !SI_MAC && !SI_FREEBSD
|
||||
#define SANITIZER_INTERCEPT_UTMPX SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD
|
||||
|
||||
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO (!SI_FREEBSD && !SI_MAC)
|
||||
#define SANITIZER_INTERCEPT_MEMALIGN (!SI_FREEBSD && !SI_MAC)
|
||||
#define SANITIZER_INTERCEPT_PVALLOC (!SI_FREEBSD && !SI_MAC)
|
||||
#define SANITIZER_INTERCEPT_CFREE (!SI_FREEBSD && !SI_MAC)
|
||||
|
||||
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
|
||||
|
@ -37,6 +37,11 @@ SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g'
|
||||
DISTPREFIX?= ${PKG}-${VERSION}
|
||||
DISTFILEGZ?= ${DISTPREFIX}.tar.gz
|
||||
DISTFILE?= ${DISTPREFIX}.tar.xz
|
||||
DISTINFO= ${DISTFILE}.distinfo
|
||||
DISTINFOSIGN= ${DISTINFO}.asc
|
||||
CKSUM?= cksum -a SHA256
|
||||
PGP?= netpgp
|
||||
|
||||
FOSSILID?= current
|
||||
|
||||
.SUFFIXES: .in
|
||||
@ -53,7 +58,7 @@ clean:
|
||||
rm -f ${TARGET}
|
||||
|
||||
distclean: clean
|
||||
rm -f config.mk ${DISTFILE}
|
||||
rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
|
||||
|
||||
installdirs:
|
||||
|
||||
@ -83,3 +88,11 @@ dist:
|
||||
fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
|
||||
gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
|
||||
rm ${DISTFILEGZ}
|
||||
|
||||
distinfo: dist
|
||||
rm -f ${DISTINFO} ${DISTINFOSIGN}
|
||||
${CKSUM} ${DISTFILE} >${DISTINFO}
|
||||
#printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
|
||||
${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
|
||||
chmod 644 ${DISTINFOSIGN}
|
||||
ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
|
||||
|
23
contrib/openresolv/configure
vendored
23
contrib/openresolv/configure
vendored
@ -120,14 +120,21 @@ echo "Configuring openresolv for ... $OS"
|
||||
rm -rf $CONFIG_MK
|
||||
echo "# $OS" >$CONFIG_MK
|
||||
|
||||
# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
|
||||
# regardless of if it's not running.
|
||||
# So we force onestatus to work around this silly bug.
|
||||
if [ -z "$STATUSARG" ]; then
|
||||
case "$OS" in
|
||||
freebsd*) STATUSARG="onestatus";;
|
||||
esac
|
||||
fi
|
||||
case "$OS" in
|
||||
freebsd*)
|
||||
# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
|
||||
# regardless of if it's not running.
|
||||
# So we force onestatus to work around this silly bug.
|
||||
if [ -z "$STATUSARG" ]; then
|
||||
STATUSARG="onestatus"
|
||||
fi
|
||||
;;
|
||||
linux*)
|
||||
# cksum does't support -a and netpgp is rare
|
||||
echo "CKSUM= sha256sum --tag" >>$CONFIG_MK
|
||||
echo "PGP= gpg2" >>$CONFIG_MK
|
||||
;;
|
||||
esac
|
||||
|
||||
for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG
|
||||
do
|
||||
|
@ -216,7 +216,7 @@ fi
|
||||
if $backup; then
|
||||
if [ "$newconf" = "$signature$NL" ]; then
|
||||
if [ -e "$resolv_conf.bak" ]; then
|
||||
newconf="$(cat "$resolv_conf.bak")"
|
||||
newconf="$(cat "$resolv_conf.bak")$NL"
|
||||
fi
|
||||
elif [ -e "$resolv_conf" ]; then
|
||||
read line <"$resolv_conf"
|
||||
|
@ -34,7 +34,6 @@ NL="
|
||||
"
|
||||
|
||||
: ${pdns_service:=pdns_recursor}
|
||||
: ${pdns_restart:=@RESTARTCMD ${pdns_service}@}
|
||||
|
||||
newzones=
|
||||
|
||||
@ -68,5 +67,12 @@ if [ ! -f "$pdns_zones" ] || \
|
||||
[ "$(cat "$pdns_zones")" != "$(printf %s "$newzones")" ]
|
||||
then
|
||||
printf %s "$newzones" >"$pdns_zones"
|
||||
eval $pdns_restart
|
||||
if [ -n "$pdns_restart" ]; then
|
||||
eval $pdns_restart
|
||||
elif [ -n "$RESTARTCMD" ]; then
|
||||
set -- ${pdns_service}
|
||||
eval $RESTARTCMD
|
||||
else
|
||||
@SBINDIR@/resolvconf -r ${pdns_service}
|
||||
fi
|
||||
fi
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd May 7, 2016
|
||||
.Dd November 29, 2016
|
||||
.Dt RESOLVCONF 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,6 +45,8 @@
|
||||
.Fl il Ar pattern
|
||||
.Nm
|
||||
.Fl u
|
||||
.Nm
|
||||
.Fl Fl version
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
manages
|
||||
@ -106,7 +108,7 @@ See
|
||||
.Xr resolvconf.conf 5
|
||||
for how to configure
|
||||
.Nm
|
||||
to use a local name server.
|
||||
to use a local name server and how to remove the private marking.
|
||||
.Pp
|
||||
.Nm
|
||||
can mark an interfaces
|
||||
@ -126,7 +128,7 @@ on the
|
||||
.Ar interface .
|
||||
.Pp
|
||||
Here are some options for the above commands:-
|
||||
.Bl -tag -width indent
|
||||
.Bl -tag -width pattern_opt
|
||||
.It Fl f
|
||||
Ignore non existent interfaces.
|
||||
Only really useful for deleting interfaces.
|
||||
@ -146,7 +148,7 @@ as exclusive when adding, otherwise only use the latest exclusive interface.
|
||||
.Pp
|
||||
.Nm
|
||||
has some more commands for general usage:-
|
||||
.Bl -tag -width indent
|
||||
.Bl -tag -width pattern_opt
|
||||
.It Fl i Ar pattern
|
||||
List the interfaces and protocols, optionally matching
|
||||
.Ar pattern ,
|
||||
@ -168,12 +170,15 @@ to update all its subscribers.
|
||||
.Nm
|
||||
does not update the subscribers when adding a resolv.conf that matches
|
||||
what it already has for that interface.
|
||||
.It Fl Fl version
|
||||
Echo the resolvconf version to
|
||||
.Em stdout .
|
||||
.El
|
||||
.Pp
|
||||
.Nm
|
||||
also has some commands designed to be used by it's subscribers and
|
||||
system startup:-
|
||||
.Bl -tag -width indent
|
||||
.Bl -tag -width pattern_opt
|
||||
.It Fl I
|
||||
Initialise the state directory
|
||||
.Pa @VARDIR@ .
|
||||
@ -223,7 +228,7 @@ Here are some suggested protocol tags to use for each
|
||||
.Pa resolv.conf
|
||||
file registered on an
|
||||
.Ar interface Ns No :-
|
||||
.Bl -tag -width indent
|
||||
.Bl -tag -width pattern_opt
|
||||
.It dhcp
|
||||
Dynamic Host Configuration Protocol.
|
||||
Initial versions of
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 28, 2016
|
||||
.Dd December 29, 2016
|
||||
.Dt RESOLVCONF.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -69,6 +69,11 @@ If unset, defaults to the following:-
|
||||
These interfaces will be processed next, unless they have a metric.
|
||||
If unset, defaults to the following:-
|
||||
.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*
|
||||
.It Sy inclusive_interfaces
|
||||
Ignore any exlcusive marking for these interfaces.
|
||||
This is handy when 3rd party integrations force the
|
||||
.Nm resolvconf -x
|
||||
option and you want to disable it easily.
|
||||
.It Sy local_nameservers
|
||||
If unset, defaults to the following:-
|
||||
.D1 127.* 0.0.0.0 255.255.255.255 ::1
|
||||
@ -102,6 +107,11 @@ Requires a local nameserver other than libc.
|
||||
This is equivalent to the
|
||||
.Nm resolvconf -p
|
||||
option.
|
||||
.It Sy public_interfaces
|
||||
Force these interface to be public, overriding the private marking.
|
||||
This is handy when 3rd party integrations force the
|
||||
.Nm resolvconf -p
|
||||
option and you want to disable it easily.
|
||||
.It Sy replace
|
||||
Is a space separated list of replacement keywords.
|
||||
The syntax is this:
|
||||
|
@ -25,13 +25,19 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
RESOLVCONF="$0"
|
||||
OPENRESOLV_VERSION="3.8.1"
|
||||
OPENRESOLV_VERSION="3.9.0"
|
||||
SYSCONFDIR=@SYSCONFDIR@
|
||||
LIBEXECDIR=@LIBEXECDIR@
|
||||
VARDIR=@VARDIR@
|
||||
RCDIR=@RCDIR@
|
||||
RESTARTCMD=@RESTARTCMD@
|
||||
|
||||
if [ "$1" = "--version" ]; then
|
||||
echo "openresolv $OPENRESOLV_VERSION"
|
||||
echo "Copyright (c) 2007-2016 Roy Marples"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Disregard dhcpcd setting
|
||||
unset interface_order state_dir
|
||||
|
||||
@ -90,6 +96,7 @@ usage()
|
||||
that match the specified pattern
|
||||
|
||||
-u Run updates from our current DNS information
|
||||
--version Echo the ${RESOLVCONF##*/} version
|
||||
|
||||
Options:
|
||||
-f Ignore non existent interfaces
|
||||
@ -129,6 +136,34 @@ strip_trailing_dots()
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
private_iface()
|
||||
{
|
||||
local p
|
||||
|
||||
# Allow expansion
|
||||
cd "$IFACEDIR"
|
||||
|
||||
# Public interfaces override private ones.
|
||||
for p in $public_interfaces; do
|
||||
case "$iface" in
|
||||
"$p"|"$p":*) return 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -e "$PRIVATEDIR/$iface" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
for p in $private_interfaces; do
|
||||
case "$iface" in
|
||||
"$p"|"$p":*) return 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Not a private interface
|
||||
return 1
|
||||
}
|
||||
|
||||
# Parse resolv.conf's and make variables
|
||||
# for domain name servers, search name servers and global nameservers
|
||||
parse_resolv()
|
||||
@ -144,20 +179,10 @@ parse_resolv()
|
||||
if ${new}; then
|
||||
iface="${line#\# resolv.conf from *}"
|
||||
new=false
|
||||
if [ -e "$PRIVATEDIR/$iface" ]; then
|
||||
if private_iface "$iface"; then
|
||||
private=true
|
||||
else
|
||||
# Allow expansion
|
||||
cd "$IFACEDIR"
|
||||
private=false
|
||||
for p in $private_interfaces; do
|
||||
case "$iface" in
|
||||
"$p"|"$p":*)
|
||||
private=true
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@ -301,9 +326,9 @@ fi"
|
||||
/usr/sbin/service \$1 restart;
|
||||
fi"
|
||||
elif [ -x /bin/sv ]; then
|
||||
RESTARTCMD="/bin/sv try-restart \$1"
|
||||
RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1"
|
||||
elif [ -x /usr/bin/sv ]; then
|
||||
RESTARTCMD="/usr/bin/sv try-restart \$1"
|
||||
RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1"
|
||||
elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then
|
||||
RCDIR=/etc/rc.d
|
||||
RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then
|
||||
@ -378,6 +403,14 @@ list_resolv()
|
||||
done
|
||||
fi
|
||||
excl=true
|
||||
cd "$IFACEDIR"
|
||||
for i in $inclusive_interfaces; do
|
||||
if [ -f "$i" -a "$list" = "$i" ]; then
|
||||
list=
|
||||
excl=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
*)
|
||||
excl=false
|
||||
@ -418,7 +451,6 @@ list_resolv()
|
||||
|
||||
cd "$IFACEDIR"
|
||||
retval=1
|
||||
excl=true
|
||||
for i in $(uniqify $list); do
|
||||
# Only list interfaces which we really have
|
||||
if ! [ -f "$i" ]; then
|
||||
@ -432,8 +464,7 @@ list_resolv()
|
||||
if [ "$cmd" = i -o "$cmd" = "-i" ]; then
|
||||
printf %s "$i "
|
||||
else
|
||||
echo_resolv "$i"
|
||||
echo
|
||||
echo_resolv "$i" && echo
|
||||
fi
|
||||
[ $? = 0 -a "$retval" = 1 ] && retval=0
|
||||
done
|
||||
|
@ -1,12 +0,0 @@
|
||||
version.c
|
||||
Makefile
|
||||
Makefile-devel.in
|
||||
config.status
|
||||
config.log
|
||||
config.cache
|
||||
config.h
|
||||
.devel
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
tcpdump
|
||||
autom4te.cache
|
@ -1,3 +1,187 @@
|
||||
Wednesday January 18, 2017 devel.fx.lebail@orange.fr
|
||||
Summary for 4.9.0 tcpdump release
|
||||
General updates:
|
||||
Improve separation frontend/backend (tcpdump/libnetdissect)
|
||||
Don't require IPv6 library support in order to support IPv6 addresses
|
||||
Introduce data types to use for integral values in packet structures
|
||||
Fix display of timestamps with -tt, -ttt and -ttttt options
|
||||
Fix some heap overflows found with American Fuzzy Lop by Hanno Boeck and others
|
||||
(More information in the log with CVE-2016-* and CVE-2017-*)
|
||||
Change the way protocols print link-layer addresses (Fix heap overflows
|
||||
in CALM-FAST and GeoNetworking printers)
|
||||
Pass correct caplen value to ether_print() and some other functions
|
||||
Fix lookup_nsap() to match what isonsap_string() expects
|
||||
Clean up relative time stamp printing (Fix an array overflow)
|
||||
Fix some alignment issues with GCC on Solaris 10 SPARC
|
||||
Add some ND_TTEST_/ND_TCHECK_ macros to simplify writing bounds checks
|
||||
Add a fn_printztn() which returns the number of bytes processed
|
||||
Add nd_init() and nd_cleanup() functions. Improve libsmi support
|
||||
Add CONTRIBUTING file
|
||||
Add a summary comment in all printers
|
||||
Compile with more warning options in devel mode if supported (-Wcast-qual, ...)
|
||||
Fix some leaks found by Valgrind/Memcheck
|
||||
Fix a bunch of de-constifications
|
||||
Squelch some Coverity warnings and some compiler warnings
|
||||
Update Coverity and Travis-CI setup
|
||||
Update Visual Studio files
|
||||
|
||||
Frontend:
|
||||
Fix capsicum support to work with zerocopy buffers in bpf
|
||||
Try opening interfaces by name first, then by name-as-index
|
||||
Work around pcap_create() failures fetching time stamp type lists
|
||||
Fix a segmentation fault with 'tcpdump -J'
|
||||
Improve addrtostr6() bounds checking
|
||||
Add exit_tcpdump() function
|
||||
Don't drop CAP_SYS_CHROOT before chrooting
|
||||
Fixes issue where statistics not reported when -G and -W options used
|
||||
|
||||
New printers supporting:
|
||||
Generic Protocol Extension for VXLAN (VXLAN-GPE)
|
||||
Home Networking Control Protocol (HNCP), RFCs 7787 and 7788
|
||||
Locator/Identifier Separation Protocol (LISP), type 3 and type 4 packets
|
||||
Marvell Extended Distributed Switch Architecture header (MEDSA)
|
||||
Network Service Header (NSH)
|
||||
REdis Serialization Protocol (RESP)
|
||||
|
||||
Updated printers:
|
||||
802.11: Beginnings of 11ac radiotap support
|
||||
802.11: Check the Protected bit for management frames
|
||||
802.11: Do bounds checking on last_presentp before dereferencing it (Fix a heap overflow)
|
||||
802.11: Fix the radiotap printer to handle the special bits correctly
|
||||
802.11: If we have the MCS field, it's 11n
|
||||
802.11: Only print unknown frame type or subtype messages once
|
||||
802.11: Radiotap dBm values get printed as dB; Update a test output accordingly
|
||||
802.11: Source and destination addresses were backwards
|
||||
AH: Add a bounds check
|
||||
AH: Report to our caller that dissection failed if a bounds check fails
|
||||
AP1394: Print src > dst, not dst > src
|
||||
ARP: Don't assume the target hardware address is <= 6 octets long (Fix a heap overflow)
|
||||
ATALK: Add bounds and length checks (Fix heap overflows)
|
||||
ATM: Add some bounds checks (Fix a heap overflow)
|
||||
ATM: Fix an incorrect bounds check
|
||||
BFD: Update specification from draft to RFC 5880
|
||||
BFD: Update to print optional authentication field
|
||||
BGP: Add decoding of ADD-PATH capability
|
||||
BGP: Add support for the AIGP attribute (RFC7311)
|
||||
BGP: Print LARGE_COMMUNITY Path Attribute
|
||||
BGP: Update BGP numbers from IANA; Print minor values for FSM notification
|
||||
BOOTP: Add a bounds check
|
||||
Babel: Add decoder for source-specific extension
|
||||
CDP: Filter out non-printable characters
|
||||
CFM: Fixes to match the IEEE standard, additional bounds and length checks
|
||||
CSLIP: Add more bounds checks (Fix a heap overflow)
|
||||
ClassicalIPoATM: Add a bounds check on LLC+SNAP header (Fix a heap overflow)
|
||||
DHCP: Fix MUDURL and TZ options
|
||||
DHCPv6: Process MUDURL and TZ options
|
||||
DHCPv6: Update Status Codes with RFCs/IANA names
|
||||
DNS: Represent the "DNSSEC OK" bit as "DO" instead of "OK". Add a test case
|
||||
DTP: Improve packet integrity checks
|
||||
EGP: Fix bounds checks
|
||||
ESP: Don't use OpenSSL_add_all_algorithms() in OpenSSL 1.1.0 or later
|
||||
ESP: Handle OpenSSL 1.1.x
|
||||
Ethernet: Add some bounds checking before calling isoclns_print (Fix a heap overflow)
|
||||
Ethernet: Print the Length/Type field as length when needed
|
||||
FDDI: Fix -e output for FDDI
|
||||
FR: Add some packet-length checks and improve Q.933 printing (Fix heap overflows)
|
||||
GRE: Add some bounds checks (Fix heap overflows)
|
||||
Geneve: Fix error message with invalid option length; Update list option classes
|
||||
HNCP: Fix incorrect time interval format. Fix handling of IPv4 prefixes
|
||||
ICMP6: Fetch a 32-bit big-endian quantity with EXTRACT_32BITS()
|
||||
ICMP6: dagid is always an IPv6 address, not an opaque 128-bit string
|
||||
IGMP: Add a length check
|
||||
IP: Add a bounds check (Fix a heap overflow)
|
||||
IP: Check before fetching the protocol version (Fix a heap overflow)
|
||||
IP: Don't try to dissect if IP version != 4 (Fix a heap overflow)
|
||||
IP: Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP
|
||||
IPComp: Check whether we have the CPI before we fetch it (Fix a heap overflow)
|
||||
IPoFC: Fix -e output (IP-over-Fibre Channel)
|
||||
IPv6: Don't overwrite the destination IPv6 address for routing headers
|
||||
IPv6: Fix header printing
|
||||
IPv6: Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP
|
||||
ISAKMP: Clean up parsing of IKEv2 Security Associations
|
||||
ISOCLNS/IS-IS: Add support for Purge Originator Identifier (RFC6232) and test cases
|
||||
ISOCLNS/IS-IS: Don't overwrite packet data when checking the signature
|
||||
ISOCLNS/IS-IS: Filter out non-printable characters
|
||||
ISOCLNS/IS-IS: Fix segmentation faults
|
||||
ISOCLNS/IS-IS: Have signature_verify() do the copying and clearing
|
||||
ISOCLNS: Add some bounds checks
|
||||
Juniper: Make sure a Juniper header TLV isn't bigger than what's left in the packet (Fix a heap overflow)
|
||||
LLC/SNAP: With -e, print the LLC header before the SNAP header; without it, cut the SNAP header
|
||||
LLC: Add a bounds check (Fix a heap overflow)
|
||||
LLC: Clean up printing of LLC packets
|
||||
LLC: Fix the printing of RFC 948-style IP packets
|
||||
LLC: Skip the LLC and SNAP headers with -x for 802.11 and some other protocols
|
||||
LLDP: Implement IANA OUI and LLDP MUD option
|
||||
MPLS LSP ping: Update printing for RFC 4379, bug fixes, more bounds checks
|
||||
MPLS: "length" is now the *remaining* packet length
|
||||
MPLS: Add bounds and length checks (Fix a heap overflow)
|
||||
NFS: Add a test that makes unaligned accesses
|
||||
NFS: Don't assume the ONC RPC header is nicely aligned
|
||||
NFS: Don't overflow the Opaque_Handle buffer (Fix a segmentation fault)
|
||||
NFS: Don't run past the end of an NFSv3 file handle
|
||||
OLSR: Add a test to cover a HNA sgw case
|
||||
OLSR: Fix 'Advertised networks' count
|
||||
OLSR: Fix printing of smart-gateway HNAs in IPv4
|
||||
OSPF: Add a bounds check for the Hello packet options
|
||||
OSPF: Do more bounds checking
|
||||
OSPF: Fix a segmentation fault
|
||||
OSPF: Fix printing 'ospf_topology_values' default
|
||||
OTV: Add missing bounds checks
|
||||
PGM: Print the formatted IP address, not the raw binary address, as a string
|
||||
PIM: Add some bounds checking (Fix a heap overflow)
|
||||
PIMv2: Fix checksumming of Register messages
|
||||
PPI: Pass an adjusted struct pcap_pkthdr to the sub-printer
|
||||
PPP: Add some bounds checks (Fix a heap overflow)
|
||||
PPP: Report invalid PAP AACK/ANAK packets
|
||||
Q.933: Add a missing bounds check
|
||||
RADIUS: Add Value 13 "VLAN" to Tunnel-Type attribute
|
||||
RADIUS: Filter out non-printable characters
|
||||
RADIUS: Translate UDP/1700 as RADIUS
|
||||
RESP: Do better checking of RESP packets
|
||||
RPKI-RTR: Add a return value check for "fn_printn" call
|
||||
RPKI-RTR: Remove printing when truncated condition already detected
|
||||
RPL: Fix 'Consistency Check' control code
|
||||
RPL: Fix suboption print
|
||||
RSVP: An INTEGRITY object in a submessage covers only the submessage
|
||||
RSVP: Fix an infinite loop; Add bounds and length checks
|
||||
RSVP: Fix some if statements missing brackets
|
||||
RSVP: Have signature_verify() do the copying and clearing
|
||||
RTCP: Add some bounds checks
|
||||
RTP: Add some bounds checks, fix two segmentation faults
|
||||
SCTP: Do more bounds checking
|
||||
SFLOW: Fix bounds checking
|
||||
SLOW: Fix bugs, add checks
|
||||
SMB: Before fetching the flags2 field, make sure we have it
|
||||
SMB: Do bounds checks on NBNS resource types and resource data lengths
|
||||
SNMP: Clean up the "have libsmi but no modules loaded" case
|
||||
SNMP: Clean up the object abbreviation list and fix the code to match them
|
||||
SNMP: Do bounds checks when printing character and octet strings
|
||||
SNMP: Improve ASN.1 bounds checks
|
||||
SNMP: More bounds and length checks
|
||||
STP: Add a bunch of bounds checks, and fix some printing (Fix heap overflows)
|
||||
STP: Filter out non-printable characters
|
||||
TCP: Add bounds and length checks for packets with TCP option 20
|
||||
TCP: Correct TCP option Kind value for TCP Auth and add SCPS-TP
|
||||
TCP: Fix two bounds checks (Fix heap overflows)
|
||||
TCP: Make sure we have the data offset field before fetching it (Fix a heap overflow)
|
||||
TCP: Put TCP-AO option decoding right
|
||||
TFTP: Don't use strchr() to scan packet data (Fix a heap overflow)
|
||||
Telnet: Add some bounds checks
|
||||
TokenRing: Fix -e output
|
||||
UDLD: Fix an infinite loop
|
||||
UDP: Add a bounds check (Fix a heap overflow)
|
||||
UDP: Check against the packet length first
|
||||
UDP: Don't do the DDP-over-UDP heuristic check up front
|
||||
VAT: Add some bounds checks
|
||||
VTP: Add a test on Mgmt Domain Name length
|
||||
VTP: Add bounds checks and filter out non-printable characters
|
||||
VXLAN: Add a bound check and a test case
|
||||
ZeroMQ: Fix an infinite loop
|
||||
|
||||
Tuesday April 14, 2015 guy@alum.mit.edu
|
||||
Summary for 4.8.0 tcpdump release
|
||||
Fix "-x" for Apple PKTAP and PPI packets
|
||||
|
||||
Friday April 10, 2015 guy@alum.mit.edu
|
||||
Summary for 4.7.4 tcpdump release
|
||||
RPKI to Router Protocol: Fix Segmentation Faults and other problems
|
||||
@ -464,10 +648,10 @@ Wed. November 12, 2003. mcr@sandelman.ottawa.on.ca. Summary for 3.8 release
|
||||
|
||||
Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release
|
||||
|
||||
Fixed infinite loop when parsing malformed isakmp packets.
|
||||
Fixed infinite loop when parsing invalid isakmp packets.
|
||||
(reported by iDefense; already fixed in CVS)
|
||||
Fixed infinite loop when parsing malformed BGP packets.
|
||||
Fixed buffer overflow with certain malformed NFS packets.
|
||||
Fixed infinite loop when parsing invalid BGP packets.
|
||||
Fixed buffer overflow with certain invalid NFS packets.
|
||||
Pretty-print unprintable network names in 802.11 printer.
|
||||
Handle truncated nbp (appletalk) packets.
|
||||
Updated DHCPv6 printer to match draft-ietf-dhc-dhcpv6-22.txt
|
||||
|
103
contrib/tcpdump/CONTRIBUTING
Normal file
103
contrib/tcpdump/CONTRIBUTING
Normal file
@ -0,0 +1,103 @@
|
||||
Some Information for Contributors
|
||||
---------------------------------
|
||||
You want to contribute to Tcpdump, Thanks!
|
||||
Please, read these lines.
|
||||
|
||||
1) Fork the Tcpdump repository on GitHub from
|
||||
https://github.com/the-tcpdump-group/tcpdump
|
||||
(See https://help.github.com/articles/fork-a-repo/)
|
||||
|
||||
2) Setup an optional Travis-CI build
|
||||
You can setup a travis build for your fork. So, you can test your changes
|
||||
on Linux and OSX before sending pull requests.
|
||||
(See http://docs.travis-ci.com/user/getting-started/)
|
||||
|
||||
3) Clone your repository
|
||||
git clone https://github.com/<username>/tcpdump.git
|
||||
|
||||
4) Do a 'touch .devel' in your working directory.
|
||||
Currently, the effect is
|
||||
a) add (via configure, in Makefile) some warnings options ( -Wall
|
||||
-Wmissing-prototypes -Wstrict-prototypes, ...) to the compiler if it
|
||||
supports these options,
|
||||
b) have the Makefile support "make depend" and the configure script run it.
|
||||
|
||||
5) Configure and build
|
||||
./configure && make -s && make check
|
||||
|
||||
6) Add/update sample.pcap files
|
||||
We use tests directory to do regression tests on the dissection of captured
|
||||
packets, by running tcpdump against a savefile sample.pcap, created with -w
|
||||
option and comparing the results with a text file sample.out giving the
|
||||
expected results.
|
||||
|
||||
Any new/updated fields in a dissector must be present in a sample.pcap file
|
||||
and the corresponding output file.
|
||||
|
||||
Configuration is set in tests/TESTLIST.
|
||||
Each line in this file has the following format:
|
||||
test-name sample.pcap sample.out tcpdump-options
|
||||
|
||||
the sample.out file can be build by:
|
||||
(cd tests && ../tcpdump -n -r sample.pcap tcpdump-options > sample.out)
|
||||
|
||||
It is often useful to have test outputs with different verbosity levels
|
||||
(none, -v, -vv, -vvv, etc.) depending on the code.
|
||||
|
||||
7) Test with 'make check'
|
||||
Don't send a pull request if 'make check' gives failed tests.
|
||||
|
||||
8) Rebase your commits against upstream/master
|
||||
(To keep linearity)
|
||||
|
||||
9) Initiate and send a pull request
|
||||
(See https://help.github.com/articles/using-pull-requests/)
|
||||
|
||||
Some remarks
|
||||
------------
|
||||
a) A thorough reading of some other printers code is useful.
|
||||
|
||||
b) Put the normative reference if any as comments (RFC, etc.).
|
||||
|
||||
c) Put the format of packets/headers/options as comments.
|
||||
|
||||
d) The printer may receive incomplete packet in the buffer, truncated at any
|
||||
random position, for example by capturing with '-s size' option.
|
||||
Thus use ND_TTEST, ND_TTEST2, ND_TCHECK or ND_TCHECK2 for bound checking.
|
||||
For ND_TCHECK2:
|
||||
Define : static const char tstr[] = " [|protocol]";
|
||||
Define a label: trunc
|
||||
Print with: ND_PRINT((ndo, "%s", tstr));
|
||||
You can test the code via:
|
||||
sudo ./tcpdump -s snaplen [-v][v][...] -i lo # in a terminal
|
||||
sudo tcpreplay -i lo sample.pcap # in another terminal
|
||||
You should try several values for snaplen to do various truncation.
|
||||
|
||||
e) Do invalid packet checks in code: Think that your code can receive in input
|
||||
not only a valid packet but any arbitrary random sequence of octets (packet
|
||||
- built malformed originally by the sender or by a fuzz tester,
|
||||
- became corrupted in transit).
|
||||
Print with: ND_PRINT((ndo, "%s", istr)); /* to print " (invalid)" */
|
||||
|
||||
f) Use 'struct tok' for indexed strings and print them with
|
||||
tok2str() or bittok2str() (for flags).
|
||||
|
||||
g) Avoid empty lines in output of printers.
|
||||
|
||||
h) A commit message must have:
|
||||
First line: Capitalized short summary in the imperative (70 chars or less)
|
||||
|
||||
Body: Detailed explanatory text, if necessary. Fold it to approximately
|
||||
72 characters. There must be an empty line separating the summary from
|
||||
the body.
|
||||
|
||||
i) Avoid non-ASCII characters in code and commit messages.
|
||||
|
||||
j) Use the style of the modified sources.
|
||||
|
||||
k) Don't mix declarations and code
|
||||
|
||||
l) Don't use // for comments
|
||||
Not all C compilers accept C++/C99 comments by default.
|
||||
|
||||
m) Avoid trailing tabs/spaces
|
@ -20,11 +20,13 @@ Additional people who have contributed patches:
|
||||
Andrea Bittau <a dot bittau at cs dot ucl dot ac dot uk>
|
||||
Andrew Brown <atatat at atatdot dot net>
|
||||
Andrew Church <andrew at users dot sourceforge dot net>
|
||||
Andrew Darqui <andrew dot darqui at gmail dot com>
|
||||
Andrew Hintz <adhintz at users dot sourceforge dot net>
|
||||
Andrew Nording <andrew at nording dot ru>
|
||||
Andrew Tridgell <tridge at linuxcare dot com>
|
||||
Andy Heffernan <ahh at juniper dot net>
|
||||
Anton Bernal <anton at juniper dot net>
|
||||
Antonin Décimo <antonin dot decimo at gmail dot com>
|
||||
Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
|
||||
Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu>
|
||||
Arnaldo Carvalho de Melo <acme at ghostprotocols dot net>
|
||||
@ -33,6 +35,7 @@ Additional people who have contributed patches:
|
||||
Ben Byer <bushing at sourceforge dot net>
|
||||
Ben Smithurst <ben at scientia dot demon dot co dot uk>
|
||||
Bert Vermeulen <bert at biot dot com>
|
||||
Bill Parker <wp02855 at gmail dot com>
|
||||
Bjoern A. Zeeb <bzeeb at Zabbadoz dot NeT>
|
||||
Bram <tcpdump at mail dot wizbit dot be>
|
||||
Brent L. Bates <blbates at vigyan dot com>
|
||||
@ -95,6 +98,7 @@ Additional people who have contributed patches:
|
||||
Jason R. Thorpe <thorpej at netbsd dot org>
|
||||
Jefferson Ogata <jogata at nodc dot noaa dot gov>
|
||||
Jeffrey Hutzelman <jhutz at cmu dot edu>
|
||||
Jean-Raphaël Gaglione <jr dot gaglione at yahoo dot fr>
|
||||
Jesper Peterson <jesper at endace dot com>
|
||||
Jesse Gross <jesse at nicira dot com>
|
||||
Jim Hutchins <jim at ca dot sandia dot gov>
|
||||
@ -119,7 +123,7 @@ Additional people who have contributed patches:
|
||||
Larry Lile <lile at stdio dot com>
|
||||
Lennert Buytenhek <buytenh at gnu dot org>
|
||||
Loganaden Velvindron <logan at elandsys dot com>
|
||||
Longinus00 <Longinus00 at gmail dot com>
|
||||
Daniel Lee <Longinus00 at gmail dot com>
|
||||
Loris Degioanni <loris at netgroup-serv dot polito dot it>
|
||||
Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
|
||||
Lucas C. Villa Real <lucasvr at us dot ibm dot com>
|
||||
@ -134,6 +138,7 @@ Additional people who have contributed patches:
|
||||
Markus Schöpflin <schoepflin at sourceforge dot net>
|
||||
Marshall Rose <mrose at dbc dot mtview dot ca dot us>
|
||||
Martin Husemann <martin at netbsd dot org>
|
||||
Matthieu Boutier <boutier at pps dot univ-paris-diderot dot fr>
|
||||
Max Laier <max at love2party dot net>
|
||||
Michael A. Meffie III <meffie at sourceforge dot net>
|
||||
Michael Madore <mmadore at turbolinux dot com>
|
||||
|
@ -49,9 +49,10 @@ addrtoname.c - address to hostname routines
|
||||
addrtoname.h - address to hostname definitions
|
||||
ah.h - IPSEC Authentication Header definitions
|
||||
appletalk.h - AppleTalk definitions
|
||||
ascii_strcasecmp.c - locale-independent case-independent string comparison
|
||||
routines
|
||||
atime.awk - TCP ack awk script
|
||||
atm.h - ATM traffic type definitions
|
||||
atmuni31.h - ATM Q.2931 definitions
|
||||
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
|
||||
have them
|
||||
chdlc.h - Cisco HDLC definitions
|
||||
@ -100,100 +101,8 @@ pcap_dump_ftell.c - pcap_dump_ftell() implementation, in case libpcap
|
||||
doesn't have it
|
||||
pcap-missing.h - declarations of functions possibly missing from libpcap
|
||||
ppp.h - Point to Point Protocol definitions
|
||||
print-802_11.c - IEEE 802.11 printer routines
|
||||
print-ap1394.c - Apple IP-over-IEEE 1394 printer routines
|
||||
print-ah.c - IPSEC Authentication Header printer routines
|
||||
print-aodv.c - AODV printer routines
|
||||
print-arcnet.c - ARCNET printer routines
|
||||
print-arp.c - Address Resolution Protocol printer routines
|
||||
print-ascii.c - ASCII packet dump routines
|
||||
print-atalk.c - AppleTalk printer routines
|
||||
print-atm.c - ATM printer routines
|
||||
print-beep.c - BEEP printer routines
|
||||
print-bgp.c - Border Gateway Protocol printer routines
|
||||
print-bootp.c - BOOTP and IPv4 DHCP printer routines
|
||||
print-bt.c - Bluetooth printer routines
|
||||
print-cdp.c - Cisco Discovery Protocol printer routines
|
||||
print-chdlc.c - Cisco HDLC printer routines
|
||||
print-cip.c - Classical-IP over ATM routines
|
||||
print-cnfp.c - Cisco NetFlow printer routines
|
||||
print-dccp.c - DCCP printer routines
|
||||
print-decnet.c - DECnet printer routines
|
||||
print-dhcp6.c - IPv6 DHCP printer routines
|
||||
print-domain.c - Domain Name System printer routines
|
||||
print-dvmrp.c - Distance Vector Multicast Routing Protocol printer routines
|
||||
print-eap.c - EAP printer routines
|
||||
print-enc.c - OpenBSD IPsec encapsulation BPF layer printer routines
|
||||
print-egp.c - External Gateway Protocol printer routines
|
||||
print-esp.c - IPSEC Encapsulating Security Payload printer routines
|
||||
print-ether.c - Ethernet printer routines
|
||||
print-fddi.c - Fiber Distributed Data Interface printer routines
|
||||
print-fr.c - Frame Relay printer routines
|
||||
print-frag6.c - IPv6 fragmentation header printer routines
|
||||
print-gre.c - Generic Routing Encapsulation printer routines
|
||||
print-hsrp.c - Cisco Hot Standby Router Protocol printer routines
|
||||
print-icmp.c - Internet Control Message Protocol printer routines
|
||||
print-icmp6.c - IPv6 Internet Control Message Protocol printer routines
|
||||
print-igmp.c - Internet Group Management Protocol printer routines
|
||||
print-igrp.c - Interior Gateway Routing Protocol printer routines
|
||||
print-ip.c - IP printer routines
|
||||
print-ip6.c - IPv6 printer routines
|
||||
print-ip6opts.c - IPv6 header option printer routines
|
||||
print-ipcomp.c - IP Payload Compression Protocol printer routines
|
||||
print-ipx.c - IPX printer routines
|
||||
print-isakmp.c - Internet Security Association and Key Management Protocol
|
||||
print-isoclns.c - ISO CLNS, ESIS, and ISIS printer routines
|
||||
print-krb.c - Kerberos printer routines
|
||||
print-l2tp.c - Layer Two Tunneling Protocol printer routines
|
||||
print-lane.c - ATM LANE printer routines
|
||||
print-llc.c - IEEE 802.2 LLC printer routines
|
||||
print-lspping.c - LSPPING printer routines
|
||||
print-lwres.c - Lightweight Resolver protocol printer routines
|
||||
print-mobile.c - IPv4 mobility printer routines
|
||||
print-mobility.c - IPv6 mobility printer routines
|
||||
print-mpls.c - Multi-Protocol Label Switching printer routines
|
||||
print-msdp.c - Multicast Source Discovery Protocol printer routines
|
||||
print-nfs.c - Network File System printer routines
|
||||
print-ntp.c - Network Time Protocol printer routines
|
||||
print-null.c - BSD loopback device printer routines
|
||||
print-ospf.c - Open Shortest Path First printer routines
|
||||
print-ospf6.c - IPv6 Open Shortest Path First printer routines
|
||||
print-pflog.c - OpenBSD packet filter log file printer routines
|
||||
print-pgm.c - Pragmatic General Multicast printer routines
|
||||
print-pim.c - Protocol Independent Multicast printer routines
|
||||
print-ppp.c - Point to Point Protocol printer routines
|
||||
print-pppoe.c - PPP-over-Ethernet printer routines
|
||||
print-pptp.c - Point-to-Point Tunnelling Protocol printer routines
|
||||
print-radius.c - Radius protocol printer routines
|
||||
print-raw.c - Raw IP printer routines
|
||||
print-rip.c - Routing Information Protocol printer routines
|
||||
print-ripng.c - IPv6 Routing Information Protocol printer routines
|
||||
print-rrcp.c - Realtek Remote Control Protocol routines
|
||||
print-rsvp.c - Resource reSerVation Protocol (RSVP) printer routines
|
||||
print-rt6.c - IPv6 routing header printer routines
|
||||
print-rx.c - AFS RX printer routines
|
||||
print-sctp.c - Stream Control Transmission Protocol printer routines
|
||||
print-sip.c - SIP printer routines
|
||||
print-sl.c - Compressed Serial Line Internet Protocol printer routines
|
||||
print-sll.c - Linux "cooked" capture printer routines
|
||||
print-slow.c - IEEE "slow protocol" (802.3ad) printer routines
|
||||
print-smb.c - SMB/CIFS printer routines
|
||||
print-snmp.c - Simple Network Management Protocol printer routines
|
||||
print-stp.c - IEEE 802.1d spanning tree protocol printer routines
|
||||
print-sunatm.c - SunATM DLPI capture printer routines
|
||||
print-sunrpc.c - Sun Remote Procedure Call printer routines
|
||||
print-symantec.c - Symantec Enterprise Firewall printer routines
|
||||
print-tcp.c - TCP printer routines
|
||||
print-telnet.c - Telnet option printer routines
|
||||
print-tftp.c - Trivial File Transfer Protocol printer routines
|
||||
print-timed.c - BSD time daemon protocol printer routines
|
||||
print-token.c - Token Ring printer routines
|
||||
print-udp.c - UDP printer routines
|
||||
print-usb.c - USB printer routines
|
||||
print-vjc.c - PPP Van Jacobson compression (RFC1144) printer routines
|
||||
print-vrrp.c - Virtual Router Redundancy Protocol
|
||||
print-wb.c - White Board printer routines
|
||||
print-zephyr.c - Zephyr printer routines
|
||||
print.c - Top-level routines for protocol printing
|
||||
print-*.c - The netdissect printers
|
||||
rpc_auth.h - definitions for ONC RPC authentication
|
||||
rpc_msg.h - definitions for ONC RPC messages
|
||||
send-ack.awk - unidirectional tcp send/ack awk script
|
||||
@ -203,11 +112,11 @@ slcompress.h - SLIP/PPP Van Jacobson compression (RFC1144) definitions
|
||||
smb.h - SMB/CIFS definitions
|
||||
smbutil.c - SMB/CIFS utility routines
|
||||
stime.awk - TCP send awk script
|
||||
strcasecmp.c - missing routine
|
||||
tcp.h - TCP definitions
|
||||
tcpdump.1 - manual entry
|
||||
tcpdump.c - main program
|
||||
timeval-operations.h - timeval operations macros
|
||||
udp.h - UDP definitions
|
||||
util.c - utility routines
|
||||
util-print.c - utility routines for protocol printers
|
||||
vfprintf.c - emulation routine
|
||||
win32 - headers and routines for building on Win32 systems
|
||||
|
@ -74,7 +74,9 @@ CSRC = setsignal.c tcpdump.c
|
||||
|
||||
LIBNETDISSECT_SRC=\
|
||||
addrtoname.c \
|
||||
addrtostr.c \
|
||||
af.c \
|
||||
ascii_strcasecmp.c \
|
||||
checksum.c \
|
||||
cpack.c \
|
||||
gmpls.c \
|
||||
@ -86,6 +88,7 @@ LIBNETDISSECT_SRC=\
|
||||
nlpid.c \
|
||||
oui.c \
|
||||
parsenfsfh.c \
|
||||
print.c \
|
||||
print-802_11.c \
|
||||
print-802_15_4.c \
|
||||
print-ah.c \
|
||||
@ -98,6 +101,7 @@ LIBNETDISSECT_SRC=\
|
||||
print-ascii.c \
|
||||
print-atalk.c \
|
||||
print-atm.c \
|
||||
print-babel.c \
|
||||
print-beep.c \
|
||||
print-bfd.c \
|
||||
print-bgp.c \
|
||||
@ -112,6 +116,7 @@ LIBNETDISSECT_SRC=\
|
||||
print-cnfp.c \
|
||||
print-dccp.c \
|
||||
print-decnet.c \
|
||||
print-dhcp6.c \
|
||||
print-domain.c \
|
||||
print-dtp.c \
|
||||
print-dvmrp.c \
|
||||
@ -124,17 +129,21 @@ LIBNETDISSECT_SRC=\
|
||||
print-fddi.c \
|
||||
print-forces.c \
|
||||
print-fr.c \
|
||||
print-frag6.c \
|
||||
print-ftp.c \
|
||||
print-geneve.c \
|
||||
print-geonet.c \
|
||||
print-gre.c \
|
||||
print-hncp.c \
|
||||
print-hsrp.c \
|
||||
print-http.c \
|
||||
print-icmp.c \
|
||||
print-icmp6.c \
|
||||
print-igmp.c \
|
||||
print-igrp.c \
|
||||
print-ip.c \
|
||||
print-ip6.c \
|
||||
print-ip6opts.c \
|
||||
print-ipcomp.c \
|
||||
print-ipfc.c \
|
||||
print-ipnet.c \
|
||||
@ -146,6 +155,7 @@ LIBNETDISSECT_SRC=\
|
||||
print-l2tp.c \
|
||||
print-lane.c \
|
||||
print-ldp.c \
|
||||
print-lisp.c \
|
||||
print-llc.c \
|
||||
print-lldp.c \
|
||||
print-lmp.c \
|
||||
@ -154,7 +164,9 @@ LIBNETDISSECT_SRC=\
|
||||
print-lwapp.c \
|
||||
print-lwres.c \
|
||||
print-m3ua.c \
|
||||
print-medsa.c \
|
||||
print-mobile.c \
|
||||
print-mobility.c \
|
||||
print-mpcp.c \
|
||||
print-mpls.c \
|
||||
print-mptcp.c \
|
||||
@ -162,12 +174,14 @@ LIBNETDISSECT_SRC=\
|
||||
print-msnlb.c \
|
||||
print-nflog.c \
|
||||
print-nfs.c \
|
||||
print-nsh.c \
|
||||
print-ntp.c \
|
||||
print-null.c \
|
||||
print-olsr.c \
|
||||
print-openflow-1.0.c \
|
||||
print-openflow.c \
|
||||
print-ospf.c \
|
||||
print-ospf6.c \
|
||||
print-otv.c \
|
||||
print-pgm.c \
|
||||
print-pim.c \
|
||||
@ -178,10 +192,13 @@ LIBNETDISSECT_SRC=\
|
||||
print-pptp.c \
|
||||
print-radius.c \
|
||||
print-raw.c \
|
||||
print-resp.c \
|
||||
print-rip.c \
|
||||
print-ripng.c \
|
||||
print-rpki-rtr.c \
|
||||
print-rrcp.c \
|
||||
print-rsvp.c \
|
||||
print-rt6.c \
|
||||
print-rtsp.c \
|
||||
print-rx.c \
|
||||
print-sctp.c \
|
||||
@ -211,11 +228,14 @@ LIBNETDISSECT_SRC=\
|
||||
print-vrrp.c \
|
||||
print-vtp.c \
|
||||
print-vxlan.c \
|
||||
print-vxlan-gpe.c \
|
||||
print-wb.c \
|
||||
print-zephyr.c \
|
||||
print-zeromq.c \
|
||||
netdissect.c \
|
||||
signature.c \
|
||||
util.c
|
||||
strtoaddr.c \
|
||||
util-print.c
|
||||
|
||||
LOCALSRC = @LOCALSRC@
|
||||
GENSRC = version.c
|
||||
@ -232,11 +252,12 @@ SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
|
||||
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ)
|
||||
HDR = \
|
||||
addrtoname.h \
|
||||
addrtostr.h \
|
||||
af.h \
|
||||
ah.h \
|
||||
appletalk.h \
|
||||
ascii_strcasecmp.h \
|
||||
atm.h \
|
||||
atmuni31.h \
|
||||
chdlc.h \
|
||||
cpack.h \
|
||||
ether.h \
|
||||
@ -264,6 +285,7 @@ HDR = \
|
||||
oui.h \
|
||||
pcap-missing.h \
|
||||
ppp.h \
|
||||
print.h \
|
||||
rpc_auth.h \
|
||||
rpc_msg.h \
|
||||
rpl.h \
|
||||
@ -271,14 +293,15 @@ HDR = \
|
||||
signature.h \
|
||||
slcompress.h \
|
||||
smb.h \
|
||||
strtoaddr.h \
|
||||
tcp.h \
|
||||
tcpdump-stdinc.h \
|
||||
netdissect-stdinc.h \
|
||||
timeval-operations.h \
|
||||
udp.h
|
||||
|
||||
TAGHDR = \
|
||||
/usr/include/arpa/tftp.h \
|
||||
/usr/include/net/if_arp.h \
|
||||
/usr/include/net/slip.h \
|
||||
/usr/include/netinet/if_ether.h \
|
||||
/usr/include/netinet/in.h \
|
||||
/usr/include/netinet/ip_icmp.h \
|
||||
@ -292,11 +315,14 @@ CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
|
||||
|
||||
EXTRA_DIST = \
|
||||
CHANGES \
|
||||
CONTRIBUTING \
|
||||
CREDITS \
|
||||
INSTALL.txt \
|
||||
LICENSE \
|
||||
Makefile.in \
|
||||
Makefile-devel-adds \
|
||||
PLATFORMS \
|
||||
README \
|
||||
README.md \
|
||||
Readme.Win32 \
|
||||
VERSION \
|
||||
@ -314,14 +340,9 @@ EXTRA_DIST = \
|
||||
lbl/os-sunos4.h \
|
||||
lbl/os-ultrix4.h \
|
||||
makemib \
|
||||
missing/addrinfo.h \
|
||||
missing/dlnames.c \
|
||||
missing/datalinks.c \
|
||||
missing/getnameinfo.c \
|
||||
missing/getopt_long.c \
|
||||
missing/inet_aton.c \
|
||||
missing/inet_ntop.c \
|
||||
missing/inet_pton.c \
|
||||
missing/snprintf.c \
|
||||
missing/strdup.c \
|
||||
missing/strlcat.c \
|
||||
@ -330,27 +351,19 @@ EXTRA_DIST = \
|
||||
mkdep \
|
||||
packetdat.awk \
|
||||
pcap_dump_ftell.c \
|
||||
print-babel.c \
|
||||
print-dhcp6.c \
|
||||
print-frag6.c \
|
||||
print-icmp6.c \
|
||||
print-ip6opts.c \
|
||||
print-mobility.c \
|
||||
print-ospf6.c \
|
||||
print-pflog.c \
|
||||
print-ripng.c \
|
||||
print-rt6.c \
|
||||
print-smb.c \
|
||||
send-ack.awk \
|
||||
smbutil.c \
|
||||
stime.awk \
|
||||
strcasecmp.c \
|
||||
tcpdump.1.in \
|
||||
vfprintf.c \
|
||||
win32/Include/w32_fzs.h \
|
||||
win32/prj/GNUmakefile \
|
||||
win32/prj/WinDump.dsp \
|
||||
win32/prj/WinDump.dsw
|
||||
win32/prj/WinDump.dsw \
|
||||
win32/prj/WinDump.sln \
|
||||
win32/prj/WinDump.vcproj \
|
||||
win32/src/ether_ntohost.c
|
||||
|
||||
TEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print`
|
||||
|
||||
@ -362,23 +375,15 @@ $(PROG): $(OBJ) @V_PCAPDEP@
|
||||
|
||||
$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
|
||||
@rm -f $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ)
|
||||
$(AR) cr $@ $(LIBNETDISSECT_OBJ)
|
||||
$(RANLIB) $@
|
||||
|
||||
datalinks.o: $(srcdir)/missing/datalinks.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
|
||||
dlnames.o: $(srcdir)/missing/dlnames.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
|
||||
getnameinfo.o: $(srcdir)/missing/getnameinfo.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
|
||||
getopt_long.o: $(srcdir)/missing/getopt_long.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
|
||||
inet_pton.o: $(srcdir)/missing/inet_pton.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c
|
||||
inet_ntop.o: $(srcdir)/missing/inet_ntop.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c
|
||||
inet_aton.o: $(srcdir)/missing/inet_aton.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c
|
||||
snprintf.o: $(srcdir)/missing/snprintf.c
|
||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
|
||||
strdup.o: $(srcdir)/missing/strdup.c
|
||||
@ -434,6 +439,9 @@ distclean:
|
||||
check: tcpdump
|
||||
(cd tests && ./TESTrun.sh)
|
||||
|
||||
extags: $(TAGFILES)
|
||||
ctags $(TAGFILES)
|
||||
|
||||
tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
||||
|
9
contrib/tcpdump/PLATFORMS
Normal file
9
contrib/tcpdump/PLATFORMS
Normal file
@ -0,0 +1,9 @@
|
||||
== Tested platforms ==
|
||||
NetBSD 5.1/i386 (mcr - 2012/4/1)
|
||||
Debian Linux (squeeze/i386) (mcr - 2012/4/1)
|
||||
|
||||
---
|
||||
RedHat Linux 6.1/i386 (assar)
|
||||
FreeBSD 2.2.8/i386 (itojun)
|
||||
|
||||
|
1
contrib/tcpdump/README
Symbolic link
1
contrib/tcpdump/README
Symbolic link
@ -0,0 +1 @@
|
||||
README.md
|
@ -1 +1 @@
|
||||
4.7.4
|
||||
4.9.0
|
||||
|
@ -20,11 +20,8 @@
|
||||
*
|
||||
* Internet, ethernet, port, and protocol string to address
|
||||
* and address to string conversion routines
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@ -33,7 +30,8 @@
|
||||
#include <libcasper.h>
|
||||
#include <casper/cap_dns.h>
|
||||
#endif /* HAVE_CASPER */
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
#ifdef HAVE_NETINET_IF_ETHER_H
|
||||
@ -64,8 +62,10 @@ extern int ether_ntohost(char *, const struct ether_addr *);
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "addrtostr.h"
|
||||
#include "ethertype.h"
|
||||
#include "llc.h"
|
||||
#include "setsignal.h"
|
||||
#include "extract.h"
|
||||
@ -78,7 +78,7 @@ extern int ether_ntohost(char *, const struct ether_addr *);
|
||||
/*
|
||||
* hash tables for whatever-to-name translations
|
||||
*
|
||||
* XXX there has to be error checks against strdup(3) failure
|
||||
* ndo_error() called on strdup(3) failure
|
||||
*/
|
||||
|
||||
#define HASHNAMESIZE 4096
|
||||
@ -96,7 +96,7 @@ static struct hnamemem eprototable[HASHNAMESIZE];
|
||||
static struct hnamemem dnaddrtable[HASHNAMESIZE];
|
||||
static struct hnamemem ipxsaptable[HASHNAMESIZE];
|
||||
|
||||
#if defined(INET6) && defined(WIN32)
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* fake gethostbyaddr for Win2k/XP
|
||||
* gethostbyaddr() returns incorrect value when AF_INET6 is passed
|
||||
@ -134,9 +134,8 @@ win32_gethostbyaddr(const char *addr, int len, int type)
|
||||
}
|
||||
}
|
||||
#define gethostbyaddr win32_gethostbyaddr
|
||||
#endif /* INET6 & WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef INET6
|
||||
struct h6namemem {
|
||||
struct in6_addr addr;
|
||||
char *name;
|
||||
@ -144,7 +143,6 @@ struct h6namemem {
|
||||
};
|
||||
|
||||
static struct h6namemem h6nametable[HASHNAMESIZE];
|
||||
#endif /* INET6 */
|
||||
|
||||
struct enamemem {
|
||||
u_short e_addr0;
|
||||
@ -214,7 +212,7 @@ extern cap_channel_t *capdns;
|
||||
*
|
||||
* NOTE: ap is *NOT* necessarily part of the packet data (not even if
|
||||
* this is being called with the "ipaddr_string()" macro), so you
|
||||
* *CANNOT* use the TCHECK{2}/TTEST{2} macros on it. Furthermore,
|
||||
* *CANNOT* use the ND_TCHECK{2}/ND_TTEST{2} macros on it. Furthermore,
|
||||
* even in cases where it *is* part of the packet data, the caller
|
||||
* would still have to check for a null return value, even if it's
|
||||
* just printing the return value with "%s" - not all versions of
|
||||
@ -232,7 +230,7 @@ getname(netdissect_options *ndo, const u_char *ap)
|
||||
{
|
||||
register struct hostent *hp;
|
||||
uint32_t addr;
|
||||
static struct hnamemem *p; /* static for longjmp() */
|
||||
struct hnamemem *p;
|
||||
|
||||
memcpy(&addr, ap, sizeof(addr));
|
||||
p = &hnametable[addr & (HASHNAMESIZE-1)];
|
||||
@ -241,7 +239,7 @@ getname(netdissect_options *ndo, const u_char *ap)
|
||||
return (p->name);
|
||||
}
|
||||
p->addr = addr;
|
||||
p->nxt = newhnamemem();
|
||||
p->nxt = newhnamemem(ndo);
|
||||
|
||||
/*
|
||||
* Print names unless:
|
||||
@ -263,6 +261,9 @@ getname(netdissect_options *ndo, const u_char *ap)
|
||||
char *dotp;
|
||||
|
||||
p->name = strdup(hp->h_name);
|
||||
if (p->name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"getname: strdup(hp->h_name)");
|
||||
if (ndo->ndo_Nflag) {
|
||||
/* Remove domain qualifications */
|
||||
dotp = strchr(p->name, '.');
|
||||
@ -273,10 +274,11 @@ getname(netdissect_options *ndo, const u_char *ap)
|
||||
}
|
||||
}
|
||||
p->name = strdup(intoa(addr));
|
||||
if (p->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "getname: strdup(intoa(addr))");
|
||||
return (p->name);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
/*
|
||||
* Return a name for the IP6 address pointed to by ap. This address
|
||||
* is assumed to be in network byte order.
|
||||
@ -292,7 +294,7 @@ getname6(netdissect_options *ndo, const u_char *ap)
|
||||
uint16_t d;
|
||||
} addra;
|
||||
} addr;
|
||||
static struct h6namemem *p; /* static for longjmp() */
|
||||
struct h6namemem *p;
|
||||
register const char *cp;
|
||||
char ntop_buf[INET6_ADDRSTRLEN];
|
||||
|
||||
@ -303,7 +305,7 @@ getname6(netdissect_options *ndo, const u_char *ap)
|
||||
return (p->name);
|
||||
}
|
||||
p->addr = addr.addr;
|
||||
p->nxt = newh6namemem();
|
||||
p->nxt = newh6namemem(ndo);
|
||||
|
||||
/*
|
||||
* Do not print names if -n was given.
|
||||
@ -315,11 +317,15 @@ getname6(netdissect_options *ndo, const u_char *ap)
|
||||
sizeof(addr), AF_INET6);
|
||||
} else
|
||||
#endif
|
||||
hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6);
|
||||
hp = gethostbyaddr((char *)&addr, sizeof(addr),
|
||||
AF_INET6);
|
||||
if (hp) {
|
||||
char *dotp;
|
||||
|
||||
p->name = strdup(hp->h_name);
|
||||
if (p->name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"getname6: strdup(hp->h_name)");
|
||||
if (ndo->ndo_Nflag) {
|
||||
/* Remove domain qualifications */
|
||||
dotp = strchr(p->name, '.');
|
||||
@ -329,11 +335,12 @@ getname6(netdissect_options *ndo, const u_char *ap)
|
||||
return (p->name);
|
||||
}
|
||||
}
|
||||
cp = inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf));
|
||||
cp = addrtostr6(ap, ntop_buf, sizeof(ntop_buf));
|
||||
p->name = strdup(cp);
|
||||
if (p->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "getname6: strdup(cp)");
|
||||
return (p->name);
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
|
||||
@ -341,7 +348,7 @@ static const char hex[] = "0123456789abcdef";
|
||||
/* Find the hash node that corresponds the ether address 'ep' */
|
||||
|
||||
static inline struct enamemem *
|
||||
lookup_emem(const u_char *ep)
|
||||
lookup_emem(netdissect_options *ndo, const u_char *ep)
|
||||
{
|
||||
register u_int i, j, k;
|
||||
struct enamemem *tp;
|
||||
@ -363,7 +370,7 @@ lookup_emem(const u_char *ep)
|
||||
tp->e_addr2 = k;
|
||||
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
|
||||
if (tp->e_nxt == NULL)
|
||||
error("lookup_emem: calloc");
|
||||
(*ndo->ndo_error)(ndo, "lookup_emem: calloc");
|
||||
|
||||
return tp;
|
||||
}
|
||||
@ -374,7 +381,8 @@ lookup_emem(const u_char *ep)
|
||||
*/
|
||||
|
||||
static inline struct enamemem *
|
||||
lookup_bytestring(register const u_char *bs, const unsigned int nlen)
|
||||
lookup_bytestring(netdissect_options *ndo, register const u_char *bs,
|
||||
const unsigned int nlen)
|
||||
{
|
||||
struct enamemem *tp;
|
||||
register u_int i, j, k;
|
||||
@ -406,12 +414,12 @@ lookup_bytestring(register const u_char *bs, const unsigned int nlen)
|
||||
|
||||
tp->e_bs = (u_char *) calloc(1, nlen + 1);
|
||||
if (tp->e_bs == NULL)
|
||||
error("lookup_bytestring: calloc");
|
||||
(*ndo->ndo_error)(ndo, "lookup_bytestring: calloc");
|
||||
|
||||
memcpy(tp->e_bs, bs, nlen);
|
||||
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
|
||||
if (tp->e_nxt == NULL)
|
||||
error("lookup_bytestring: calloc");
|
||||
(*ndo->ndo_error)(ndo, "lookup_bytestring: calloc");
|
||||
|
||||
return tp;
|
||||
}
|
||||
@ -419,14 +427,15 @@ lookup_bytestring(register const u_char *bs, const unsigned int nlen)
|
||||
/* Find the hash node that corresponds the NSAP 'nsap' */
|
||||
|
||||
static inline struct enamemem *
|
||||
lookup_nsap(register const u_char *nsap)
|
||||
lookup_nsap(netdissect_options *ndo, register const u_char *nsap,
|
||||
register u_int nsap_length)
|
||||
{
|
||||
register u_int i, j, k;
|
||||
unsigned int nlen = *nsap;
|
||||
struct enamemem *tp;
|
||||
const u_char *ensap = nsap + nlen - 6;
|
||||
const u_char *ensap;
|
||||
|
||||
if (nlen > 6) {
|
||||
if (nsap_length > 6) {
|
||||
ensap = nsap + nsap_length - 6;
|
||||
k = (ensap[0] << 8) | ensap[1];
|
||||
j = (ensap[2] << 8) | ensap[3];
|
||||
i = (ensap[4] << 8) | ensap[5];
|
||||
@ -439,22 +448,23 @@ lookup_nsap(register const u_char *nsap)
|
||||
if (tp->e_addr0 == i &&
|
||||
tp->e_addr1 == j &&
|
||||
tp->e_addr2 == k &&
|
||||
tp->e_nsap[0] == nlen &&
|
||||
tp->e_nsap[0] == nsap_length &&
|
||||
memcmp((const char *)&(nsap[1]),
|
||||
(char *)&(tp->e_nsap[1]), nlen) == 0)
|
||||
(char *)&(tp->e_nsap[1]), nsap_length) == 0)
|
||||
return tp;
|
||||
else
|
||||
tp = tp->e_nxt;
|
||||
tp->e_addr0 = i;
|
||||
tp->e_addr1 = j;
|
||||
tp->e_addr2 = k;
|
||||
tp->e_nsap = (u_char *)malloc(nlen + 1);
|
||||
tp->e_nsap = (u_char *)malloc(nsap_length + 1);
|
||||
if (tp->e_nsap == NULL)
|
||||
error("lookup_nsap: malloc");
|
||||
memcpy((char *)tp->e_nsap, (const char *)nsap, nlen + 1);
|
||||
(*ndo->ndo_error)(ndo, "lookup_nsap: malloc");
|
||||
tp->e_nsap[0] = (u_char)nsap_length; /* guaranteed < ISONSAP_MAX_LENGTH */
|
||||
memcpy((char *)&tp->e_nsap[1], (const char *)nsap, nsap_length);
|
||||
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
|
||||
if (tp->e_nxt == NULL)
|
||||
error("lookup_nsap: calloc");
|
||||
(*ndo->ndo_error)(ndo, "lookup_nsap: calloc");
|
||||
|
||||
return tp;
|
||||
}
|
||||
@ -462,7 +472,7 @@ lookup_nsap(register const u_char *nsap)
|
||||
/* Find the hash node that corresponds the protoid 'pi'. */
|
||||
|
||||
static inline struct protoidmem *
|
||||
lookup_protoid(const u_char *pi)
|
||||
lookup_protoid(netdissect_options *ndo, const u_char *pi)
|
||||
{
|
||||
register u_int i, j;
|
||||
struct protoidmem *tp;
|
||||
@ -482,7 +492,7 @@ lookup_protoid(const u_char *pi)
|
||||
tp->p_proto = j;
|
||||
tp->p_nxt = (struct protoidmem *)calloc(1, sizeof(*tp));
|
||||
if (tp->p_nxt == NULL)
|
||||
error("lookup_protoid: calloc");
|
||||
(*ndo->ndo_error)(ndo, "lookup_protoid: calloc");
|
||||
|
||||
return tp;
|
||||
}
|
||||
@ -496,21 +506,18 @@ etheraddr_string(netdissect_options *ndo, register const u_char *ep)
|
||||
int oui;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
tp = lookup_emem(ep);
|
||||
tp = lookup_emem(ndo, ep);
|
||||
if (tp->e_name)
|
||||
return (tp->e_name);
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
if (!ndo->ndo_nflag) {
|
||||
char buf2[BUFSIZE];
|
||||
|
||||
/*
|
||||
* We don't cast it to "const struct ether_addr *"
|
||||
* because some systems fail to declare the second
|
||||
* argument as a "const" pointer, even though they
|
||||
* don't modify what it points to.
|
||||
*/
|
||||
if (ether_ntohost(buf2, (struct ether_addr *)ep) == 0) {
|
||||
if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) {
|
||||
tp->e_name = strdup(buf2);
|
||||
if (tp->e_name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"etheraddr_string: strdup(buf2)");
|
||||
return (tp->e_name);
|
||||
}
|
||||
}
|
||||
@ -531,11 +538,13 @@ etheraddr_string(netdissect_options *ndo, register const u_char *ep)
|
||||
} else
|
||||
*cp = '\0';
|
||||
tp->e_name = strdup(buf);
|
||||
if (tp->e_name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "etheraddr_string: strdup(buf)");
|
||||
return (tp->e_name);
|
||||
}
|
||||
|
||||
const char *
|
||||
le64addr_string(const u_char *ep)
|
||||
le64addr_string(netdissect_options *ndo, const u_char *ep)
|
||||
{
|
||||
const unsigned int len = 8;
|
||||
register u_int i;
|
||||
@ -543,7 +552,7 @@ le64addr_string(const u_char *ep)
|
||||
register struct enamemem *tp;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
tp = lookup_bytestring(ep, len);
|
||||
tp = lookup_bytestring(ndo, ep, len);
|
||||
if (tp->e_name)
|
||||
return (tp->e_name);
|
||||
|
||||
@ -558,12 +567,15 @@ le64addr_string(const u_char *ep)
|
||||
*cp = '\0';
|
||||
|
||||
tp->e_name = strdup(buf);
|
||||
if (tp->e_name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "le64addr_string: strdup(buf)");
|
||||
|
||||
return (tp->e_name);
|
||||
}
|
||||
|
||||
const char *
|
||||
linkaddr_string(netdissect_options *ndo, const u_char *ep, const unsigned int type, const unsigned int len)
|
||||
linkaddr_string(netdissect_options *ndo, const u_char *ep,
|
||||
const unsigned int type, const unsigned int len)
|
||||
{
|
||||
register u_int i;
|
||||
register char *cp;
|
||||
@ -578,13 +590,13 @@ linkaddr_string(netdissect_options *ndo, const u_char *ep, const unsigned int ty
|
||||
if (type == LINKADDR_FRELAY)
|
||||
return (q922_string(ndo, ep, len));
|
||||
|
||||
tp = lookup_bytestring(ep, len);
|
||||
tp = lookup_bytestring(ndo, ep, len);
|
||||
if (tp->e_name)
|
||||
return (tp->e_name);
|
||||
|
||||
tp->e_name = cp = (char *)malloc(len*3);
|
||||
if (tp->e_name == NULL)
|
||||
error("linkaddr_string: malloc");
|
||||
(*ndo->ndo_error)(ndo, "linkaddr_string: malloc");
|
||||
*cp++ = hex[*ep >> 4];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
for (i = len-1; i > 0 ; --i) {
|
||||
@ -597,7 +609,7 @@ linkaddr_string(netdissect_options *ndo, const u_char *ep, const unsigned int ty
|
||||
}
|
||||
|
||||
const char *
|
||||
etherproto_string(u_short port)
|
||||
etherproto_string(netdissect_options *ndo, u_short port)
|
||||
{
|
||||
register char *cp;
|
||||
register struct hnamemem *tp;
|
||||
@ -609,7 +621,7 @@ etherproto_string(u_short port)
|
||||
return (tp->name);
|
||||
|
||||
tp->addr = i;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
|
||||
cp = buf;
|
||||
NTOHS(port);
|
||||
@ -619,18 +631,20 @@ etherproto_string(u_short port)
|
||||
*cp++ = hex[port & 0xf];
|
||||
*cp++ = '\0';
|
||||
tp->name = strdup(buf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "etherproto_string: strdup(buf)");
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
const char *
|
||||
protoid_string(register const u_char *pi)
|
||||
protoid_string(netdissect_options *ndo, register const u_char *pi)
|
||||
{
|
||||
register u_int i, j;
|
||||
register char *cp;
|
||||
register struct protoidmem *tp;
|
||||
char buf[sizeof("00:00:00:00:00")];
|
||||
|
||||
tp = lookup_protoid(pi);
|
||||
tp = lookup_protoid(ndo, pi);
|
||||
if (tp->p_name)
|
||||
return tp->p_name;
|
||||
|
||||
@ -646,12 +660,15 @@ protoid_string(register const u_char *pi)
|
||||
}
|
||||
*cp = '\0';
|
||||
tp->p_name = strdup(buf);
|
||||
if (tp->p_name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "protoid_string: strdup(buf)");
|
||||
return (tp->p_name);
|
||||
}
|
||||
|
||||
#define ISONSAP_MAX_LENGTH 20
|
||||
const char *
|
||||
isonsap_string(const u_char *nsap, register u_int nsap_length)
|
||||
isonsap_string(netdissect_options *ndo, const u_char *nsap,
|
||||
register u_int nsap_length)
|
||||
{
|
||||
register u_int nsap_idx;
|
||||
register char *cp;
|
||||
@ -660,13 +677,13 @@ isonsap_string(const u_char *nsap, register u_int nsap_length)
|
||||
if (nsap_length < 1 || nsap_length > ISONSAP_MAX_LENGTH)
|
||||
return ("isonsap_string: illegal length");
|
||||
|
||||
tp = lookup_nsap(nsap);
|
||||
tp = lookup_nsap(ndo, nsap, nsap_length);
|
||||
if (tp->e_name)
|
||||
return tp->e_name;
|
||||
|
||||
tp->e_name = cp = (char *)malloc(sizeof("xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx"));
|
||||
if (cp == NULL)
|
||||
error("isonsap_string: malloc");
|
||||
(*ndo->ndo_error)(ndo, "isonsap_string: malloc");
|
||||
|
||||
for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
|
||||
*cp++ = hex[*nsap >> 4];
|
||||
@ -681,7 +698,7 @@ isonsap_string(const u_char *nsap, register u_int nsap_length)
|
||||
}
|
||||
|
||||
const char *
|
||||
tcpport_string(u_short port)
|
||||
tcpport_string(netdissect_options *ndo, u_short port)
|
||||
{
|
||||
register struct hnamemem *tp;
|
||||
register uint32_t i = port;
|
||||
@ -692,15 +709,17 @@ tcpport_string(u_short port)
|
||||
return (tp->name);
|
||||
|
||||
tp->addr = i;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
|
||||
(void)snprintf(buf, sizeof(buf), "%u", i);
|
||||
tp->name = strdup(buf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "tcpport_string: strdup(buf)");
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
const char *
|
||||
udpport_string(register u_short port)
|
||||
udpport_string(netdissect_options *ndo, register u_short port)
|
||||
{
|
||||
register struct hnamemem *tp;
|
||||
register uint32_t i = port;
|
||||
@ -711,15 +730,17 @@ udpport_string(register u_short port)
|
||||
return (tp->name);
|
||||
|
||||
tp->addr = i;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
|
||||
(void)snprintf(buf, sizeof(buf), "%u", i);
|
||||
tp->name = strdup(buf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "udpport_string: strdup(buf)");
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
const char *
|
||||
ipxsap_string(u_short port)
|
||||
ipxsap_string(netdissect_options *ndo, u_short port)
|
||||
{
|
||||
register char *cp;
|
||||
register struct hnamemem *tp;
|
||||
@ -731,7 +752,7 @@ ipxsap_string(u_short port)
|
||||
return (tp->name);
|
||||
|
||||
tp->addr = i;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
|
||||
cp = buf;
|
||||
NTOHS(port);
|
||||
@ -741,6 +762,8 @@ ipxsap_string(u_short port)
|
||||
*cp++ = hex[port & 0xf];
|
||||
*cp++ = '\0';
|
||||
tp->name = strdup(buf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "ipxsap_string: strdup(buf)");
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
@ -769,25 +792,44 @@ init_servarray(netdissect_options *ndo)
|
||||
table->name = strdup(buf);
|
||||
} else
|
||||
table->name = strdup(sv->s_name);
|
||||
if (table->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "init_servarray: strdup");
|
||||
|
||||
table->addr = port;
|
||||
table->nxt = newhnamemem();
|
||||
table->nxt = newhnamemem(ndo);
|
||||
}
|
||||
endservent();
|
||||
}
|
||||
|
||||
/* in libpcap.a (nametoaddr.c) */
|
||||
#if defined(WIN32) && !defined(USE_STATIC_LIBPCAP)
|
||||
extern __declspec(dllimport)
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
const struct eproto {
|
||||
static const struct eproto {
|
||||
const char *s;
|
||||
u_short p;
|
||||
} eproto_db[];
|
||||
} eproto_db[] = {
|
||||
{ "pup", ETHERTYPE_PUP },
|
||||
{ "xns", ETHERTYPE_NS },
|
||||
{ "ip", ETHERTYPE_IP },
|
||||
{ "ip6", ETHERTYPE_IPV6 },
|
||||
{ "arp", ETHERTYPE_ARP },
|
||||
{ "rarp", ETHERTYPE_REVARP },
|
||||
{ "sprite", ETHERTYPE_SPRITE },
|
||||
{ "mopdl", ETHERTYPE_MOPDL },
|
||||
{ "moprc", ETHERTYPE_MOPRC },
|
||||
{ "decnet", ETHERTYPE_DN },
|
||||
{ "lat", ETHERTYPE_LAT },
|
||||
{ "sca", ETHERTYPE_SCA },
|
||||
{ "lanbridge", ETHERTYPE_LANBRIDGE },
|
||||
{ "vexp", ETHERTYPE_VEXP },
|
||||
{ "vprod", ETHERTYPE_VPROD },
|
||||
{ "atalk", ETHERTYPE_ATALK },
|
||||
{ "atalkarp", ETHERTYPE_AARP },
|
||||
{ "loopback", ETHERTYPE_LOOPBACK },
|
||||
{ "decdts", ETHERTYPE_DECDTS },
|
||||
{ "decdns", ETHERTYPE_DECDNS },
|
||||
{ (char *)0, 0 }
|
||||
};
|
||||
|
||||
static void
|
||||
init_eprotoarray(void)
|
||||
init_eprotoarray(netdissect_options *ndo)
|
||||
{
|
||||
register int i;
|
||||
register struct hnamemem *table;
|
||||
@ -799,7 +841,7 @@ init_eprotoarray(void)
|
||||
table = table->nxt;
|
||||
table->name = eproto_db[i].s;
|
||||
table->addr = htons(eproto_db[i].p);
|
||||
table->nxt = newhnamemem();
|
||||
table->nxt = newhnamemem(ndo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -820,7 +862,7 @@ static const struct protoidlist {
|
||||
* types.
|
||||
*/
|
||||
static void
|
||||
init_protoidarray(void)
|
||||
init_protoidarray(netdissect_options *ndo)
|
||||
{
|
||||
register int i;
|
||||
register struct protoidmem *tp;
|
||||
@ -834,12 +876,15 @@ init_protoidarray(void)
|
||||
u_short etype = htons(eproto_db[i].p);
|
||||
|
||||
memcpy((char *)&protoid[3], (char *)&etype, 2);
|
||||
tp = lookup_protoid(protoid);
|
||||
tp = lookup_protoid(ndo, protoid);
|
||||
tp->p_name = strdup(eproto_db[i].s);
|
||||
if (tp->p_name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"init_protoidarray: strdup(eproto_db[i].s)");
|
||||
}
|
||||
/* Hardwire some SNAP proto ID names */
|
||||
for (pl = protoidlist; pl->name != NULL; ++pl) {
|
||||
tp = lookup_protoid(pl->protoid);
|
||||
tp = lookup_protoid(ndo, pl->protoid);
|
||||
/* Don't override existing name */
|
||||
if (tp->p_name != NULL)
|
||||
continue;
|
||||
@ -871,7 +916,7 @@ static const struct etherlist {
|
||||
* translation, so we just pcap_next_etherent as a convenience.
|
||||
*/
|
||||
static void
|
||||
init_etherarray(void)
|
||||
init_etherarray(netdissect_options *ndo)
|
||||
{
|
||||
register const struct etherlist *el;
|
||||
register struct enamemem *tp;
|
||||
@ -885,8 +930,11 @@ init_etherarray(void)
|
||||
fp = fopen(PCAP_ETHERS_FILE, "r");
|
||||
if (fp != NULL) {
|
||||
while ((ep = pcap_next_etherent(fp)) != NULL) {
|
||||
tp = lookup_emem(ep->addr);
|
||||
tp = lookup_emem(ndo, ep->addr);
|
||||
tp->e_name = strdup(ep->name);
|
||||
if (tp->e_name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"init_etherarray: strdup(ep->addr)");
|
||||
}
|
||||
(void)fclose(fp);
|
||||
}
|
||||
@ -894,7 +942,7 @@ init_etherarray(void)
|
||||
|
||||
/* Hardwire some ethernet names */
|
||||
for (el = etherlist; el->name != NULL; ++el) {
|
||||
tp = lookup_emem(el->addr);
|
||||
tp = lookup_emem(ndo, el->addr);
|
||||
/* Don't override existing name */
|
||||
if (tp->e_name != NULL)
|
||||
continue;
|
||||
@ -902,14 +950,12 @@ init_etherarray(void)
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
/*
|
||||
* Use YP/NIS version of name if available.
|
||||
*
|
||||
* We don't cast it to "const struct ether_addr *"
|
||||
* because some systems don't modify the Ethernet
|
||||
* address but fail to declare the second argument
|
||||
* as a "const" pointer.
|
||||
*/
|
||||
if (ether_ntohost(name, (struct ether_addr *)el->addr) == 0) {
|
||||
if (ether_ntohost(name, (const struct ether_addr *)el->addr) == 0) {
|
||||
tp->e_name = strdup(name);
|
||||
if (tp->e_name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"init_etherarray: strdup(name)");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -1135,7 +1181,7 @@ static const struct tok ipxsap_db[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
init_ipxsaparray(void)
|
||||
init_ipxsaparray(netdissect_options *ndo)
|
||||
{
|
||||
register int i;
|
||||
register struct hnamemem *table;
|
||||
@ -1147,7 +1193,7 @@ init_ipxsaparray(void)
|
||||
table = table->nxt;
|
||||
table->name = ipxsap_db[i].s;
|
||||
table->addr = htons(ipxsap_db[i].v);
|
||||
table->nxt = newhnamemem();
|
||||
table->nxt = newhnamemem(ndo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1170,11 +1216,11 @@ init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
|
||||
*/
|
||||
return;
|
||||
|
||||
init_etherarray();
|
||||
init_etherarray(ndo);
|
||||
init_servarray(ndo);
|
||||
init_eprotoarray();
|
||||
init_protoidarray();
|
||||
init_ipxsaparray();
|
||||
init_eprotoarray(ndo);
|
||||
init_protoidarray(ndo);
|
||||
init_ipxsaparray(ndo);
|
||||
}
|
||||
|
||||
const char *
|
||||
@ -1182,24 +1228,24 @@ dnaddr_string(netdissect_options *ndo, u_short dnaddr)
|
||||
{
|
||||
register struct hnamemem *tp;
|
||||
|
||||
for (tp = &dnaddrtable[dnaddr & (HASHNAMESIZE-1)]; tp->nxt != 0;
|
||||
for (tp = &dnaddrtable[dnaddr & (HASHNAMESIZE-1)]; tp->nxt != NULL;
|
||||
tp = tp->nxt)
|
||||
if (tp->addr == dnaddr)
|
||||
return (tp->name);
|
||||
|
||||
tp->addr = dnaddr;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
if (ndo->ndo_nflag)
|
||||
tp->name = dnnum_string(dnaddr);
|
||||
tp->name = dnnum_string(ndo, dnaddr);
|
||||
else
|
||||
tp->name = dnname_string(dnaddr);
|
||||
tp->name = dnname_string(ndo, dnaddr);
|
||||
|
||||
return(tp->name);
|
||||
}
|
||||
|
||||
/* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */
|
||||
struct hnamemem *
|
||||
newhnamemem(void)
|
||||
newhnamemem(netdissect_options *ndo)
|
||||
{
|
||||
register struct hnamemem *p;
|
||||
static struct hnamemem *ptr = NULL;
|
||||
@ -1209,17 +1255,16 @@ newhnamemem(void)
|
||||
num = 64;
|
||||
ptr = (struct hnamemem *)calloc(num, sizeof (*ptr));
|
||||
if (ptr == NULL)
|
||||
error("newhnamemem: calloc");
|
||||
(*ndo->ndo_error)(ndo, "newhnamemem: calloc");
|
||||
}
|
||||
--num;
|
||||
p = ptr++;
|
||||
return (p);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
/* Return a zero'ed h6namemem struct and cuts down on calloc() overhead */
|
||||
struct h6namemem *
|
||||
newh6namemem(void)
|
||||
newh6namemem(netdissect_options *ndo)
|
||||
{
|
||||
register struct h6namemem *p;
|
||||
static struct h6namemem *ptr = NULL;
|
||||
@ -1229,13 +1274,12 @@ newh6namemem(void)
|
||||
num = 64;
|
||||
ptr = (struct h6namemem *)calloc(num, sizeof (*ptr));
|
||||
if (ptr == NULL)
|
||||
error("newh6namemem: calloc");
|
||||
(*ndo->ndo_error)(ndo, "newh6namemem: calloc");
|
||||
}
|
||||
--num;
|
||||
p = ptr++;
|
||||
return (p);
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
/* Represent TCI part of the 802.1Q 4-octet tag as text. */
|
||||
const char *
|
||||
|
@ -19,6 +19,14 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions to let us compile most of the IPv6 code even on systems
|
||||
* without IPv6 support.
|
||||
*/
|
||||
#ifndef INET6_ADDRSTRLEN
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
#endif
|
||||
|
||||
/* Name to address translation routines. */
|
||||
|
||||
enum {
|
||||
@ -32,28 +40,22 @@ enum {
|
||||
|
||||
extern const char *linkaddr_string(netdissect_options *, const u_char *, const unsigned int, const unsigned int);
|
||||
extern const char *etheraddr_string(netdissect_options *, const u_char *);
|
||||
extern const char *le64addr_string(const u_char *);
|
||||
extern const char *etherproto_string(u_short);
|
||||
extern const char *tcpport_string(u_short);
|
||||
extern const char *udpport_string(u_short);
|
||||
extern const char *isonsap_string(const u_char *, register u_int);
|
||||
extern const char *le64addr_string(netdissect_options *, const u_char *);
|
||||
extern const char *etherproto_string(netdissect_options *, u_short);
|
||||
extern const char *tcpport_string(netdissect_options *, u_short);
|
||||
extern const char *udpport_string(netdissect_options *, u_short);
|
||||
extern const char *isonsap_string(netdissect_options *, const u_char *, register u_int);
|
||||
extern const char *dnaddr_string(netdissect_options *, u_short);
|
||||
extern const char *protoid_string(const u_char *);
|
||||
extern const char *ipxsap_string(u_short);
|
||||
extern const char *protoid_string(netdissect_options *, const u_char *);
|
||||
extern const char *ipxsap_string(netdissect_options *, u_short);
|
||||
extern const char *getname(netdissect_options *, const u_char *);
|
||||
#ifdef INET6
|
||||
extern const char *getname6(netdissect_options *, const u_char *);
|
||||
#endif
|
||||
extern const char *intoa(uint32_t);
|
||||
|
||||
extern void init_addrtoname(netdissect_options *, uint32_t, uint32_t);
|
||||
extern struct hnamemem *newhnamemem(void);
|
||||
#ifdef INET6
|
||||
extern struct h6namemem *newh6namemem(void);
|
||||
#endif
|
||||
extern struct hnamemem *newhnamemem(netdissect_options *);
|
||||
extern struct h6namemem *newh6namemem(netdissect_options *);
|
||||
extern const char * ieee8021q_tci_string(const uint16_t);
|
||||
|
||||
#define ipaddr_string(ndo, p) getname(ndo, (const u_char *)(p))
|
||||
#ifdef INET6
|
||||
#define ip6addr_string(ndo, p) getname6(ndo, (const u_char *)(p))
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -17,7 +17,7 @@
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Kungliga Tekniska
|
||||
* Högskolan and its contributors.
|
||||
* Högskolan and its contributors.
|
||||
*
|
||||
* 4. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
@ -40,9 +40,11 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
#include "addrtostr.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
*
|
||||
@ -56,13 +58,12 @@
|
||||
#define INT16SZ 2 /* word size */
|
||||
#endif
|
||||
|
||||
static const char *
|
||||
inet_ntop_v4 (const void *src, char *dst, size_t size)
|
||||
const char *
|
||||
addrtostr (const void *src, char *dst, size_t size)
|
||||
{
|
||||
const u_char *srcaddr = (const u_char *)src;
|
||||
const char digits[] = "0123456789";
|
||||
int i;
|
||||
struct in_addr *addr = (struct in_addr *)src;
|
||||
u_long a = ntohl(addr->s_addr);
|
||||
const char *orig_dst = dst;
|
||||
|
||||
if (size < INET_ADDRSTRLEN) {
|
||||
@ -70,7 +71,7 @@ inet_ntop_v4 (const void *src, char *dst, size_t size)
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < 4; ++i) {
|
||||
int n = (a >> (24 - i * 8)) & 0xFF;
|
||||
int n = *srcaddr++;
|
||||
int non_zerop = 0;
|
||||
|
||||
if (non_zerop || n / 100 > 0) {
|
||||
@ -91,12 +92,11 @@ inet_ntop_v4 (const void *src, char *dst, size_t size)
|
||||
return orig_dst;
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
/*
|
||||
* Convert IPv6 binary address into presentation (printable) format.
|
||||
*/
|
||||
static const char *
|
||||
inet_ntop_v6 (const u_char *src, char *dst, size_t size)
|
||||
const char *
|
||||
addrtostr6 (const void *src, char *dst, size_t size)
|
||||
{
|
||||
/*
|
||||
* Note that int32_t and int16_t need only be "at least" large enough
|
||||
@ -105,14 +105,16 @@ inet_ntop_v6 (const u_char *src, char *dst, size_t size)
|
||||
* Keep this in mind if you think this function should have been coded
|
||||
* to use pointer overlays. All the world's not a VAX.
|
||||
*/
|
||||
char tmp [INET6_ADDRSTRLEN+1];
|
||||
char *tp;
|
||||
const u_char *srcaddr = (const u_char *)src;
|
||||
char *dp;
|
||||
size_t space_left, added_space;
|
||||
int snprintfed;
|
||||
struct {
|
||||
long base;
|
||||
long len;
|
||||
} best, cur;
|
||||
u_long words [IN6ADDRSZ / INT16SZ];
|
||||
int i;
|
||||
int i;
|
||||
|
||||
/* Preprocess:
|
||||
* Copy the input (bytewise) array into a wordwise array.
|
||||
@ -120,7 +122,7 @@ inet_ntop_v6 (const u_char *src, char *dst, size_t size)
|
||||
*/
|
||||
memset (words, 0, sizeof(words));
|
||||
for (i = 0; i < IN6ADDRSZ; i++)
|
||||
words[i/2] |= (src[i] << ((1 - (i % 2)) << 3));
|
||||
words[i/2] |= (srcaddr[i] << ((1 - (i % 2)) << 3));
|
||||
|
||||
best.len = 0;
|
||||
best.base = -1;
|
||||
@ -148,7 +150,17 @@ inet_ntop_v6 (const u_char *src, char *dst, size_t size)
|
||||
|
||||
/* Format the result.
|
||||
*/
|
||||
tp = tmp;
|
||||
dp = dst;
|
||||
space_left = size;
|
||||
#define APPEND_CHAR(c) \
|
||||
{ \
|
||||
if (space_left == 0) { \
|
||||
errno = ENOSPC; \
|
||||
return (NULL); \
|
||||
} \
|
||||
*dp++ = c; \
|
||||
space_left--; \
|
||||
}
|
||||
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
|
||||
{
|
||||
/* Are we inside the best run of 0x00's?
|
||||
@ -156,61 +168,47 @@ inet_ntop_v6 (const u_char *src, char *dst, size_t size)
|
||||
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
|
||||
{
|
||||
if (i == best.base)
|
||||
*tp++ = ':';
|
||||
APPEND_CHAR(':');
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Are we following an initial run of 0x00s or any real hex?
|
||||
*/
|
||||
if (i != 0)
|
||||
*tp++ = ':';
|
||||
APPEND_CHAR(':');
|
||||
|
||||
/* Is this address an encapsulated IPv4?
|
||||
*/
|
||||
if (i == 6 && best.base == 0 &&
|
||||
(best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
|
||||
{
|
||||
if (!inet_ntop_v4(src+12, tp, sizeof(tmp) - (tp - tmp)))
|
||||
if (!addrtostr(srcaddr+12, dp, space_left))
|
||||
{
|
||||
errno = ENOSPC;
|
||||
return (NULL);
|
||||
}
|
||||
tp += strlen(tp);
|
||||
added_space = strlen(dp);
|
||||
dp += added_space;
|
||||
space_left -= added_space;
|
||||
break;
|
||||
}
|
||||
tp += sprintf (tp, "%lx", words[i]);
|
||||
snprintfed = snprintf (dp, space_left, "%lx", words[i]);
|
||||
if (snprintfed < 0)
|
||||
return (NULL);
|
||||
if ((size_t) snprintfed >= space_left)
|
||||
{
|
||||
errno = ENOSPC;
|
||||
return (NULL);
|
||||
}
|
||||
dp += snprintfed;
|
||||
space_left -= snprintfed;
|
||||
}
|
||||
|
||||
/* Was it a trailing run of 0x00's?
|
||||
*/
|
||||
if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))
|
||||
*tp++ = ':';
|
||||
*tp++ = '\0';
|
||||
APPEND_CHAR(':');
|
||||
APPEND_CHAR('\0');
|
||||
|
||||
/* Check for overflow, copy, and we're done.
|
||||
*/
|
||||
if ((size_t)(tp - tmp) > size)
|
||||
{
|
||||
errno = ENOSPC;
|
||||
return (NULL);
|
||||
}
|
||||
return strcpy (dst, tmp);
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
|
||||
const char *
|
||||
inet_ntop(int af, const void *src, char *dst, size_t size)
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET :
|
||||
return inet_ntop_v4 (src, dst, size);
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
return inet_ntop_v6 ((const u_char*)src, dst, size);
|
||||
#endif
|
||||
default :
|
||||
errno = EAFNOSUPPORT;
|
||||
return NULL;
|
||||
}
|
||||
return (dst);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Kungliga Tekniska H<EFBFBD>gskolan
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -17,7 +17,7 @@
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Kungliga Tekniska
|
||||
* H<EFBFBD>gskolan and its contributors.
|
||||
* Högskolan and its contributors.
|
||||
*
|
||||
* 4. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
@ -36,14 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
/* Address to printable string translation routines. */
|
||||
|
||||
int
|
||||
inet_pton(int af, const char *src, void *dst)
|
||||
{
|
||||
if (af != AF_INET) {
|
||||
errno = EAFNOSUPPORT;
|
||||
return -1;
|
||||
}
|
||||
return inet_aton (src, dst);
|
||||
}
|
||||
extern const char *addrtostr(const void *src, char *dst, size_t size);
|
||||
extern const char *addrtostr6(const void *src, char *dst, size_t size);
|
@ -15,13 +15,12 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include "interface.h"
|
||||
#include <netdissect-stdinc.h>
|
||||
#include "netdissect.h"
|
||||
#include "af.h"
|
||||
|
||||
const struct tok af_values[] = {
|
||||
|
@ -50,6 +50,6 @@ extern const struct tok bsd_af_values[];
|
||||
#define BSD_AFNUM_ISO 7
|
||||
#define BSD_AFNUM_APPLETALK 16
|
||||
#define BSD_AFNUM_IPX 23
|
||||
#define BSD_AFNUM_INET6_BSD 24 /* OpenBSD (and probably NetBSD), BSD/OS */
|
||||
#define BSD_AFNUM_INET6_FREEBSD 28
|
||||
#define BSD_AFNUM_INET6_DARWIN 30
|
||||
#define BSD_AFNUM_INET6_BSD 24 /* NetBSD, OpenBSD, BSD/OS, Npcap */
|
||||
#define BSD_AFNUM_INET6_FREEBSD 28 /* FreeBSD */
|
||||
#define BSD_AFNUM_INET6_DARWIN 30 /* OS X, iOS, other Darwin-based OSes */
|
||||
|
105
contrib/tcpdump/ascii_strcasecmp.c
Normal file
105
contrib/tcpdump/ascii_strcasecmp.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 1987 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that this notice is preserved and that due credit is given
|
||||
* to the University of California at Berkeley. The name of the University
|
||||
* may not be used to endorse or promote products derived from this
|
||||
* software without specific written prior permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "ascii_strcasecmp.h"
|
||||
|
||||
/*
|
||||
* This array maps upper-case ASCII letters to their lower-case
|
||||
* equivalents; all other byte values are mapped to themselves,
|
||||
* so this is locale-independent and intended to be locale-independent,
|
||||
* to avoid issues with, for example, "i" and "I" not being lower-case
|
||||
* and upper-case versions of the same letter in Turkish, where
|
||||
* there are separate "i with dot" and "i without dot" letters.
|
||||
*/
|
||||
static const unsigned char charmap[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
||||
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
||||
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
||||
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
};
|
||||
|
||||
int
|
||||
ascii_strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
register const unsigned char *cm = charmap,
|
||||
*us1 = (const unsigned char *)s1,
|
||||
*us2 = (const unsigned char *)s2;
|
||||
|
||||
while (cm[*us1] == cm[*us2++])
|
||||
if (*us1++ == '\0')
|
||||
return(0);
|
||||
return(cm[*us1] - cm[*--us2]);
|
||||
}
|
||||
|
||||
int
|
||||
ascii_strncasecmp(const char *s1, const char *s2, register size_t n)
|
||||
{
|
||||
register const unsigned char *cm = charmap,
|
||||
*us1 = (const unsigned char *)s1,
|
||||
*us2 = (const unsigned char *)s2;
|
||||
|
||||
for (;;) {
|
||||
if (n == 0) {
|
||||
/*
|
||||
* We've run out of characters that we should
|
||||
* compare, and they've all been equal; return
|
||||
* 0, to indicate that the prefixes are the
|
||||
* same.
|
||||
*/
|
||||
return(0);
|
||||
}
|
||||
if (cm[*us1] != cm[*us2++]) {
|
||||
/*
|
||||
* We've found a mismatch.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
if (*us1++ == '\0') {
|
||||
/*
|
||||
* We've run out of characters *to* compare,
|
||||
* and they've all been equal; return 0, to
|
||||
* indicate that the strings are the same.
|
||||
*/
|
||||
return(0);
|
||||
}
|
||||
n--;
|
||||
}
|
||||
return(cm[*us1] - cm[*--us2]);
|
||||
}
|
33
contrib/tcpdump/ascii_strcasecmp.h
Normal file
33
contrib/tcpdump/ascii_strcasecmp.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 1988-1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1998-2012 Michael Richardson <mcr@tcpdump.org>
|
||||
* The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef netdissect_ascii_strcasecmp_h
|
||||
#define netdissect_ascii_strcasecmp_h
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern int ascii_strcasecmp(const char *, const char *);
|
||||
extern int ascii_strncasecmp(const char *, const char *, size_t);
|
||||
|
||||
#endif /* netdissect_ascii_strcasecmp_h */
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1997 Yen Yen Lim and North Dakota State University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Yen Yen Lim and
|
||||
North Dakota State University
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Based on UNI3.1 standard by ATM Forum */
|
||||
|
||||
/* ATM traffic types based on VPI=0 and (the following VCI */
|
||||
#define VCI_PPC 0x05 /* Point-to-point signal msg */
|
||||
#define VCI_BCC 0x02 /* Broadcast signal msg */
|
||||
#define VCI_OAMF4SC 0x03 /* Segment OAM F4 flow cell */
|
||||
#define VCI_OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
|
||||
#define VCI_METAC 0x01 /* Meta signal msg */
|
||||
#define VCI_ILMIC 0x10 /* ILMI msg */
|
||||
|
||||
/* Q.2931 signalling messages */
|
||||
#define CALL_PROCEED 0x02 /* call proceeding */
|
||||
#define CONNECT 0x07 /* connect */
|
||||
#define CONNECT_ACK 0x0f /* connect_ack */
|
||||
#define SETUP 0x05 /* setup */
|
||||
#define RELEASE 0x4d /* release */
|
||||
#define RELEASE_DONE 0x5a /* release_done */
|
||||
#define RESTART 0x46 /* restart */
|
||||
#define RESTART_ACK 0x4e /* restart ack */
|
||||
#define STATUS 0x7d /* status */
|
||||
#define STATUS_ENQ 0x75 /* status ack */
|
||||
#define ADD_PARTY 0x80 /* add party */
|
||||
#define ADD_PARTY_ACK 0x81 /* add party ack */
|
||||
#define ADD_PARTY_REJ 0x82 /* add party rej */
|
||||
#define DROP_PARTY 0x83 /* drop party */
|
||||
#define DROP_PARTY_ACK 0x84 /* drop party ack */
|
||||
|
||||
/* Information Element Parameters in the signalling messages */
|
||||
#define CAUSE 0x08 /* cause */
|
||||
#define ENDPT_REF 0x54 /* endpoint reference */
|
||||
#define AAL_PARA 0x58 /* ATM adaptation layer parameters */
|
||||
#define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
|
||||
#define CONNECT_ID 0x5a /* connection identifier */
|
||||
#define QOS_PARA 0x5c /* quality of service parameters */
|
||||
#define B_HIGHER 0x5d /* broadband higher layer information */
|
||||
#define B_BEARER 0x5e /* broadband bearer capability */
|
||||
#define B_LOWER 0x5f /* broadband lower information */
|
||||
#define CALLING_PARTY 0x6c /* calling party number */
|
||||
#define CALLED_PARTY 0x70 /* called party nmber */
|
||||
|
||||
#define Q2931 0x09
|
||||
|
||||
/* Q.2931 signalling general messages format */
|
||||
#define PROTO_POS 0 /* offset of protocol discriminator */
|
||||
#define CALL_REF_POS 2 /* offset of call reference value */
|
||||
#define MSG_TYPE_POS 5 /* offset of message type */
|
||||
#define MSG_LEN_POS 7 /* offset of mesage length */
|
||||
#define IE_BEGIN_POS 9 /* offset of first information element */
|
||||
|
||||
/* format of signalling messages */
|
||||
#define TYPE_POS 0
|
||||
#define LEN_POS 2
|
||||
#define FIELD_BEGIN_POS 4
|
@ -19,16 +19,15 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
void
|
||||
bpf_dump(const struct bpf_program *p, int option)
|
||||
|
@ -17,19 +17,18 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
/*
|
||||
* CRC-10 table generated using the following Python snippet:
|
||||
@ -146,17 +145,17 @@ create_osi_cksum (const uint8_t *pptr, int checksum_offset, int length)
|
||||
uint32_t c0;
|
||||
uint32_t c1;
|
||||
uint16_t checksum;
|
||||
int index;
|
||||
int idx;
|
||||
|
||||
c0 = 0;
|
||||
c1 = 0;
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
for (idx = 0; idx < length; idx++) {
|
||||
/*
|
||||
* Ignore the contents of the checksum field.
|
||||
*/
|
||||
if (index == checksum_offset ||
|
||||
index == checksum_offset+1) {
|
||||
if (idx == checksum_offset ||
|
||||
idx == checksum_offset+1) {
|
||||
c1 += c0;
|
||||
pptr++;
|
||||
} else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* define if you have the addrinfo function */
|
||||
#undef HAVE_ADDRINFO
|
||||
/* define if you want to build the possibly-buggy SMB printer */
|
||||
#undef ENABLE_SMB
|
||||
|
||||
/* Define to 1 if you have the `alarm' function. */
|
||||
#undef HAVE_ALARM
|
||||
@ -9,7 +9,7 @@
|
||||
/* Define to 1 if you have the `bpf_dump' function. */
|
||||
#undef HAVE_BPF_DUMP
|
||||
|
||||
/* capsicum support available */
|
||||
/* Casper library support available */
|
||||
#undef HAVE_CASPER
|
||||
|
||||
/* Define to 1 if you have the `cap_enter' function. */
|
||||
@ -34,24 +34,21 @@
|
||||
/* Define to 1 if you have the `ether_ntohost' function. */
|
||||
#undef HAVE_ETHER_NTOHOST
|
||||
|
||||
/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
|
||||
#undef HAVE_EVP_CIPHER_CTX_NEW
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `getnameinfo' function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
/* Define to 1 if you have the `getopt_long' function. */
|
||||
#undef HAVE_GETOPT_LONG
|
||||
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
/* define if you have the h_errno variable */
|
||||
#undef HAVE_H_ERRNO
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
@ -79,6 +76,9 @@
|
||||
/* Define to 1 if you have the <netinet/if_ether.h> header file. */
|
||||
#undef HAVE_NETINET_IF_ETHER_H
|
||||
|
||||
/* Define to 1 if you have the <net/if_pflog.h> header file. */
|
||||
#undef HAVE_NET_IF_PFLOG_H
|
||||
|
||||
/* Define to 1 if you have the <net/pfvar.h> header file. */
|
||||
#undef HAVE_NET_PFVAR_H
|
||||
|
||||
@ -88,6 +88,9 @@
|
||||
/* Define to 1 if you have the <openssl/evp.h> header file. */
|
||||
#undef HAVE_OPENSSL_EVP_H
|
||||
|
||||
/* define if the OS provides AF_INET6 and struct in6_addr */
|
||||
#undef HAVE_OS_IPV6_SUPPORT
|
||||
|
||||
/* if there's an os_proto.h for this platform, to use additional prototypes */
|
||||
#undef HAVE_OS_PROTO_H
|
||||
|
||||
@ -142,6 +145,12 @@
|
||||
/* Define to 1 if you have the `pcap_set_immediate_mode' function. */
|
||||
#undef HAVE_PCAP_SET_IMMEDIATE_MODE
|
||||
|
||||
/* Define to 1 if you have the `pcap_set_optimizer_debug' function. */
|
||||
#undef HAVE_PCAP_SET_OPTIMIZER_DEBUG
|
||||
|
||||
/* Define to 1 if you have the `pcap_set_parser_debug' function. */
|
||||
#undef HAVE_PCAP_SET_PARSER_DEBUG
|
||||
|
||||
/* Define to 1 if you have the `pcap_set_tstamp_precision' function. */
|
||||
#undef HAVE_PCAP_SET_TSTAMP_PRECISION
|
||||
|
||||
@ -184,9 +193,6 @@
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
@ -238,15 +244,9 @@
|
||||
/* define if your compiler has __attribute__ */
|
||||
#undef HAVE___ATTRIBUTE__
|
||||
|
||||
/* Define if you enable IPv6 support */
|
||||
#undef INET6
|
||||
|
||||
/* if unaligned access fails */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
/* define if you need to include missing/addrinfo.h */
|
||||
#undef NEED_ADDRINFO_H
|
||||
|
||||
/* Define to 1 if netinet/ether.h declares `ether_ntohost' */
|
||||
#undef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
|
||||
|
||||
@ -292,9 +292,6 @@
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* define if you want to build the possibly-buggy SMB printer */
|
||||
#undef TCPDUMP_DO_SMB
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
|
1167
contrib/tcpdump/configure
vendored
1167
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,13 @@ AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>])
|
||||
if test "$ac_cv_header_net_pfvar_h" = yes; then
|
||||
LOCALSRC="print-pflog.c $LOCALSRC"
|
||||
AC_CHECK_HEADERS(net/if_pflog.h, , , [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <net/pfvar.h>])
|
||||
if test "$ac_cv_header_net_if_pflog_h" = yes; then
|
||||
LOCALSRC="print-pflog.c $LOCALSRC"
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
@ -169,7 +175,7 @@ AC_ARG_ENABLE(smb,
|
||||
case "$enableval" in
|
||||
yes) AC_MSG_RESULT(yes)
|
||||
AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
|
||||
AC_DEFINE(TCPDUMP_DO_SMB, 1,
|
||||
AC_DEFINE(ENABLE_SMB, 1,
|
||||
[define if you want to build the possibly-buggy SMB printer])
|
||||
LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
|
||||
;;
|
||||
@ -229,32 +235,24 @@ else
|
||||
fi
|
||||
|
||||
#
|
||||
# We must check this before checking whether to enable IPv6, because,
|
||||
# on some platforms (such as SunOS 5.x), the test program requires
|
||||
# the extra networking libraries.
|
||||
# We must check this before checking whether to check the OS's IPv6,
|
||||
# support because, on some platforms (such as SunOS 5.x), the test
|
||||
# program requires the extra networking libraries.
|
||||
#
|
||||
AC_LBL_LIBRARY_NET
|
||||
|
||||
AC_MSG_CHECKING([whether to enable ipv6])
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
[ --enable-ipv6 enable ipv6 (with ipv4) support
|
||||
--disable-ipv6 disable ipv6 support],
|
||||
[ case "$enableval" in
|
||||
yes) AC_MSG_RESULT(yes)
|
||||
LOCALSRC="print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-babel.c $LOCALSRC"
|
||||
AC_DEFINE(INET6, 1, [Define if you enable IPv6 support])
|
||||
ipv6=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
ipv6=no
|
||||
;;
|
||||
esac ],
|
||||
|
||||
AC_COMPILE_IFELSE(
|
||||
#
|
||||
# Check whether AF_INET6 and struct in6_addr are defined.
|
||||
# If they aren't both defined, we don't have sufficient OS
|
||||
# support for IPv6, so we don't look for IPv6 support libraries,
|
||||
# and we define AF_INET6 and struct in6_addr ourselves.
|
||||
#
|
||||
AC_MSG_CHECKING([whether the operating system supports IPv6])
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_SOURCE(
|
||||
[[/* AF_INET6 available check */
|
||||
[[
|
||||
/* AF_INET6 available check */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -267,17 +265,19 @@ foo(struct in6_addr *addr)
|
||||
#else
|
||||
#error "AF_INET6 not defined"
|
||||
#endif
|
||||
]])
|
||||
]])
|
||||
],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
LOCALSRC="print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-babel.c $LOCALSRC"
|
||||
AC_DEFINE(INET6, 1, [Define if you enable IPv6 support])
|
||||
ipv6=yes],
|
||||
[ AC_MSG_RESULT(no)
|
||||
ipv6=no],
|
||||
[ AC_MSG_RESULT(no)
|
||||
ipv6=no]
|
||||
))
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
|
||||
[define if the OS provides AF_INET6 and struct in6_addr])
|
||||
ipv6=yes
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
ipv6=no
|
||||
]
|
||||
)
|
||||
|
||||
ipv6type=unknown
|
||||
ipv6lib=none
|
||||
@ -294,8 +294,7 @@ if test "$ipv6" = "yes"; then
|
||||
#ifdef IPV6_INRIA_VERSION
|
||||
yes
|
||||
#endif],
|
||||
[ipv6type=$i;
|
||||
CFLAGS="-DINET6 $CFLAGS"])
|
||||
[ipv6type=$i])
|
||||
;;
|
||||
kame)
|
||||
dnl http://www.kame.net/
|
||||
@ -307,8 +306,7 @@ yes
|
||||
[ipv6type=$i;
|
||||
ipv6lib=inet6;
|
||||
ipv6libdir=/usr/local/v6/lib;
|
||||
ipv6trylibc=yes;
|
||||
CFLAGS="-DINET6 $CFLAGS"])
|
||||
ipv6trylibc=yes])
|
||||
;;
|
||||
linux-glibc)
|
||||
dnl http://www.v6.linux.or.jp/
|
||||
@ -317,8 +315,7 @@ yes
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
|
||||
yes
|
||||
#endif],
|
||||
[ipv6type=$i;
|
||||
CFLAGS="-DINET6 $CFLAGS"])
|
||||
[ipv6type=$i])
|
||||
;;
|
||||
linux-libinet6)
|
||||
dnl http://www.v6.linux.or.jp/
|
||||
@ -331,7 +328,7 @@ yes
|
||||
ipv6lib=inet6
|
||||
ipv6libdir=/usr/inet6/lib
|
||||
ipv6trylibc=yes;
|
||||
CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
|
||||
CFLAGS="-I/usr/inet6/include $CFLAGS"
|
||||
fi
|
||||
;;
|
||||
toshiba)
|
||||
@ -342,8 +339,7 @@ yes
|
||||
#endif],
|
||||
[ipv6type=$i;
|
||||
ipv6lib=inet6;
|
||||
ipv6libdir=/usr/local/v6/lib;
|
||||
CFLAGS="-DINET6 $CFLAGS"])
|
||||
ipv6libdir=/usr/local/v6/lib])
|
||||
;;
|
||||
v6d)
|
||||
AC_EGREP_CPP(yes,
|
||||
@ -364,8 +360,7 @@ yes
|
||||
#endif],
|
||||
[ipv6type=$i;
|
||||
ipv6lib=inet6;
|
||||
ipv6libdir=/usr/local/v6/lib;
|
||||
CFLAGS="-DINET6 $CFLAGS"])
|
||||
ipv6libdir=/usr/local/v6/lib])
|
||||
;;
|
||||
esac
|
||||
if test "$ipv6type" != "unknown"; then
|
||||
@ -391,151 +386,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test "$ipv6" = "yes"; then
|
||||
#
|
||||
# XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
|
||||
# function in libc; there are "ngetaddrinfo()" and
|
||||
# "ogetaddrinfo()" functions, and <netdb.h> #defines
|
||||
# "getaddrinfo" to be either "ngetaddrinfo" or
|
||||
# "ogetaddrinfo", depending on whether _SOCKADDR_LEN
|
||||
# or _XOPEN_SOURCE_EXTENDED are defined or not.
|
||||
#
|
||||
# So this test doesn't work on Tru64 5.1, and possibly
|
||||
# on other 5.x releases. This causes the configure
|
||||
# script to become confused, and results in libpcap
|
||||
# being unbuildable.
|
||||
#
|
||||
AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
|
||||
AC_MSG_CHECKING(getaddrinfo bug)
|
||||
AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
main()
|
||||
{
|
||||
int passive, gaierr, inet4 = 0, inet6 = 0;
|
||||
struct addrinfo hints, *ai, *aitop;
|
||||
char straddr[INET6_ADDRSTRLEN], strport[16];
|
||||
|
||||
for (passive = 0; passive <= 1; passive++) {
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_flags = passive ? AI_PASSIVE : 0;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
|
||||
(void)gai_strerror(gaierr);
|
||||
goto bad;
|
||||
}
|
||||
for (ai = aitop; ai; ai = ai->ai_next) {
|
||||
if (ai->ai_addr == NULL ||
|
||||
ai->ai_addrlen == 0 ||
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
|
||||
straddr, sizeof(straddr), strport, sizeof(strport),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
|
||||
goto bad;
|
||||
}
|
||||
switch (ai->ai_family) {
|
||||
case AF_INET:
|
||||
if (strcmp(strport, "54321") != 0) {
|
||||
goto bad;
|
||||
}
|
||||
if (passive) {
|
||||
if (strcmp(straddr, "0.0.0.0") != 0) {
|
||||
goto bad;
|
||||
}
|
||||
} else {
|
||||
if (strcmp(straddr, "127.0.0.1") != 0) {
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
inet4++;
|
||||
break;
|
||||
case AF_INET6:
|
||||
if (strcmp(strport, "54321") != 0) {
|
||||
goto bad;
|
||||
}
|
||||
if (passive) {
|
||||
if (strcmp(straddr, "::") != 0) {
|
||||
goto bad;
|
||||
}
|
||||
} else {
|
||||
if (strcmp(straddr, "::1") != 0) {
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
inet6++;
|
||||
break;
|
||||
case AF_UNSPEC:
|
||||
goto bad;
|
||||
break;
|
||||
#ifdef AF_UNIX
|
||||
case AF_UNIX:
|
||||
#else
|
||||
#ifdef AF_LOCAL
|
||||
case AF_LOCAL:
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
/* another family support? */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* supported family should be 2, unsupported family should be 0 */
|
||||
if (!(inet4 == 0 || inet4 == 2))
|
||||
goto bad;
|
||||
if (!(inet6 == 0 || inet6 == 2))
|
||||
goto bad;
|
||||
|
||||
if (aitop)
|
||||
freeaddrinfo(aitop);
|
||||
exit(0);
|
||||
|
||||
bad:
|
||||
if (aitop)
|
||||
freeaddrinfo(aitop);
|
||||
exit(1);
|
||||
}
|
||||
],
|
||||
td_cv_buggygetaddrinfo=no,
|
||||
td_cv_buggygetaddrinfo=yes,
|
||||
td_cv_buggygetaddrinfo=unknown)])
|
||||
if test "$td_cv_buggygetaddrinfo" = no; then
|
||||
AC_MSG_RESULT(good)
|
||||
elif test "$td_cv_buggygetaddrinfo" = unknown; then
|
||||
AC_MSG_RESULT([unknown (cross-compiling)])
|
||||
else
|
||||
AC_MSG_RESULT(buggy)
|
||||
fi
|
||||
|
||||
if test "$td_cv_buggygetaddrinfo" = "yes"; then
|
||||
#
|
||||
# XXX - it doesn't appear that "ipv6type" can ever be
|
||||
# set to "linux". Should this be testing for
|
||||
# "linux-glibc", or for that *or* "linux-libinet6"?
|
||||
# If the latter, note that "linux-libinet6" is also
|
||||
# the type given to some non-Linux OSes.
|
||||
#
|
||||
if test "$ipv6type" != "linux"; then
|
||||
echo 'Fatal: You must get working getaddrinfo() function.'
|
||||
echo ' or you can specify "--disable-ipv6"'.
|
||||
exit 1
|
||||
else
|
||||
echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
|
||||
echo ' Better upgrade your system library to newest version'
|
||||
echo ' of GNU C library (aka glibc).'
|
||||
fi
|
||||
fi
|
||||
])
|
||||
AC_REPLACE_FUNCS(getnameinfo)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
|
||||
[td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
|
||||
[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
|
||||
@ -546,28 +396,7 @@ if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
|
||||
[define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Checks for addrinfo structure
|
||||
AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
|
||||
if test "$ac_cv_addrinfo" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Checks for NI_MAXSERV
|
||||
AC_NI_MAXSERV(ac_cv_maxserv)
|
||||
if test "$ac_cv_maxserv" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Checks for NI_NAMEREQD
|
||||
AC_NI_NAMEREQD(ac_cv_namereqd)
|
||||
if test "$ac_cv_namereqd" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep getopt_long)
|
||||
AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getopt_long)
|
||||
AC_CHECK_FUNCS(fork vfork strftime)
|
||||
AC_CHECK_FUNCS(setlinebuf alarm)
|
||||
|
||||
@ -589,52 +418,12 @@ dnl Some platforms may need -lnsl for getrpcbynumber.
|
||||
AC_SEARCH_LIBS(getrpcbynumber, nsl,
|
||||
AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
|
||||
|
||||
dnl AC_CHECK_LIB(z, uncompress)
|
||||
dnl AC_CHECK_HEADERS(zlib.h)
|
||||
|
||||
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
|
||||
|
||||
#
|
||||
# Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
|
||||
# libraries (e.g., "-lsocket -lnsl" on Solaris).
|
||||
#
|
||||
# We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
|
||||
# use AC_CHECK_FUNC which doesn't let us specify the right #includes
|
||||
# to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
|
||||
# resolver, and the way it defines inet_{ntop,pton} is rather strange;
|
||||
# it does not ship with a libc symbol "inet_ntop()", it ships with
|
||||
# "_inet_ntop()", and has a #define macro in one of the system headers
|
||||
# to rename it.
|
||||
#
|
||||
dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
|
||||
AC_MSG_CHECKING(for inet_ntop)
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[4], dst[128];
|
||||
inet_ntop(AF_INET, src, dst, sizeof(dst));],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_LIBOBJ(inet_ntop)])
|
||||
AC_MSG_CHECKING(for inet_pton)
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128], dst[4];
|
||||
inet_pton(AF_INET, src, dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_LIBOBJ(inet_pton)])
|
||||
AC_MSG_CHECKING(for inet_aton)
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128];
|
||||
struct in_addr dst;
|
||||
inet_aton(src, &dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_LIBOBJ(inet_aton)])
|
||||
|
||||
#
|
||||
# Check for these after AC_LBL_LIBPCAP, for the same reason.
|
||||
#
|
||||
# You are in a twisty little maze of UN*Xes, all different.
|
||||
# Some might not have ether_ntohost().
|
||||
# Some might have it, but not declare it in any header file.
|
||||
@ -753,14 +542,6 @@ fi
|
||||
# libdlpi is needed for Solaris 11 and later.
|
||||
AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
|
||||
|
||||
dnl portability macros for getaddrinfo/getnameinfo
|
||||
dnl
|
||||
dnl Check for sa_len
|
||||
AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
|
||||
if test "$ac_cv_sockaddr_has_sa_len" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
|
||||
dnl and "pcap_datalink_name_to_val()", and use substitute versions
|
||||
@ -860,39 +641,51 @@ if test $ac_cv_func_pcap_lib_version = "no" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
extern int pcap_debug;
|
||||
|
||||
return pcap_debug;
|
||||
],
|
||||
ac_lbl_cv_pcap_debug_defined=yes,
|
||||
ac_lbl_cv_pcap_debug_defined=no)
|
||||
if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
#
|
||||
# Check for special debugging functions
|
||||
#
|
||||
AC_CHECK_FUNCS(pcap_set_parser_debug)
|
||||
if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
|
||||
#
|
||||
# OK, what about "yydebug"?
|
||||
#
|
||||
AC_MSG_CHECKING(whether yydebug is defined by libpcap)
|
||||
# OK, we don't have pcap_set_parser_debug() to set the libpcap
|
||||
# filter expression parser debug flag; can we directly set the
|
||||
# flag?
|
||||
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
extern int yydebug;
|
||||
extern int pcap_debug;
|
||||
|
||||
return yydebug;
|
||||
return pcap_debug;
|
||||
],
|
||||
ac_lbl_cv_yydebug_defined=yes,
|
||||
ac_lbl_cv_yydebug_defined=no)
|
||||
if test "$ac_lbl_cv_yydebug_defined" = yes ; then
|
||||
ac_lbl_cv_pcap_debug_defined=yes,
|
||||
ac_lbl_cv_pcap_debug_defined=no)
|
||||
if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
|
||||
AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
#
|
||||
# OK, what about "yydebug"?
|
||||
#
|
||||
AC_MSG_CHECKING(whether yydebug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
extern int yydebug;
|
||||
|
||||
return yydebug;
|
||||
],
|
||||
ac_lbl_cv_yydebug_defined=yes,
|
||||
ac_lbl_cv_yydebug_defined=no)
|
||||
if test "$ac_lbl_cv_yydebug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_FUNCS(pcap_set_optimizer_debug)
|
||||
AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
|
||||
|
||||
V_GROUP=0
|
||||
@ -1071,9 +864,9 @@ fi
|
||||
#
|
||||
savedcppflags="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "tcpdump-stdinc.h"])
|
||||
AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "tcpdump-stdinc.h"])
|
||||
AC_CHECK_HEADERS(pcap/usb.h,,,[#include "tcpdump-stdinc.h"])
|
||||
AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"])
|
||||
AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"])
|
||||
AC_CHECK_HEADERS(pcap/usb.h,,,[#include "netdissect-stdinc.h"])
|
||||
CPPFLAGS="$savedcppflags"
|
||||
|
||||
AC_PROG_RANLIB
|
||||
@ -1085,35 +878,71 @@ AC_LBL_SOCKADDR_SA_LEN
|
||||
|
||||
AC_LBL_UNALIGNED_ACCESS
|
||||
|
||||
AC_VAR_H_ERRNO
|
||||
|
||||
# Check for OpenSSL libcrypto
|
||||
AC_MSG_CHECKING(whether to use OpenSSL libcrypto)
|
||||
# Check for OpenSSL/libressl libcrypto
|
||||
AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
|
||||
# Specify location for both includes and libraries.
|
||||
want_libcrypto=ifavailable
|
||||
AC_ARG_WITH(crypto,
|
||||
AS_HELP_STRING([--with-crypto],
|
||||
[use OpenSSL libcrypto @<:@default=yes, if available@:>@]),
|
||||
AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@,
|
||||
[use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]),
|
||||
[
|
||||
if test $withval = no
|
||||
then
|
||||
# User doesn't want to link with libcrypto.
|
||||
want_libcrypto=no
|
||||
AC_MSG_RESULT(no)
|
||||
elif test $withval = yes
|
||||
then
|
||||
# User wants to link with libcrypto but hasn't specified
|
||||
# a directory.
|
||||
want_libcrypto=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
# User wants to link with libcrypto and has specified
|
||||
# a directory, so use the provided value.
|
||||
want_libcrypto=yes
|
||||
libcrypto_root=$withval
|
||||
AC_MSG_RESULT([yes, using the version installed in $withval])
|
||||
|
||||
#
|
||||
# Put the subdirectories of the libcrypto root directory
|
||||
# at the front of the header and library search path.
|
||||
#
|
||||
CFLAGS="-I$withval/include $CFLAGS"
|
||||
LIBS="-L$withval/lib $LIBS"
|
||||
fi
|
||||
],[
|
||||
#
|
||||
# Use libcrypto if it's present, otherwise don't.
|
||||
# Use libcrypto if it's present, otherwise don't; no directory
|
||||
# was specified.
|
||||
#
|
||||
want_libcrypto=ifavailable
|
||||
AC_MSG_RESULT([yes, if available])
|
||||
])
|
||||
if test "$want_libcrypto" != "no"; then
|
||||
AC_CHECK_LIB(crypto, DES_cbc_encrypt)
|
||||
AC_CHECK_HEADERS(openssl/evp.h)
|
||||
#
|
||||
# Don't check for libcrypto unless we have its headers;
|
||||
# Apple, bless their pointy little heads, apparently ship
|
||||
# libcrypto as a library, but not the header files, in
|
||||
# El Capitan, probably because they don't want you writing
|
||||
# nasty portable code that could run on other UN*Xes, they
|
||||
# want you writing code that uses their Shiny New Crypto
|
||||
# Library and that only runs on OS X.
|
||||
#
|
||||
AC_CHECK_HEADER(openssl/crypto.h,
|
||||
[
|
||||
AC_CHECK_LIB(crypto, DES_cbc_encrypt)
|
||||
if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then
|
||||
AC_CHECK_HEADERS(openssl/evp.h)
|
||||
#
|
||||
# OK, do we have EVP_CIPHER_CTX_new?
|
||||
# If so, we use it to allocate an
|
||||
# EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
|
||||
# opaque; otherwise, we allocate it ourselves.
|
||||
#
|
||||
AC_CHECK_FUNCS(EVP_CIPHER_CTX_new)
|
||||
fi
|
||||
])
|
||||
fi
|
||||
|
||||
# Check for libcap-ng
|
||||
|
@ -27,20 +27,19 @@
|
||||
* OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "cpack.h"
|
||||
#include "extract.h"
|
||||
|
||||
uint8_t *
|
||||
cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment)
|
||||
const uint8_t *
|
||||
cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment)
|
||||
{
|
||||
size_t misalignment = (size_t)(p - buf) % alignment;
|
||||
|
||||
@ -54,10 +53,10 @@ cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment)
|
||||
* wordsize bytes remain in the buffer after the boundary. Otherwise,
|
||||
* return a pointer to the boundary.
|
||||
*/
|
||||
uint8_t *
|
||||
const uint8_t *
|
||||
cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
|
||||
{
|
||||
uint8_t *next;
|
||||
const uint8_t *next;
|
||||
|
||||
/* Ensure alignment. */
|
||||
next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
|
||||
@ -81,7 +80,7 @@ cpack_advance(struct cpack_state *cs, const size_t toskip)
|
||||
}
|
||||
|
||||
int
|
||||
cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen)
|
||||
cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen)
|
||||
{
|
||||
memset(cs, 0, sizeof(*cs));
|
||||
|
||||
@ -96,7 +95,7 @@ cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen)
|
||||
int
|
||||
cpack_uint64(struct cpack_state *cs, uint64_t *u)
|
||||
{
|
||||
uint8_t *next;
|
||||
const uint8_t *next;
|
||||
|
||||
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
|
||||
return -1;
|
||||
@ -112,7 +111,7 @@ cpack_uint64(struct cpack_state *cs, uint64_t *u)
|
||||
int
|
||||
cpack_uint32(struct cpack_state *cs, uint32_t *u)
|
||||
{
|
||||
uint8_t *next;
|
||||
const uint8_t *next;
|
||||
|
||||
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
|
||||
return -1;
|
||||
@ -128,7 +127,7 @@ cpack_uint32(struct cpack_state *cs, uint32_t *u)
|
||||
int
|
||||
cpack_uint16(struct cpack_state *cs, uint16_t *u)
|
||||
{
|
||||
uint8_t *next;
|
||||
const uint8_t *next;
|
||||
|
||||
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
|
||||
return -1;
|
||||
|
@ -31,20 +31,20 @@
|
||||
#define _CPACK_H
|
||||
|
||||
struct cpack_state {
|
||||
uint8_t *c_buf;
|
||||
uint8_t *c_next;
|
||||
const uint8_t *c_buf;
|
||||
const uint8_t *c_next;
|
||||
size_t c_len;
|
||||
};
|
||||
|
||||
int cpack_init(struct cpack_state *, uint8_t *, size_t);
|
||||
int cpack_init(struct cpack_state *, const uint8_t *, size_t);
|
||||
|
||||
int cpack_uint8(struct cpack_state *, uint8_t *);
|
||||
int cpack_uint16(struct cpack_state *, uint16_t *);
|
||||
int cpack_uint32(struct cpack_state *, uint32_t *);
|
||||
int cpack_uint64(struct cpack_state *, uint64_t *);
|
||||
|
||||
uint8_t *cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment);
|
||||
uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize);
|
||||
const uint8_t *cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment);
|
||||
const uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize);
|
||||
|
||||
#define cpack_int8(__s, __p) cpack_uint8((__s), (uint8_t*)(__p))
|
||||
#define cpack_int16(__s, __p) cpack_uint16((__s), (uint16_t*)(__p))
|
||||
|
@ -41,18 +41,17 @@
|
||||
#define ETHER_ADDR_LEN 6
|
||||
|
||||
/*
|
||||
* Structure of a DEC/Intel/Xerox or 802.3 Ethernet header.
|
||||
* Structure of an Ethernet header.
|
||||
*/
|
||||
struct ether_header {
|
||||
uint8_t ether_dhost[ETHER_ADDR_LEN];
|
||||
uint8_t ether_shost[ETHER_ADDR_LEN];
|
||||
uint16_t ether_type;
|
||||
uint16_t ether_length_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* Length of a DEC/Intel/Xerox or 802.3 Ethernet header; note that some
|
||||
* compilers may pad "struct ether_header" to a multiple of 4 bytes,
|
||||
* for example, so "sizeof (struct ether_header)" may not give the right
|
||||
* answer.
|
||||
* Length of an Ethernet header; note that some compilers may pad
|
||||
* "struct ether_header" to a multiple of 4 bytes, for example, so
|
||||
* "sizeof (struct ether_header)" may not give the right answer.
|
||||
*/
|
||||
#define ETHER_HDRLEN 14
|
||||
|
@ -17,7 +17,6 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -197,5 +196,8 @@
|
||||
#ifndef ETHERTYPE_GEONET
|
||||
#define ETHERTYPE_GEONET 0x8947 /* ETSI GeoNetworking (Official IEEE registration from Jan 2013) */
|
||||
#endif
|
||||
#ifndef ETHERTYPE_MEDSA
|
||||
#define ETHERTYPE_MEDSA 0xdada /* Marvel Distributed Switch Architecture */
|
||||
#endif
|
||||
|
||||
extern const struct tok ethertype_values[];
|
||||
|
@ -103,7 +103,7 @@ EXTRACT_32BITS(const void *p)
|
||||
static inline uint64_t
|
||||
EXTRACT_64BITS(const void *p)
|
||||
{
|
||||
return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 | \
|
||||
return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 |
|
||||
((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0));
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ EXTRACT_32BITS(const void *p)
|
||||
static inline uint64_t
|
||||
EXTRACT_64BITS(const void *p)
|
||||
{
|
||||
return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 | \
|
||||
return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 |
|
||||
((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0));
|
||||
|
||||
}
|
||||
@ -215,3 +215,30 @@ EXTRACT_64BITS(const void *p)
|
||||
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
|
||||
((uint64_t)(*((const uint8_t *)(p) + 1)) << 8) | \
|
||||
((uint64_t)(*((const uint8_t *)(p) + 0)) << 0)))
|
||||
|
||||
/*
|
||||
* Macros to check the presence of the values in question.
|
||||
*/
|
||||
#define ND_TTEST_8BITS(p) ND_TTEST2(*(p), 1)
|
||||
#define ND_TCHECK_8BITS(p) ND_TCHECK2(*(p), 1)
|
||||
|
||||
#define ND_TTEST_16BITS(p) ND_TTEST2(*(p), 2)
|
||||
#define ND_TCHECK_16BITS(p) ND_TCHECK2(*(p), 2)
|
||||
|
||||
#define ND_TTEST_24BITS(p) ND_TTEST2(*(p), 3)
|
||||
#define ND_TCHECK_24BITS(p) ND_TCHECK2(*(p), 3)
|
||||
|
||||
#define ND_TTEST_32BITS(p) ND_TTEST2(*(p), 4)
|
||||
#define ND_TCHECK_32BITS(p) ND_TCHECK2(*(p), 4)
|
||||
|
||||
#define ND_TTEST_40BITS(p) ND_TTEST2(*(p), 5)
|
||||
#define ND_TCHECK_40BITS(p) ND_TCHECK2(*(p), 5)
|
||||
|
||||
#define ND_TTEST_48BITS(p) ND_TTEST2(*(p), 6)
|
||||
#define ND_TCHECK_48BITS(p) ND_TCHECK2(*(p), 6)
|
||||
|
||||
#define ND_TTEST_56BITS(p) ND_TTEST2(*(p), 7)
|
||||
#define ND_TCHECK_56BITS(p) ND_TCHECK2(*(p), 7)
|
||||
|
||||
#define ND_TTEST_64BITS(p) ND_TTEST2(*(p), 8)
|
||||
#define ND_TCHECK_64BITS(p) ND_TCHECK2(*(p), 8)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
/* $FreeBSD: projects/clang400-import/contrib/tcpdump/getopt_long.h 276788 2015-01-07 19:55:18Z delphij $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -13,14 +13,13 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "gmpls.h"
|
||||
|
||||
/* rfc3471 */
|
||||
|
@ -19,12 +19,11 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -35,14 +35,13 @@
|
||||
* @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
/*
|
||||
* Checksum routine for Internet Protocol family headers (Portable Version).
|
||||
@ -74,7 +73,7 @@ in_cksum(const struct cksum_vec *vec, int veclen)
|
||||
for (; veclen != 0; vec++, veclen--) {
|
||||
if (vec->len == 0)
|
||||
continue;
|
||||
w = (const uint16_t *)(void *)vec->ptr;
|
||||
w = (const uint16_t *)(const void *)vec->ptr;
|
||||
if (mlen == -1) {
|
||||
/*
|
||||
* The first byte of this chunk is the continuation
|
||||
@ -86,18 +85,18 @@ in_cksum(const struct cksum_vec *vec, int veclen)
|
||||
*/
|
||||
s_util.c[1] = *(const uint8_t *)w;
|
||||
sum += s_util.s;
|
||||
w = (const uint16_t *)(void *)((const uint8_t *)w + 1);
|
||||
w = (const uint16_t *)(const void *)((const uint8_t *)w + 1);
|
||||
mlen = vec->len - 1;
|
||||
} else
|
||||
mlen = vec->len;
|
||||
/*
|
||||
* Force to even boundary.
|
||||
*/
|
||||
if ((1 & (unsigned long) w) && (mlen > 0)) {
|
||||
if ((1 & (uintptr_t) w) && (mlen > 0)) {
|
||||
REDUCE;
|
||||
sum <<= 8;
|
||||
s_util.c[0] = *(const uint8_t *)w;
|
||||
w = (const uint16_t *)(void *)((const uint8_t *)w + 1);
|
||||
w = (const uint16_t *)(const void *)((const uint8_t *)w + 1);
|
||||
mlen--;
|
||||
byte_swapped = 1;
|
||||
}
|
||||
|
@ -65,165 +65,15 @@ extern char *strdup(const char *);
|
||||
extern char *strsep(char **, const char *);
|
||||
#endif
|
||||
|
||||
#define PT_VAT 1 /* Visual Audio Tool */
|
||||
#define PT_WB 2 /* distributed White Board */
|
||||
#define PT_RPC 3 /* Remote Procedure Call */
|
||||
#define PT_RTP 4 /* Real-Time Applications protocol */
|
||||
#define PT_RTCP 5 /* Real-Time Applications control protocol */
|
||||
#define PT_SNMP 6 /* Simple Network Management Protocol */
|
||||
#define PT_CNFP 7 /* Cisco NetFlow protocol */
|
||||
#define PT_TFTP 8 /* trivial file transfer protocol */
|
||||
#define PT_AODV 9 /* Ad-hoc On-demand Distance Vector Protocol */
|
||||
#define PT_CARP 10 /* Common Address Redundancy Protocol */
|
||||
#define PT_RADIUS 11 /* RADIUS authentication Protocol */
|
||||
#define PT_ZMTP1 12 /* ZeroMQ Message Transport Protocol 1.0 */
|
||||
#define PT_VXLAN 13 /* Virtual eXtensible Local Area Network */
|
||||
#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */
|
||||
#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */
|
||||
#define PT_LMP 16 /* Link Management Protocol */
|
||||
|
||||
#define ESRC(ep) ((ep)->ether_shost)
|
||||
#define EDST(ep) ((ep)->ether_dhost)
|
||||
|
||||
#ifndef NTOHL
|
||||
#define NTOHL(x) (x) = ntohl(x)
|
||||
#define NTOHS(x) (x) = ntohs(x)
|
||||
#define HTONL(x) (x) = htonl(x)
|
||||
#define HTONS(x) (x) = htons(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern char *program_name; /* used to generate self-identifying messages */
|
||||
|
||||
extern int32_t thiszone; /* seconds offset from gmt to local time */
|
||||
|
||||
/*
|
||||
* True if "l" bytes of "var" were captured.
|
||||
*
|
||||
* The "snapend - (l) <= snapend" checks to make sure "l" isn't so large
|
||||
* that "snapend - (l)" underflows.
|
||||
*
|
||||
* The check is for <= rather than < because "l" might be 0.
|
||||
*
|
||||
* We cast the pointers to uintptr_t to make sure that the compiler
|
||||
* doesn't optimize away any of these tests (which it is allowed to
|
||||
* do, as adding an integer to, or subtracting an integer from, a
|
||||
* pointer assumes that the pointer is a pointer to an element of an
|
||||
* array and that the result of the addition or subtraction yields a
|
||||
* pointer to another member of the array, so that, for example, if
|
||||
* you subtract a positive integer from a pointer, the result is
|
||||
* guaranteed to be less than the original pointer value). See
|
||||
*
|
||||
* http://www.kb.cert.org/vuls/id/162289
|
||||
*/
|
||||
#define TTEST2(var, l) \
|
||||
((uintptr_t)snapend - (l) <= (uintptr_t)snapend && \
|
||||
(uintptr_t)&(var) <= (uintptr_t)snapend - (l))
|
||||
|
||||
/* True if "var" was captured */
|
||||
#define TTEST(var) TTEST2(var, sizeof(var))
|
||||
|
||||
/* Bail if "l" bytes of "var" were not captured */
|
||||
#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc
|
||||
|
||||
/* Bail if "var" was not captured */
|
||||
#define TCHECK(var) TCHECK2(var, sizeof(var))
|
||||
|
||||
extern int mask2plen(uint32_t);
|
||||
extern const char *tok2strary_internal(const char **, int, const char *, int);
|
||||
#define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
|
||||
|
||||
extern void error(const char *, ...)
|
||||
__attribute__((noreturn))
|
||||
#ifdef __ATTRIBUTE___FORMAT_OK
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
#endif /* __ATTRIBUTE___FORMAT_OK */
|
||||
;
|
||||
extern void warning(const char *, ...)
|
||||
#ifdef __ATTRIBUTE___FORMAT_OK
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
#endif /* __ATTRIBUTE___FORMAT_OK */
|
||||
;
|
||||
|
||||
extern char *read_infile(char *);
|
||||
extern char *copy_argv(char **);
|
||||
|
||||
extern const char *dnname_string(u_short);
|
||||
extern const char *dnnum_string(u_short);
|
||||
|
||||
/* checksum routines */
|
||||
extern void init_checksum(void);
|
||||
extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int);
|
||||
extern uint16_t create_osi_cksum(const uint8_t *, int, int);
|
||||
|
||||
/* The printer routines. */
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
extern char *smb_errstr(int, int);
|
||||
extern const char *nt_errstr(uint32_t);
|
||||
|
||||
#ifdef INET6
|
||||
extern int mask62plen(const u_char *);
|
||||
#endif /*INET6*/
|
||||
|
||||
struct cksum_vec {
|
||||
const uint8_t *ptr;
|
||||
int len;
|
||||
};
|
||||
extern uint16_t in_cksum(const struct cksum_vec *, int);
|
||||
extern uint16_t in_cksum_shouldbe(uint16_t, uint16_t);
|
||||
|
||||
#ifndef HAVE_BPF_DUMP
|
||||
struct bpf_program;
|
||||
|
||||
extern void bpf_dump(const struct bpf_program *, int);
|
||||
|
||||
#endif
|
||||
|
||||
#include "netdissect.h"
|
||||
|
||||
/* forward compatibility */
|
||||
|
||||
#ifndef NETDISSECT_REWORKED
|
||||
extern netdissect_options *gndo;
|
||||
|
||||
#define bflag gndo->ndo_bflag
|
||||
#define eflag gndo->ndo_eflag
|
||||
#define fflag gndo->ndo_fflag
|
||||
#define jflag gndo->ndo_jflag
|
||||
#define Kflag gndo->ndo_Kflag
|
||||
#define nflag gndo->ndo_nflag
|
||||
#define Nflag gndo->ndo_Nflag
|
||||
#define Oflag gndo->ndo_Oflag
|
||||
#define pflag gndo->ndo_pflag
|
||||
#define qflag gndo->ndo_qflag
|
||||
#define Rflag gndo->ndo_Rflag
|
||||
#define sflag gndo->ndo_sflag
|
||||
#define Sflag gndo->ndo_Sflag
|
||||
#define tflag gndo->ndo_tflag
|
||||
#define Uflag gndo->ndo_Uflag
|
||||
#define uflag gndo->ndo_uflag
|
||||
#define vflag gndo->ndo_vflag
|
||||
#define xflag gndo->ndo_xflag
|
||||
#define Xflag gndo->ndo_Xflag
|
||||
#define Cflag gndo->ndo_Cflag
|
||||
#define Gflag gndo->ndo_Gflag
|
||||
#define Aflag gndo->ndo_Aflag
|
||||
#define Bflag gndo->ndo_Bflag
|
||||
#define Iflag gndo->ndo_Iflag
|
||||
#define suppress_default_print gndo->ndo_suppress_default_print
|
||||
#define packettype gndo->ndo_packettype
|
||||
#define sigsecret gndo->ndo_sigsecret
|
||||
#define Wflag gndo->ndo_Wflag
|
||||
#define WflagChars gndo->ndo_WflagChars
|
||||
#define Cflag_count gndo->ndo_Cflag_count
|
||||
#define Gflag_count gndo->ndo_Gflag_count
|
||||
#define Gflag_time gndo->ndo_Gflag_time
|
||||
#define Hflag gndo->ndo_Hflag
|
||||
#define snaplen gndo->ndo_snaplen
|
||||
#define snapend gndo->ndo_snapend
|
||||
|
||||
extern void default_print(const u_char *, u_int);
|
||||
|
||||
#endif
|
||||
|
@ -33,10 +33,8 @@
|
||||
* @(#)ip.h 8.2 (Berkeley) 6/1/94
|
||||
*/
|
||||
|
||||
#ifndef TCPDUMP_IP_H
|
||||
#define TCPDUMP_IP_H
|
||||
|
||||
#include "tcpdump-stdinc.h"
|
||||
#ifndef netdissect_ip_h
|
||||
#define netdissect_ip_h
|
||||
|
||||
/*
|
||||
* Definitions for internet protocol version 4.
|
||||
@ -52,21 +50,21 @@
|
||||
* against negative integers quite easily, and fail in subtle ways.
|
||||
*/
|
||||
struct ip {
|
||||
uint8_t ip_vhl; /* header length, version */
|
||||
nd_uint8_t ip_vhl; /* header length, version */
|
||||
#define IP_V(ip) (((ip)->ip_vhl & 0xf0) >> 4)
|
||||
#define IP_HL(ip) ((ip)->ip_vhl & 0x0f)
|
||||
uint8_t ip_tos; /* type of service */
|
||||
uint16_t ip_len; /* total length */
|
||||
uint16_t ip_id; /* identification */
|
||||
uint16_t ip_off; /* fragment offset field */
|
||||
nd_uint8_t ip_tos; /* type of service */
|
||||
nd_uint16_t ip_len; /* total length */
|
||||
nd_uint16_t ip_id; /* identification */
|
||||
nd_uint16_t ip_off; /* fragment offset field */
|
||||
#define IP_DF 0x4000 /* dont fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||
uint8_t ip_ttl; /* time to live */
|
||||
uint8_t ip_p; /* protocol */
|
||||
uint16_t ip_sum; /* checksum */
|
||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||
} UNALIGNED;
|
||||
nd_uint8_t ip_ttl; /* time to live */
|
||||
nd_uint8_t ip_p; /* protocol */
|
||||
nd_uint16_t ip_sum; /* checksum */
|
||||
nd_ipv4 ip_src,ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
|
||||
@ -125,20 +123,20 @@ struct ip {
|
||||
* Time stamp option structure.
|
||||
*/
|
||||
struct ip_timestamp {
|
||||
uint8_t ipt_code; /* IPOPT_TS */
|
||||
uint8_t ipt_len; /* size of structure (variable) */
|
||||
uint8_t ipt_ptr; /* index of current entry */
|
||||
uint8_t ipt_oflwflg; /* flags, overflow counter */
|
||||
nd_uint8_t ipt_code; /* IPOPT_TS */
|
||||
nd_uint8_t ipt_len; /* size of structure (variable) */
|
||||
nd_uint8_t ipt_ptr; /* index of current entry */
|
||||
nd_uint8_t ipt_oflwflg; /* flags, overflow counter */
|
||||
#define IPTS_OFLW(ip) (((ipt)->ipt_oflwflg & 0xf0) >> 4)
|
||||
#define IPTS_FLG(ip) ((ipt)->ipt_oflwflg & 0x0f)
|
||||
union ipt_timestamp {
|
||||
uint32_t ipt_time[1];
|
||||
nd_uint32_t ipt_time[1];
|
||||
struct ipt_ta {
|
||||
struct in_addr ipt_addr;
|
||||
uint32_t ipt_time;
|
||||
nd_ipv4 ipt_addr;
|
||||
nd_uint32_t ipt_time;
|
||||
} ipt_ta[1];
|
||||
} ipt_timestamp;
|
||||
} UNALIGNED;
|
||||
};
|
||||
|
||||
/* flag bits for ipt_flg */
|
||||
#define IPOPT_TS_TSONLY 0 /* timestamps only */
|
||||
@ -163,4 +161,4 @@ struct ip_timestamp {
|
||||
#define IPTTLDEC 1 /* subtracted when forwarding */
|
||||
|
||||
#define IP_MSS 576 /* default maximum segment size */
|
||||
#endif /* TCPDUMP_IP_H */
|
||||
#endif /* netdissect_ip_h */
|
||||
|
@ -172,7 +172,11 @@ struct ip6_rthdr {
|
||||
/* followed by routing type specific data */
|
||||
} UNALIGNED;
|
||||
|
||||
#define IPV6_RTHDR_TYPE_0 0
|
||||
#define IPV6_RTHDR_TYPE_2 2
|
||||
|
||||
/* Type 0 Routing header */
|
||||
/* Also used for Type 2 */
|
||||
struct ip6_rthdr0 {
|
||||
uint8_t ip6r0_nxt; /* next header */
|
||||
uint8_t ip6r0_len; /* length in units of 8 octets */
|
||||
@ -195,7 +199,4 @@ struct ip6_frag {
|
||||
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
|
||||
#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
|
||||
|
||||
/* in print-ip6.c */
|
||||
extern int nextproto6_cksum(const struct ip6_hdr *, const uint8_t *, u_int, u_int, u_int);
|
||||
|
||||
#endif /* not _NETINET_IP6_H_ */
|
||||
|
@ -13,14 +13,13 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
const struct tok ipproto_values[] = {
|
||||
|
@ -32,8 +32,7 @@
|
||||
*
|
||||
* From:
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
* $FreeBSD$
|
||||
* FreeBSD: src/sys/netinet/in.h,v 1.38.2.3 1999/08/29 16:29:34 peter Exp
|
||||
* $FreeBSD: projects/clang400-import/contrib/tcpdump/ipproto.h 276788 2015-01-07 19:55:18Z delphij $
|
||||
*/
|
||||
|
||||
extern const struct tok ipproto_values[];
|
||||
|
@ -13,42 +13,83 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include "interface.h"
|
||||
#include <netdissect-stdinc.h>
|
||||
#include "netdissect.h"
|
||||
#include "l2vpn.h"
|
||||
|
||||
/* draft-ietf-pwe3-iana-allocation-04 */
|
||||
/*
|
||||
* BGP Layer 2 Encapsulation Types
|
||||
*
|
||||
* RFC 6624
|
||||
*
|
||||
* http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-l2-encapsulation-types-registry
|
||||
*/
|
||||
const struct tok l2vpn_encaps_values[] = {
|
||||
{ 0x00, "Reserved"},
|
||||
{ 0x01, "Frame Relay"},
|
||||
{ 0x02, "ATM AAL5 VCC transport"},
|
||||
{ 0x03, "ATM transparent cell transport"},
|
||||
{ 0x04, "Ethernet VLAN"},
|
||||
{ 0x05, "Ethernet"},
|
||||
{ 0x06, "Cisco-HDLC"},
|
||||
{ 0x07, "PPP"},
|
||||
{ 0x08, "SONET/SDH Circuit Emulation Service over MPLS"},
|
||||
{ 0x09, "ATM n-to-one VCC cell transport"},
|
||||
{ 0x0a, "ATM n-to-one VPC cell transport"},
|
||||
{ 0x0b, "IP Layer2 Transport"},
|
||||
{ 0x0c, "ATM one-to-one VCC Cell Mode"},
|
||||
{ 0x0d, "ATM one-to-one VPC Cell Mode"},
|
||||
{ 0x0e, "ATM AAL5 PDU VCC transport"},
|
||||
{ 0x0f, "Frame-Relay Port mode"},
|
||||
{ 0x10, "SONET/SDH Circuit Emulation over Packet"},
|
||||
{ 0x11, "Structure-agnostic E1 over Packet"},
|
||||
{ 0x12, "Structure-agnostic T1 (DS1) over Packet"},
|
||||
{ 0x13, "Structure-agnostic E3 over Packet"},
|
||||
{ 0x14, "Structure-agnostic T3 (DS3) over Packet"},
|
||||
{ 0x15, "CESoPSN basic mode"},
|
||||
{ 0x16, "TDMoIP basic mode"},
|
||||
{ 0x17, "CESoPSN TDM with CAS"},
|
||||
{ 0x18, "TDMoIP TDM with CAS"},
|
||||
{ 0x40, "IP-interworking"},
|
||||
{ 0, "Reserved"},
|
||||
{ 1, "Frame Relay"},
|
||||
{ 2, "ATM AAL5 SDU VCC transport"},
|
||||
{ 3, "ATM transparent cell transport"},
|
||||
{ 4, "Ethernet (VLAN) Tagged Mode"},
|
||||
{ 5, "Ethernet Raw Mode"},
|
||||
{ 6, "Cisco HDLC"},
|
||||
{ 7, "PPP"},
|
||||
{ 8, "SONET/SDH Circuit Emulation Service over MPLS"},
|
||||
{ 9, "ATM n-to-one VCC cell transport"},
|
||||
{ 10, "ATM n-to-one VPC cell transport"},
|
||||
{ 11, "IP layer 2 transport"},
|
||||
{ 15, "Frame Relay Port mode"},
|
||||
{ 17, "Structure-agnostic E1 over packet"},
|
||||
{ 18, "Structure-agnostic T1 (DS1) over packet"},
|
||||
{ 19, "VPLS"},
|
||||
{ 20, "Structure-agnostic T3 (DS3) over packet"},
|
||||
{ 21, "Nx64kbit/s Basic Service using Structure-aware"},
|
||||
{ 25, "Frame Relay DLCI"},
|
||||
{ 40, "Structure-agnostic E3 over packet"},
|
||||
{ 41, "Octet-aligned playload for Structure-agnostic DS1 circuits"},
|
||||
{ 42, "E1 Nx64kbit/s with CAS using Structure-aware"},
|
||||
{ 43, "DS1 (ESF) Nx64kbit/s with CAS using Structure-aware"},
|
||||
{ 44, "DS1 (SF) Nx64kbit/s with CAS using Structure-aware"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* MPLS Pseudowire Types
|
||||
*
|
||||
* RFC 4446
|
||||
*
|
||||
* http://www.iana.org/assignments/pwe3-parameters/pwe3-parameters.xhtml#pwe3-parameters-2
|
||||
*/
|
||||
const struct tok mpls_pw_types_values[] = {
|
||||
{ 0x0000, "Reserved"},
|
||||
{ 0x0001, "Frame Relay DLCI (Martini Mode)"},
|
||||
{ 0x0002, "ATM AAL5 SDU VCC transport"},
|
||||
{ 0x0003, "ATM transparent cell transport"},
|
||||
{ 0x0004, "Ethernet VLAN"},
|
||||
{ 0x0005, "Ethernet"},
|
||||
{ 0x0006, "Cisco-HDLC"},
|
||||
{ 0x0007, "PPP"},
|
||||
{ 0x0008, "SONET/SDH Circuit Emulation Service over MPLS"},
|
||||
{ 0x0009, "ATM n-to-one VCC cell transport"},
|
||||
{ 0x000a, "ATM n-to-one VPC cell transport"},
|
||||
{ 0x000b, "IP Layer2 Transport"},
|
||||
{ 0x000c, "ATM one-to-one VCC Cell Mode"},
|
||||
{ 0x000d, "ATM one-to-one VPC Cell Mode"},
|
||||
{ 0x000e, "ATM AAL5 PDU VCC transport"},
|
||||
{ 0x000f, "Frame-Relay Port mode"},
|
||||
{ 0x0010, "SONET/SDH Circuit Emulation over Packet"},
|
||||
{ 0x0011, "Structure-agnostic E1 over Packet"},
|
||||
{ 0x0012, "Structure-agnostic T1 (DS1) over Packet"},
|
||||
{ 0x0013, "Structure-agnostic E3 over Packet"},
|
||||
{ 0x0014, "Structure-agnostic T3 (DS3) over Packet"},
|
||||
{ 0x0015, "CESoPSN basic mode"},
|
||||
{ 0x0016, "TDMoIP basic mode"},
|
||||
{ 0x0017, "CESoPSN TDM with CAS"},
|
||||
{ 0x0018, "TDMoIP TDM with CAS"},
|
||||
{ 0x0019, "Frame Relay DLCI"},
|
||||
{ 0x0040, "IP-interworking"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
@ -14,3 +14,4 @@
|
||||
*/
|
||||
|
||||
extern const struct tok l2vpn_encaps_values[];
|
||||
extern const struct tok mpls_pw_types_values[];
|
||||
|
@ -25,4 +25,3 @@ int setlinebuf(FILE *);
|
||||
#endif
|
||||
char *strerror(int);
|
||||
int snprintf(char *, size_t, const char *, ...);
|
||||
int strcasecmp(const char *, const char *);
|
||||
|
@ -166,12 +166,10 @@ int sscanf(char *, const char *, ...);
|
||||
int stat(const char *, struct stat *);
|
||||
int statfs(char *, struct statfs *);
|
||||
char *strerror(int);
|
||||
int strcasecmp(const char *, const char *);
|
||||
#ifdef __STDC__
|
||||
struct tm;
|
||||
#endif
|
||||
int strftime(char *, int, char *, struct tm *);
|
||||
int strncasecmp(const char *, const char *, int);
|
||||
long strtol(const char *, char **, int);
|
||||
void sync(void);
|
||||
void syslog(int, const char *, ...);
|
||||
|
@ -34,4 +34,3 @@ int ioctl(int, int, caddr_t);
|
||||
int pfopen(char *, int);
|
||||
int setlinebuf(FILE *);
|
||||
int socket(int, int, int);
|
||||
int strcasecmp(const char *, const char *);
|
||||
|
@ -29,7 +29,7 @@
|
||||
* need to do to get it defined? This is clearly wrong, as we shouldn't
|
||||
* have to include UNIX or Windows system header files to get it.
|
||||
*/
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#ifndef HAVE___ATTRIBUTE__
|
||||
#define __attribute__(x)
|
||||
|
@ -18,8 +18,8 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef tcpdump_machdep_h
|
||||
#define tcpdump_machdep_h
|
||||
#ifndef netdissect_machdep_h
|
||||
#define netdissect_machdep_h
|
||||
|
||||
int abort_on_misalignment(char *, size_t);
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
/* parse problem: new name "mib" for mgmt.mib(1) ignored */
|
||||
/* parse problem: no parent for 0.nullSpecific(0) */
|
||||
struct obj
|
||||
static struct obj
|
||||
_proteon_obj = {
|
||||
"proteon", 1, 0,
|
||||
NULL, NULL
|
||||
|
@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_ADDRINFO
|
||||
|
||||
/*
|
||||
* Error return codes from getaddrinfo()
|
||||
*/
|
||||
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
|
||||
#define EAI_AGAIN 2 /* temporary failure in name resolution */
|
||||
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
|
||||
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
|
||||
#define EAI_FAMILY 5 /* ai_family not supported */
|
||||
#define EAI_MEMORY 6 /* memory allocation failure */
|
||||
#define EAI_NODATA 7 /* no address associated with hostname */
|
||||
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
|
||||
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
|
||||
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
|
||||
#define EAI_SYSTEM 11 /* system error returned in errno */
|
||||
#define EAI_BADHINTS 12
|
||||
#define EAI_PROTOCOL 13
|
||||
#define EAI_MAX 14
|
||||
|
||||
/* internal error */
|
||||
#define NETDB_INTERNAL -1 /* see errno */
|
||||
|
||||
/*
|
||||
* Flag values for getaddrinfo()
|
||||
*/
|
||||
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
|
||||
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
|
||||
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
|
||||
/* valid flags for addrinfo */
|
||||
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
|
||||
|
||||
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
|
||||
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
|
||||
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
|
||||
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
|
||||
/* special recommended flags for getipnodebyname */
|
||||
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
|
||||
|
||||
struct addrinfo {
|
||||
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
|
||||
int ai_family; /* PF_xxx */
|
||||
int ai_socktype; /* SOCK_xxx */
|
||||
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
||||
size_t ai_addrlen; /* length of ai_addr */
|
||||
char *ai_canonname; /* canonical name for hostname */
|
||||
struct sockaddr *ai_addr; /* binary address */
|
||||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
};
|
||||
|
||||
extern void freeaddrinfo (struct addrinfo *);
|
||||
extern void freehostent (struct hostent *);
|
||||
extern int getnameinfo (const struct sockaddr *, size_t, char *,
|
||||
size_t, char *, size_t, int);
|
||||
extern struct hostent *getipnodebyaddr (const void *, size_t, int, int *);
|
||||
extern struct hostent *getipnodebyname (const char *, int, int, int *);
|
||||
extern int inet_pton (int, const char *, void *);
|
||||
extern const char *inet_ntop (int, const void *, char *, size_t);
|
||||
#endif /* HAVE_ADDRINFO */
|
||||
|
||||
/*
|
||||
* Constants for getnameinfo()
|
||||
*/
|
||||
#ifndef NI_MAXHOST
|
||||
#define NI_MAXHOST 1025
|
||||
#endif
|
||||
#ifndef NI_MAXSERV
|
||||
#define NI_MAXSERV 32
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Flag values for getnameinfo()
|
||||
*/
|
||||
#ifndef NI_NOFQDN
|
||||
#define NI_NOFQDN 0x00000001
|
||||
#endif
|
||||
#ifndef NI_NUMERICHOST
|
||||
#define NI_NUMERICHOST 0x00000002
|
||||
#endif
|
||||
#ifndef NI_NAMEREQD
|
||||
#define NI_NAMEREQD 0x00000004
|
||||
#endif
|
||||
#ifndef NI_NUMERICSERV
|
||||
#define NI_NUMERICSERV 0x00000008
|
||||
#endif
|
||||
#ifndef NI_DGRAM
|
||||
#define NI_DGRAM 0x00000010
|
||||
#endif
|
@ -35,7 +35,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -35,12 +35,13 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "pcap-missing.h"
|
||||
#include "ascii_strcasecmp.h"
|
||||
|
||||
struct dlt_choice {
|
||||
const char *name;
|
||||
@ -137,7 +138,7 @@ pcap_datalink_name_to_val(const char *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; dlt_choices[i].name != NULL; i++) {
|
||||
if (strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
|
||||
if (ascii_strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
|
||||
name) == 0)
|
||||
return (dlt_choices[i].dlt);
|
||||
}
|
||||
|
@ -1,276 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Issues to be discussed:
|
||||
* - Thread safe-ness must be checked
|
||||
* - Return values. There seems to be no standard for return value (RFC2553)
|
||||
* but INRIA implementation returns EAI_xxx defined for getaddrinfo().
|
||||
* - RFC2553 says that we should raise error on short buffer. X/Open says
|
||||
* we need to truncate the result. We obey RFC2553 (and X/Open should be
|
||||
* modified).
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <netdb.h>
|
||||
#include <resolv.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef NEED_ADDRINFO_H
|
||||
#include "addrinfo.h"
|
||||
#endif
|
||||
|
||||
#define SUCCESS 0
|
||||
#define ANY 0
|
||||
#define YES 1
|
||||
#define NO 0
|
||||
|
||||
static struct afd {
|
||||
int a_af;
|
||||
int a_addrlen;
|
||||
int a_socklen;
|
||||
int a_off;
|
||||
} afdl [] = {
|
||||
#ifdef INET6
|
||||
{PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
|
||||
offsetof(struct sockaddr_in6, sin6_addr)},
|
||||
#endif
|
||||
{PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
|
||||
offsetof(struct sockaddr_in, sin_addr)},
|
||||
{0, 0, 0},
|
||||
};
|
||||
|
||||
struct sockinet {
|
||||
u_char si_len;
|
||||
u_char si_family;
|
||||
u_short si_port;
|
||||
};
|
||||
|
||||
#define ENI_NOSOCKET 0
|
||||
#define ENI_NOSERVNAME 1
|
||||
#define ENI_NOHOSTNAME 2
|
||||
#define ENI_MEMORY 3
|
||||
#define ENI_SYSTEM 4
|
||||
#define ENI_FAMILY 5
|
||||
#define ENI_SALEN 6
|
||||
|
||||
int
|
||||
getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
const struct sockaddr *sa;
|
||||
size_t salen;
|
||||
char *host;
|
||||
size_t hostlen;
|
||||
char *serv;
|
||||
size_t servlen;
|
||||
int flags;
|
||||
{
|
||||
struct afd *afd;
|
||||
struct servent *sp;
|
||||
struct hostent *hp;
|
||||
u_short port;
|
||||
int family, i;
|
||||
char *addr, *p;
|
||||
uint32_t v4a;
|
||||
int h_error;
|
||||
char numserv[512];
|
||||
char numaddr[512];
|
||||
|
||||
if (sa == NULL)
|
||||
return ENI_NOSOCKET;
|
||||
|
||||
#ifdef HAVE_SA_LEN /*XXX*/
|
||||
if (sa->sa_len != salen)
|
||||
return ENI_SALEN;
|
||||
#endif
|
||||
|
||||
family = sa->sa_family;
|
||||
for (i = 0; afdl[i].a_af; i++)
|
||||
if (afdl[i].a_af == family) {
|
||||
afd = &afdl[i];
|
||||
goto found;
|
||||
}
|
||||
return ENI_FAMILY;
|
||||
|
||||
found:
|
||||
if (salen != afd->a_socklen)
|
||||
return ENI_SALEN;
|
||||
|
||||
port = ((struct sockinet *)sa)->si_port; /* network byte order */
|
||||
addr = (char *)sa + afd->a_off;
|
||||
|
||||
if (serv == NULL || servlen == 0) {
|
||||
/*
|
||||
* do nothing in this case.
|
||||
* in case you are wondering if "&&" is more correct than
|
||||
* "||" here: RFC2553 says that serv == NULL OR servlen == 0
|
||||
* means that the caller does not want the result.
|
||||
*/
|
||||
} else {
|
||||
if (flags & NI_NUMERICSERV)
|
||||
sp = NULL;
|
||||
else {
|
||||
sp = getservbyport(port,
|
||||
(flags & NI_DGRAM) ? "udp" : "tcp");
|
||||
}
|
||||
if (sp) {
|
||||
if (strlen(sp->s_name) + 1 > servlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(serv, sp->s_name);
|
||||
} else {
|
||||
snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
|
||||
if (strlen(numserv) + 1 > servlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(serv, numserv);
|
||||
}
|
||||
}
|
||||
|
||||
switch (sa->sa_family) {
|
||||
case AF_INET:
|
||||
v4a = (uint32_t)
|
||||
ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr);
|
||||
if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
|
||||
flags |= NI_NUMERICHOST;
|
||||
v4a >>= IN_CLASSA_NSHIFT;
|
||||
if (v4a == 0)
|
||||
flags |= NI_NUMERICHOST;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *sin6;
|
||||
sin6 = (struct sockaddr_in6 *)sa;
|
||||
switch (sin6->sin6_addr.s6_addr[0]) {
|
||||
case 0x00:
|
||||
if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
|
||||
;
|
||||
else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
|
||||
;
|
||||
else
|
||||
flags |= NI_NUMERICHOST;
|
||||
break;
|
||||
default:
|
||||
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
|
||||
flags |= NI_NUMERICHOST;
|
||||
}
|
||||
else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
|
||||
flags |= NI_NUMERICHOST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (host == NULL || hostlen == 0) {
|
||||
/*
|
||||
* do nothing in this case.
|
||||
* in case you are wondering if "&&" is more correct than
|
||||
* "||" here: RFC2553 says that host == NULL OR hostlen == 0
|
||||
* means that the caller does not want the result.
|
||||
*/
|
||||
} else if (flags & NI_NUMERICHOST) {
|
||||
/* NUMERICHOST and NAMEREQD conflicts with each other */
|
||||
if (flags & NI_NAMEREQD)
|
||||
return ENI_NOHOSTNAME;
|
||||
if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
|
||||
== NULL)
|
||||
return ENI_SYSTEM;
|
||||
if (strlen(numaddr) + 1 > hostlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(host, numaddr);
|
||||
#if defined(INET6) && defined(NI_WITHSCOPEID)
|
||||
if (afd->a_af == AF_INET6 &&
|
||||
(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr) ||
|
||||
IN6_IS_ADDR_MULTICAST((struct in6_addr *)addr)) &&
|
||||
((struct sockaddr_in6 *)sa)->sin6_scope_id) {
|
||||
#ifndef ALWAYS_WITHSCOPE
|
||||
if (flags & NI_WITHSCOPEID)
|
||||
#endif /* !ALWAYS_WITHSCOPE */
|
||||
{
|
||||
char *ep = strchr(host, '\0');
|
||||
unsigned int ifindex =
|
||||
((struct sockaddr_in6 *)sa)->sin6_scope_id;
|
||||
|
||||
*ep = SCOPE_DELIMITER;
|
||||
if ((if_indextoname(ifindex, ep + 1)) == NULL)
|
||||
/* XXX what should we do? */
|
||||
strncpy(ep + 1, "???", 3);
|
||||
}
|
||||
}
|
||||
#endif /* INET6 */
|
||||
} else {
|
||||
#ifdef USE_GETIPNODEBY
|
||||
hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
|
||||
#else
|
||||
hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
|
||||
#ifdef HAVE_H_ERRNO
|
||||
h_error = h_errno;
|
||||
#else
|
||||
h_error = EINVAL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (hp) {
|
||||
if (flags & NI_NOFQDN) {
|
||||
p = strchr(hp->h_name, '.');
|
||||
if (p) *p = '\0';
|
||||
}
|
||||
if (strlen(hp->h_name) + 1 > hostlen) {
|
||||
#ifdef USE_GETIPNODEBY
|
||||
freehostent(hp);
|
||||
#endif
|
||||
return ENI_MEMORY;
|
||||
}
|
||||
strcpy(host, hp->h_name);
|
||||
#ifdef USE_GETIPNODEBY
|
||||
freehostent(hp);
|
||||
#endif
|
||||
} else {
|
||||
if (flags & NI_NAMEREQD)
|
||||
return ENI_NOHOSTNAME;
|
||||
if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
|
||||
== NULL)
|
||||
return ENI_NOHOSTNAME;
|
||||
if (strlen(numaddr) + 1 > hostlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(host, numaddr);
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
@ -42,7 +42,7 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <interface.h>
|
||||
#include "netdissect.h"
|
||||
|
||||
enum format_flags {
|
||||
minus_flag = 1,
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
char *
|
||||
strdup(str)
|
||||
|
@ -28,15 +28,15 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
|
@ -28,15 +28,15 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
|
@ -31,15 +31,15 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
/*
|
||||
* Get next token from string *stringp, where tokens are possibly-empty
|
||||
|
@ -70,20 +70,6 @@
|
||||
/* number of bytes of fixed size data in resource record */
|
||||
#define RRFIXEDSZ 10
|
||||
|
||||
/*
|
||||
* Internet nameserver port number
|
||||
*/
|
||||
#define NAMESERVER_PORT 53
|
||||
|
||||
/*
|
||||
* Port for multicast DNS; see
|
||||
*
|
||||
* http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt
|
||||
*
|
||||
* for the current mDNS spec.
|
||||
*/
|
||||
#define MULTICASTDNS_PORT 5353
|
||||
|
||||
/*
|
||||
* Currently defined opcodes
|
||||
*/
|
||||
|
@ -32,28 +32,30 @@
|
||||
/*
|
||||
* Include the appropriate OS header files on Windows and various flavors
|
||||
* of UNIX, include various non-OS header files on Windows, and define
|
||||
* various items as needed, to isolate most of tcpdump's platform
|
||||
* various items as needed, to isolate most of netdissect's platform
|
||||
* differences to this one file.
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_stdinc_h
|
||||
#define tcpdump_stdinc_h
|
||||
#ifndef netdissect_stdinc_h
|
||||
#define netdissect_stdinc_h
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
/*
|
||||
* Includes and definitions for Windows.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include "bittypes.h" /* in wpcap's Win32/include */
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <net/netdb.h> /* in wpcap's Win32/include */
|
||||
|
||||
#ifndef uint8_t
|
||||
#define uint8_t unsigned char
|
||||
@ -133,6 +135,17 @@
|
||||
|
||||
#endif /* _MSC_EXTENSIONS */
|
||||
|
||||
/*
|
||||
* Suppress definition of intN_t in bittypes.h, as included by <pcap/pcap.h>
|
||||
* on Windows.
|
||||
* (Yes, HAVE_U_INTn_T, as the definition guards are UN*X-oriented, and
|
||||
* we check for u_intN_t in the UN*X configure script.)
|
||||
*/
|
||||
#define HAVE_U_INT8_T
|
||||
#define HAVE_U_INT16_T
|
||||
#define HAVE_U_INT32_T
|
||||
#define HAVE_U_INT64_T
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define stat _stat
|
||||
#define open _open
|
||||
@ -142,13 +155,6 @@
|
||||
#define O_RDONLY _O_RDONLY
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Protos for missing/x.c functions (ideally <missing/addrinfo.h>
|
||||
* should be used, but it clashes with <ws2tcpip.h>).
|
||||
*/
|
||||
extern const char *inet_ntop (int, const void *, char *, size_t);
|
||||
extern int inet_pton (int, const char *, void *);
|
||||
extern int inet_aton (const char *cp, struct in_addr *addr);
|
||||
|
||||
/*
|
||||
* With MSVC, for C, __inline is used to make a function an inline.
|
||||
*/
|
||||
@ -156,6 +162,10 @@ extern int inet_aton (const char *cp, struct in_addr *addr);
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#ifdef AF_INET6
|
||||
#define HAVE_OS_IPV6_SUPPORT
|
||||
#endif
|
||||
|
||||
#ifndef INET6_ADDRSTRLEN
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
#endif
|
||||
@ -171,12 +181,15 @@ typedef char* caddr_t;
|
||||
#endif /* caddr_t */
|
||||
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#define NI_MAXHOST 1025
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#define RETSIGTYPE void
|
||||
|
||||
#else /* WIN32 */
|
||||
#else /* _WIN32 */
|
||||
|
||||
/*
|
||||
* Includes and definitions for various flavors of UN*X.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
@ -198,7 +211,7 @@ typedef char* caddr_t;
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#endif /* WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifndef HAVE___ATTRIBUTE__
|
||||
#define __attribute__(x)
|
||||
@ -241,7 +254,10 @@ typedef char* caddr_t;
|
||||
#define UNALIGNED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(MSDOS)
|
||||
/*
|
||||
* fopen() read and write modes for text files and binary files.
|
||||
*/
|
||||
#if defined(_WIN32) || defined(MSDOS)
|
||||
#define FOPEN_READ_TXT "rt"
|
||||
#define FOPEN_READ_BIN "rb"
|
||||
#define FOPEN_WRITE_TXT "wt"
|
||||
@ -253,6 +269,16 @@ typedef char* caddr_t;
|
||||
#define FOPEN_WRITE_BIN FOPEN_WRITE_TXT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Inline x86 assembler-language versions of ntoh[ls]() and hton[ls](),
|
||||
* defined if the OS doesn't provide them. These assume no more than
|
||||
* an 80386, so, for example, it avoids the bswap instruction added in
|
||||
* the 80486.
|
||||
*
|
||||
* (We don't use them on OS X; Apple provides their own, which *doesn't*
|
||||
* avoid the bswap instruction, as OS X only supports machines that
|
||||
* have it.)
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(__i386__) && !defined(__APPLE__) && !defined(__ntohl)
|
||||
#undef ntohl
|
||||
#undef ntohs
|
||||
@ -284,6 +310,32 @@ typedef char* caddr_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the OS doesn't define AF_INET6 and struct in6_addr:
|
||||
*
|
||||
* define AF_INET6, so we can use it internally as a "this is an
|
||||
* IPv6 address" indication;
|
||||
*
|
||||
* define struct in6_addr so that we can use it for IPv6 addresses.
|
||||
*/
|
||||
#ifndef HAVE_OS_IPV6_SUPPORT
|
||||
#ifndef AF_INET6
|
||||
#define AF_INET6 24
|
||||
|
||||
struct in6_addr {
|
||||
union {
|
||||
__uint8_t __u6_addr8[16];
|
||||
__uint16_t __u6_addr16[8];
|
||||
__uint32_t __u6_addr32[4];
|
||||
} __u6_addr; /* 128-bit IP6 address */
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NI_MAXHOST
|
||||
#define NI_MAXHOST 1025
|
||||
#endif
|
||||
|
||||
#ifndef INET_ADDRSTRLEN
|
||||
#define INET_ADDRSTRLEN 16
|
||||
#endif
|
||||
@ -349,4 +401,4 @@ typedef char* caddr_t;
|
||||
#define max(a,b) ((b)>(a)?(b):(a))
|
||||
#endif
|
||||
|
||||
#endif /* tcpdump_stdinc_h */
|
||||
#endif /* netdissect_stdinc_h */
|
146
contrib/tcpdump/netdissect.c
Normal file
146
contrib/tcpdump/netdissect.c
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 1988-1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1998-2012 Michael Richardson <mcr@tcpdump.org>
|
||||
* The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
#include "netdissect.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef USE_LIBSMI
|
||||
#include <smi.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize anything that must be initialized before dissecting
|
||||
* packets.
|
||||
*
|
||||
* This should be called at the beginning of the program; it does
|
||||
* not need to be called, and should not be called, for every
|
||||
* netdissect_options structure.
|
||||
*/
|
||||
int
|
||||
nd_init(char *errbuf, size_t errbuf_size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* Request Winsock 2.2; we expect Winsock 2.
|
||||
*/
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0) {
|
||||
strlcpy(errbuf, "Attempting to initialize Winsock failed",
|
||||
errbuf_size);
|
||||
return (-1);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef USE_LIBSMI
|
||||
/*
|
||||
* XXX - should we just fail if this fails? Some of the
|
||||
* libsmi calls may fail.
|
||||
*/
|
||||
smiInit("tcpdump");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Clears the error buffer, and uses it so we don't get
|
||||
* "unused argument" warnings at compile time.
|
||||
*/
|
||||
strlcpy(errbuf, "", errbuf_size);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up anything that ndo_init() did.
|
||||
*/
|
||||
void
|
||||
nd_cleanup(void)
|
||||
{
|
||||
#ifdef USE_LIBSMI
|
||||
/*
|
||||
* This appears, in libsmi 0.4.8, to do nothing if smiInit()
|
||||
* wasn't done or failed, so we call it unconditionally.
|
||||
*/
|
||||
smiExit();
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Undo the WSAStartup() call above.
|
||||
*/
|
||||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
nd_have_smi_support(void)
|
||||
{
|
||||
#ifdef USE_LIBSMI
|
||||
return (1);
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Indicates whether an SMI module has been loaded, so that we can use
|
||||
* libsmi to translate OIDs.
|
||||
*/
|
||||
int nd_smi_module_loaded;
|
||||
|
||||
int
|
||||
nd_load_smi_module(const char *module, char *errbuf, size_t errbuf_size)
|
||||
{
|
||||
#ifdef USE_LIBSMI
|
||||
if (smiLoadModule(module) == 0) {
|
||||
snprintf(errbuf, errbuf_size, "could not load MIB module %s",
|
||||
module);
|
||||
return (-1);
|
||||
}
|
||||
nd_smi_module_loaded = 1;
|
||||
return (0);
|
||||
#else
|
||||
snprintf(errbuf, errbuf_size, "MIB module %s not loaded: no libsmi support",
|
||||
module);
|
||||
return (-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *
|
||||
nd_smi_version_string(void)
|
||||
{
|
||||
#ifdef USE_LIBSMI
|
||||
return (smi_version_string);
|
||||
#else
|
||||
return (NULL);
|
||||
#endif
|
||||
}
|
@ -34,11 +34,52 @@
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data types corresponding to multi-byte integral values within data
|
||||
* structures. These are defined as arrays of octets, so that they're
|
||||
* not aligned on their "natural" boundaries, and so that you *must*
|
||||
* use the EXTRACT_ macros to extract them (which you should be doing
|
||||
* *anyway*, so as not to assume a particular byte order or alignment
|
||||
* in your code).
|
||||
*/
|
||||
typedef unsigned char nd_uint16_t[2];
|
||||
typedef unsigned char nd_uint24_t[3];
|
||||
typedef unsigned char nd_uint32_t[4];
|
||||
typedef unsigned char nd_uint40_t[5];
|
||||
typedef unsigned char nd_uint48_t[6];
|
||||
typedef unsigned char nd_uint56_t[7];
|
||||
typedef unsigned char nd_uint64_t[8];
|
||||
|
||||
/*
|
||||
* Use this for IPv4 addresses. It's defined as an array of octets, so
|
||||
* that it's not aligned on its "natural" boundary, and it's defined as
|
||||
* a structure in the hopes that this makes it harder to naively use
|
||||
* EXTRACT_32BITS() to extract the value - in many cases you just want
|
||||
* to use UNALIGNED_MEMCPY() to copy its value, so that it remains in
|
||||
* network byte order.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char bytes[4];
|
||||
} nd_ipv4;
|
||||
|
||||
/*
|
||||
* Data types corresponding to single-byte integral values, for
|
||||
* completeness.
|
||||
*/
|
||||
typedef unsigned char nd_uint8_t;
|
||||
typedef signed char nd_int8_t;
|
||||
|
||||
/* snprintf et al */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "ip.h" /* struct ip for nextproto4_cksum() */
|
||||
#include "ip6.h" /* struct ip6 for nextproto6_cksum() */
|
||||
|
||||
extern int32_t thiszone; /* seconds offset from gmt to local time */
|
||||
/* invalid string to print '(invalid)' for malformed or corrupted packets */
|
||||
extern const char istr[];
|
||||
|
||||
#if !defined(HAVE_SNPRINTF)
|
||||
int snprintf (char *str, size_t sz, const char *format, ...)
|
||||
@ -54,7 +95,7 @@ int vsnprintf (char *str, size_t sz, const char *format, va_list ap)
|
||||
__attribute__((format (printf, 3, 0)))
|
||||
#endif /* __ATTRIBUTE___FORMAT_OK */
|
||||
;
|
||||
#endif /* !defined(HAVE_SNPRINTF) */
|
||||
#endif /* !defined(HAVE_VSNPRINTF) */
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
extern size_t strlcat (char *, const char *, size_t);
|
||||
@ -76,7 +117,6 @@ struct tok {
|
||||
const char *s; /* string */
|
||||
};
|
||||
|
||||
#define TOKBUFSIZE 128
|
||||
extern const char *tok2strbuf(const struct tok *, const char *, u_int,
|
||||
char *buf, size_t bufsize);
|
||||
|
||||
@ -85,11 +125,27 @@ extern const char *tok2str(const struct tok *, const char *, u_int);
|
||||
extern char *bittok2str(const struct tok *, const char *, u_int);
|
||||
extern char *bittok2str_nosep(const struct tok *, const char *, u_int);
|
||||
|
||||
/* Initialize netdissect. */
|
||||
extern int nd_init(char *, size_t);
|
||||
/* Clean up netdissect. */
|
||||
extern void nd_cleanup(void);
|
||||
|
||||
/* Do we have libsmi support? */
|
||||
extern int nd_have_smi_support(void);
|
||||
/* Load an SMI module. */
|
||||
extern int nd_load_smi_module(const char *, char *, size_t);
|
||||
/* Flag indicating whether an SMI module has been loaded. */
|
||||
extern int nd_smi_module_loaded;
|
||||
/* Version number of the SMI library, or NULL if we don't have libsmi support. */
|
||||
extern const char *nd_smi_version_string(void);
|
||||
|
||||
typedef struct netdissect_options netdissect_options;
|
||||
|
||||
#define IF_PRINTER_ARGS (netdissect_options *, const struct pcap_pkthdr *, const u_char *)
|
||||
|
||||
typedef u_int (*if_printer) IF_PRINTER_ARGS;
|
||||
|
||||
struct netdissect_options {
|
||||
int ndo_aflag; /* translate network and broadcast addresses */
|
||||
int ndo_bflag; /* print 4 byte ASes in ASDOT notation */
|
||||
int ndo_eflag; /* print ethernet header */
|
||||
int ndo_fflag; /* don't translate "foreign" IP address */
|
||||
@ -97,69 +153,41 @@ struct netdissect_options {
|
||||
int ndo_nflag; /* leave addresses as numbers */
|
||||
int ndo_Nflag; /* remove domains from printed host names */
|
||||
int ndo_qflag; /* quick (shorter) output */
|
||||
int ndo_Rflag; /* print sequence # field in AH/ESP*/
|
||||
int ndo_sflag; /* use the libsmi to translate OIDs */
|
||||
int ndo_Sflag; /* print raw TCP sequence numbers */
|
||||
int ndo_tflag; /* print packet arrival time */
|
||||
int ndo_Uflag; /* "unbuffered" output of dump files */
|
||||
int ndo_uflag; /* Print undecoded NFS handles */
|
||||
int ndo_vflag; /* verbose */
|
||||
int ndo_vflag; /* verbosity level */
|
||||
int ndo_xflag; /* print packet in hex */
|
||||
int ndo_Xflag; /* print packet in hex/ascii */
|
||||
int ndo_Aflag; /* print packet only in ascii observing TAB,
|
||||
* LF, CR and SPACE as graphical chars
|
||||
*/
|
||||
int ndo_Bflag; /* buffer size */
|
||||
int ndo_Iflag; /* rfmon (monitor) mode */
|
||||
int ndo_Oflag; /* run filter code optimizer */
|
||||
int ndo_dlt; /* if != -1, ask libpcap for the DLT it names*/
|
||||
int ndo_jflag; /* packet time stamp source */
|
||||
int ndo_pflag; /* don't go promiscuous */
|
||||
int ndo_immediate; /* use immediate mode */
|
||||
|
||||
int ndo_Cflag; /* rotate dump files after this many bytes */
|
||||
int ndo_Cflag_count; /* Keep track of which file number we're writing */
|
||||
int ndo_Gflag; /* rotate dump files after this many seconds */
|
||||
int ndo_Gflag_count; /* number of files created with Gflag rotation */
|
||||
time_t ndo_Gflag_time; /* The last time_t the dump file was rotated. */
|
||||
int ndo_Wflag; /* recycle output files after this number of files */
|
||||
int ndo_WflagChars;
|
||||
int ndo_Hflag; /* dissect 802.11s draft mesh standard */
|
||||
int ndo_packet_number; /* print a packet number in the beginning of line */
|
||||
int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
|
||||
int ndo_tstamp_precision; /* requested time stamp precision */
|
||||
const char *ndo_dltname;
|
||||
int ndo_tstamp_precision; /* requested time stamp precision */
|
||||
const char *program_name; /* Name of the program using the library */
|
||||
|
||||
char *ndo_espsecret;
|
||||
struct sa_list *ndo_sa_list_head; /* used by print-esp.c */
|
||||
struct sa_list *ndo_sa_default;
|
||||
|
||||
char *ndo_sigsecret; /* Signature verification secret key */
|
||||
|
||||
struct esp_algorithm *ndo_espsecret_xform; /* cache of decoded */
|
||||
char *ndo_espsecret_key;
|
||||
char *ndo_sigsecret; /* Signature verification secret key */
|
||||
|
||||
int ndo_packettype; /* as specified by -T */
|
||||
|
||||
char *ndo_program_name; /*used to generate self-identifying messages */
|
||||
|
||||
int32_t ndo_thiszone; /* seconds offset from gmt to local time */
|
||||
|
||||
int ndo_snaplen;
|
||||
|
||||
/*global pointers to beginning and end of current packet (during printing) */
|
||||
const u_char *ndo_packetp;
|
||||
const u_char *ndo_snapend;
|
||||
|
||||
/* bookkeeping for ^T output */
|
||||
int ndo_infodelay;
|
||||
/* pointer to the if_printer function */
|
||||
if_printer ndo_if_printer;
|
||||
|
||||
/* pointer to void function to output stuff */
|
||||
void (*ndo_default_print)(netdissect_options *,
|
||||
register const u_char *bp, register u_int length);
|
||||
|
||||
/* pointer to function to print ^T output */
|
||||
void (*ndo_info)(netdissect_options *, int verbose);
|
||||
register const u_char *bp, register u_int length);
|
||||
|
||||
/* pointer to function to do regular output */
|
||||
int (*ndo_printf)(netdissect_options *,
|
||||
@ -203,6 +231,7 @@ struct netdissect_options {
|
||||
#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */
|
||||
#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */
|
||||
#define PT_LMP 16 /* Link Management Protocol */
|
||||
#define PT_RESP 17 /* RESP */
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) ((a)>(b)?(b):(a))
|
||||
@ -211,6 +240,9 @@ struct netdissect_options {
|
||||
#define max(a,b) ((b)>(a)?(b):(a))
|
||||
#endif
|
||||
|
||||
/* For source or destination ports tests (UDP, TCP, ...) */
|
||||
#define IS_SRC_OR_DST_PORT(p) (sport == (p) || dport == (p))
|
||||
|
||||
/*
|
||||
* Maximum snapshot length. This should be enough to capture the full
|
||||
* packet on most network interfaces.
|
||||
@ -271,6 +303,11 @@ struct netdissect_options {
|
||||
* http://www.kb.cert.org/vuls/id/162289
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test in two parts to avoid these warnings:
|
||||
* comparison of unsigned expression >= 0 is always true [-Wtype-limits],
|
||||
* comparison is always true due to limited range of data type [-Wtype-limits].
|
||||
*/
|
||||
#define IS_NOT_NEGATIVE(x) (((x) > 0) || ((x) == 0))
|
||||
|
||||
#define ND_TTEST2(var, l) \
|
||||
@ -291,9 +328,12 @@ struct netdissect_options {
|
||||
#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
|
||||
|
||||
extern void ts_print(netdissect_options *, const struct timeval *);
|
||||
extern void relts_print(netdissect_options *, int);
|
||||
extern void signed_relts_print(netdissect_options *, int32_t);
|
||||
extern void unsigned_relts_print(netdissect_options *, uint32_t);
|
||||
|
||||
extern void fn_print_char(netdissect_options *, u_char);
|
||||
extern int fn_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern u_int fn_printztn(netdissect_options *ndo, const u_char *, u_int, const u_char *);
|
||||
extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
|
||||
@ -305,11 +345,6 @@ extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char
|
||||
extern void txtproto_print(netdissect_options *, const u_char *, u_int,
|
||||
const char *, const char **, u_int);
|
||||
|
||||
#if 0
|
||||
extern char *read_infile(netdissect_options *, char *);
|
||||
extern char *copy_argv(netdissect_options *, char **);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Locale-independent macros for testing character properties and
|
||||
* stripping the 8th bit from characters. Assumed to be handed
|
||||
@ -352,286 +387,278 @@ extern int unaligned_memcmp(const void *, const void *, size_t);
|
||||
#define PLURAL_SUFFIX(n) \
|
||||
(((n) != 1) ? "s" : "")
|
||||
|
||||
#if 0
|
||||
extern const char *dnname_string(netdissect_options *, u_short);
|
||||
extern const char *dnnum_string(netdissect_options *, u_short);
|
||||
#endif
|
||||
extern const char *tok2strary_internal(const char **, int, const char *, int);
|
||||
#define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
|
||||
|
||||
extern if_printer lookup_printer(int);
|
||||
|
||||
/* The DLT printer routines */
|
||||
|
||||
extern u_int ap1394_if_print IF_PRINTER_ARGS;
|
||||
extern u_int arcnet_if_print IF_PRINTER_ARGS;
|
||||
extern u_int arcnet_linux_if_print IF_PRINTER_ARGS;
|
||||
extern u_int atm_if_print IF_PRINTER_ARGS;
|
||||
extern u_int bt_if_print IF_PRINTER_ARGS;
|
||||
extern u_int chdlc_if_print IF_PRINTER_ARGS;
|
||||
extern u_int cip_if_print IF_PRINTER_ARGS;
|
||||
extern u_int enc_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ether_if_print IF_PRINTER_ARGS;
|
||||
extern u_int fddi_if_print IF_PRINTER_ARGS;
|
||||
extern u_int fr_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ieee802_11_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ieee802_11_radio_avs_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ieee802_11_radio_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ieee802_15_4_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ipfc_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ipnet_if_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_atm1_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_atm2_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_chdlc_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_es_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_ether_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_frelay_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_ggsn_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_mfr_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_mlfr_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_mlppp_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_monitor_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_ppp_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_pppoe_atm_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_pppoe_print IF_PRINTER_ARGS;
|
||||
extern u_int juniper_services_print IF_PRINTER_ARGS;
|
||||
extern u_int lane_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ltalk_if_print IF_PRINTER_ARGS;
|
||||
extern u_int mfr_if_print IF_PRINTER_ARGS;
|
||||
extern u_int netanalyzer_if_print IF_PRINTER_ARGS;
|
||||
extern u_int netanalyzer_transparent_if_print IF_PRINTER_ARGS;
|
||||
extern u_int nflog_if_print IF_PRINTER_ARGS;
|
||||
extern u_int null_if_print IF_PRINTER_ARGS;
|
||||
extern u_int pflog_if_print IF_PRINTER_ARGS;
|
||||
extern u_int pktap_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ppi_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ppp_bsdos_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ppp_hdlc_if_print IF_PRINTER_ARGS;
|
||||
extern u_int ppp_if_print IF_PRINTER_ARGS;
|
||||
extern u_int pppoe_if_print IF_PRINTER_ARGS;
|
||||
extern u_int prism_if_print IF_PRINTER_ARGS;
|
||||
extern u_int raw_if_print IF_PRINTER_ARGS;
|
||||
extern u_int sl_bsdos_if_print IF_PRINTER_ARGS;
|
||||
extern u_int sl_if_print IF_PRINTER_ARGS;
|
||||
extern u_int sll_if_print IF_PRINTER_ARGS;
|
||||
extern u_int sunatm_if_print IF_PRINTER_ARGS;
|
||||
extern u_int symantec_if_print IF_PRINTER_ARGS;
|
||||
extern u_int token_if_print IF_PRINTER_ARGS;
|
||||
extern u_int usb_linux_48_byte_print IF_PRINTER_ARGS;
|
||||
extern u_int usb_linux_64_byte_print IF_PRINTER_ARGS;
|
||||
|
||||
/*
|
||||
* Structure passed to some printers to allow them to print
|
||||
* link-layer address information if ndo_eflag isn't set
|
||||
* (because they are for protocols that don't have their
|
||||
* own addresses, so that we'd want to report link-layer
|
||||
* address information).
|
||||
*
|
||||
* This contains a pointer to an address and a pointer to a routine
|
||||
* to which we pass that pointer in order to get a string.
|
||||
*/
|
||||
struct lladdr_info {
|
||||
const char *(*addr_string)(netdissect_options *, const u_char *);
|
||||
const u_char *addr;
|
||||
};
|
||||
|
||||
/* The printer routines. */
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
extern char *q922_string(netdissect_options *ndo, const u_char *, u_int);
|
||||
|
||||
typedef u_int (*if_ndo_printer)(struct netdissect_options *ndo,
|
||||
const struct pcap_pkthdr *, const u_char *);
|
||||
typedef u_int (*if_printer)(const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
extern if_ndo_printer lookup_ndo_printer(int);
|
||||
extern if_printer lookup_printer(int);
|
||||
|
||||
extern void eap_print(netdissect_options *,const u_char *, u_int);
|
||||
extern int esp_print(netdissect_options *,
|
||||
const u_char *bp, const int length, const u_char *bp2,
|
||||
int *nhdr, int *padlen);
|
||||
extern void arp_print(netdissect_options *,const u_char *, u_int, u_int);
|
||||
extern void tipc_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void msnlb_print(netdissect_options *, const u_char *);
|
||||
extern void icmp6_print(netdissect_options *ndo, const u_char *,
|
||||
u_int, const u_char *, int);
|
||||
extern void isakmp_print(netdissect_options *,const u_char *,
|
||||
u_int, const u_char *);
|
||||
extern void isakmp_rfc3948_print(netdissect_options *,const u_char *,
|
||||
u_int, const u_char *);
|
||||
extern void ip_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void ip_print_inner(netdissect_options *ndo,
|
||||
const u_char *bp, u_int length, u_int nh,
|
||||
const u_char *bp2);
|
||||
extern void rrcp_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void loopback_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void carp_print(netdissect_options *, const u_char *, u_int, int);
|
||||
|
||||
extern void ether_print(netdissect_options *,
|
||||
const u_char *, u_int, u_int,
|
||||
void (*)(netdissect_options *, const u_char *),
|
||||
const u_char *);
|
||||
|
||||
extern u_int ether_if_print(netdissect_options *,
|
||||
const struct pcap_pkthdr *,const u_char *);
|
||||
extern u_int netanalyzer_if_print(netdissect_options *,
|
||||
const struct pcap_pkthdr *,const u_char *);
|
||||
extern u_int netanalyzer_transparent_if_print(netdissect_options *,
|
||||
const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
|
||||
extern int ethertype_print(netdissect_options *,u_short, const u_char *,
|
||||
u_int, u_int);
|
||||
|
||||
extern int print_unknown_data(netdissect_options *,const u_char *, const char *,int);
|
||||
extern void ascii_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void hex_print_with_offset(netdissect_options *, const char *ident, const u_char *cp,
|
||||
u_int, u_int);
|
||||
extern void hex_print(netdissect_options *,const char *ident, const u_char *cp,u_int);
|
||||
extern void hex_and_ascii_print_with_offset(netdissect_options *, const char *, const u_char *, u_int, u_int);
|
||||
extern void hex_and_ascii_print(netdissect_options *, const char *, const u_char *, u_int);
|
||||
|
||||
extern void aarp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int ah_print(netdissect_options *, register const u_char *);
|
||||
extern void beep_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void dtp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int cip_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern int ipcomp_print(netdissect_options *, register const u_char *, int *);
|
||||
extern u_int ipfc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void udld_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void hsrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void igrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void msdp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int null_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void mobile_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int ap1394_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int bt_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void lane_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern u_int lane_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void otv_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ahcp_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void vxlan_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int arcnet_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int arcnet_linux_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void bfd_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void gre_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int vjc_print(netdissect_options *, register const char *, u_short);
|
||||
extern void ipN_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int raw_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int usb_linux_48_byte_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int usb_linux_64_byte_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int symantec_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int chdlc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int chdlc_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern void zmtp1_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void zmtp1_print_datagram(netdissect_options *, const u_char *, const u_int);
|
||||
extern void ipx_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void mpls_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int pppoe_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int pppoe_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void sunrpcrequest_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern u_int pflog_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int token_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern u_int token_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void vqp_print(netdissect_options *, register const u_char *, register u_int);
|
||||
extern void zephyr_print(netdissect_options *, const u_char *, int);
|
||||
extern void fddi_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern u_int fddi_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void mpcp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rpki_rtr_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int sll_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void dccp_print(netdissect_options *, const u_char *, const u_char *, u_int);
|
||||
extern int llc_print(netdissect_options *, const u_char *, u_int, u_int, const u_char *, const u_char *, u_short *);
|
||||
extern int snap_print(netdissect_options *, const u_char *, u_int, u_int, u_int);
|
||||
extern void eigrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void stp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void l2tp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void udp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void icmp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void openflow_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void telnet_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void slow_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void radius_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int fr_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern u_int mfr_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern u_int fr_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int mfr_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void q933_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void igmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lwapp_control_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void lwapp_data_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void pgm_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void pptp_print(netdissect_options *, const u_char *);
|
||||
extern void ldp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void wb_print(netdissect_options *, const void *, u_int);
|
||||
extern int oam_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void atm_print(netdissect_options *, u_int, u_int, u_int, const u_char *, u_int, u_int);
|
||||
extern u_int sunatm_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int atm_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void vtp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int mptcp_print(netdissect_options *, const u_char *, u_int, u_char);
|
||||
extern void ntp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void cnfp_print(netdissect_options *, const u_char *);
|
||||
extern void dvmrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void egp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int enc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sl_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sl_bsdos_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void tftp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void vrrp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void pimv1_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void cisco_autorp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void pim_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern const u_char * ns_nprint (netdissect_options *, register const u_char *, register const u_char *);
|
||||
extern void ns_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void bootp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void sflow_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void aodv_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void sctp_print(netdissect_options *, const u_char *, const u_char *, u_int);
|
||||
extern char *bgp_vpn_rd_print (netdissect_options *, const u_char *);
|
||||
extern void aoe_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void arp_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void ascii_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void atalk_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void atm_print(netdissect_options *, u_int, u_int, u_int, const u_char *, u_int, u_int);
|
||||
extern void babel_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void beep_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void bfd_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void bgp_print(netdissect_options *, const u_char *, int);
|
||||
extern void olsr_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern char *bgp_vpn_rd_print (netdissect_options *, const u_char *);
|
||||
extern void bootp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void calm_fast_print(netdissect_options *, const u_char *, u_int, const struct lladdr_info *);
|
||||
extern void carp_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void cdp_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void cfm_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int chdlc_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern void cisco_autorp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void cnfp_print(netdissect_options *, const u_char *);
|
||||
extern void dccp_print(netdissect_options *, const u_char *, const u_char *, u_int);
|
||||
extern void decnet_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void dhcp6_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int dstopt_print(netdissect_options *, const u_char *);
|
||||
extern void dtp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void dvmrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void eap_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void egp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void eigrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int esp_print(netdissect_options *, const u_char *, const int, const u_char *, int *, int *);
|
||||
extern u_int ether_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), const u_char *);
|
||||
extern int ethertype_print(netdissect_options *, u_short, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
|
||||
extern u_int fddi_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void forces_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lspping_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int fr_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern int frag6_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern void ftp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void geneve_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void geonet_print(netdissect_options *, const u_char *, u_int, const struct lladdr_info *);
|
||||
extern void gre_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int hbhopt_print(netdissect_options *, const u_char *);
|
||||
extern void hex_and_ascii_print(netdissect_options *, const char *, const u_char *, u_int);
|
||||
extern void hex_and_ascii_print_with_offset(netdissect_options *, const char *, const u_char *, u_int, u_int);
|
||||
extern void hex_print(netdissect_options *, const char *ident, const u_char *cp, u_int);
|
||||
extern void hex_print_with_offset(netdissect_options *, const char *ident, const u_char *cp, u_int, u_int);
|
||||
extern void hncp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void hsrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void http_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void icmp6_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void icmp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void igmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void igrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ip6_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ipN_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ip_print_inner(netdissect_options *, const u_char *, u_int, u_int nh, const u_char *);
|
||||
extern void ipcomp_print(netdissect_options *, register const u_char *);
|
||||
extern void ipx_netbios_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ipx_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void isakmp_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void isakmp_rfc3948_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void isoclns_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void krb_print(netdissect_options *, const u_char *);
|
||||
extern void cdp_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void atalk_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int ltalk_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void l2tp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lane_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void ldp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lisp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int llap_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void aarp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int juniper_atm1_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm2_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mfr_print(netdissect_options *, const struct pcap_pkthdr *, register const u_char *);
|
||||
extern u_int juniper_mlfr_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mlppp_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_pppoe_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_pppoe_atm_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_ggsn_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_es_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_monitor_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_services_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_ether_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_ppp_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_frelay_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_chdlc_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void snmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rx_print(netdissect_options *, register const u_char *, int, int, int, u_char *);
|
||||
extern void nfsreply_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void nfsreply_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void nfsreq_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void sip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void syslog_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int llc_print(netdissect_options *, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
|
||||
extern void lldp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void loopback_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void lspping_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lwapp_control_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void lwapp_data_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void lwres_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void cfm_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void m3ua_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void medsa_print(netdissect_options *, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
|
||||
extern u_int mfr_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern void mobile_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int mobility_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern void mpcp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void mpls_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int mptcp_print(netdissect_options *, const u_char *, u_int, u_char);
|
||||
extern void msdp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void msnlb_print(netdissect_options *, const u_char *);
|
||||
extern void nbt_tcp_print(netdissect_options *, const u_char *, int);
|
||||
extern void nbt_udp137_print(netdissect_options *, const u_char *, int);
|
||||
extern void nbt_udp138_print(netdissect_options *, const u_char *, int);
|
||||
extern void smb_tcp_print(netdissect_options *, const u_char *, int);
|
||||
extern void netbeui_print(netdissect_options *, u_short, const u_char *, int);
|
||||
extern void ipx_netbios_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void print_data(netdissect_options *, const unsigned char *, int);
|
||||
extern void decnet_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void tcp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void ospf_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern int ospf_print_te_lsa(netdissect_options *, const uint8_t *, u_int);
|
||||
extern int ospf_print_grace_lsa(netdissect_options *, const uint8_t *, u_int);
|
||||
extern u_int ppp_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern u_int ppp_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ppp_hdlc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ppp_bsdos_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void lldp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rsvp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void timed_print(netdissect_options *, const u_char *);
|
||||
extern void m3ua_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void aoe_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void ftp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void http_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rtsp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void smtp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void geneve_print(netdissect_options *, const u_char *, u_int);
|
||||
|
||||
extern void pfsync_ip_print(netdissect_options *, const u_char *, u_int);
|
||||
|
||||
/* stuff that has not yet been rototiled */
|
||||
|
||||
#if 0
|
||||
extern void ascii_print(netdissect_options *,u_int);
|
||||
extern void default_print(netdissect_options *,const u_char *, u_int);
|
||||
extern char *smb_errstr(netdissect_options *,int, int);
|
||||
extern const char *nt_errstr(netdissect_options *, uint32_t);
|
||||
#endif
|
||||
|
||||
extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ppi_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int nflog_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int pktap_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ieee802_11_radio_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ieee802_11_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ieee802_11_radio_avs_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int prism_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
extern void ip6_print(netdissect_options *,const u_char *, u_int);
|
||||
#ifdef INET6
|
||||
extern int frag6_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern int rt6_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern int hbhopt_print(netdissect_options *, const u_char *);
|
||||
extern int dstopt_print(netdissect_options *, const u_char *);
|
||||
extern void ripng_print(netdissect_options *, const u_char *, unsigned int);
|
||||
extern int mobility_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern void dhcp6_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void nfsreply_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void nfsreply_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void nfsreq_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern const u_char * ns_nprint (netdissect_options *, register const u_char *, register const u_char *);
|
||||
extern void ns_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void nsh_print(netdissect_options *ndo, const u_char *bp, u_int len);
|
||||
extern void ntp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void oam_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void olsr_print(netdissect_options *, const u_char *, u_int, int);
|
||||
extern void openflow_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void ospf6_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void babel_print(netdissect_options *, const u_char *, u_int);
|
||||
#endif /*INET6*/
|
||||
extern void ospf_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern int ospf_print_grace_lsa(netdissect_options *, const uint8_t *, u_int);
|
||||
extern int ospf_print_te_lsa(netdissect_options *, const uint8_t *, u_int);
|
||||
extern void otv_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void pfsync_ip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void pgm_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void pim_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void pimv1_print(netdissect_options *, const u_char *, u_int);
|
||||
extern u_int ppp_print(netdissect_options *, register const u_char *, u_int);
|
||||
extern u_int pppoe_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void pptp_print(netdissect_options *, const u_char *);
|
||||
extern int print_unknown_data(netdissect_options *, const u_char *, const char *, int);
|
||||
extern char *q922_string(netdissect_options *, const u_char *, u_int);
|
||||
extern void q933_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void radius_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void resp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ripng_print(netdissect_options *, const u_char *, unsigned int);
|
||||
extern void rpki_rtr_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rrcp_print(netdissect_options *, const u_char *, u_int, const struct lladdr_info *, const struct lladdr_info *);
|
||||
extern void rsvp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int rt6_print(netdissect_options *, const u_char *, const u_char *);
|
||||
extern void rtsp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void rx_print(netdissect_options *, register const u_char *, int, int, int, const u_char *);
|
||||
extern void sctp_print(netdissect_options *, const u_char *, const u_char *, u_int);
|
||||
extern void sflow_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void sip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void slow_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void smb_print_data(netdissect_options *, const unsigned char *, int);
|
||||
extern void smb_tcp_print(netdissect_options *, const u_char *, int);
|
||||
extern void smtp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern int snap_print(netdissect_options *, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *, u_int);
|
||||
extern void snmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void stp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void sunrpcrequest_print(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void syslog_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void tcp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void telnet_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void tftp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void timed_print(netdissect_options *, const u_char *);
|
||||
extern void tipc_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern u_int token_print(netdissect_options *, const u_char *, u_int, u_int);
|
||||
extern void udld_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void udp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern int vjc_print(netdissect_options *, register const char *, u_short);
|
||||
extern void vqp_print(netdissect_options *, register const u_char *, register u_int);
|
||||
extern void vrrp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
|
||||
extern void vtp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len);
|
||||
extern void vxlan_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void wb_print(netdissect_options *, const void *, u_int);
|
||||
extern void zephyr_print(netdissect_options *, const u_char *, int);
|
||||
extern void zmtp1_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void zmtp1_print_datagram(netdissect_options *, const u_char *, const u_int);
|
||||
|
||||
/* checksum routines */
|
||||
extern void init_checksum(void);
|
||||
extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int);
|
||||
extern uint16_t create_osi_cksum(const uint8_t *, int, int);
|
||||
|
||||
#if 0
|
||||
struct cksum_vec {
|
||||
const uint8_t *ptr;
|
||||
int len;
|
||||
};
|
||||
extern uint16_t in_cksum(const struct cksum_vec *, int);
|
||||
extern uint16_t in_cksum_shouldbe(uint16_t, uint16_t);
|
||||
#endif
|
||||
extern int nextproto4_cksum(netdissect_options *ndo, const struct ip *, const uint8_t *, u_int, u_int, u_int);
|
||||
extern int decode_prefix4(netdissect_options *ndo, const u_char *, u_int, char *, u_int);
|
||||
#ifdef INET6
|
||||
extern int decode_prefix6(netdissect_options *ndo, const u_char *, u_int, char *, u_int);
|
||||
#endif
|
||||
|
||||
extern void esp_print_decodesecret(netdissect_options *ndo);
|
||||
extern int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
|
||||
int initiator,
|
||||
extern int nextproto4_cksum(netdissect_options *, const struct ip *, const uint8_t *, u_int, u_int, u_int);
|
||||
|
||||
/* in print-ip6.c */
|
||||
extern int nextproto6_cksum(netdissect_options *, const struct ip6_hdr *, const uint8_t *, u_int, u_int, u_int);
|
||||
|
||||
/* Utilities */
|
||||
extern int mask2plen(uint32_t);
|
||||
extern int mask62plen(const u_char *);
|
||||
|
||||
extern const char *dnname_string(netdissect_options *, u_short);
|
||||
extern const char *dnnum_string(netdissect_options *, u_short);
|
||||
|
||||
extern char *smb_errstr(int, int);
|
||||
extern const char *nt_errstr(uint32_t);
|
||||
|
||||
extern int decode_prefix4(netdissect_options *, const u_char *, u_int, char *, u_int);
|
||||
extern int decode_prefix6(netdissect_options *, const u_char *, u_int, char *, u_int);
|
||||
|
||||
extern void esp_print_decodesecret(netdissect_options *);
|
||||
extern int esp_print_decrypt_buffer_by_ikev2(netdissect_options *, int,
|
||||
u_char spii[8], u_char spir[8],
|
||||
u_char *buf, u_char *end);
|
||||
|
||||
|
||||
extern void geonet_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *geo_pck, u_int len);
|
||||
extern void calm_fast_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *calm_pck, u_int len);
|
||||
const u_char *, const u_char *);
|
||||
|
||||
#endif /* netdissect_h */
|
||||
|
@ -35,7 +35,6 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* @(#)nfsproto.h 8.2 (Berkeley) 3/30/95
|
||||
*/
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
* Jeffrey C. Mogul
|
||||
* Digital Equipment Corporation
|
||||
* Western Research Laboratory
|
||||
* $FreeBSD$
|
||||
* $NetBSD: nfsfh.h,v 1.1.1.2 1997/10/03 17:25:13 christos Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -65,4 +63,4 @@ typedef struct {
|
||||
#define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\
|
||||
dev_eq(a.Fsid_dev, b.Fsid_dev))
|
||||
|
||||
extern void Parse_fh(const unsigned char *, int, my_fsid *, uint32_t *, const char **, const char **, int);
|
||||
extern void Parse_fh(const unsigned char *, u_int, my_fsid *, uint32_t *, const char **, const char **, int);
|
||||
|
@ -13,13 +13,12 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include "interface.h"
|
||||
#include <netdissect-stdinc.h>
|
||||
#include "netdissect.h"
|
||||
#include "nlpid.h"
|
||||
|
||||
const struct tok nlpid_values[] = {
|
||||
|
@ -13,13 +13,12 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include "interface.h"
|
||||
#include <netdissect-stdinc.h>
|
||||
#include "netdissect.h"
|
||||
#include "oui.h"
|
||||
|
||||
/* FIXME complete OUI list using a script */
|
||||
@ -27,6 +26,7 @@
|
||||
const struct tok oui_values[] = {
|
||||
{ OUI_ENCAP_ETHER, "Ethernet" },
|
||||
{ OUI_CISCO, "Cisco" },
|
||||
{ OUI_IANA, "IANA" },
|
||||
{ OUI_NORTEL, "Nortel Networks SONMP" },
|
||||
{ OUI_CISCO_90, "Cisco bridged" },
|
||||
{ OUI_RFC2684, "Ethernet bridged" },
|
||||
|
@ -16,29 +16,30 @@
|
||||
extern const struct tok oui_values[];
|
||||
extern const struct tok smi_values[];
|
||||
|
||||
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
|
||||
#define OUI_CISCO 0x00000c /* Cisco protocols */
|
||||
#define OUI_NORTEL 0x000081 /* Nortel SONMP */
|
||||
#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
|
||||
#define OUI_RFC2684 0x0080c2 /* RFC 2427/2684 bridged Ethernet */
|
||||
#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */
|
||||
#define OUI_CABLE_BPDU 0x00E02F /* DOCSIS spanning tree BPDU */
|
||||
#define OUI_APPLETALK 0x080007 /* Appletalk */
|
||||
#define OUI_JUNIPER 0x009069 /* Juniper */
|
||||
#define OUI_HP 0x080009 /* Hewlett-Packard */
|
||||
#define OUI_IEEE_8021_PRIVATE 0x0080c2 /* IEEE 802.1 Organisation Specific - Annex F */
|
||||
#define OUI_IEEE_8023_PRIVATE 0x00120f /* IEEE 802.3 Organisation Specific - Annex G */
|
||||
#define OUI_TIA 0x0012bb /* TIA - Telecommunications Industry Association - ANSI/TIA-1057- 2006 */
|
||||
#define OUI_DCBX 0x001B21 /* DCBX */
|
||||
#define OUI_NICIRA 0x002320 /* Nicira Networks */
|
||||
#define OUI_BSN 0x5c16c7 /* Big Switch Networks */
|
||||
#define OUI_VELLO 0xb0d2f5 /* Vello Systems */
|
||||
#define OUI_HP2 0x002481 /* HP too */
|
||||
#define OUI_HPLABS 0x0004ea /* HP-Labs */
|
||||
#define OUI_INFOBLOX 0x748771 /* Infoblox Inc */
|
||||
#define OUI_ONLAB 0xa42305 /* Open Networking Lab */
|
||||
#define OUI_FREESCALE 0x00049f /* Freescale */
|
||||
#define OUI_NETRONOME 0x0015ad /* Netronome */
|
||||
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
|
||||
#define OUI_CISCO 0x00000c /* Cisco protocols */
|
||||
#define OUI_IANA 0x00005E /* IANA */
|
||||
#define OUI_NORTEL 0x000081 /* Nortel SONMP */
|
||||
#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
|
||||
#define OUI_RFC2684 0x0080c2 /* RFC 2427/2684 bridged Ethernet */
|
||||
#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */
|
||||
#define OUI_CABLE_BPDU 0x00E02F /* DOCSIS spanning tree BPDU */
|
||||
#define OUI_APPLETALK 0x080007 /* Appletalk */
|
||||
#define OUI_JUNIPER 0x009069 /* Juniper */
|
||||
#define OUI_HP 0x080009 /* Hewlett-Packard */
|
||||
#define OUI_IEEE_8021_PRIVATE 0x0080c2 /* IEEE 802.1 Organisation Specific - Annex F */
|
||||
#define OUI_IEEE_8023_PRIVATE 0x00120f /* IEEE 802.3 Organisation Specific - Annex G */
|
||||
#define OUI_TIA 0x0012bb /* TIA - Telecommunications Industry Association - ANSI/TIA-1057- 2006 */
|
||||
#define OUI_DCBX 0x001B21 /* DCBX */
|
||||
#define OUI_NICIRA 0x002320 /* Nicira Networks */
|
||||
#define OUI_BSN 0x5c16c7 /* Big Switch Networks */
|
||||
#define OUI_VELLO 0xb0d2f5 /* Vello Systems */
|
||||
#define OUI_HP2 0x002481 /* HP too */
|
||||
#define OUI_HPLABS 0x0004ea /* HP-Labs */
|
||||
#define OUI_INFOBLOX 0x748771 /* Infoblox Inc */
|
||||
#define OUI_ONLAB 0xa42305 /* Open Networking Lab */
|
||||
#define OUI_FREESCALE 0x00049f /* Freescale */
|
||||
#define OUI_NETRONOME 0x0015ad /* Netronome */
|
||||
|
||||
/*
|
||||
* These are SMI Network Management Private Enterprise Codes for
|
||||
|
@ -38,21 +38,18 @@
|
||||
* Jeffrey C. Mogul
|
||||
* Digital Equipment Corporation
|
||||
* Western Research Laboratory
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "nfsfh.h"
|
||||
|
||||
/*
|
||||
@ -105,10 +102,10 @@
|
||||
((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24))
|
||||
#endif
|
||||
|
||||
static int is_UCX(const unsigned char *);
|
||||
static int is_UCX(const unsigned char *, u_int);
|
||||
|
||||
void
|
||||
Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
|
||||
Parse_fh(register const unsigned char *fh, u_int len, my_fsid *fsidp,
|
||||
uint32_t *inop,
|
||||
const char **osnamep, /* if non-NULL, return OS name here */
|
||||
const char **fsnamep, /* if non-NULL, return server fs name here (for VMS) */
|
||||
@ -117,138 +114,146 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
|
||||
register const unsigned char *fhp = fh;
|
||||
uint32_t temp;
|
||||
int fhtype = FHT_UNKNOWN;
|
||||
int i;
|
||||
u_int i;
|
||||
|
||||
if (ourself) {
|
||||
/* File handle generated on this host, no need for guessing */
|
||||
/*
|
||||
* Require at least 16 bytes of file handle; it's variable-length
|
||||
* in NFSv3. "len" is in units of 32-bit words, not bytes.
|
||||
*/
|
||||
if (len < 16/4)
|
||||
fhtype = FHT_UNKNOWN;
|
||||
else {
|
||||
if (ourself) {
|
||||
/* File handle generated on this host, no need for guessing */
|
||||
#if defined(IRIX40)
|
||||
fhtype = FHT_IRIX4;
|
||||
fhtype = FHT_IRIX4;
|
||||
#endif
|
||||
#if defined(IRIX50)
|
||||
fhtype = FHT_IRIX5;
|
||||
fhtype = FHT_IRIX5;
|
||||
#endif
|
||||
#if defined(IRIX51)
|
||||
fhtype = FHT_IRIX5;
|
||||
fhtype = FHT_IRIX5;
|
||||
#endif
|
||||
#if defined(SUNOS4)
|
||||
fhtype = FHT_SUNOS4;
|
||||
fhtype = FHT_SUNOS4;
|
||||
#endif
|
||||
#if defined(SUNOS5)
|
||||
fhtype = FHT_SUNOS5;
|
||||
fhtype = FHT_SUNOS5;
|
||||
#endif
|
||||
#if defined(ultrix)
|
||||
fhtype = FHT_ULTRIX;
|
||||
fhtype = FHT_ULTRIX;
|
||||
#endif
|
||||
#if defined(__osf__)
|
||||
fhtype = FHT_DECOSF;
|
||||
fhtype = FHT_DECOSF;
|
||||
#endif
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \
|
||||
|| defined(__OpenBSD__)
|
||||
fhtype = FHT_BSD44;
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* This is basically a big decision tree
|
||||
*/
|
||||
else if ((fhp[0] == 0) && (fhp[1] == 0)) {
|
||||
/* bytes[0,1] == (0,0); rules out Ultrix, IRIX5, SUNOS5 */
|
||||
/* probably rules out HP-UX, AIX unless they allow major=0 */
|
||||
if ((fhp[2] == 0) && (fhp[3] == 0)) {
|
||||
/* bytes[2,3] == (0,0); must be Auspex */
|
||||
/* XXX or could be Ultrix+MASSBUS "hp" disk? */
|
||||
fhtype = FHT_AUSPEX;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* bytes[2,3] != (0,0); rules out Auspex, could be
|
||||
* DECOSF, SUNOS4, or IRIX4
|
||||
*/
|
||||
if ((fhp[4] != 0) && (fhp[5] == 0) &&
|
||||
(fhp[8] == 12) && (fhp[9] == 0)) {
|
||||
/* seems to be DECOSF, with minor == 0 */
|
||||
fhtype = FHT_DECOSF;
|
||||
}
|
||||
else {
|
||||
/* could be SUNOS4 or IRIX4 */
|
||||
/* XXX the test of fhp[5] == 8 could be wrong */
|
||||
if ((fhp[4] == 0) && (fhp[5] == 8) && (fhp[6] == 0) &&
|
||||
(fhp[7] == 0)) {
|
||||
/* looks like a length, not a file system typecode */
|
||||
fhtype = FHT_IRIX4;
|
||||
}
|
||||
else {
|
||||
/* by elimination */
|
||||
fhtype = FHT_SUNOS4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* bytes[0,1] != (0,0); rules out Auspex, IRIX4, SUNOS4
|
||||
* could be IRIX5, DECOSF, UCX, Ultrix, SUNOS5
|
||||
* could be AIX, HP-UX
|
||||
*/
|
||||
if ((fhp[2] == 0) && (fhp[3] == 0)) {
|
||||
/*
|
||||
* bytes[2,3] == (0,0); rules out OSF, probably not UCX
|
||||
* (unless the exported device name is just one letter!),
|
||||
* could be Ultrix, IRIX5, AIX, or SUNOS5
|
||||
* might be HP-UX (depends on their values for minor devs)
|
||||
*/
|
||||
if ((fhp[6] == 0) && (fhp[7] == 0)) {
|
||||
fhtype = FHT_BSD44;
|
||||
#endif
|
||||
}
|
||||
/*XXX we probably only need to test of these two bytes */
|
||||
else if ((fhp[21] == 0) && (fhp[23] == 0)) {
|
||||
fhtype = FHT_ULTRIX;
|
||||
}
|
||||
else {
|
||||
/* Could be SUNOS5/IRIX5, maybe AIX */
|
||||
/* XXX no obvious difference between SUNOS5 and IRIX5 */
|
||||
if (fhp[9] == 10)
|
||||
fhtype = FHT_SUNOS5;
|
||||
/* XXX what about AIX? */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* bytes[2,3] != (0,0); rules out Ultrix, could be
|
||||
* DECOSF, SUNOS5, IRIX5, AIX, HP-UX, or UCX
|
||||
* This is basically a big decision tree
|
||||
*/
|
||||
if ((fhp[8] == 12) && (fhp[9] == 0)) {
|
||||
fhtype = FHT_DECOSF;
|
||||
}
|
||||
else if ((fhp[8] == 0) && (fhp[9] == 10)) {
|
||||
/* could be SUNOS5/IRIX5, AIX, HP-UX */
|
||||
if ((fhp[7] == 0) && (fhp[6] == 0) &&
|
||||
(fhp[5] == 0) && (fhp[4] == 0)) {
|
||||
/* XXX is this always true of HP-UX? */
|
||||
fhtype = FHT_HPUX9;
|
||||
}
|
||||
else if (fhp[7] == 2) {
|
||||
/* This would be MNT_NFS on AIX, which is impossible */
|
||||
fhtype = FHT_SUNOS5; /* or maybe IRIX5 */
|
||||
else if ((fhp[0] == 0) && (fhp[1] == 0)) {
|
||||
/* bytes[0,1] == (0,0); rules out Ultrix, IRIX5, SUNOS5 */
|
||||
/* probably rules out HP-UX, AIX unless they allow major=0 */
|
||||
if ((fhp[2] == 0) && (fhp[3] == 0)) {
|
||||
/* bytes[2,3] == (0,0); must be Auspex */
|
||||
/* XXX or could be Ultrix+MASSBUS "hp" disk? */
|
||||
fhtype = FHT_AUSPEX;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* XXX Could be SUNOS5/IRIX5 or AIX. I don't
|
||||
* XXX see any way to disambiguate these, so
|
||||
* XXX I'm going with the more likely guess.
|
||||
* XXX Sorry, Big Blue.
|
||||
* bytes[2,3] != (0,0); rules out Auspex, could be
|
||||
* DECOSF, SUNOS4, or IRIX4
|
||||
*/
|
||||
fhtype = FHT_SUNOS5; /* or maybe IRIX5 */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (is_UCX(fhp)) {
|
||||
fhtype = FHT_VMSUCX;
|
||||
}
|
||||
else {
|
||||
fhtype = FHT_UNKNOWN;
|
||||
if ((fhp[4] != 0) && (fhp[5] == 0) &&
|
||||
(fhp[8] == 12) && (fhp[9] == 0)) {
|
||||
/* seems to be DECOSF, with minor == 0 */
|
||||
fhtype = FHT_DECOSF;
|
||||
}
|
||||
else {
|
||||
/* could be SUNOS4 or IRIX4 */
|
||||
/* XXX the test of fhp[5] == 8 could be wrong */
|
||||
if ((fhp[4] == 0) && (fhp[5] == 8) && (fhp[6] == 0) &&
|
||||
(fhp[7] == 0)) {
|
||||
/* looks like a length, not a file system typecode */
|
||||
fhtype = FHT_IRIX4;
|
||||
}
|
||||
else {
|
||||
/* by elimination */
|
||||
fhtype = FHT_SUNOS4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* bytes[0,1] != (0,0); rules out Auspex, IRIX4, SUNOS4
|
||||
* could be IRIX5, DECOSF, UCX, Ultrix, SUNOS5
|
||||
* could be AIX, HP-UX
|
||||
*/
|
||||
if ((fhp[2] == 0) && (fhp[3] == 0)) {
|
||||
/*
|
||||
* bytes[2,3] == (0,0); rules out OSF, probably not UCX
|
||||
* (unless the exported device name is just one letter!),
|
||||
* could be Ultrix, IRIX5, AIX, or SUNOS5
|
||||
* might be HP-UX (depends on their values for minor devs)
|
||||
*/
|
||||
if ((fhp[6] == 0) && (fhp[7] == 0)) {
|
||||
fhtype = FHT_BSD44;
|
||||
}
|
||||
/*XXX we probably only need to test of these two bytes */
|
||||
else if ((len >= 24/4) && (fhp[21] == 0) && (fhp[23] == 0)) {
|
||||
fhtype = FHT_ULTRIX;
|
||||
}
|
||||
else {
|
||||
/* Could be SUNOS5/IRIX5, maybe AIX */
|
||||
/* XXX no obvious difference between SUNOS5 and IRIX5 */
|
||||
if (fhp[9] == 10)
|
||||
fhtype = FHT_SUNOS5;
|
||||
/* XXX what about AIX? */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* bytes[2,3] != (0,0); rules out Ultrix, could be
|
||||
* DECOSF, SUNOS5, IRIX5, AIX, HP-UX, or UCX
|
||||
*/
|
||||
if ((fhp[8] == 12) && (fhp[9] == 0)) {
|
||||
fhtype = FHT_DECOSF;
|
||||
}
|
||||
else if ((fhp[8] == 0) && (fhp[9] == 10)) {
|
||||
/* could be SUNOS5/IRIX5, AIX, HP-UX */
|
||||
if ((fhp[7] == 0) && (fhp[6] == 0) &&
|
||||
(fhp[5] == 0) && (fhp[4] == 0)) {
|
||||
/* XXX is this always true of HP-UX? */
|
||||
fhtype = FHT_HPUX9;
|
||||
}
|
||||
else if (fhp[7] == 2) {
|
||||
/* This would be MNT_NFS on AIX, which is impossible */
|
||||
fhtype = FHT_SUNOS5; /* or maybe IRIX5 */
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* XXX Could be SUNOS5/IRIX5 or AIX. I don't
|
||||
* XXX see any way to disambiguate these, so
|
||||
* XXX I'm going with the more likely guess.
|
||||
* XXX Sorry, Big Blue.
|
||||
*/
|
||||
fhtype = FHT_SUNOS5; /* or maybe IRIX5 */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (is_UCX(fhp, len)) {
|
||||
fhtype = FHT_VMSUCX;
|
||||
}
|
||||
else {
|
||||
fhtype = FHT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX still needs to handle SUNOS3 */
|
||||
@ -363,13 +368,13 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
|
||||
if (sizeof(*fsidp) > 14)
|
||||
memset((char *)fsidp, 0, sizeof(*fsidp));
|
||||
/* just use the whole thing */
|
||||
memcpy((char *)fsidp, (char *)fh, 14);
|
||||
memcpy((char *)fsidp, (const char *)fh, 14);
|
||||
}
|
||||
else {
|
||||
uint32_t tempa[4]; /* at least 16 bytes, maybe more */
|
||||
|
||||
memset((char *)tempa, 0, sizeof(tempa));
|
||||
memcpy((char *)tempa, (char *)fh, 14); /* ensure alignment */
|
||||
memcpy((char *)tempa, (const char *)fh, 14); /* ensure alignment */
|
||||
fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
|
||||
fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
|
||||
fsidp->fsid_code = 0;
|
||||
@ -380,7 +385,7 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
|
||||
|
||||
/* Caller must save (and null-terminate?) this value */
|
||||
if (fsnamep)
|
||||
*fsnamep = (char *)&(fhp[1]);
|
||||
*fsnamep = (const char *)&(fhp[1]);
|
||||
|
||||
if (osnamep)
|
||||
*osnamep = "VMS";
|
||||
@ -412,13 +417,14 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
|
||||
case FHT_UNKNOWN:
|
||||
#ifdef DEBUG
|
||||
/* XXX debugging */
|
||||
for (i = 0; i < 32; i++)
|
||||
for (i = 0; i < len*4; i++)
|
||||
(void)fprintf(stderr, "%x.", fhp[i]);
|
||||
(void)fprintf(stderr, "\n");
|
||||
#endif
|
||||
/* Save the actual handle, so it can be display with -u */
|
||||
for (i = 0; i < 32; i++)
|
||||
for (i = 0; i < len*4 && i*2 < sizeof(fsidp->Opaque_Handle) - 1; i++)
|
||||
(void)snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X", fhp[i]);
|
||||
fsidp->Opaque_Handle[i*2] = '\0';
|
||||
|
||||
/* XXX for now, give "bogus" values to aid debugging */
|
||||
fsidp->fsid_code = 0;
|
||||
@ -445,11 +451,18 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
|
||||
* (3) followed by string of nulls
|
||||
*/
|
||||
static int
|
||||
is_UCX(const unsigned char *fhp)
|
||||
is_UCX(const unsigned char *fhp, u_int len)
|
||||
{
|
||||
register int i;
|
||||
register u_int i;
|
||||
int seen_null = 0;
|
||||
|
||||
/*
|
||||
* Require at least 28 bytes of file handle; it's variable-length
|
||||
* in NFSv3. "len" is in units of 32-bit words, not bytes.
|
||||
*/
|
||||
if (len < 28/4)
|
||||
return(0);
|
||||
|
||||
for (i = 1; i < 14; i++) {
|
||||
if (ND_ISPRINT(fhp[i])) {
|
||||
if (seen_null)
|
||||
|
@ -19,8 +19,8 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_pcap_missing_h
|
||||
#define tcpdump_pcap_missing_h
|
||||
#ifndef netdissect_pcap_missing_h
|
||||
#define netdissect_pcap_missing_h
|
||||
|
||||
/*
|
||||
* Declarations of functions that might be missing from libpcap.
|
||||
@ -46,13 +46,4 @@ extern const char *pcap_datalink_val_to_description(int);
|
||||
extern long pcap_dump_ftell(pcap_dumper_t *);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* netdissect_pcap_missing_h */
|
||||
|
@ -13,8 +13,6 @@
|
||||
* University. Carnegie Mellon makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#define PPP_HDRLEN 4 /* length of PPP header */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,14 +20,15 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: IEEE 802.15.4 printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#include "extract.h"
|
||||
@ -112,7 +113,7 @@ ieee802_15_4_if_print(netdissect_options *ndo,
|
||||
if (ndo->ndo_vflag)
|
||||
ND_PRINT((ndo,"seq %02x ", seq));
|
||||
if (hdrlen == -1) {
|
||||
ND_PRINT((ndo,"malformed! "));
|
||||
ND_PRINT((ndo,"invalid! "));
|
||||
return caplen;
|
||||
}
|
||||
|
||||
@ -139,7 +140,7 @@ ieee802_15_4_if_print(netdissect_options *ndo,
|
||||
case 0x03:
|
||||
panid = EXTRACT_LE_16BITS(p);
|
||||
p += 2;
|
||||
ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p)));
|
||||
ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(ndo, p)));
|
||||
p += 8;
|
||||
break;
|
||||
}
|
||||
@ -165,7 +166,7 @@ ieee802_15_4_if_print(netdissect_options *ndo,
|
||||
panid = EXTRACT_LE_16BITS(p);
|
||||
p += 2;
|
||||
}
|
||||
ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p)));
|
||||
ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(ndo, p)));
|
||||
p += 8;
|
||||
break;
|
||||
}
|
||||
|
@ -21,40 +21,40 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: IPSEC Authentication Header printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "ah.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
|
||||
int
|
||||
ah_print(netdissect_options *ndo, register const u_char *bp)
|
||||
{
|
||||
register const struct ah *ah;
|
||||
register const u_char *ep;
|
||||
int sumlen;
|
||||
uint32_t spi;
|
||||
|
||||
ah = (const struct ah *)bp;
|
||||
ep = ndo->ndo_snapend; /* 'ep' points to the end of available data. */
|
||||
|
||||
ND_TCHECK(*ah);
|
||||
|
||||
sumlen = ah->ah_len << 2;
|
||||
spi = EXTRACT_32BITS(&ah->ah_spi);
|
||||
|
||||
ND_PRINT((ndo, "AH(spi=0x%08x", spi));
|
||||
ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_32BITS(&ah->ah_spi)));
|
||||
if (ndo->ndo_vflag)
|
||||
ND_PRINT((ndo, ",sumlen=%d", sumlen));
|
||||
ND_TCHECK_32BITS(ah + 1);
|
||||
ND_PRINT((ndo, ",seq=0x%x", EXTRACT_32BITS(ah + 1)));
|
||||
if (bp + sizeof(struct ah) + sumlen > ep)
|
||||
ND_PRINT((ndo, "[truncated]"));
|
||||
if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) {
|
||||
ND_PRINT((ndo, "[truncated]):"));
|
||||
return -1;
|
||||
}
|
||||
ND_PRINT((ndo, "): "));
|
||||
|
||||
return sizeof(struct ah) + sumlen;
|
||||
|
@ -1,8 +1,4 @@
|
||||
/*
|
||||
* This module implements decoding of AHCP (Ad Hoc Configuration Protocol) based
|
||||
* on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2013 The TCPDUMP project
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,19 +25,21 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Ad Hoc Configuration Protocol (AHCP) printer */
|
||||
|
||||
/* Based on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
static const char tstr[] = " [|ahcp]";
|
||||
static const char cstr[] = "(corrupt)";
|
||||
|
||||
#define AHCP_MAGIC_NUMBER 43
|
||||
#define AHCP_VERSION_1 1
|
||||
@ -107,7 +105,7 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
char buf[BUFSIZE];
|
||||
|
||||
if (cp + 4 != ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 4);
|
||||
t = EXTRACT_32BITS(cp);
|
||||
if (NULL == (tm = gmtime(&t)))
|
||||
@ -118,8 +116,8 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
ND_PRINT((ndo, ": %s UTC", buf));
|
||||
return 0;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, ": %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return 0;
|
||||
trunc:
|
||||
@ -131,13 +129,13 @@ static int
|
||||
ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
{
|
||||
if (cp + 4 != ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 4);
|
||||
ND_PRINT((ndo, ": %us", EXTRACT_32BITS(cp)));
|
||||
return 0;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, ": %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return 0;
|
||||
trunc:
|
||||
@ -152,20 +150,16 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha
|
||||
|
||||
while (cp < ep) {
|
||||
if (cp + 16 > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 16);
|
||||
#ifdef INET6
|
||||
ND_PRINT((ndo, "%s%s", sep, ip6addr_string(ndo, cp)));
|
||||
#else
|
||||
ND_PRINT((ndo, "%s(compiled w/o IPv6)", sep));
|
||||
#endif /* INET6 */
|
||||
cp += 16;
|
||||
sep = ", ";
|
||||
}
|
||||
return 0;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, ": %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return 0;
|
||||
trunc:
|
||||
@ -180,7 +174,7 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha
|
||||
|
||||
while (cp < ep) {
|
||||
if (cp + 4 > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 4);
|
||||
ND_PRINT((ndo, "%s%s", sep, ipaddr_string(ndo, cp)));
|
||||
cp += 4;
|
||||
@ -188,8 +182,8 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha
|
||||
}
|
||||
return 0;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, ": %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return 0;
|
||||
trunc:
|
||||
@ -204,20 +198,16 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char
|
||||
|
||||
while (cp < ep) {
|
||||
if (cp + 17 > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 17);
|
||||
#ifdef INET6
|
||||
ND_PRINT((ndo, "%s%s/%u", sep, ip6addr_string(ndo, cp), *(cp + 16)));
|
||||
#else
|
||||
ND_PRINT((ndo, "%s(compiled w/o IPv6)/%u", sep, *(cp + 16)));
|
||||
#endif /* INET6 */
|
||||
cp += 17;
|
||||
sep = ", ";
|
||||
}
|
||||
return 0;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, ": %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return 0;
|
||||
trunc:
|
||||
@ -232,7 +222,7 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char
|
||||
|
||||
while (cp < ep) {
|
||||
if (cp + 5 > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 5);
|
||||
ND_PRINT((ndo, "%s%s/%u", sep, ipaddr_string(ndo, cp), *(cp + 4)));
|
||||
cp += 5;
|
||||
@ -240,8 +230,8 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char
|
||||
}
|
||||
return 0;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, ": %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return 0;
|
||||
trunc:
|
||||
@ -283,12 +273,12 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
continue;
|
||||
/* Length */
|
||||
if (cp + 1 > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
ND_TCHECK2(*cp, 1);
|
||||
option_len = *cp;
|
||||
cp += 1;
|
||||
if (cp + option_len > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Value */
|
||||
if (option_no <= AHCP1_OPT_MAX && data_decoders[option_no] != NULL) {
|
||||
if (data_decoders[option_no](ndo, cp, cp + option_len) < 0)
|
||||
@ -301,8 +291,8 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
}
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, " %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -316,7 +306,7 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
uint16_t body_len;
|
||||
|
||||
if (cp + AHCP1_BODY_MIN_LEN > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Type */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
type = *cp;
|
||||
@ -337,7 +327,7 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
ND_PRINT((ndo, ", Length %u", body_len));
|
||||
}
|
||||
if (cp + body_len > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
|
||||
/* Options */
|
||||
if (ndo->ndo_vflag >= 2)
|
||||
@ -346,8 +336,8 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
|
||||
ND_TCHECK2(*cp, body_len);
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, " %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -362,11 +352,11 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
|
||||
|
||||
ND_PRINT((ndo, "AHCP"));
|
||||
if (len < 2)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Magic */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
if (*cp != AHCP_MAGIC_NUMBER)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
cp += 1;
|
||||
/* Version */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
@ -376,7 +366,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
|
||||
case AHCP_VERSION_1: {
|
||||
ND_PRINT((ndo, " Version 1"));
|
||||
if (len < AHCP1_HEADER_FIX_LEN)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
if (!ndo->ndo_vflag) {
|
||||
ND_TCHECK2(*cp, AHCP1_HEADER_FIX_LEN - 2);
|
||||
cp += AHCP1_HEADER_FIX_LEN - 2;
|
||||
@ -412,8 +402,8 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
|
||||
}
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, " %s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
|
@ -30,16 +30,17 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Ad hoc On-Demand Distance Vector (AODV) Routing printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "extract.h"
|
||||
|
||||
|
||||
struct aodv_rreq {
|
||||
@ -53,7 +54,6 @@ struct aodv_rreq {
|
||||
uint32_t rreq_oa; /* originator IPv4 address */
|
||||
uint32_t rreq_os; /* originator sequence number */
|
||||
};
|
||||
#ifdef INET6
|
||||
struct aodv_rreq6 {
|
||||
uint8_t rreq_type; /* AODV message type (1) */
|
||||
uint8_t rreq_flags; /* various flags */
|
||||
@ -76,7 +76,6 @@ struct aodv_rreq6_draft_01 {
|
||||
struct in6_addr rreq_da; /* destination IPv6 address */
|
||||
struct in6_addr rreq_oa; /* originator IPv6 address */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define RREQ_JOIN 0x80 /* join (reserved for multicast */
|
||||
#define RREQ_REPAIR 0x40 /* repair (reserved for multicast */
|
||||
@ -95,7 +94,6 @@ struct aodv_rrep {
|
||||
uint32_t rrep_oa; /* originator IPv4 address */
|
||||
uint32_t rrep_life; /* lifetime of this route */
|
||||
};
|
||||
#ifdef INET6
|
||||
struct aodv_rrep6 {
|
||||
uint8_t rrep_type; /* AODV message type (2) */
|
||||
uint8_t rrep_flags; /* various flags */
|
||||
@ -116,7 +114,6 @@ struct aodv_rrep6_draft_01 {
|
||||
struct in6_addr rrep_oa; /* originator IPv6 address */
|
||||
uint32_t rrep_life; /* lifetime of this route */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define RREP_REPAIR 0x80 /* repair (reserved for multicast */
|
||||
#define RREP_ACK 0x40 /* acknowledgement required */
|
||||
@ -127,7 +124,6 @@ struct rerr_unreach {
|
||||
uint32_t u_da; /* IPv4 address */
|
||||
uint32_t u_ds; /* sequence number */
|
||||
};
|
||||
#ifdef INET6
|
||||
struct rerr_unreach6 {
|
||||
struct in6_addr u_da; /* IPv6 address */
|
||||
uint32_t u_ds; /* sequence number */
|
||||
@ -136,7 +132,6 @@ struct rerr_unreach6_draft_01 {
|
||||
struct in6_addr u_da; /* IPv6 address */
|
||||
uint32_t u_ds; /* sequence number */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct aodv_rerr {
|
||||
uint8_t rerr_type; /* AODV message type (3 or 18) */
|
||||
@ -275,7 +270,7 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
|
||||
ap->rerr_flags & RERR_NODELETE ? "[D]" : "",
|
||||
ap->rerr_dc, length));
|
||||
dp = (struct rerr_unreach *)(dat + sizeof(*ap));
|
||||
dp = (const struct rerr_unreach *)(dat + sizeof(*ap));
|
||||
i = length - sizeof(*ap);
|
||||
for (dc = ap->rerr_dc; dc != 0; dc--) {
|
||||
ND_TCHECK(*dp);
|
||||
@ -293,13 +288,8 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_rreq(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_rreq(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
const struct aodv_rreq6 *ap = (const struct aodv_rreq6 *)dat;
|
||||
|
||||
@ -326,19 +316,11 @@ aodv_v6_rreq(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, " [|rreq"));
|
||||
#else
|
||||
ND_PRINT((ndo, " v6 rreq %u", length));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_rrep(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_rrep(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
const struct aodv_rrep6 *ap = (const struct aodv_rrep6 *)dat;
|
||||
|
||||
@ -362,19 +344,11 @@ aodv_v6_rrep(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, " [|rreq"));
|
||||
#else
|
||||
ND_PRINT((ndo, " rrep %u", length));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i, dc;
|
||||
const struct aodv_rerr *ap = (const struct aodv_rerr *)dat;
|
||||
const struct rerr_unreach6 *dp6;
|
||||
@ -385,7 +359,7 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
|
||||
ap->rerr_flags & RERR_NODELETE ? "[D]" : "",
|
||||
ap->rerr_dc, length));
|
||||
dp6 = (struct rerr_unreach6 *)(void *)(ap + 1);
|
||||
dp6 = (const struct rerr_unreach6 *)(const void *)(ap + 1);
|
||||
i = length - sizeof(*ap);
|
||||
for (dc = ap->rerr_dc; dc != 0; dc--) {
|
||||
ND_TCHECK(*dp6);
|
||||
@ -400,19 +374,11 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, "[|rerr]"));
|
||||
#else
|
||||
ND_PRINT((ndo, " rerr %u", length));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
const struct aodv_rreq6_draft_01 *ap = (const struct aodv_rreq6_draft_01 *)dat;
|
||||
|
||||
@ -439,19 +405,11 @@ aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat _U_, u_int leng
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, " [|rreq"));
|
||||
#else
|
||||
ND_PRINT((ndo, " rreq %u", length));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
const struct aodv_rrep6_draft_01 *ap = (const struct aodv_rrep6_draft_01 *)dat;
|
||||
|
||||
@ -475,19 +433,11 @@ aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat _U_, u_int leng
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, " [|rreq"));
|
||||
#else
|
||||
ND_PRINT((ndo, " rrep %u", length));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i, dc;
|
||||
const struct aodv_rerr *ap = (const struct aodv_rerr *)dat;
|
||||
const struct rerr_unreach6_draft_01 *dp6;
|
||||
@ -498,7 +448,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int leng
|
||||
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
|
||||
ap->rerr_flags & RERR_NODELETE ? "[D]" : "",
|
||||
ap->rerr_dc, length));
|
||||
dp6 = (struct rerr_unreach6_draft_01 *)(void *)(ap + 1);
|
||||
dp6 = (const struct rerr_unreach6_draft_01 *)(const void *)(ap + 1);
|
||||
i = length - sizeof(*ap);
|
||||
for (dc = ap->rerr_dc; dc != 0; dc--) {
|
||||
ND_TCHECK(*dp6);
|
||||
@ -513,9 +463,6 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int leng
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, "[|rerr]"));
|
||||
#else
|
||||
ND_PRINT((ndo, " rerr %u", length));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,8 +1,4 @@
|
||||
/*
|
||||
* This module implements decoding of the ATA over Ethernet (AoE) protocol
|
||||
* according to the following specification:
|
||||
* http://support.coraid.com/documents/AoEr11.txt
|
||||
*
|
||||
* Copyright (c) 2014 The TCPDUMP project
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,20 +25,22 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: ATA over Ethernet (AoE) protocol printer */
|
||||
|
||||
/* specification: http://brantleycoilecompany.com/AoEr11.pdf */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ether.h"
|
||||
|
||||
static const char tstr[] = " [|aoe]";
|
||||
static const char cstr[] = " (corrupt)";
|
||||
|
||||
#define AOE_V1 1
|
||||
#define ATA_SECTOR_SIZE 512
|
||||
@ -148,7 +146,7 @@ aoev1_issue_print(netdissect_options *ndo,
|
||||
const u_char *ep = cp + len;
|
||||
|
||||
if (len < AOEV1_ISSUE_ARG_LEN)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* AFlags */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", *cp)));
|
||||
@ -197,8 +195,8 @@ aoev1_issue_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "\n\tData: %u bytes", len - AOEV1_ISSUE_ARG_LEN));
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, "%s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -213,7 +211,7 @@ aoev1_query_print(netdissect_options *ndo,
|
||||
uint16_t cslen;
|
||||
|
||||
if (len < AOEV1_QUERY_ARG_LEN)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Buffer Count */
|
||||
ND_TCHECK2(*cp, 2);
|
||||
ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_16BITS(cp)));
|
||||
@ -236,7 +234,7 @@ aoev1_query_print(netdissect_options *ndo,
|
||||
cslen = EXTRACT_16BITS(cp);
|
||||
cp += 2;
|
||||
if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Config String */
|
||||
ND_TCHECK2(*cp, cslen);
|
||||
if (cslen) {
|
||||
@ -246,8 +244,8 @@ aoev1_query_print(netdissect_options *ndo,
|
||||
}
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, "%s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -262,7 +260,7 @@ aoev1_mac_print(netdissect_options *ndo,
|
||||
uint8_t dircount, i;
|
||||
|
||||
if (len < AOEV1_MAC_ARG_LEN)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Reserved */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
cp += 1;
|
||||
@ -280,7 +278,7 @@ aoev1_mac_print(netdissect_options *ndo,
|
||||
cp += 1;
|
||||
ND_PRINT((ndo, ", Dir Count: %u", dircount));
|
||||
if (AOEV1_MAC_ARG_LEN + dircount * 8 > len)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* directives */
|
||||
for (i = 0; i < dircount; i++) {
|
||||
/* Reserved */
|
||||
@ -297,8 +295,8 @@ aoev1_mac_print(netdissect_options *ndo,
|
||||
}
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, "%s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -313,7 +311,7 @@ aoev1_reserve_print(netdissect_options *ndo,
|
||||
uint8_t nmacs, i;
|
||||
|
||||
if (len < AOEV1_RESERVE_ARG_LEN || (len - AOEV1_RESERVE_ARG_LEN) % ETHER_ADDR_LEN)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* RCmd */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
ND_PRINT((ndo, "\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", *cp)));
|
||||
@ -324,7 +322,7 @@ aoev1_reserve_print(netdissect_options *ndo,
|
||||
cp += 1;
|
||||
ND_PRINT((ndo, ", NMacs: %u", nmacs));
|
||||
if (AOEV1_RESERVE_ARG_LEN + nmacs * ETHER_ADDR_LEN != len)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* addresses */
|
||||
for (i = 0; i < nmacs; i++) {
|
||||
ND_PRINT((ndo, "\n\tEthernet Address %u: %s", i, etheraddr_string(ndo, cp)));
|
||||
@ -332,8 +330,8 @@ aoev1_reserve_print(netdissect_options *ndo,
|
||||
}
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, "%s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -350,7 +348,7 @@ aoev1_print(netdissect_options *ndo,
|
||||
void (*cmd_decoder)(netdissect_options *, const u_char *, const u_int);
|
||||
|
||||
if (len < AOEV1_COMMON_HDR_LEN)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Flags */
|
||||
flags = *cp & 0x0F;
|
||||
ND_PRINT((ndo, ", Flags: [%s]", bittok2str(aoev1_flag_str, "none", flags)));
|
||||
@ -390,8 +388,8 @@ aoev1_print(netdissect_options *ndo,
|
||||
cmd_decoder(ndo, cp, len - AOEV1_COMMON_HDR_LEN);
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, "%s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
@ -408,7 +406,7 @@ aoe_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "AoE length %u", len));
|
||||
|
||||
if (len < 1)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
/* Ver/Flags */
|
||||
ND_TCHECK2(*cp, 1);
|
||||
ver = (*cp & 0xF0) >> 4;
|
||||
@ -422,8 +420,8 @@ aoe_print(netdissect_options *ndo,
|
||||
}
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, "%s", cstr));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
ND_TCHECK2(*cp, ep - cp);
|
||||
return;
|
||||
trunc:
|
||||
|
@ -19,14 +19,15 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Apple IP-over-IEEE 1394 printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
@ -48,6 +49,12 @@ struct firewire_header {
|
||||
*/
|
||||
#define FIREWIRE_HDRLEN 18
|
||||
|
||||
static const char *
|
||||
fwaddr_string(netdissect_options *ndo, const u_char *addr)
|
||||
{
|
||||
return (linkaddr_string(ndo, addr, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN));
|
||||
}
|
||||
|
||||
static inline void
|
||||
ap1394_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int length)
|
||||
{
|
||||
@ -57,8 +64,8 @@ ap1394_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int lengt
|
||||
fp = (const struct firewire_header *)bp;
|
||||
|
||||
ND_PRINT((ndo, "%s > %s",
|
||||
linkaddr_string(ndo, fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN),
|
||||
linkaddr_string(ndo, fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN)));
|
||||
fwaddr_string(ndo, fp->firewire_shost),
|
||||
fwaddr_string(ndo, fp->firewire_dhost)));
|
||||
|
||||
firewire_type = EXTRACT_16BITS(&fp->firewire_type);
|
||||
if (!ndo->ndo_qflag) {
|
||||
@ -83,8 +90,9 @@ ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
|
||||
{
|
||||
u_int length = h->len;
|
||||
u_int caplen = h->caplen;
|
||||
struct firewire_header *fp;
|
||||
const struct firewire_header *fp;
|
||||
u_short ether_type;
|
||||
struct lladdr_info src, dst;
|
||||
|
||||
if (caplen < FIREWIRE_HDRLEN) {
|
||||
ND_PRINT((ndo, "[|ap1394]"));
|
||||
@ -96,14 +104,18 @@ ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
|
||||
|
||||
length -= FIREWIRE_HDRLEN;
|
||||
caplen -= FIREWIRE_HDRLEN;
|
||||
fp = (struct firewire_header *)p;
|
||||
fp = (const struct firewire_header *)p;
|
||||
p += FIREWIRE_HDRLEN;
|
||||
|
||||
ether_type = EXTRACT_16BITS(&fp->firewire_type);
|
||||
if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
|
||||
src.addr = fp->firewire_shost;
|
||||
src.addr_string = fwaddr_string;
|
||||
dst.addr = fp->firewire_dhost;
|
||||
dst.addr_string = fwaddr_string;
|
||||
if (ethertype_print(ndo, ether_type, p, length, caplen, &src, &dst) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!ndo->ndo_eflag)
|
||||
ap1394_hdr_print(ndo, (u_char *)fp, length + FIREWIRE_HDRLEN);
|
||||
ap1394_hdr_print(ndo, (const u_char *)fp, length + FIREWIRE_HDRLEN);
|
||||
|
||||
if (!ndo->ndo_suppress_default_print)
|
||||
ND_DEFAULTPRINT(p, caplen);
|
||||
|
@ -21,14 +21,15 @@
|
||||
* From: NetBSD: print-arcnet.c,v 1.2 2000/04/24 13:02:28 itojun Exp
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Attached Resource Computer NETwork (ARCNET) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
|
||||
/*
|
||||
|
@ -17,24 +17,23 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Address Resolution Protocol (ARP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ether.h"
|
||||
#include "ethertype.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "extract.h"
|
||||
|
||||
static const char tstr[] = "[|ARP]";
|
||||
|
||||
@ -178,7 +177,17 @@ struct atmarp_pkthdr {
|
||||
#define ATMTSA(ap) (aar_tsa(ap))
|
||||
#define ATMTPA(ap) (aar_tpa(ap))
|
||||
|
||||
static u_char ezero[6];
|
||||
static int
|
||||
isnonzero(const u_char *a, size_t len)
|
||||
{
|
||||
while (len > 0) {
|
||||
if (*a != 0)
|
||||
return (1);
|
||||
a++;
|
||||
len--;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
atmarp_addr_print(netdissect_options *ndo,
|
||||
@ -359,7 +368,7 @@ arp_print(netdissect_options *ndo,
|
||||
|
||||
case ARPOP_REQUEST:
|
||||
ND_PRINT((ndo, "who-has %s", ipaddr_string(ndo, TPA(ap))));
|
||||
if (memcmp((const char *)ezero, (const char *)THA(ap), HRD_LEN(ap)) != 0)
|
||||
if (isnonzero((const u_char *)THA(ap), HRD_LEN(ap)))
|
||||
ND_PRINT((ndo, " (%s)",
|
||||
linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap))));
|
||||
ND_PRINT((ndo, " tell %s", ipaddr_string(ndo, SPA(ap))));
|
||||
|
@ -36,15 +36,16 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: ASCII packet dump printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
#define ASCII_LINELENGTH 300
|
||||
#define HEXDUMP_BYTES_PER_LINE 16
|
||||
|
@ -17,26 +17,23 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Format and print AppleTalk packets.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: AppleTalk printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "extract.h"
|
||||
#include "appletalk.h"
|
||||
|
||||
static const char tstr[] = "[|atalk]";
|
||||
@ -80,7 +77,14 @@ u_int
|
||||
ltalk_if_print(netdissect_options *ndo,
|
||||
const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
return (llap_print(ndo, p, h->caplen));
|
||||
u_int hdrlen;
|
||||
|
||||
hdrlen = llap_print(ndo, p, h->len);
|
||||
if (hdrlen == 0) {
|
||||
/* Cut short by the snapshot length. */
|
||||
return (h->caplen);
|
||||
}
|
||||
return (hdrlen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -100,6 +104,10 @@ llap_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " [|llap %u]", length));
|
||||
return (length);
|
||||
}
|
||||
if (!ND_TTEST2(*bp, sizeof(*lp))) {
|
||||
ND_PRINT((ndo, " [|llap]"));
|
||||
return (0); /* cut short by the snapshot length */
|
||||
}
|
||||
lp = (const struct LAP *)bp;
|
||||
bp += sizeof(*lp);
|
||||
length -= sizeof(*lp);
|
||||
@ -111,6 +119,10 @@ llap_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " [|sddp %u]", length));
|
||||
return (length);
|
||||
}
|
||||
if (!ND_TTEST2(*bp, ddpSSize)) {
|
||||
ND_PRINT((ndo, " [|sddp]"));
|
||||
return (0); /* cut short by the snapshot length */
|
||||
}
|
||||
sdp = (const struct atShortDDP *)bp;
|
||||
ND_PRINT((ndo, "%s.%s",
|
||||
ataddr_string(ndo, 0, lp->src), ddpskt_string(ndo, sdp->srcSkt)));
|
||||
@ -127,6 +139,10 @@ llap_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " [|ddp %u]", length));
|
||||
return (length);
|
||||
}
|
||||
if (!ND_TTEST2(*bp, ddpSize)) {
|
||||
ND_PRINT((ndo, " [|ddp]"));
|
||||
return (0); /* cut short by the snapshot length */
|
||||
}
|
||||
dp = (const struct atDDP *)bp;
|
||||
snet = EXTRACT_16BITS(&dp->srcNet);
|
||||
ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode),
|
||||
@ -173,6 +189,10 @@ atalk_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " [|ddp %u]", length));
|
||||
return;
|
||||
}
|
||||
if (!ND_TTEST2(*bp, ddpSize)) {
|
||||
ND_PRINT((ndo, " [|ddp]"));
|
||||
return;
|
||||
}
|
||||
dp = (const struct atDDP *)bp;
|
||||
snet = EXTRACT_16BITS(&dp->srcNet);
|
||||
ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode),
|
||||
@ -196,6 +216,15 @@ aarp_print(netdissect_options *ndo,
|
||||
|
||||
ND_PRINT((ndo, "aarp "));
|
||||
ap = (const struct aarp *)bp;
|
||||
if (!ND_TTEST(*ap)) {
|
||||
/* Just bail if we don't have the whole chunk. */
|
||||
ND_PRINT((ndo, " [|aarp]"));
|
||||
return;
|
||||
}
|
||||
if (length < sizeof(*ap)) {
|
||||
ND_PRINT((ndo, " [|aarp %u]", length));
|
||||
return;
|
||||
}
|
||||
if (EXTRACT_16BITS(&ap->htype) == 1 &&
|
||||
EXTRACT_16BITS(&ap->ptype) == ETHERTYPE_ATALK &&
|
||||
ap->halen == 6 && ap->palen == 4 )
|
||||
@ -382,7 +411,7 @@ nbp_print(netdissect_options *ndo,
|
||||
register u_char snode, register u_char skt)
|
||||
{
|
||||
register const struct atNBPtuple *tp =
|
||||
(const struct atNBPtuple *)((u_char *)np + nbpHeaderSize);
|
||||
(const struct atNBPtuple *)((const u_char *)np + nbpHeaderSize);
|
||||
int i;
|
||||
const u_char *ep;
|
||||
|
||||
@ -569,8 +598,11 @@ ataddr_string(netdissect_options *ndo,
|
||||
tp->nxt; tp = tp->nxt)
|
||||
;
|
||||
tp->addr = i2;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
tp->name = strdup(nambuf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"ataddr_string: strdup(nambuf)");
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
@ -584,20 +616,25 @@ ataddr_string(netdissect_options *ndo,
|
||||
for (tp2 = &hnametable[i & (HASHNAMESIZE-1)]; tp2->nxt; tp2 = tp2->nxt)
|
||||
if (tp2->addr == i) {
|
||||
tp->addr = (atnet << 8) | athost;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
(void)snprintf(nambuf, sizeof(nambuf), "%s.%d",
|
||||
tp2->name, athost);
|
||||
tp->name = strdup(nambuf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo,
|
||||
"ataddr_string: strdup(nambuf)");
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
tp->addr = (atnet << 8) | athost;
|
||||
tp->nxt = newhnamemem();
|
||||
tp->nxt = newhnamemem(ndo);
|
||||
if (athost != 255)
|
||||
(void)snprintf(nambuf, sizeof(nambuf), "%d.%d", atnet, athost);
|
||||
else
|
||||
(void)snprintf(nambuf, sizeof(nambuf), "%d", atnet);
|
||||
tp->name = strdup(nambuf);
|
||||
if (tp->name == NULL)
|
||||
(*ndo->ndo_error)(ndo, "ataddr_string: strdup(nambuf)");
|
||||
|
||||
return (tp->name);
|
||||
}
|
||||
|
@ -17,24 +17,112 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Asynchronous Transfer Mode (ATM) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "atm.h"
|
||||
#include "atmuni31.h"
|
||||
#include "llc.h"
|
||||
|
||||
/* start of the original atmuni31.h */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Yen Yen Lim and North Dakota State University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Yen Yen Lim and
|
||||
North Dakota State University
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Based on UNI3.1 standard by ATM Forum */
|
||||
|
||||
/* ATM traffic types based on VPI=0 and (the following VCI */
|
||||
#define VCI_PPC 0x05 /* Point-to-point signal msg */
|
||||
#define VCI_BCC 0x02 /* Broadcast signal msg */
|
||||
#define VCI_OAMF4SC 0x03 /* Segment OAM F4 flow cell */
|
||||
#define VCI_OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
|
||||
#define VCI_METAC 0x01 /* Meta signal msg */
|
||||
#define VCI_ILMIC 0x10 /* ILMI msg */
|
||||
|
||||
/* Q.2931 signalling messages */
|
||||
#define CALL_PROCEED 0x02 /* call proceeding */
|
||||
#define CONNECT 0x07 /* connect */
|
||||
#define CONNECT_ACK 0x0f /* connect_ack */
|
||||
#define SETUP 0x05 /* setup */
|
||||
#define RELEASE 0x4d /* release */
|
||||
#define RELEASE_DONE 0x5a /* release_done */
|
||||
#define RESTART 0x46 /* restart */
|
||||
#define RESTART_ACK 0x4e /* restart ack */
|
||||
#define STATUS 0x7d /* status */
|
||||
#define STATUS_ENQ 0x75 /* status ack */
|
||||
#define ADD_PARTY 0x80 /* add party */
|
||||
#define ADD_PARTY_ACK 0x81 /* add party ack */
|
||||
#define ADD_PARTY_REJ 0x82 /* add party rej */
|
||||
#define DROP_PARTY 0x83 /* drop party */
|
||||
#define DROP_PARTY_ACK 0x84 /* drop party ack */
|
||||
|
||||
/* Information Element Parameters in the signalling messages */
|
||||
#define CAUSE 0x08 /* cause */
|
||||
#define ENDPT_REF 0x54 /* endpoint reference */
|
||||
#define AAL_PARA 0x58 /* ATM adaptation layer parameters */
|
||||
#define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
|
||||
#define CONNECT_ID 0x5a /* connection identifier */
|
||||
#define QOS_PARA 0x5c /* quality of service parameters */
|
||||
#define B_HIGHER 0x5d /* broadband higher layer information */
|
||||
#define B_BEARER 0x5e /* broadband bearer capability */
|
||||
#define B_LOWER 0x5f /* broadband lower information */
|
||||
#define CALLING_PARTY 0x6c /* calling party number */
|
||||
#define CALLED_PARTY 0x70 /* called party nmber */
|
||||
|
||||
#define Q2931 0x09
|
||||
|
||||
/* Q.2931 signalling general messages format */
|
||||
#define PROTO_POS 0 /* offset of protocol discriminator */
|
||||
#define CALL_REF_POS 2 /* offset of call reference value */
|
||||
#define MSG_TYPE_POS 5 /* offset of message type */
|
||||
#define MSG_LEN_POS 7 /* offset of mesage length */
|
||||
#define IE_BEGIN_POS 9 /* offset of first information element */
|
||||
|
||||
/* format of signalling messages */
|
||||
#define TYPE_POS 0
|
||||
#define LEN_POS 2
|
||||
#define FIELD_BEGIN_POS 4
|
||||
|
||||
/* end of the original atmuni31.h */
|
||||
|
||||
static const char tstr[] = "[|atm]";
|
||||
|
||||
#define OAM_CRC10_MASK 0x3ff
|
||||
@ -128,22 +216,20 @@ static const struct tok *oam_functype_values[16] = {
|
||||
/*
|
||||
* Print an RFC 1483 LLC-encapsulated ATM frame.
|
||||
*/
|
||||
static void
|
||||
static u_int
|
||||
atm_llc_print(netdissect_options *ndo,
|
||||
const u_char *p, int length, int caplen)
|
||||
{
|
||||
u_short extracted_ethertype;
|
||||
int llc_hdrlen;
|
||||
|
||||
if (!llc_print(ndo, p, length, caplen, NULL, NULL,
|
||||
&extracted_ethertype)) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (extracted_ethertype) {
|
||||
ND_PRINT((ndo, "(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype))));
|
||||
}
|
||||
llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
|
||||
if (llc_hdrlen < 0) {
|
||||
/* packet not known, print raw packet */
|
||||
if (!ndo->ndo_suppress_default_print)
|
||||
ND_DEFAULTPRINT(p, caplen);
|
||||
llc_hdrlen = -llc_hdrlen;
|
||||
}
|
||||
return (llc_hdrlen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -231,7 +317,7 @@ atm_if_print(netdissect_options *ndo,
|
||||
caplen -= 20;
|
||||
hdrlen += 20;
|
||||
}
|
||||
atm_llc_print(ndo, p, length, caplen);
|
||||
hdrlen += atm_llc_print(ndo, p, length, caplen);
|
||||
return (hdrlen);
|
||||
}
|
||||
|
||||
@ -259,24 +345,18 @@ static const struct tok msgtype2str[] = {
|
||||
|
||||
static void
|
||||
sig_print(netdissect_options *ndo,
|
||||
const u_char *p, int caplen)
|
||||
const u_char *p)
|
||||
{
|
||||
uint32_t call_ref;
|
||||
|
||||
if (caplen < PROTO_POS) {
|
||||
ND_PRINT((ndo, "%s", tstr));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK(p[PROTO_POS]);
|
||||
if (p[PROTO_POS] == Q2931) {
|
||||
/*
|
||||
* protocol:Q.2931 for User to Network Interface
|
||||
* (UNI 3.1) signalling
|
||||
*/
|
||||
ND_PRINT((ndo, "Q.2931"));
|
||||
if (caplen < MSG_TYPE_POS) {
|
||||
ND_PRINT((ndo, " %s", tstr));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK(p[MSG_TYPE_POS]);
|
||||
ND_PRINT((ndo, ":%s ",
|
||||
tok2str(msgtype2str, "msgtype#%d", p[MSG_TYPE_POS])));
|
||||
|
||||
@ -292,6 +372,10 @@ sig_print(netdissect_options *ndo,
|
||||
/* SCCOP with some unknown protocol atop it */
|
||||
ND_PRINT((ndo, "SSCOP, proto %d ", p[PROTO_POS]));
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, " %s", tstr));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -309,7 +393,7 @@ atm_print(netdissect_options *ndo,
|
||||
switch (vci) {
|
||||
|
||||
case VCI_PPC:
|
||||
sig_print(ndo, p, caplen);
|
||||
sig_print(ndo, p);
|
||||
return;
|
||||
|
||||
case VCI_BCC:
|
||||
@ -362,7 +446,7 @@ struct oam_fm_ais_rdi_t {
|
||||
uint8_t unused[28];
|
||||
};
|
||||
|
||||
int
|
||||
void
|
||||
oam_print (netdissect_options *ndo,
|
||||
const u_char *p, u_int length, u_int hec)
|
||||
{
|
||||
@ -376,6 +460,7 @@ oam_print (netdissect_options *ndo,
|
||||
} oam_ptr;
|
||||
|
||||
|
||||
ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec));
|
||||
cell_header = EXTRACT_32BITS(p+hec);
|
||||
cell_type = ((*(p+ATM_HDR_LEN_NOHEC+hec))>>4) & 0x0f;
|
||||
func_type = (*(p+ATM_HDR_LEN_NOHEC+hec)) & 0x0f;
|
||||
@ -392,7 +477,7 @@ oam_print (netdissect_options *ndo,
|
||||
clp, length));
|
||||
|
||||
if (!ndo->ndo_vflag) {
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
ND_PRINT((ndo, "\n\tcell-type %s (%u)",
|
||||
@ -411,6 +496,7 @@ oam_print (netdissect_options *ndo,
|
||||
switch (cell_type << 4 | func_type) {
|
||||
case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_LOOPBACK):
|
||||
oam_ptr.oam_fm_loopback = (const struct oam_fm_loopback_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
|
||||
ND_TCHECK(*oam_ptr.oam_fm_loopback);
|
||||
ND_PRINT((ndo, "\n\tLoopback-Indicator %s, Correlation-Tag 0x%08x",
|
||||
tok2str(oam_fm_loopback_indicator_values,
|
||||
"Unknown",
|
||||
@ -433,6 +519,7 @@ oam_print (netdissect_options *ndo,
|
||||
case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_AIS):
|
||||
case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_RDI):
|
||||
oam_ptr.oam_fm_ais_rdi = (const struct oam_fm_ais_rdi_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
|
||||
ND_TCHECK(*oam_ptr.oam_fm_ais_rdi);
|
||||
ND_PRINT((ndo, "\n\tFailure-type 0x%02x", oam_ptr.oam_fm_ais_rdi->failure_type));
|
||||
ND_PRINT((ndo, "\n\tLocation-ID "));
|
||||
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
|
||||
@ -451,6 +538,7 @@ oam_print (netdissect_options *ndo,
|
||||
}
|
||||
|
||||
/* crc10 checksum verification */
|
||||
ND_TCHECK2(*(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN), 2);
|
||||
cksum = EXTRACT_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
|
||||
& OAM_CRC10_MASK;
|
||||
cksum_shouldbe = verify_crc10_cksum(0, p, OAM_PAYLOAD_LEN);
|
||||
@ -459,5 +547,9 @@ oam_print (netdissect_options *ndo,
|
||||
cksum,
|
||||
cksum_shouldbe == 0 ? "" : "in"));
|
||||
|
||||
return 1;
|
||||
return;
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, "[|oam]"));
|
||||
return;
|
||||
}
|
||||
|
@ -26,17 +26,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Babel Routing Protocol printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
@ -53,7 +54,7 @@ babel_print(netdissect_options *ndo,
|
||||
ND_TCHECK2(*cp, 4);
|
||||
|
||||
if(cp[0] != 42) {
|
||||
ND_PRINT((ndo, " malformed header"));
|
||||
ND_PRINT((ndo, " invalid header"));
|
||||
return;
|
||||
} else {
|
||||
ND_PRINT((ndo, " %d", cp[1]));
|
||||
@ -89,6 +90,9 @@ babel_print(netdissect_options *ndo,
|
||||
#define MESSAGE_MH_REQUEST 10
|
||||
#define MESSAGE_TSPC 11
|
||||
#define MESSAGE_HMAC 12
|
||||
#define MESSAGE_UPDATE_SRC_SPECIFIC 13
|
||||
#define MESSAGE_REQUEST_SRC_SPECIFIC 14
|
||||
#define MESSAGE_MH_REQUEST_SRC_SPECIFIC 15
|
||||
|
||||
/* sub-TLVs */
|
||||
#define MESSAGE_SUB_PAD1 0
|
||||
@ -123,11 +127,7 @@ format_prefix(netdissect_options *ndo, const u_char *prefix, unsigned char plen)
|
||||
if(plen >= 96 && memcmp(prefix, v4prefix, 12) == 0)
|
||||
snprintf(buf, 50, "%s/%u", ipaddr_string(ndo, prefix + 12), plen - 96);
|
||||
else
|
||||
#ifdef INET6
|
||||
snprintf(buf, 50, "%s/%u", ip6addr_string(ndo, prefix), plen);
|
||||
#else
|
||||
snprintf(buf, 50, "IPv6 addresses not supported");
|
||||
#endif
|
||||
buf[49] = '\0';
|
||||
return buf;
|
||||
}
|
||||
@ -138,11 +138,7 @@ format_address(netdissect_options *ndo, const u_char *prefix)
|
||||
if(memcmp(prefix, v4prefix, 12) == 0)
|
||||
return ipaddr_string(ndo, prefix + 12);
|
||||
else
|
||||
#ifdef INET6
|
||||
return ip6addr_string(ndo, prefix);
|
||||
#else
|
||||
return "IPv6 addresses not supported";
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *
|
||||
@ -284,10 +280,10 @@ subtlvs_print(netdissect_options *ndo,
|
||||
continue;
|
||||
}
|
||||
if(cp == ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
sublen = *cp++;
|
||||
if(cp + sublen > ep)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
|
||||
switch(subtype) {
|
||||
case MESSAGE_SUB_PADN:
|
||||
@ -305,19 +301,20 @@ subtlvs_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "%s%s", sep, tok2str(diversity_str, "%u", *cp++)));
|
||||
sep = "-";
|
||||
}
|
||||
if(tlv_type != MESSAGE_UPDATE)
|
||||
if(tlv_type != MESSAGE_UPDATE &&
|
||||
tlv_type != MESSAGE_UPDATE_SRC_SPECIFIC)
|
||||
ND_PRINT((ndo, " (bogus)"));
|
||||
break;
|
||||
case MESSAGE_SUB_TIMESTAMP:
|
||||
ND_PRINT((ndo, " sub-timestamp"));
|
||||
if(tlv_type == MESSAGE_HELLO) {
|
||||
if(sublen < 4)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
t1 = EXTRACT_32BITS(cp);
|
||||
ND_PRINT((ndo, " %s", format_timestamp(t1)));
|
||||
} else if(tlv_type == MESSAGE_IHU) {
|
||||
if(sublen < 8)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
t1 = EXTRACT_32BITS(cp);
|
||||
ND_PRINT((ndo, " %s", format_timestamp(t1)));
|
||||
t2 = EXTRACT_32BITS(cp + 4);
|
||||
@ -333,12 +330,12 @@ subtlvs_print(netdissect_options *ndo,
|
||||
} /* while */
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, " (corrupt)"));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
}
|
||||
|
||||
#define ICHECK(i, l) \
|
||||
if ((i) + (l) > bodylen || (i) + (l) > length) goto corrupt;
|
||||
if ((i) + (l) > bodylen || (i) + (l) > length) goto invalid;
|
||||
|
||||
static void
|
||||
babel_print_v2(netdissect_options *ndo,
|
||||
@ -352,7 +349,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
|
||||
ND_TCHECK2(*cp, 4);
|
||||
if (length < 4)
|
||||
goto corrupt;
|
||||
goto invalid;
|
||||
bodylen = EXTRACT_16BITS(cp + 2);
|
||||
ND_PRINT((ndo, " (%u)", bodylen));
|
||||
|
||||
@ -393,7 +390,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " ack-req"));
|
||||
else {
|
||||
ND_PRINT((ndo, "\n\tAcknowledgment Request "));
|
||||
if(len < 6) goto corrupt;
|
||||
if(len < 6) goto invalid;
|
||||
nonce = EXTRACT_16BITS(message + 4);
|
||||
interval = EXTRACT_16BITS(message + 6);
|
||||
ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval)));
|
||||
@ -407,7 +404,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " ack"));
|
||||
else {
|
||||
ND_PRINT((ndo, "\n\tAcknowledgment "));
|
||||
if(len < 2) goto corrupt;
|
||||
if(len < 2) goto invalid;
|
||||
nonce = EXTRACT_16BITS(message + 2);
|
||||
ND_PRINT((ndo, "%04x", nonce));
|
||||
}
|
||||
@ -420,7 +417,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " hello"));
|
||||
else {
|
||||
ND_PRINT((ndo, "\n\tHello "));
|
||||
if(len < 6) goto corrupt;
|
||||
if(len < 6) goto invalid;
|
||||
seqno = EXTRACT_16BITS(message + 4);
|
||||
interval = EXTRACT_16BITS(message + 6);
|
||||
ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval)));
|
||||
@ -439,7 +436,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
u_char address[16];
|
||||
int rc;
|
||||
ND_PRINT((ndo, "\n\tIHU "));
|
||||
if(len < 6) goto corrupt;
|
||||
if(len < 6) goto invalid;
|
||||
txcost = EXTRACT_16BITS(message + 4);
|
||||
interval = EXTRACT_16BITS(message + 6);
|
||||
rc = network_address(message[2], message + 8, len - 6, address);
|
||||
@ -459,7 +456,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " router-id"));
|
||||
else {
|
||||
ND_PRINT((ndo, "\n\tRouter Id"));
|
||||
if(len < 10) goto corrupt;
|
||||
if(len < 10) goto invalid;
|
||||
ND_PRINT((ndo, " %s", format_id(message + 4)));
|
||||
}
|
||||
}
|
||||
@ -472,9 +469,9 @@ babel_print_v2(netdissect_options *ndo,
|
||||
int rc;
|
||||
u_char nh[16];
|
||||
ND_PRINT((ndo, "\n\tNext Hop"));
|
||||
if(len < 2) goto corrupt;
|
||||
if(len < 2) goto invalid;
|
||||
rc = network_address(message[2], message + 4, len - 2, nh);
|
||||
if(rc < 0) goto corrupt;
|
||||
if(rc < 0) goto invalid;
|
||||
ND_PRINT((ndo, " %s", format_address(ndo, nh)));
|
||||
}
|
||||
}
|
||||
@ -496,13 +493,13 @@ babel_print_v2(netdissect_options *ndo,
|
||||
int rc;
|
||||
u_char prefix[16];
|
||||
ND_PRINT((ndo, "\n\tUpdate"));
|
||||
if(len < 10) goto corrupt;
|
||||
if(len < 10) goto invalid;
|
||||
plen = message[4] + (message[2] == 1 ? 96 : 0);
|
||||
rc = network_prefix(message[2], message[4], message[5],
|
||||
message + 12,
|
||||
message[2] == 1 ? v4_prefix : v6_prefix,
|
||||
len - 10, prefix);
|
||||
if(rc < 0) goto corrupt;
|
||||
if(rc < 0) goto invalid;
|
||||
interval = EXTRACT_16BITS(message + 6);
|
||||
seqno = EXTRACT_16BITS(message + 8);
|
||||
metric = EXTRACT_16BITS(message + 10);
|
||||
@ -532,11 +529,11 @@ babel_print_v2(netdissect_options *ndo,
|
||||
int rc;
|
||||
u_char prefix[16], plen;
|
||||
ND_PRINT((ndo, "\n\tRequest "));
|
||||
if(len < 2) goto corrupt;
|
||||
if(len < 2) goto invalid;
|
||||
plen = message[3] + (message[2] == 1 ? 96 : 0);
|
||||
rc = network_prefix(message[2], message[3], 0,
|
||||
message + 4, NULL, len - 2, prefix);
|
||||
if(rc < 0) goto corrupt;
|
||||
if(rc < 0) goto invalid;
|
||||
ND_PRINT((ndo, "for %s",
|
||||
message[2] == 0 ? "any" : format_prefix(ndo, prefix, plen)));
|
||||
}
|
||||
@ -551,11 +548,11 @@ babel_print_v2(netdissect_options *ndo,
|
||||
u_short seqno;
|
||||
u_char prefix[16], plen;
|
||||
ND_PRINT((ndo, "\n\tMH-Request "));
|
||||
if(len < 14) goto corrupt;
|
||||
if(len < 14) goto invalid;
|
||||
seqno = EXTRACT_16BITS(message + 4);
|
||||
rc = network_prefix(message[2], message[3], 0,
|
||||
message + 16, NULL, len - 14, prefix);
|
||||
if(rc < 0) goto corrupt;
|
||||
if(rc < 0) goto invalid;
|
||||
plen = message[3] + (message[2] == 1 ? 96 : 0);
|
||||
ND_PRINT((ndo, "(%u hops) for %s seqno %u id %s",
|
||||
message[6], format_prefix(ndo, prefix, plen),
|
||||
@ -568,7 +565,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " tspc"));
|
||||
else {
|
||||
ND_PRINT((ndo, "\n\tTS/PC "));
|
||||
if(len < 6) goto corrupt;
|
||||
if(len < 6) goto invalid;
|
||||
ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_32BITS (message + 4),
|
||||
EXTRACT_16BITS(message + 2)));
|
||||
}
|
||||
@ -579,13 +576,127 @@ babel_print_v2(netdissect_options *ndo,
|
||||
else {
|
||||
unsigned j;
|
||||
ND_PRINT((ndo, "\n\tHMAC "));
|
||||
if(len < 18) goto corrupt;
|
||||
if(len < 18) goto invalid;
|
||||
ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_16BITS(message + 2), len - 2));
|
||||
for (j = 0; j < len - 2; j++)
|
||||
ND_PRINT((ndo, "%02X", message[4 + j]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MESSAGE_UPDATE_SRC_SPECIFIC : {
|
||||
if(!ndo->ndo_vflag) {
|
||||
ND_PRINT((ndo, " ss-update"));
|
||||
} else {
|
||||
u_char prefix[16], src_prefix[16];
|
||||
u_short interval, seqno, metric;
|
||||
u_char ae, plen, src_plen, omitted;
|
||||
int rc;
|
||||
int parsed_len = 10;
|
||||
ND_PRINT((ndo, "\n\tSS-Update"));
|
||||
if(len < 10) goto invalid;
|
||||
ae = message[2];
|
||||
src_plen = message[3];
|
||||
plen = message[4];
|
||||
omitted = message[5];
|
||||
interval = EXTRACT_16BITS(message + 6);
|
||||
seqno = EXTRACT_16BITS(message + 8);
|
||||
metric = EXTRACT_16BITS(message + 10);
|
||||
rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len,
|
||||
ae == 1 ? v4_prefix : v6_prefix,
|
||||
len - parsed_len, prefix);
|
||||
if(rc < 0) goto invalid;
|
||||
if(ae == 1)
|
||||
plen += 96;
|
||||
parsed_len += rc;
|
||||
rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len,
|
||||
NULL, len - parsed_len, src_prefix);
|
||||
if(rc < 0) goto invalid;
|
||||
if(ae == 1)
|
||||
src_plen += 96;
|
||||
parsed_len += rc;
|
||||
|
||||
ND_PRINT((ndo, " %s from", format_prefix(ndo, prefix, plen)));
|
||||
ND_PRINT((ndo, " %s metric %u seqno %u interval %s",
|
||||
format_prefix(ndo, src_prefix, src_plen),
|
||||
metric, seqno, format_interval_update(interval)));
|
||||
/* extra data? */
|
||||
if((u_int)parsed_len < len)
|
||||
subtlvs_print(ndo, message + 2 + parsed_len,
|
||||
message + 2 + len, type);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MESSAGE_REQUEST_SRC_SPECIFIC : {
|
||||
if(!ndo->ndo_vflag)
|
||||
ND_PRINT((ndo, " ss-request"));
|
||||
else {
|
||||
int rc, parsed_len = 3;
|
||||
u_char ae, plen, src_plen, prefix[16], src_prefix[16];
|
||||
ND_PRINT((ndo, "\n\tSS-Request "));
|
||||
if(len < 3) goto invalid;
|
||||
ae = message[2];
|
||||
plen = message[3];
|
||||
src_plen = message[4];
|
||||
rc = network_prefix(ae, plen, 0, message + 2 + parsed_len,
|
||||
NULL, len - parsed_len, prefix);
|
||||
if(rc < 0) goto invalid;
|
||||
if(ae == 1)
|
||||
plen += 96;
|
||||
parsed_len += rc;
|
||||
rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len,
|
||||
NULL, len - parsed_len, src_prefix);
|
||||
if(rc < 0) goto invalid;
|
||||
if(ae == 1)
|
||||
src_plen += 96;
|
||||
parsed_len += rc;
|
||||
if(ae == 0) {
|
||||
ND_PRINT((ndo, "for any"));
|
||||
} else {
|
||||
ND_PRINT((ndo, "for (%s, ", format_prefix(ndo, prefix, plen)));
|
||||
ND_PRINT((ndo, "%s)", format_prefix(ndo, src_prefix, src_plen)));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MESSAGE_MH_REQUEST_SRC_SPECIFIC : {
|
||||
if(!ndo->ndo_vflag)
|
||||
ND_PRINT((ndo, " ss-mh-request"));
|
||||
else {
|
||||
int rc, parsed_len = 14;
|
||||
u_short seqno;
|
||||
u_char ae, plen, src_plen, prefix[16], src_prefix[16], hopc;
|
||||
const u_char *router_id = NULL;
|
||||
ND_PRINT((ndo, "\n\tSS-MH-Request "));
|
||||
if(len < 14) goto invalid;
|
||||
ae = message[2];
|
||||
plen = message[3];
|
||||
seqno = EXTRACT_16BITS(message + 4);
|
||||
hopc = message[6];
|
||||
src_plen = message[7];
|
||||
router_id = message + 8;
|
||||
rc = network_prefix(ae, plen, 0, message + 2 + parsed_len,
|
||||
NULL, len - parsed_len, prefix);
|
||||
if(rc < 0) goto invalid;
|
||||
if(ae == 1)
|
||||
plen += 96;
|
||||
parsed_len += rc;
|
||||
rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len,
|
||||
NULL, len - parsed_len, src_prefix);
|
||||
if(rc < 0) goto invalid;
|
||||
if(ae == 1)
|
||||
src_plen += 96;
|
||||
ND_PRINT((ndo, "(%u hops) for (%s, ",
|
||||
hopc, format_prefix(ndo, prefix, plen)));
|
||||
ND_PRINT((ndo, "%s) seqno %u id %s",
|
||||
format_prefix(ndo, src_prefix, src_plen),
|
||||
seqno, format_id(router_id)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!ndo->ndo_vflag)
|
||||
ND_PRINT((ndo, " unknown"));
|
||||
@ -600,7 +711,7 @@ babel_print_v2(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " %s", tstr));
|
||||
return;
|
||||
|
||||
corrupt:
|
||||
ND_PRINT((ndo, " (corrupt)"));
|
||||
invalid:
|
||||
ND_PRINT((ndo, "%s", istr));
|
||||
return;
|
||||
}
|
||||
|
@ -2,23 +2,24 @@
|
||||
* Copyright (C) 2000, Richard Sharpe
|
||||
*
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style licence that accompanies tcpdump or under the GNU GPL
|
||||
* BSD-style license that accompanies tcpdump or under the GNU GPL
|
||||
* version 2 or later.
|
||||
*
|
||||
* print-beep.c
|
||||
*
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Blocks Extensible Exchange Protocol (BEEP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
|
||||
/* Check for a string but not go beyond length
|
||||
* Return TRUE on match, FALSE otherwise
|
||||
|
@ -13,14 +13,17 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Bidirectional Forwarding Detection (BFD) printer */
|
||||
|
||||
/* specification: RFC 5880 (for version 1) and RFC 5881 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "udp.h"
|
||||
@ -46,12 +49,12 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Control packet, BFDv1, draft-ietf-bfd-base-02.txt
|
||||
* Control packet, BFDv1, RFC 5880
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* |Vers | Diag |Sta|P|F|C|A|D|R| Detect Mult | Length |
|
||||
* |Vers | Diag |Sta|P|F|C|A|D|M| Detect Mult | Length |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | My Discriminator |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
@ -91,20 +94,37 @@ struct bfd_auth_header_t {
|
||||
uint8_t auth_type;
|
||||
uint8_t auth_len;
|
||||
uint8_t auth_data;
|
||||
uint8_t dummy; /* minimun 4 bytes */
|
||||
};
|
||||
|
||||
enum auth_type {
|
||||
AUTH_PASSWORD = 1,
|
||||
AUTH_MD5 = 2,
|
||||
AUTH_MET_MD5 = 3,
|
||||
AUTH_SHA1 = 4,
|
||||
AUTH_MET_SHA1 = 5
|
||||
};
|
||||
|
||||
static const struct tok bfd_v1_authentication_values[] = {
|
||||
{ 0, "Reserved" },
|
||||
{ 1, "Simple Password" },
|
||||
{ 2, "Keyed MD5" },
|
||||
{ 3, "Meticulous Keyed MD5" },
|
||||
{ 4, "Keyed SHA1" },
|
||||
{ 5, "Meticulous Keyed SHA1" },
|
||||
{ AUTH_PASSWORD, "Simple Password" },
|
||||
{ AUTH_MD5, "Keyed MD5" },
|
||||
{ AUTH_MET_MD5, "Meticulous Keyed MD5" },
|
||||
{ AUTH_SHA1, "Keyed SHA1" },
|
||||
{ AUTH_MET_SHA1, "Meticulous Keyed SHA1" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define BFD_EXTRACT_VERSION(x) (((x)&0xe0)>>5)
|
||||
#define BFD_EXTRACT_DIAG(x) ((x)&0x1f)
|
||||
enum auth_length {
|
||||
AUTH_PASSWORD_FIELD_MIN_LEN = 4, /* header + password min: 3 + 1 */
|
||||
AUTH_PASSWORD_FIELD_MAX_LEN = 19, /* header + password max: 3 + 16 */
|
||||
AUTH_MD5_FIELD_LEN = 24,
|
||||
AUTH_MD5_HASH_LEN = 16,
|
||||
AUTH_SHA1_FIELD_LEN = 28,
|
||||
AUTH_SHA1_HASH_LEN = 20
|
||||
};
|
||||
|
||||
#define BFD_EXTRACT_VERSION(x) (((x)&0xe0)>>5)
|
||||
#define BFD_EXTRACT_DIAG(x) ((x)&0x1f)
|
||||
|
||||
static const struct tok bfd_port_values[] = {
|
||||
{ BFD_CONTROL_PORT, "Control" },
|
||||
@ -112,7 +132,6 @@ static const struct tok bfd_port_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
static const struct tok bfd_diag_values[] = {
|
||||
{ 0, "No Diagnostic" },
|
||||
{ 1, "Control Detection Time Expired" },
|
||||
@ -127,14 +146,14 @@ static const struct tok bfd_diag_values[] = {
|
||||
};
|
||||
|
||||
static const struct tok bfd_v0_flag_values[] = {
|
||||
{ 0x80, "I Hear You" },
|
||||
{ 0x40, "Demand" },
|
||||
{ 0x20, "Poll" },
|
||||
{ 0x10, "Final" },
|
||||
{ 0x08, "Reserved" },
|
||||
{ 0x04, "Reserved" },
|
||||
{ 0x02, "Reserved" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 0x80, "I Hear You" },
|
||||
{ 0x40, "Demand" },
|
||||
{ 0x20, "Poll" },
|
||||
{ 0x10, "Final" },
|
||||
{ 0x08, "Reserved" },
|
||||
{ 0x04, "Reserved" },
|
||||
{ 0x02, "Reserved" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -146,7 +165,7 @@ static const struct tok bfd_v1_flag_values[] = {
|
||||
{ 0x08, "Control Plane Independent" },
|
||||
{ BFD_FLAG_AUTH, "Authentication Present" },
|
||||
{ 0x02, "Demand" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 0x01, "Multipoint" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -158,12 +177,122 @@ static const struct tok bfd_v1_state_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static int
|
||||
auth_print(netdissect_options *ndo, register const u_char *pptr)
|
||||
{
|
||||
const struct bfd_auth_header_t *bfd_auth_header;
|
||||
int i;
|
||||
|
||||
pptr += sizeof (const struct bfd_header_t);
|
||||
bfd_auth_header = (const struct bfd_auth_header_t *)pptr;
|
||||
ND_TCHECK(*bfd_auth_header);
|
||||
ND_PRINT((ndo, "\n\tAuthentication: %s (%u), length: %u",
|
||||
tok2str(bfd_v1_authentication_values,"Unknown",bfd_auth_header->auth_type),
|
||||
bfd_auth_header->auth_type,
|
||||
bfd_auth_header->auth_len));
|
||||
pptr += 2;
|
||||
ND_PRINT((ndo, "\n\t Auth Key ID: %d", *pptr));
|
||||
|
||||
switch(bfd_auth_header->auth_type) {
|
||||
case AUTH_PASSWORD:
|
||||
/*
|
||||
* Simple Password Authentication Section Format
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Type | Auth Len | Auth Key ID | Password... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
if (bfd_auth_header->auth_len < AUTH_PASSWORD_FIELD_MIN_LEN ||
|
||||
bfd_auth_header->auth_len > AUTH_PASSWORD_FIELD_MAX_LEN) {
|
||||
ND_PRINT((ndo, "[invalid length %d]",
|
||||
bfd_auth_header->auth_len));
|
||||
break;
|
||||
}
|
||||
pptr++;
|
||||
ND_PRINT((ndo, ", Password: "));
|
||||
/* the length is equal to the password length plus three */
|
||||
if (fn_printn(ndo, pptr, bfd_auth_header->auth_len - 3,
|
||||
ndo->ndo_snapend))
|
||||
goto trunc;
|
||||
break;
|
||||
case AUTH_MD5:
|
||||
case AUTH_MET_MD5:
|
||||
/*
|
||||
* Keyed MD5 and Meticulous Keyed MD5 Authentication Section Format
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Type | Auth Len | Auth Key ID | Reserved |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Sequence Number |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Key/Digest... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
if (bfd_auth_header->auth_len != AUTH_MD5_FIELD_LEN) {
|
||||
ND_PRINT((ndo, "[invalid length %d]",
|
||||
bfd_auth_header->auth_len));
|
||||
break;
|
||||
}
|
||||
pptr += 2;
|
||||
ND_TCHECK2(*pptr, 4);
|
||||
ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_32BITS(pptr)));
|
||||
pptr += 4;
|
||||
ND_TCHECK2(*pptr, AUTH_MD5_HASH_LEN);
|
||||
ND_PRINT((ndo, "\n\t Digest: "));
|
||||
for(i = 0; i < AUTH_MD5_HASH_LEN; i++)
|
||||
ND_PRINT((ndo, "%02x", pptr[i]));
|
||||
break;
|
||||
case AUTH_SHA1:
|
||||
case AUTH_MET_SHA1:
|
||||
/*
|
||||
* Keyed SHA1 and Meticulous Keyed SHA1 Authentication Section Format
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Type | Auth Len | Auth Key ID | Reserved |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Sequence Number |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Key/Hash... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
if (bfd_auth_header->auth_len != AUTH_SHA1_FIELD_LEN) {
|
||||
ND_PRINT((ndo, "[invalid length %d]",
|
||||
bfd_auth_header->auth_len));
|
||||
break;
|
||||
}
|
||||
pptr += 2;
|
||||
ND_TCHECK2(*pptr, 4);
|
||||
ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_32BITS(pptr)));
|
||||
pptr += 4;
|
||||
ND_TCHECK2(*pptr, AUTH_SHA1_HASH_LEN);
|
||||
ND_PRINT((ndo, "\n\t Hash: "));
|
||||
for(i = 0; i < AUTH_SHA1_HASH_LEN; i++)
|
||||
ND_PRINT((ndo, "%02x", pptr[i]));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
trunc:
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
bfd_print(netdissect_options *ndo, register const u_char *pptr,
|
||||
register u_int len, register u_int port)
|
||||
{
|
||||
const struct bfd_header_t *bfd_header;
|
||||
const struct bfd_auth_header_t *bfd_auth_header;
|
||||
uint8_t version = 0;
|
||||
|
||||
bfd_header = (const struct bfd_header_t *)pptr;
|
||||
@ -244,13 +373,8 @@ bfd_print(netdissect_options *ndo, register const u_char *pptr,
|
||||
ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000));
|
||||
|
||||
if (bfd_header->flags & BFD_FLAG_AUTH) {
|
||||
pptr += sizeof (const struct bfd_header_t);
|
||||
bfd_auth_header = (const struct bfd_auth_header_t *)pptr;
|
||||
ND_TCHECK2(*bfd_auth_header, sizeof(const struct bfd_auth_header_t));
|
||||
ND_PRINT((ndo, "\n\t%s (%u) Authentication, length %u present",
|
||||
tok2str(bfd_v1_authentication_values,"Unknown",bfd_auth_header->auth_type),
|
||||
bfd_auth_header->auth_type,
|
||||
bfd_auth_header->auth_len));
|
||||
if (auth_print(ndo, pptr))
|
||||
goto trunc;
|
||||
}
|
||||
break;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,22 +17,19 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Format and print bootp packets.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: BOOTP and IPv4 DHCP printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
@ -215,8 +212,9 @@ struct bootp {
|
||||
#define TAG_CLIENT_GUID ((uint8_t) 97)
|
||||
#define TAG_LDAP_URL ((uint8_t) 95)
|
||||
#define TAG_6OVER4 ((uint8_t) 96)
|
||||
#define TAG_PRINTER_NAME ((uint8_t) 100)
|
||||
#define TAG_MDHCP_SERVER ((uint8_t) 101)
|
||||
/* RFC 4833, TZ codes */
|
||||
#define TAG_TZ_PCODE ((uint8_t) 100)
|
||||
#define TAG_TZ_TCODE ((uint8_t) 101)
|
||||
#define TAG_IPX_COMPAT ((uint8_t) 110)
|
||||
#define TAG_NETINFO_PARENT ((uint8_t) 112)
|
||||
#define TAG_NETINFO_PARENT_TAG ((uint8_t) 113)
|
||||
@ -224,6 +222,7 @@ struct bootp {
|
||||
#define TAG_FAILOVER ((uint8_t) 115)
|
||||
#define TAG_EXTENDED_REQUEST ((uint8_t) 126)
|
||||
#define TAG_EXTENDED_OPTION ((uint8_t) 127)
|
||||
#define TAG_MUDURL ((uint8_t) 161)
|
||||
|
||||
/* DHCP Message types (values for TAG_DHCP_MESSAGE option) */
|
||||
#define DHCPDISCOVER 1
|
||||
@ -294,6 +293,7 @@ bootp_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "BOOTP/DHCP, %s",
|
||||
tok2str(bootp_op_values, "unknown (0x%02x)", bp->bp_op)));
|
||||
|
||||
ND_TCHECK(bp->bp_hlen);
|
||||
if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
|
||||
ND_TCHECK2(bp->bp_chaddr[0], 6);
|
||||
ND_PRINT((ndo, " from %s", etheraddr_string(ndo, bp->bp_chaddr)));
|
||||
@ -356,7 +356,8 @@ bootp_print(netdissect_options *ndo,
|
||||
ND_TCHECK2(bp->bp_sname[0], 1); /* check first char only */
|
||||
if (*bp->bp_sname) {
|
||||
ND_PRINT((ndo, "\n\t sname \""));
|
||||
if (fn_print(ndo, bp->bp_sname, ndo->ndo_snapend)) {
|
||||
if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof bp->bp_sname,
|
||||
ndo->ndo_snapend)) {
|
||||
ND_PRINT((ndo, "\""));
|
||||
ND_PRINT((ndo, "%s", tstr + 1));
|
||||
return;
|
||||
@ -366,7 +367,8 @@ bootp_print(netdissect_options *ndo,
|
||||
ND_TCHECK2(bp->bp_file[0], 1); /* check first char only */
|
||||
if (*bp->bp_file) {
|
||||
ND_PRINT((ndo, "\n\t file \""));
|
||||
if (fn_print(ndo, bp->bp_file, ndo->ndo_snapend)) {
|
||||
if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof bp->bp_file,
|
||||
ndo->ndo_snapend)) {
|
||||
ND_PRINT((ndo, "\""));
|
||||
ND_PRINT((ndo, "%s", tstr + 1));
|
||||
return;
|
||||
@ -522,13 +524,14 @@ static const struct tok tag2str[] = {
|
||||
{ TAG_CLIENT_GUID, "bGUID" }, /* XXX 'b' */
|
||||
{ TAG_LDAP_URL, "aLDAP" },
|
||||
{ TAG_6OVER4, "i6o4" },
|
||||
{ TAG_PRINTER_NAME, "aPRTR" },
|
||||
{ TAG_MDHCP_SERVER, "bMDHCP" }, /* XXX 'b' */
|
||||
{ TAG_TZ_PCODE, "aPOSIX-TZ" },
|
||||
{ TAG_TZ_TCODE, "aTZ-Name" },
|
||||
{ TAG_IPX_COMPAT, "bIPX" }, /* XXX 'b' */
|
||||
{ TAG_NETINFO_PARENT, "iNI" },
|
||||
{ TAG_NETINFO_PARENT_TAG, "aNITAG" },
|
||||
{ TAG_URL, "aURL" },
|
||||
{ TAG_FAILOVER, "bFAIL" }, /* XXX 'b' */
|
||||
{ TAG_MUDURL, "aMUD-URL" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
/* 2-byte extended tags */
|
||||
@ -999,7 +1002,7 @@ rfc1048_print(netdissect_options *ndo,
|
||||
break;
|
||||
}
|
||||
if (len < suboptlen) {
|
||||
ND_PRINT((ndo, "ERROR: malformed option"));
|
||||
ND_PRINT((ndo, "ERROR: invalid option"));
|
||||
bp += len;
|
||||
len = 0;
|
||||
break;
|
||||
|
@ -17,14 +17,15 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Bluetooth printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
|
||||
#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
|
||||
|
@ -15,14 +15,15 @@
|
||||
* Original code by Ola Martin Lykkja (ola.lykkja@q-free.com)
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Communication access for land mobiles (CALM) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
/*
|
||||
@ -36,19 +37,33 @@
|
||||
* to the calm header of the packet.
|
||||
*/
|
||||
void
|
||||
calm_fast_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int length)
|
||||
calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src)
|
||||
{
|
||||
int srcNwref = bp[0];
|
||||
int dstNwref = bp[1];
|
||||
int srcNwref;
|
||||
int dstNwref;
|
||||
|
||||
ND_TCHECK2(*bp, 2);
|
||||
if (length < 2)
|
||||
goto trunc;
|
||||
srcNwref = bp[0];
|
||||
dstNwref = bp[1];
|
||||
length -= 2;
|
||||
bp += 2;
|
||||
|
||||
ND_PRINT((ndo, "CALM FAST src:%s; ", etheraddr_string(ndo, eth+6)));
|
||||
ND_PRINT((ndo, "CALM FAST"));
|
||||
if (src != NULL)
|
||||
ND_PRINT((ndo, " src:%s", (src->addr_string)(ndo, src->addr)));
|
||||
ND_PRINT((ndo, "; "));
|
||||
ND_PRINT((ndo, "SrcNwref:%d; ", srcNwref));
|
||||
ND_PRINT((ndo, "DstNwref:%d; ", dstNwref));
|
||||
|
||||
if (ndo->ndo_vflag)
|
||||
ND_DEFAULTPRINT(bp, length);
|
||||
return;
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, "[|calm fast]"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,14 +34,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Common Address Redundancy Protocol (CARP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include "interface.h" /* for checksum structure and functions */
|
||||
#include "netdissect.h" /* for checksum structure and functions */
|
||||
#include "extract.h"
|
||||
|
||||
void
|
||||
|
@ -24,18 +24,19 @@
|
||||
* http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
|
||||
*/
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
/* \summary: Cisco Discovery Protocol (CDP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "extract.h"
|
||||
#include "nlpid.h"
|
||||
|
||||
static const char tstr[] = "[|cdp]";
|
||||
@ -170,9 +171,11 @@ cdp_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "\n\t "));
|
||||
for (i=0;i<len;i++) {
|
||||
j = *(tptr+i);
|
||||
ND_PRINT((ndo, "%c", j));
|
||||
if (j == 0x0a) /* lets rework the version string to get a nice indentation */
|
||||
ND_PRINT((ndo, "\t "));
|
||||
if (j == '\n') /* lets rework the version string to
|
||||
get a nice indentation */
|
||||
ND_PRINT((ndo, "\n\t "));
|
||||
else
|
||||
fn_print_char(ndo, j);
|
||||
}
|
||||
break;
|
||||
case 0x06: /* Platform */
|
||||
@ -278,11 +281,9 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
{
|
||||
int pt, pl, al, num;
|
||||
const u_char *endp = p + l;
|
||||
#ifdef INET6
|
||||
static const u_char prot_ipv6[] = {
|
||||
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x86, 0xdd
|
||||
};
|
||||
#endif
|
||||
|
||||
ND_TCHECK2(*p, 4);
|
||||
if (p + 4 > endp)
|
||||
@ -317,7 +318,6 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "IPv4 (%u) %s", num, ipaddr_string(ndo, p)));
|
||||
p += 4;
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (pt == PT_IEEE_802_2 && pl == 8 &&
|
||||
memcmp(p, prot_ipv6, 8) == 0 && al == 16) {
|
||||
/*
|
||||
@ -334,7 +334,6 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "IPv6 (%u) %s", num, ip6addr_string(ndo, p)));
|
||||
p += al;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
/*
|
||||
* Generic case: just print raw data
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user