aboutsummaryrefslogtreecommitdiff
path: root/pcap-dlpi.c
Commit message (Collapse)AuthorAgeFilesLines
...
* As per suggestions from the anonymous SourceForge user who submitted bugguy2003-02-041-16/+23
| | | | | | | | | | | | | | | | | 673958, make two changes on Solaris: don't set SB_NO_DROPS - doing so means that bufmod doesn't drop packets, so it can't report the number of drops, but packets probably still get dropped *somewhere*, if for no other reason than that the system refuses to allocate more mblks/dblks, even if it doesn't discard messages that arrive at the stream head if it's full; set the chunk size to 65536, as otherwise packets are dropped too easily. snoop also appears not to set SB_NO_DROPS and also appears to set the chunk size to 65536, so that's probably the right thing to do.
* Make "split_dname()" take a "char *" as an argument and return a "charguy2003-01-031-18/+17
| | | | | *", and arrange never to pass it the argument to "pcap_open_live()" - copy the device name to a buffer before doing anything else to it.
* Constify the device argument to "pcap_open_live()", as was done forguy2002-12-281-7/+8
| | | | | other pcap-xxx.c files, and constify the argument to and return value from "split_dname()" as well, to match.
* NetBSD support for multiple data link types on an interface, from Davidguy2002-12-191-1/+7
| | | | | | | | | | | | Young <dyoung@ojctech.com>, with some minor changes by Jason R. Thorpe <thorpej@netbsd.org>, and further changes by me to support it on BPF systems lacking BIOCGDLTLIST and other platforms lacking an equivalent feature. Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't done so already). Add APIs to map DLT names to DLT values and vice versa.
* Add SunATM support, based on code from Yen Yen Lim at North Dakota Stateguy2002-07-111-5/+98
| | | | University.
* whitespace cleanupitojun2002-06-111-4/+4
|
* Fix up some printf calls to cope with both 32-bit and 64-bit longs andguy2002-05-311-4/+4
| | | | "size_t"s.
* From John Bankier <jbankier@rainfinity.com>: the buffer into which weguy2002-03-051-2/+2
| | | | | | read packets is "p->bufsize" bytes long, not MAXDLBUF bytes long ("p->bufsize" is set to (MAXDLBUF * sizeof sizeof(bpf_u_int32))), so supply that as the "maxlen" value in the "data" argument to "getmsg()".
* The "sbh_timestamp" member of an "sb_hdr" structure isn't necessarily aguy2002-02-221-2/+3
| | | | | | | | "struct timeval" - on Solaris 7 and 8, when compiling in LP64 or I32LPx mode, it's a "struct timeval32" (presumably so that bufmod doesn't have to worry about whether the stream is being read by a 32-bit program or a 64-bit program). Set the "struct timeval" "pkthdr.ts" by copying the individual members rather than by doing a structure assignment.
* Put more information into the comments for "pcap_stats()".guy2001-12-101-2/+8
|
* AIX's DLPI devices are, at least in AIX 4.3 and later, in theguy2001-11-171-1/+5
| | | | "/dev/dlpi" directory, not the "/dev" directory.
* Close a file descriptor leak, as per a patch that comes with Nessus andguy2001-11-111-1/+4
| | | | Pavel Kankovsky's suggested fix to that patch.
* As suggested by Hyung Sik Yoon <hsyn@kr.ibm.com>, use 2 rather than 0 asguy2001-10-121-7/+12
| | | | | the SAP on AIX if a SAP of 1537 doesn't work; he says that 2 works on Token Ring but 0 doesn't.
* Add comments to "pcap_stats()" indicating what the counters mean on theguy2001-07-291-1/+12
| | | | | various platforms (assuming the vendors' documentation is correct and that I've correctly interpreted it).
* On AIX, if binding to the SAP 1537 fails, try binding to 0; Token Ringguy2001-07-281-26/+228
| | | | | | | | | | | | | | devices appear to reject attempts to bind to 1537, perhaps because Token Ring devices use SAPs rather than Ethertypes and 1537 isn't a valid SAP value. Try to supply a string rather than a numerical value for various DLPI errors, and to supply a string rather than a numerical value for unexpected DLPI primitives. Cast the argument to <ctype.h> macros to "unsigned char", to eliminate GCC warnings and to keep the macros from referring outside an array when handed bytes with the 8th bit set.
* The "dl_module_id_1" and "dl_module_id_2" members of aguy2001-06-271-3/+3
| | | | | | | "dl_hp_ppa_info_t" are arrays of "u_char" (or "u_int8_t"), presumably to get around the problems of signed characters; this causes complaints from HP's C compiler if we pass them as an argument to "strcmp()", so cast them to "const char *".
* Put the code to get a unit number from a device name into a commonguy2001-05-211-33/+61
| | | | | | | | | routine, and use it both on HP-UX and other DLPI systems; this means that, in case there is ever a network device on HP-UX with a number in the device type name, we'll properly extract the unit number (i.e., we'll extract the last number from the name, not the first number) - I don't think that'll ever happen, but putting it into a common routine is cleaner in any case.
* Patch from Xianjie Zhang <xzhang@cup.hp.com> to handle HP-UX systemsguy2001-05-211-6/+76
| | | | with a large number of PPA's.
* Patch from Stefan Hudson <hudson@mbay.net> to handle, on Solaris, deviceguy2001-05-211-6/+11
| | | | class names with digits in them.
* Patch from Onno van der Linden <onno@simplex.nl> to support Token Ringguy2001-02-211-1/+6
| | | | on DLPI systems.
* Fix a couple of error messages.guy2000-11-221-3/+3
|
* When attaching a "bpf_program" to a "pcap_t" to use as a userlandguy2000-10-281-2/+3
| | | | | | | | | | | | | | filter, always attach a copy, as "pcap-linux.c" does; that way, after a program uses "pcap_setfilter()", it can safely use "pcap_freecode()" to free up the BPF instructions allocated by "pcap_compile()". Also, always free it up when the "pcap_t" is closed. Get rid of the "pcap_t *" argument to "pcap_freecode()", as it's not necessary. Document "pcap_freecode()", for the benefit of programs that might repeatedly compile filter programs and attach them, so that they can free them up after attaching them and avoid leaking memory for them.
* Get rid of the PCAP_ENCAP_ values - if an application uses them, thatguy2000-10-121-3/+3
| | | | | | | | | | | | | | | | | | application won't build with any other version of libpcap, which means that a lot of applications won't use them. In addition, "pcap_linktype()" needs to return DLT_ values, so that platforms that build libpcap as a shared library won't break binary compatibility if they update to this version of libpcap. Instead, we map from DLT_ values to LINKTYPE_ values when writing savefiles, and map from LINKTYPE_ values to DLT_ values when reading savefiles, so that savefiles don't have platform-dependent DLT_ values in the header as the link type, they have platform-independent LINKTYPE_ values. This means we don't need to make DLT_ATM_RFC1483, DLT_RAW, etc. have platform-independent values starting at 100 - only the values in the savefile header need to be like that.
* Introduce a set of PCAP_ENCAP_ codes to specify packet encapsulations.guy2000-09-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For those PCAP_ENCAP_ codes corresponding to DLT_ codes that are (believed to be) the same in all BSDs, the PCAP_ENCAP_ codes have the same values as the corresponding DLT_ codes. For those PCAP_ENCAP_ codes corresponding to DLT_ codes that were added in libpcap 0.5 as "non-kernel" DLT_ codes, or had their values changed in libpcap 0.5 in order to cope with the fact that those DLT_ codes have different values in different systems, the PCAP_ENCAP_ codes have the same values as the corresponding DLT_ codes. We add some additional PCAP_ENCAP_ codes to handle IEEE 802.11 (which currently has its link-layer information turned into an Ethernet header by at least some of the BSDs, but John Hawkinson at MIT wants to add a DLT_ value for 802.11 and pass up the full link-layer header) and the Classical IP encapsulation for ATM on Linux (which isn't always the same as DLT_ATM_RFC1483, from what I can tell, alas). "pcap-bpf.c" maps DLT_ codes to PCAP_ENCAP_ codes, so as not to supply to libpcap's callers any DLT_ codes other than the ones that have the same values on all platforms; it supplies PCAP_ENCAP_ codes for all others. In libpcap's "bpf/net/bpf.h", we define the DLT_ values that aren't the same on all platforms with the new values starting at 100 (to keep them out of the way of the values various BSDs might assign to them), as we did in 0.5, but do so only if they're not already defined; platforms with <net/bpf.h> headers that come with the kernel (e.g., the BSDs) should define them with the values that they have always had on that platform, *not* with the values we used in 0.5. (Code using this version of libpcap should check for the new PCAP_ENCAP_ codes; those are given the values that the corresponding DLT_ values had in 0.5, so code that checks for them will handle 0.5 libpcap files correctly even if the platform defines DLT_RAW, say, as something other than 101. If that code also checks for DLT_RAW - which means it can't just use a switch statement, as DLT_RAW might be defined as 101 if the platform doesn't itself define DLT_RAW with some other value - then it will also handle old DLT_RAW captures, as long as they were made on the same platform or on another platform that used the same value for DLT_RAW. It can't handle captures from a platform that uses that value for another DLT_ code, but that's always been the case, and isn't easily fixable.) The intent here is to decouple the values that are returned by "pcap_datalink()" and put into the header of tcpdump/libpcap save files from the DLT_ values returned by BIOCGDLT in BSD kernels, allowing the BSDs to assign values to DLT_ codes, in their kernels, as they choose, without creating more incompatibilities between tcpdump/libpcap save files from different platforms.
* Change the message issued on HP-UX if we can't find the PPA for aguy2000-08-131-2/+2
| | | | | | | | | | | | | | network device, so that 1) you can infer from the message whether the program is using the old version of the code to get the PPA (which didn't work all that well) or the newer version, without having to prod a user complaining about tcpdump/Ethereal/whatever not working to tell you which version of libpcap they're using; 2) programs can perhaps check the error message returned by libpcap and, if it's the old error message, tell the user that the problem may be that they're using an old libpcap.
* add config.h, remove gnuc.h. remove __deadassar2000-07-111-2/+5
|
* add code for handling find the correct dlpi device on HP-UX 11.0assar2000-07-061-34/+159
| | | | From: Guy Harris <gharris@flashcom.net>
* s/PCAP_ERRBUFF_SIZE/PCAP_ERRBUF_SIZE/ (fatal typo)itojun2000-04-271-33/+33
|
* nuke strcpy()itojun2000-04-271-5/+6
|
* do not use sprintf(). always use snprintf().itojun2000-04-271-36/+64
| | | | | | from NetBSD/OpenBSD src/lib/libpcap. use freeifaddrs() if exists.
* bumped version to 0.5mcr2000-01-251-1/+8
|
* Initial revisionmcr1999-10-071-0/+848