summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
AgeCommit message (Collapse)Author
2019-03-18support configuring BIOCSFILDROP with tcpdump.David Gwynne
this allows tcpdump to be used a quick and dirty firewall. it also looks like an amazing foot-gun, so be careful. for example `tcpdump -B drop -i ix1 udp and port 7` lets you completely drop discard packets in the hardware interrupt handler. ok sthen@ mikeb@ claudio@ visa@
2019-02-05handle Cisco's Encapsulated Remote Switch Port Analyzer (ERSPAN) protocolDavid Gwynne
ERSPAN II is an 8 byte header before an ethernet payload. the switch at work doesnt produce erspan III, so I haven't handled that yet. this at least let's me see what's on the wire so i can contemplate how i want to deal with the payload. based on draft-foschiano-erspan-03
2019-01-26fix microsecond output of timestamp deltas (-tttt)Richard Procter
2019-01-03Add snmpv3 support.Martijn van Duren
Standard output should remain the same. Additional information is placed under the -v flag. -vv can be used to retrieve the asn1 dumps. Input and OK jmatthew@
2018-12-28print well-known SAFI name instead of valuedenis
OK claudio@ sthen@
2018-12-20LLDP has it's own group address, so teach tcpdump about it.David Gwynne
ok deraadt@
2018-11-18later versions of 802.1Q replaced the vlan CFI field with DEIDavid Gwynne
CFI stood for canonical format indicator, and basically said whether the payload was ethernet of fddi (with 0 meaning ethernet). DEI stands for drop eligibility indicator
2018-11-18handle the 802.1Q i-tag format for provider backbone bridges.David Gwynne
2018-11-17tcpdump(8) monitor process privdropBryan Steele
The privsep monitor process handles all privileged operations on behalf of the unprivileged "packet parser" process. Once it enters its runtime state, it only needs to: * Perform DNS and other "numbers to names" lookups, sending results back over a pipe/socketpair. * Display the final packet statistics on ^C. We can finally now drop root privileges in this process as well, as bpf BIOCGSTATS is still permitted by non-root on open descriptors after it has been permanently locked with BIOCLOCK. This provides some additional protection, to go along with the already tight unveil(2) and pledge(2) restrictions. With this change tcpdump(8) completely drops root privileges at runtime. ok mestre@, deraadt@
2018-11-09The 'recvfd' and 'inet' promises are no longer required by tcpdump(8)Bryan Steele
This reduces the remaining runtime pledge(2) in the privsep monitor process to "stdio rpath dns bpf": - 'rpath' for /etc/{ethers,rpc}, also unveil(2)'d thanks to mestre@! - 'dns' for DNS lookups - 'bpf' BIOCGSTATS on ^C The unprivileged packet parser process remains pledged just "stdio" This depends on the previous commit that removed YP support from ethers(5). ok mestre@
2018-11-08Close the fingerprints file in the child after it has been loaded.Bryan Steele
I missed this part in my previous commit.
2018-11-08Hoist opening pf.os(5) fingerprints '-o' earlier so that it doesn'tBryan Steele
need to be unveiled at runtime in the monitor process. Cleanup the unused internal privsep "getlines" code, we now explictly fdpass the OS fingerprints file instead. ok mestre@ kn@
2018-10-22Remove #ifdef INET6kn
There's not reason to build without IPv6 support, `-U INET6' builds were broken anyway. Fix an empty redefine for IPPROTO_IPV6 in print-ip.c while here. No object change on amd64 and sparc64 with clang, gcc compiles differently but behaviour stays the same. OK denis deraadt
2018-09-29Zap dead/obsolete codekn
Flow labels used to be 24-bit back in 1995 until the IPv6 header format changed in 1998 when the field size was reduced to 20-bit. https://tools.ietf.org/html/rfc1883#section-6 https://tools.ietf.org/html/rfc2460#section-6 OK denis deraadt
2018-09-28add unveil(2) to tcpdump(8)Ricardo Mestre
The following files are opened in the privsep proc, with read permissions, and therefore need to be unveiled: - /etc/pf.os - for OS fingerprinting, but only unveiled if -o flag is used - /etc/ethers - ether_ntohost(3) - /etc/rpc - getrpcbynumber(3) Additional files are also opened, but they are either opened before reaching this code path, or are covered by pledge(2)'s dns promise. shown and tested by a few people OK brynet@ deraadt@
2018-09-20add missing braces implied by indentationJonathan Gray
ok millert@
2018-09-07Fix the build after removing an unused af argument from unmask().Kevin Lo
ok claudio@
2018-08-08mestre and I can find no reason why the pledge has "unix". DisableTheo de Raadt
that and start listening for failure reports.
2018-07-10move the verbose checksum info back after the colon.David Gwynne
requested by bluhm@ as it broke some regress tests for no good reason.
2018-07-06use a list for the -T types, now that there are many; ok dlgJason McIntyre
2018-07-06add support for vxlan packets.David Gwynne
I personally think vxlan looks suspiciously like gre, so I put the parser in print-gre.c
2018-07-06use do { } while (!bottom) instead of again: ... if (!bottom) goto again;David Gwynne
2018-07-06pass the payload to parsers via cp, which is a pointer to the payload.David Gwynne
previously they all had (const u_char *)(up + 1), which was messy.
2018-07-06add "tftp" as a type to use with -TDavid Gwynne
This forces UDP packets to be parsed as tftp messages, which is useful to see the DATA and ACK packets. They're usually on high ports which don't get matched by udp_print, which by default only handled tftp packets on port 69.
2018-07-06Add "mpls" as a type to use with -TDavid Gwynne
This allows arbitrary UDP packets to be parsed as MPLS.
2018-07-06According to RFC7510, IANA allocated port 6635 for MPLS over UDPDavid Gwynne
2018-07-06Add "gre" as a type to use with -TDavid Gwynne
This allows arbitrary UDP packets to be parsed as GRE packets.
2018-07-06Rework UDP parsing, particularly around IP addresses.David Gwynne
This originally started as trying to put a consistent space between the UDP header information and the payload parsing, but while doing that I noticed inconsistent IPv4 vs IPv6 handling. Apart from the default "srcip.srcport > dstip.dstpor" output, all the other places that IP addresses were printed assumed IPv4. It looks like it is possible that udp_print() can be called without an IP header, which made these blind IPv4 prints turn into NULL derefs. This fixes the problem above by only having a single place that prints the addresses out, and makes sure to get the difference between IPv4, IPv6 and no IP correct. This changes how the checksum is calculated. It incrementally builds the UDP checksum by feeding the IPv4 and v6 addresses in separately, then using common code for the rest of the pseudo header and actual payload. Lastly, this does make printing the space between the UDP header and its payload consistent. The UDP code is now responsible for adding a space after itself so the payload parsers don't have to. They got it wrong in some cases anyway, so this should be a lot more uniform. help and ok sthen@
2018-07-06move the ip checksumming code into in_cksum.cDavid Gwynne
this is part of a bigger change that refactors udp handling, but works on hosts of both endians. discussed at length with proctor@ ok sthen@
2018-07-03some style fixes, no functional change.David Gwynne
ok claudio@ mpi@ benno@ bluhm@ deraadt@
2018-07-03handle gre-in-udp trafficDavid Gwynne
ok deraadt@
2018-05-28recognise MikroTik's Ethernet over IP (eoip) protocolDavid Gwynne
eoip is a twisted gre based protocol using version 1 like pptp, but a different protocol id. this splits the gre 1 protocol handling up so it doesn't assume that all packets are pptp, but decides between eoip and pptp based on the protocol field. unknown protocols are unknown rather that assumed to be pptp. ok sthen@
2018-04-28Reference hosts(5) instead of the obsolete networks(5).Ingo Schwarze
While here, also delete the obsolete .Tn macros.
2018-04-03tweak vlan printing to properly decode the priority field.David Gwynne
the vlan specs have the priority of 0 and 1 swapped on the wire, which is how the kernel handles them. eg, if you use pf to set prio 1, it will end up being 0 on the wire. this makes 0 on the wire come out as 1 in tcpdump so it is consistent with the rest of the tooling. ok henning@
2018-02-24make the gre flowid output always 2 chars so payloads stay lined up.David Gwynne
2018-02-10print etherip on ipv6.David Gwynne
2018-02-09use ether_tryprint, which looks inside the ether packet.David Gwynne
ether_print just prints the ether header.
2018-02-09it turns out the wccp header is optionalDavid Gwynne
peek inside the payload to see if the first nibble looks like ipv4. if it isnt ipv4 assume it is the wccp header.
2018-02-08have a go at decoding cisco wccp gre packets, and let them fall into IP.David Gwynne
2018-02-08recognise gre proto 0 as a "keep alive" packetDavid Gwynne
2018-02-07shorten the output for gre keys.David Gwynne
2018-02-06output the data part of LCP Echo-Request and Echo-Reply packets.David Gwynne
2018-02-06rework ppp, pptp, and gre parsing.David Gwynne
this started cos i was looking at pptp, which came out like this: 23:52:00.197893 call 24 seq 7: gre-ppp-payload (gre encap) 23:52:00.198930 call 1 seq 7 ack 7: gre-ppp-payload (gre encap) now it looks like this: 23:52:00.197893 20.0.0.2 > 20.0.0.1: pptp callid 24 seq 7: 17.1.1.122 > 40.0.0.2: icmp: echo request 23:52:00.198930 20.0.0.1 > 20.0.0.2: pptp callid 1 seq 7 ack 7: 40.0.0.2 > 17.1.1.122: icmp: echo reply the big improvement in ppp parsing is it stops parsing based on what the ppp headers say, rather than what bytes have been captured. this also adds parsing of EAP packets. DLT_PPP_SERIAL is now recognised and printed. gre now prints the outer addresses always, not just when it's encapsulated by ipv6 or -v is passed to tcpdump. ok sthen@
2018-02-03Simple USBPcap parser for tcpdump(8). Raw dumps can be nicely analysedMartin Pieuchot
in wireshark. ok deraadt@, dlg@
2017-12-08Convert snprintf+write into dprintf. It is simply easier to read, andTheo de Raadt
provides retry on short-write file descriptors. ok florian, previous versions seen by millert
2017-10-30Kill <net/slip.h>.Martin Pieuchot
The ioctl(2) it defines is not supported since a long time and most of its defines are already present in tcpdump(8). ok jca@
2017-09-08Whoops, remove extra include.Bryan Steele
2017-09-08fork+exec model for tcpdump(8); re-exec the privileged child after forkBryan Steele
While tcpdump isn't a daemon in the traditional sense, it's not uncommon for people to have long running sessions. At least on OpenBSD, this is even safe thanks to the existing privsep design by otto@, canacar@ and pledge(2) work done by deraadt. ok deraadt@
2017-09-01Make 'tcpdump -v' decode RSN information elements in beaconsStefan Sperling
instead of lazily dumping them in hex. ok mpi@
2017-08-30unsigneds cannot be < 0; ok jca@Otto Moerbeek