summaryrefslogtreecommitdiffstats
path: root/lib/libpcap
AgeCommit message (Collapse)AuthorFilesLines
2021-01-20typo; spotted by jmcsthen1-3/+3
2021-01-18support PCAP_NETMASK_UNKNOWN, adapted from an old commit in upstreamsthen3-6/+20
libpcap, ok dlg@ https://github.com/the-tcpdump-group/libpcap/commit/74b2de364f3443fc2414d0160b0b942f347c6fd4 https://github.com/the-tcpdump-group/libpcap/commit/117cb5eb2eb4fe212d3851f1205bb0b8f57873c6
2020-09-12Fix byte order handling for DLT_LOOP linkskn1-4/+21
Fixing filters on DLT_LOOP revealed that we treat DLT_NULL, DLT_ENC and DLT_LOOP the same way even though DLT_LOOP stores the AF value in network not byte order like the rest. This amends the missing conversion which ought to land with the recent commit exposing the byte order mismatch: revision 1.53 date: 2020/07/21 22:44:55; author: dlg; state: Exp; lines: +2 -2; DLT_LOOP does have a link header, so tell pcap-filter so it can use it. ... debugged with and ok kn@ Discussed with bluhm who reported src/regress/sys/netinet6/rip6cksum/ failing on i386 after above commit. The comment in this commit is taken from libpcap upstream as is modulo additional file-save related byte-order handling which we don't seem to do. OK bluhm
2020-08-03crank the major cos grammar.c has grown.dlg1-2/+2
pointed out by tb@, who also provided the diff. maybe someone should/could add a Symbols.list here? ok tb@ deraadt@
2020-08-03add "sample NUM" so you can ask to capture 1/NUM packets from a filter.dlg5-6/+33
the use of the sample keyword matches similar config in other products. NUM can be a number between 2 and 1048576, and is used to divide 0x100000000 into a threshold that is then compared against a randomly generated number produced by a load of BPF_RND. having sampling as part of the grammar means you can write things like "icmp or sample 128". this lets you capture all icmp traffic and a sample of the rest of the traffic. ok jmatthew@ kn@ tb@
2020-08-03add support for handling loads from BPF_RND.dlg7-10/+38
this adds "rnd" and "random" as keywords in the grammar, and handles them as an arithmetic operator. the decoder recognises the load, so tcpdump can print it as 'ld #random'. most of the handling is copied from the "len"/"length" keywoard handling that generates and decodes a load of the actual wire length of the packet. ok jmatthew@ tb@ kn@
2020-07-21DLT_LOOP does have a link header, so tell pcap-filter so it can use it.dlg1-2/+2
matthieu@ reported that asking tcpdump to look at ip or ip6 traffic on a wg(4) interface caused all packets to be captured. this is because pcap assumes that if your link type doesn't have a link header then it is always ip or ip6 (which is weird anyway) and captures everything. there was already code to generate a filter for the DLT_LOOP link header, it was just bypassed cos earlier code said that there wasn't one. debugged with and ok kn@
2020-05-29from edgar pettijohn: correct return type in pcap_open_live.3;jmc1-3/+3
ok djm
2020-05-27add support for pcap_breakloop when reading packets from files.dlg1-1/+18
djm pulled support in for pcap_breakloop on the bpf side of things, this makes it work when reading files too. from Caspar Schutijser lteo@ seems keen ok djm@
2019-12-17Fix bogus ".It .Cm"jca1-3/+3
2019-11-28Fix typo in comment in struct pcap_pkthdrakoshibe1-2/+2
2019-09-25the mentioned .Fn functions are in a another file, so .Xr themderaadt1-5/+5
ok jmc
2019-09-25pcap-filter now section 5: adjust Xrjmc1-3/+3
2019-09-25mdoc version of pcap-filter;jmc3-759/+927
conversion suggested by deraadt, as well as renaming from section 7 to section 5; ok deraadt
2019-09-03pcap-filter(3) is not a function, it is a language description. It wasderaadt3-6/+6
mostly cobbled together from a pre-mandoc tcpdump manual page, and desperately needs some loving. First step is to name it right. Discussed with jmc
2019-08-30there is no pcap(3) function, "man pcap" returns an incorrect result.deraadt2-4/+4
this page should be called by one of the functions, so i chose the first one: pcap_open_live(3)
2019-07-19add "slow" to the list of ethernet protocol names.dlg1-1/+2
this allows "tcpdump ether proto slow", which makes looking at lacp frames a bit easier.
2019-06-28When system calls indicate an error they return -1, not some arbitraryderaadt2-24/+24
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2018-12-13further document pcap_dump; from jan staryjmc1-5/+13
text tweaked and ok djm
2018-12-12some pcap_setdirection details; from jan staryjmc1-2/+11
ok djm
2018-12-09add basic MPLS filtering supportdenis5-8/+67
OK claudio@ jca@
2018-11-10unbreak VLAN filteringdenis1-2/+7
OK dlg@
2018-11-09fix a typodenis1-2/+2
OK jca@ (from a long time ago...)
2018-06-03Sync manual with the const changes introduced in pcap.h rev 1.20.tb1-5/+5
2018-06-03Change some libpcap functions which use pointers as arguments andsthen6-20/+20
returns to const pointers: - the prefix argument to pcap_perror(); - the return value of pcap_strerror(); - the filter expression argument to pcap_compile() and pcap_compile_nopcap(); - the BPF filter program argument to bpf_image(). Matches changes made earlier in tcpdump.org's version of libpcap. From Guy Harris, ok tb@, been through a bulk ports build.
2018-04-26Convert a format string variable to a static const char[] to reduce warningsguenther1-2/+3
ok tb@ millert@ krw@
2018-04-05Import pcap_set_immediate_mode() from mainline libpcap which allows alteo6-7/+39
libpcap-based program to process packets as soon as they arrive. feedback from jasper@ ok jca@ (a long time ago)
2018-02-06recognise DLT_PPP_SERIAL.dlg2-2/+8
shlib version doesnt need a bump before no new symbols were added or removed. part of a larger diff that was ok sthen@
2018-02-03Simple USBPcap parser for tcpdump(8). Raw dumps can be nicely analysedmpi2-2/+5
in wireshark. ok deraadt@, dlg@
2018-01-01Fix wrong ETHERTYPE_IPV6denis1-2/+2
OK jca@ kettenis@ job@
2017-07-09use working boilerplate for yacc/lex instead of homemade rules.espie2-10/+6
okay millert@ (forgot the obvious scanner.l tweak in my diff)
2017-04-27Remove the "volatile" attribute from bpf_error(). The "volatile"millert1-2/+2
attribute is an obsolete way of saying "noreturn". clang doesn't recognize it and the function is already marked __dead so it is superfluous anyway.
2017-04-19Switch base tools from /dev/bpf0 to /dev/bpf. Now that /dev/bpf has beennatano1-3/+3
around for two releases, it should be safe to do so. ok bluhm deraadt sthen tb yasuoka
2016-12-02add "lldp" to the ether protocol name db.dlg1-1/+2
this lets me go "tcpdump ether proto lldp" to easily read lldp packets off the wire without other noise getting in the way. ok deraadt@ jca@ sthen@
2016-11-29Stop exporting the eproto_db array, export a pointer to it instead.jca2-6/+8
tcpdump directly uses eproto_db even though it is not part of the libpcap API. This means that we can't freely add members to this array, else ld.so complains about size mismatches. Keep the data in a static array instead and make it usable by tcpdump through a pointer whose size won't change in the future. A minor bump is enough here for ld.so to stop complaining. While here, mark _eproto_db and llc_db as const, as they are meant to be. Suggested by and ok deraadt@
2016-11-20Extend the DLT_OPENFLOW header to include the switch datapath id.reyk1-2/+2
OK rzalamena@
2016-11-16Add new DLT_OPENFLOW link-type to allow using tcpdump to debug switch(4),reyk3-3/+9
eg. tcpdump -y openflow -i switch0 Includes a minor bump for libpcap. Feedback and OK rzalamena@
2016-10-17Add missing argument names for pcap_offline_filter.lteo1-3/+3
2016-05-08Use /dev/bpf0 instead of /dev/bpf (without loop though), as suggested bynatano1-3/+3
sthen@. to make remote upgrades without media less painful. ok tb@
2016-05-03Move to /dev/bpf; ok lteonatano1-60/+11
2016-04-06bad spell of whether...jmc1-2/+2
2016-04-06add two functions from libpcap-1.7.4 which are required by at least gopacketjasper4-7/+57
ok lteo@ "go for it" dlg@
2016-04-05Move more fcntl(,F_GETFL,0) -> fcntl(,F_GETFL).krw1-3/+3
No functional change. ok guenther@
2016-04-02refactor bpf_filter a bit.dlg1-3/+1
the code was confusing around how it dealt with packets in mbufs vs plain memory buffers with a lenght. this renames bpf_filter to _bpf_filter, and changes it so the packet memory is referred to by an opaque pointer, and callers have to provide a set of operations to extra values from that opaque pointer. bpf_filter is now provided as a wrapper around _bpf_filter. it provides a set of operators that work on a straight buffer with a lenght. this also adds a bpf_mfilter function which takes an mbuf instead of a buffer, and it provides explicit operations for extracting values from mbufs. if we want to use bpf filters against other data structures (usb or scsi packets maybe?) we are able to provide functions for extracting payloads from them and use _bpf_filter as is. ok canacar@
2016-03-30for some time now mandoc has not required MLINKS to functionjmc1-27/+1
correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
2016-02-05Use the correct structure size when allocating the array for nodes.canacar1-2/+2
ok tb@ millert@
2015-12-22remove NULL-checks before free()mmcc5-27/+19
2015-11-17Remove register keyword.mmcc9-74/+74
ok deraadt@
2015-11-17memory.h -> string.hmmcc6-12/+10
ok deraadt@
2015-11-15update NAME; ok schwarzejmc1-4/+59