summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/tcpdump.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge r309649, r313048, r313083, r313104:glebius2017-02-101-963/+872
| | | | tcpdump 4.9.0
* The code responsible for opening and rotating pcap files is independentoshogbo2016-06-081-16/+16
| | | | | | | | of Capser and should use openat(2) unconditionally on FreeBSD. openat(2) is mandatory when sandboxed with Capsicum, but still works in the absence of Capsicum. Reviewed by: AllanJude
* Fix spelling of the casper introduced in the r296047.oshogbo2016-06-081-26/+26
| | | | | PR: 210031 Reported by: AllanJude, jmallett
* Convert casperd(8) daemon to the libcasper.oshogbo2016-02-251-33/+30
| | | | | | | | | | | | | | | | | | | | After calling the cap_init(3) function Casper will fork from it's original process, using pdfork(2). Forking from a process has a lot of advantages: 1. We have the same cwd as the original process. 2. The same uid, gid and groups. 3. The same MAC labels. 4. The same descriptor table. 5. The same routing table. 6. The same umask. 7. The same cpuset(1). From now services are also in form of libraries. We also removed libcapsicum at all and converts existing program using Casper to new architecture. Discussed with: pjd, jonathan, ed, drysdale@google.com, emaste Partially reviewed by: drysdale@google.com, bdrewery Approved by: pjd (mentor) Differential Revision: https://reviews.freebsd.org/D4277
* MFV r285191: tcpdump 4.7.4.pkelsey2015-07-081-113/+281
|\ | | | | | | | | | | | | | | | | | | | | Also, the changes made in r272451 and r272653 that were lost in the merge of 4.6.2 (r276788) have been restored. PR: 199568 Differential Revision: https://reviews.freebsd.org/D3007 Reviewed by: brooks, hiren Approved by: jmallett (mentor) MFC after: 1 month
* | Let the nv.h and dnv.h includes be only in sys directory.oshogbo2015-07-021-1/+1
| | | | | | | | | | | | | | Change consumers to include those files from sys. Add duplicated files to ObsoleteFiles. Approved by: pjd (mentor)
* | Remove "capability mode sandbox enabled" messages.brooks2015-05-041-2/+0
| | | | | | | | | | | | | | | | | | | | | | These messages serve little purpose and break some consumers. PR: 199855 Differential Revision: https://reviews.freebsd.org/D2440 Reviewed by: rwatson Approved by: pjd MFC after: 1 week Sponsored by: DARPA, AFRL
* | Don't include libcapsicum headers when requested.delphij2015-01-241-3/+3
| | | | | | | | | | | | Reported by: luigi MFC after: 14 days X-MFC-with: r276788
* | MFV r276761: tcpdump 4.6.2.delphij2015-01-071-210/+508
|\ \ | |/ | | | | MFC after: 1 month
* | Fix comment and sort rights by nameluigi2014-10-061-4/+4
| | | | | | | | MFC after: 3 days
* | add CAP_EVENT for the libpcap device so we will be able to useluigi2014-10-021-1/+6
| | | | | | | | | | | | pcap--netmap which does poll() on the file descriptor MFC after: 2 weeks
* | Update most userspace consumers of capability.h to use capsicum.h instead.rwatson2014-03-161-1/+1
| | | | | | | | | | | | | | auditdistd is not updated as I will make the change upstream and then do a vendor import sometime in the next week or two. MFC after: 3 weeks
* | If we cannot connect to casperd we don't enter sandbox, but if we can connectpjd2013-12-191-14/+6
| | | | | | | | | | | | | | | | to casperd, but we cannot access the service we need we exit with an error. This should not happen and just indicates some configuration error which should be fixed, so we force the user to do it by failing. Discussed with: emaste
* | Make use of casperd's system.dns service when running without the -n option.pjd2013-12-151-1/+61
| | | | | | | | | | | | Now tcpdump(8) is sandboxed even if DNS resolution is required. Sponsored by: The FreeBSD Foundation
* | Change the cap_rights_t type from uint64_t to a structure that we can extendpjd2013-09-051-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP,rpaulo2013-07-311-0/+23
| | | | | | | | | | | | 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.
* | Sandbox tcpdump(8) using Capsicum's capability mode and capabilities.pjd2013-07-071-1/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | MFV: tcpdump 4.4.0.delphij2013-05-301-72/+236
|\ \ | |/ | | | | MFC after: 4 weeks
* | MFV: tcpdump 4.3.0.delphij2012-10-051-4/+10
|\ \ | |/ | | | | MFC after: 4 weeks
* | Merge tcpdump 4.2.1.delphij2012-05-171-43/+169
|\ \ | |/ | | | | MFC after: 2 weeks
* | Merge tcpdump-4.1.1.rpaulo2010-10-281-45/+153
|\ \ | |/
* | Merge tcpdump 4.0.0 from the vendor branch.rpaulo2009-03-211-61/+324
|\ \ | |/
| * Flatten vendor/tcpdump and remove keyword expansion.rpaulo2009-03-201-1461/+0
| |
| * Import of tcpdump v3.9.8mlaier2007-10-161-2/+5
| |
| * Import of tcpdump v3.9.4sam2006-09-041-13/+44
| |
| * Virgin import of tcpdump v3.9.1 (release) from tcpdump.orgsam2005-07-111-2/+23
| | | | | | | | Approved by: re (scottl)
| * Virgin import of tcpdump v3.9.1 (alpha 096) from tcpdump.orgsam2005-05-291-102/+388
| |
| * Import tcpdump 3.8.3, from http://www.tcpdump.org/releases/tcpdump-3.8.3.tar.gzbms2004-03-311-174/+523
| |
| * Commit tcpdump.org's multi-DLT support to vendor branch.fenner2003-01-261-3/+127
| |
| * Import tcpdump 3.7.1, fromfenner2002-06-211-20/+156
| | | | | | | | http://www.tcpdump.org/release/tcpdump-3.7.1.tar.gz
| * Virgin import of tcpdump.org tcpdump v3.6.2fenner2001-04-031-32/+42
| |
| * Virgin import of tcpdump.org tcpdump v3.5fenner2000-01-301-30/+79
| |
* | Avoid excessive error message printout.mlaier2007-11-211-0/+1
| | | | | | | | | | | | PR: bin/118150 Reported by: keramida MFC after: 3 days
* | Resolve merge conflictsmlaier2007-10-161-2/+5
| | | | | | | | | | Approved by: re (kensmith) Obtained from: tcpdump.org
* | resolve merge conflictssam2006-09-041-13/+44
| | | | | | | | MFC after: 1 month
* | resolve merge conflictssam2005-07-111-2/+23
| | | | | | | | Approved by: re (scottl)
* | resolve merge conflicts and update for proper build; including:sam2005-05-291-102/+394
| | | | | | | | | | | | | | | | 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
* | Merge of tcpdump 3.8.3 from tcpdump.org, with the following caveats:bms2004-03-311-174/+517
| | | | | | | | | | | | | | | | | | | | | | 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().
* | Merge Multi-DLT support.fenner2003-01-261-3/+127
| |
* | Merge tcpdump 3.7.1fenner2002-06-211-20/+156
| | | | | | | | MFC after: 2 weeks
* | Merge tcpdump 3.6.2fenner2001-04-031-80/+41
| |
* | Merge tcpdump 3.5fenner2000-01-301-58/+89
| |
* | Add the -X flag to dump the buffer in "emacs-hexl" style,archie2000-01-261-30/+99
| | | | | | | | | | | | that is, with ASCII character decoding. Obtained from: OpenBSD
* | World, I'd like you to meet the first FreeBSD token Ring driver.julian1999-02-201-1/+1
|/ | | | | | | | 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>
* Virgin import of LBL tcpdump v3.4fenner1998-09-151-22/+46
|
* Virgin import of LBL tcpdump v3.3fenner1997-05-271-12/+12
|
* Virgin import of unmodified tcpdump v3.2.1 distribution from LBL.pst1996-08-191-0/+428
Obtained from: ftp://ftp.ee.lbl.gov/tcpdump.tar.Z on 19-Aug-1996.
OpenPOWER on IntegriCloud