History log of /freebsd-10.1-release/contrib/tcpdump/tcpdump.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 255219 04-Sep-2013 pjd

Change the cap_rights_t type from uint64_t to a structure that we can extend
in the future in a backward compatible (API and ABI) way.

The cap_rights_t represents capability rights. We used to use one bit to
represent one right, but we are running out of spare bits. Currently the new
structure provides place for 114 rights (so 50 more than the previous
cap_rights_t), but it is possible to grow the structure to hold at least 285
rights, although we can make it even larger if 285 rights won't be enough.

The structure definition looks like this:

struct cap_rights {
uint64_t cr_rights[CAP_RIGHTS_VERSION + 2];
};

The initial CAP_RIGHTS_VERSION is 0.

The top two bits in the first element of the cr_rights[] array contain total
number of elements in the array - 2. This means if those two bits are equal to
0, we have 2 array elements.

The top two bits in all remaining array elements should be 0.
The next five bits in all array elements contain array index. Only one bit is
used and bit position in this five-bits range defines array index. This means
there can be at most five array elements in the future.

To define new right the CAPRIGHT() macro must be used. The macro takes two
arguments - an array index and a bit to set, eg.

#define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL)

We still support aliases that combine few rights, but the rights have to belong
to the same array element, eg:

#define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL)
#define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL)

#define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP)

There is new API to manage the new cap_rights_t structure:

cap_rights_t *cap_rights_init(cap_rights_t *rights, ...);
void cap_rights_set(cap_rights_t *rights, ...);
void cap_rights_clear(cap_rights_t *rights, ...);
bool cap_rights_is_set(const cap_rights_t *rights, ...);

bool cap_rights_is_valid(const cap_rights_t *rights);
void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src);
void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src);
bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);

Capability rights to the cap_rights_init(), cap_rights_set(),
cap_rights_clear() and cap_rights_is_set() functions are provided by
separating them with commas, eg:

cap_rights_t rights;

cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT);

There is no need to terminate the list of rights, as those functions are
actually macros that take care of the termination, eg:

#define cap_rights_set(rights, ...) \
__cap_rights_set((rights), __VA_ARGS__, 0ULL)
void __cap_rights_set(cap_rights_t *rights, ...);

Thanks to using one bit as an array index we can assert in those functions that
there are no two rights belonging to different array elements provided
together. For example this is illegal and will be detected, because CAP_LOOKUP
belongs to element 0 and CAP_PDKILL to element 1:

cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL);

Providing several rights that belongs to the same array's element this way is
correct, but is not advised. It should only be used for aliases definition.

This commit also breaks compatibility with some existing Capsicum system calls,
but I see no other way to do that. This should be fine as Capsicum is still
experimental and this change is not going to 9.x.

Sponsored by: The FreeBSD Foundation


# 253827 31-Jul-2013 rpaulo

When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP,
tcpdump will print an error message saying rfmon is not supported.
Give a concise explanation as to how one might solve this problem by
creating a monitor mode VAP.


# 253004 07-Jul-2013 pjd

Sandbox tcpdump(8) using Capsicum's capability mode and capabilities.
For now, sandboxing is done only if -n option was specified and neither -z nor
-V options were given. Because it is very common to run tcpdump(8) with the -n
option for speed, I decided to commit sandboxing now. To also support
sandboxing when -n option wasn't specified, we need Casper daemon and its
services that are not available in FreeBSD yet.

- Limit file descriptors of a file specified by -r option or files specified
via -V option to CAP_READ only.

- If neither -r nor -V options were specified, we operate on /dev/bpf.
Limit its descriptor to CAP_READ and CAP_IOCTL plus limit allowed ioctls to
BIOCGSTATS only.

- Limit file descriptor of a file specified by -w option to CAP_SEEK and
CAP_WRITE.

- If either -C or -G options were specified, we open directory containing
destination file and we limit directory descriptor to CAP_CREATE, CAP_FCNTL,
CAP_FTRUNCATE, CAP_LOOKUP, CAP_SEEK and CAP_WRITE. Newly opened/created
files are limited to CAP_SEEK and CAP_WRITE only.

- Enter capability mode if -n option was specified and neither -z nor -V
options were specified.

Approved by: delphij, wxs
Sponsored by: The FreeBSD Foundation


# 251158 30-May-2013 delphij

MFV: tcpdump 4.4.0.

MFC after: 4 weeks


# 241235 05-Oct-2012 delphij

MFV: tcpdump 4.3.0.

MFC after: 4 weeks


# 235530 17-May-2012 delphij

Merge tcpdump 4.2.1.

MFC after: 2 weeks


# 214478 28-Oct-2010 rpaulo

Merge tcpdump-4.1.1.


# 190207 21-Mar-2009 rpaulo

Merge tcpdump 4.0.0 from the vendor branch.


# 173819 21-Nov-2007 mlaier

Avoid excessive error message printout.

PR: bin/118150
Reported by: keramida
MFC after: 3 days


# 172686 16-Oct-2007 mlaier

Resolve merge conflicts

Approved by: re (kensmith)
Obtained from: tcpdump.org


# 162021 04-Sep-2006 sam

resolve merge conflicts

MFC after: 1 month


# 147904 11-Jul-2005 sam

resolve merge conflicts

Approved by: re (scottl)


# 146778 29-May-2005 sam

resolve merge conflicts and update for proper build; including:

o print-fr.c returned to code on vendor branch
o remove pmap_prot.h include from print-sunrprc.c
o remove gcc/i386-specific ntoh* write-arounds from tcpdump-stdinc.h

Reviewed by: bms


# 127675 31-Mar-2004 bms

Merge of tcpdump 3.8.3 from tcpdump.org, with the following caveats:

print-atm.c no longer performs special handling for FORE headers; these
can no doubt be re-added at a later date.

print-fr.c is effectively a no-op.

print-llc.c has had the default_print_unaligned() call removed as
tcpdump no longer defines this function, however the prototype is still
present. Suggest we roll in a diff to use print_unknown_data().


# 109842 25-Jan-2003 fenner

Merge Multi-DLT support.


# 98527 20-Jun-2002 fenner

Merge tcpdump 3.7.1

MFC after: 2 weeks


# 75118 03-Apr-2001 fenner

Merge tcpdump 3.6.2


# 56896 29-Jan-2000 fenner

Merge tcpdump 3.5


# 56648 26-Jan-2000 archie

Add the -X flag to dump the buffer in "emacs-hexl" style,
that is, with ASCII character decoding.

Obtained from: OpenBSD


# 44165 20-Feb-1999 julian

World, I'd like you to meet the first FreeBSD token Ring driver.
This is for various Olicom cards. An IBM driver is following.
This patch also adds support to tcpdump to decode packets on tokenring.
Congratulations to the proud father.. (below)

Submitted by: Larry Lile <lile@stdio.com>


# 39298 15-Sep-1998 fenner

This commit was generated by cvs2svn to compensate for changes in r39297,
which included commits to RCS files with non-trunk default branches.


# 39297 15-Sep-1998 fenner

Virgin import of LBL tcpdump v3.4


# 26180 27-May-1997 fenner

Virgin import of LBL tcpdump v3.3


# 17680 19-Aug-1996 pst

Virgin import of unmodified tcpdump v3.2.1 distribution from LBL.
Obtained from: ftp://ftp.ee.lbl.gov/tcpdump.tar.Z on 19-Aug-1996.