From: Francois-Xavier Le Bail Date: Sun, 8 Mar 2015 20:39:43 +0000 (+0100) Subject: Delete trailing spaces/tabs X-Git-Tag: libpcap-1.7.2^2~2 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/f0b11471594801ed0bfbf7af9bba164ccc134ac5 Delete trailing spaces/tabs --- diff --git a/CREDITS b/CREDITS index 2c6ed958..b40152f5 100644 --- a/CREDITS +++ b/CREDITS @@ -46,7 +46,7 @@ Additional people who have contributed patches: David Young Dean Gaudet dhruv - Don Ebright + Don Ebright Dug Song Dustin Spicuzza dzejarczech diff --git a/INSTALL.txt b/INSTALL.txt index 12f19ccd..18b489aa 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -178,14 +178,14 @@ packet timestamps aren't very good. This appears to be due to haphazard handling of the timestamp in the kernel. Note well: there is rumoured to be a version of tcpdump floating around -called 3.0.3 that includes libpcap and is supposed to support Linux. +called 3.0.3 that includes libpcap and is supposed to support Linux. You should be advised that neither the Network Research Group at LBNL -nor the Tcpdump Group ever generated a release with this version number. +nor the Tcpdump Group ever generated a release with this version number. The LBNL Network Research Group notes with interest that a standard cracker trick to get people to install trojans is to distribute bogus -packages that have a version number higher than the current release. +packages that have a version number higher than the current release. They also noted with annoyance that 90% of the Linux related bug reports -they got are due to changes made to unofficial versions of their page. +they got are due to changes made to unofficial versions of their page. If you are having trouble but aren't using a version that came from tcpdump.org, please try that before submitting a bug report! diff --git a/LICENSE b/LICENSE index dea5f7d5..a10474d5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,9 @@ License: BSD - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright @@ -13,7 +13,7 @@ are met: 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. diff --git a/README b/README index 46fcc568..9f65948d 100644 --- a/README +++ b/README @@ -76,15 +76,15 @@ information on configuring that option. Note to Linux distributions and *BSD systems that include libpcap: -There's now a rule to make a shared library, which should work on Linux +There's now a rule to make a shared library, which should work on Linux and *BSD, among other platforms. -It sets the soname of the library to "libpcap.so.1"; this is what it -should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as +It sets the soname of the library to "libpcap.so.1"; this is what it +should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as that. -We've been maintaining binary compatibility between libpcap releases for -quite a while; there's no reason to tie a binary linked with libpcap to +We've been maintaining binary compatibility between libpcap releases for +quite a while; there's no reason to tie a binary linked with libpcap to a particular release of libpcap. Problems, bugs, questions, desirable enhancements, etc. should be sent diff --git a/README.Win32 b/README.Win32 index 503836e3..0a42dab9 100644 --- a/README.Win32 +++ b/README.Win32 @@ -1,9 +1,9 @@ -Under Win32, libpcap is integrated in the WinPcap packet capture system. -WinPcap provides a framework that allows libpcap to capture the packets -under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000 +Under Win32, libpcap is integrated in the WinPcap packet capture system. +WinPcap provides a framework that allows libpcap to capture the packets +under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000 and Windows XP. -WinPcap binaries and source code can be found at http://winpcap.polito.it: -they include also a developer's pack with all the necessary to compile +WinPcap binaries and source code can be found at http://winpcap.polito.it: +they include also a developer's pack with all the necessary to compile libpcap-based applications under Windows. How to compile libpcap with Visual Studio @@ -12,35 +12,35 @@ How to compile libpcap with Visual Studio In order to compile libpcap you will need: - version 6 (or higher) of Microsoft Visual Studio -- The November 2001 (or later) edition of Microsoft Platform -Software Development Kit (SDK), that contains some necessary includes +- The November 2001 (or later) edition of Microsoft Platform +Software Development Kit (SDK), that contains some necessary includes for IPv6 support. You can download it from http://www.microsoft.com/sdk -- the latest WinPcap sources from http://winpcap.polito.it/install +- the latest WinPcap sources from http://winpcap.polito.it/install -The WinPcap source code already contains a recent (usually the latest -stable) version of libpcap. If you need to compile a different one, -simply download it from www.tcpdump.org and copy the sources in the +The WinPcap source code already contains a recent (usually the latest +stable) version of libpcap. If you need to compile a different one, +simply download it from www.tcpdump.org and copy the sources in the winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to -compile a libpcap source retrieved from the tcpdump.org Git, you will -have to create the scanner and the grammar by hand (with lex and yacc) +compile a libpcap source retrieved from the tcpdump.org Git, you will +have to create the scanner and the grammar by hand (with lex and yacc) or with the cygnus makefile, since The Visual Studio project is not able to build them. -Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and -build wpcap.dll. wpcap.lib, the library file to link with the applications, -will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in -winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type +Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and +build wpcap.dll. wpcap.lib, the library file to link with the applications, +will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in +winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type of binary that is being created. How to compile libpcap with Cygnus ---------------------------------- -To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code -distribution and type "make". libwpcap.a, the library file to link with the -applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be +To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code +distribution and type "make". libwpcap.a, the library file to link with the +applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in winpcap\wpcap\prj. -Remember, you CANNOT use the MSVC-generated .lib files with gcc, use +Remember, you CANNOT use the MSVC-generated .lib files with gcc, use libwpcap.a instead. "make install" installs wpcap.dll in the Windows system folder. diff --git a/README.aix b/README.aix index f457df32..92e513ff 100644 --- a/README.aix +++ b/README.aix @@ -76,8 +76,8 @@ If you use DLPI: Then you need to type: strload -f /etc/dlpi.conf - - Check again with strload -q -d dlpi that the dlpi driver is loaded. + + Check again with strload -q -d dlpi that the dlpi driver is loaded. Alternatively, you can uncomment the lines for DLPI in /etc/pse.conf and reboot the machine; this way DLPI will always diff --git a/README.hpux b/README.hpux index 88c27f8a..65ecff97 100644 --- a/README.hpux +++ b/README.hpux @@ -5,14 +5,14 @@ HP-UX and cannot upgrade, please continue reading. HP-UX patches to fix packet capture problems Note that packet-capture programs such as tcpdump may, on HP-UX, not be -able to see packets sent from the machine on which they're running. +able to see packets sent from the machine on which they're running. Some articles on groups.google.com discussing this are: http://groups.google.com/groups?selm=82ld3v%2480i%241%40mamenchi.zrz.TU-Berlin.DE which says: - Newsgroups: comp.sys.hp.hpux + Newsgroups: comp.sys.hp.hpux Subject: Re: Did someone made tcpdump working on 10.20 ? Date: 12/08/1999 From: Lutz Jaenicke @@ -27,14 +27,14 @@ which says: >must me "patched" (poked) in order to see outbound data in promiscuous mode. >Many things to do .... So the question is : did someone has already this >"ready to use" PHNE_**** patch ? - + Two things: 1. You do need a late "LAN products cumulative patch" (e.g. PHNE_18173 for s700/10.20). 2. You must use echo 'lanc_outbound_promisc_flag/W1' | /usr/bin/adb -w /stand/vmunix /dev/kmem You can insert this e.g. into /sbin/init.d/lan - + Best regards, Lutz @@ -44,7 +44,7 @@ and which says: - Newsgroups: comp.sys.hp.hpux + Newsgroups: comp.sys.hp.hpux Subject: Re: tcpdump only shows incoming packets Date: 02/15/2000 From: Rick Jones @@ -56,12 +56,12 @@ which says: > outgoing. I have tried tcpflow-0.12 which also uses libpcap and the > same thing happens. Could someone please give me a hint on how to > get this right? - + Search/Read the archives ?-) - + What you are seeing is expected, un-patched, behaviour for an HP-UX system. On 11.00, you need to install the latest lancommon/DLPI - patches, and then the latest driver patch for the interface(s) in use. + patches, and then the latest driver patch for the interface(s) in use. At that point, a miracle happens and you should start seeing outbound traffic. @@ -79,7 +79,7 @@ which says: From: Harald Skotnes Rick Jones wrote: - + ... > What you are seeing is expected, un-patched, behaviour for an HP-UX @@ -87,7 +87,7 @@ which says: > patches, and then the latest driver patch for the interface(s) in > use. At that point, a miracle happens and you should start seeing > outbound traffic. - + Thanks a lot. I have this problem on several machines running HPUX 10.20 and 11.00. The machines where patched up before y2k so did not know what to think. Anyway I have now installed PHNE_19766, @@ -101,7 +101,7 @@ And another message to tcpdump-workers@tcpdump.org, from Rick Jones: Date: Mon, 29 Apr 2002 15:59:55 -0700 From: Rick Jones - To: tcpdump-workers@tcpdump.org + To: tcpdump-workers@tcpdump.org Subject: Re: [tcpdump-workers] I Can't Capture the Outbound Traffic ... @@ -130,21 +130,21 @@ captures on HP-UX 9.x: Dave Barr (barr@cis.ohio-state.edu) wrote: : Has anyone ported tcpdump (or something similar) to HP/UX 9.x? - + I'm reasonably confident that any port of tcpdump to 9.X would require the (then optional) STREAMS product. This would bring DLPI, which is what one uses to access interfaces in promiscuous mode. - + I'm not sure that HP even sells the 9.X STREAMS product any longer, since HP-UX 9.X is off the pricelist (well, maybe 9.10 for the old 68K - devices). - + devices). + Your best bet is to be up on 10.20 or better if that is at all - possible. If your hardware is supported by it, I'd go with HP-UX 11. + possible. If your hardware is supported by it, I'd go with HP-UX 11. If you want to see the system's own outbound traffic, you'll never get that functionality on 9.X, but it might happen at some point for 10.20 - and 11.X. - + and 11.X. + rick jones (as per other messages cited here, the ability to see the system's own @@ -178,12 +178,12 @@ An additional note, from Jost Martin, for HP-UX 10.20: (thanks to hildeb@www.stahl.bau.tu-bs.de (Ralf Hildebrandt) who posted the security-part some time ago) - <> + <> (Don't switch IP-forwarding off, if you need it !) Install the hack as /sbin/init.d/hacl_ip_stack (adjust permissions !) and make a sequencing-symlink - /sbin/rc2.d/S350hack_ip_stack pointing to this script. + /sbin/rc2.d/S350hack_ip_stack pointing to this script. Now all this is done on every reboot. According to Rick Jones, the global promiscuous switch also has to be diff --git a/README.linux b/README.linux index f92cd22b..ffcb9288 100644 --- a/README.linux +++ b/README.linux @@ -19,13 +19,13 @@ the 2.0[.x] kernel: The Packet protocol is used by applications which communicate directly with network devices without an intermediate network protocol implemented in the kernel, e.g. tcpdump. If you want them - to work, choose Y. + to work, choose Y. This driver is also available as a module called af_packet.o ( = code which can be inserted in and removed from the running kernel whenever you want). If you want to compile it as a module, say M here and read Documentation/modules.txt; if you use modprobe or - kmod, you may also want to add "alias net-pf-17 af_packet" to + kmod, you may also want to add "alias net-pf-17 af_packet" to /etc/modules.conf. and the note for the 2.2[.x] kernel says: @@ -47,7 +47,7 @@ In addition, there is an option that, in 2.2 and later kernels, will allow packet capture filters specified to programs such as tcpdump to be executed in the kernel, so that packets that don't pass the filter won't be copied from the kernel to the program, rather than having all packets -copied to the program and libpcap doing the filtering in user mode. +copied to the program and libpcap doing the filtering in user mode. Copying packets from the kernel to the program consumes a significant amount of CPU, so filtering in the kernel can reduce the overhead of diff --git a/README.septel b/README.septel index fbc88df3..483de6a7 100644 --- a/README.septel +++ b/README.septel @@ -14,7 +14,7 @@ where DIR is the root of the Septel software distribution, for example /var/src/septel. By default (if you write only ./configure --with-septel) it takes -./../septel as argument for DIR. +./../septel as argument for DIR. If the Septel software is correctly detected 'configure' will report: diff --git a/README.tru64 b/README.tru64 index 7fe1ef07..2420d9e1 100644 --- a/README.tru64 +++ b/README.tru64 @@ -1,4 +1,4 @@ -The following instructions are applicable to Tru64 UNIX +The following instructions are applicable to Tru64 UNIX (formerly Digital UNIX (formerly DEC OSF/1)) version 4.0, and probably to later versions as well; at least some options apply to Digital UNIX 3.2 - perhaps all do. diff --git a/TODO b/TODO index 73325e19..aae24c22 100644 --- a/TODO +++ b/TODO @@ -6,11 +6,11 @@ Important stuff (to be done before the next release) General -- configure should not be in Git. Most open source projects have an - autogen.sh script to run autoconf etc. after checkout. I think we - should stick to the standard. +- configure should not be in Git. Most open source projects have an + autogen.sh script to run autoconf etc. after checkout. I think we + should stick to the standard. -- The source files should be better documented. There is no official +- The source files should be better documented. There is no official design guideline for what is done where. There should be a common coding style (okay, you can guess that by looking at the code) and a guide for what needs to be documented. @@ -18,7 +18,7 @@ General Less urgent items ----------------- -- Better documentation and cleanup of the interface. I am seeing a few +- Better documentation and cleanup of the interface. I am seeing a few problems at the first glance which needs fixing: + pcap_lookupnet makes little to no sense with protocols != IPv4 + not very well suited for interactive programs (think ethereal). There diff --git a/Win32/Include/addrinfo.h b/Win32/Include/addrinfo.h index 4db7384a..ac4fcce1 100644 --- a/Win32/Include/addrinfo.h +++ b/Win32/Include/addrinfo.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -92,13 +92,13 @@ extern const char *inet_ntop (int, const void *, char *, size_t); #ifndef EAI_BADHINTS #define EAI_BADHINTS 12 -#endif +#endif -#ifndef EAI_PROTOCOL +#ifndef EAI_PROTOCOL #define EAI_PROTOCOL 13 #endif -#ifndef EAI_MAX +#ifndef EAI_MAX #define EAI_MAX 14 #endif diff --git a/Win32/Include/arpa/nameser.h b/Win32/Include/arpa/nameser.h index 18f185cf..b20dc1e3 100644 --- a/Win32/Include/arpa/nameser.h +++ b/Win32/Include/arpa/nameser.h @@ -3,7 +3,7 @@ * - * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -19,7 +19,7 @@ * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -33,14 +33,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -69,7 +69,7 @@ # include #endif #include -#else +#else #include #define __LITTLE_ENDIAN 1 #define __BYTE_ORDER __LITTLE_ENDIAN diff --git a/Win32/Include/bittypes.h b/Win32/Include/bittypes.h index 7c0cbdeb..95aa9faa 100644 --- a/Win32/Include/bittypes.h +++ b/Win32/Include/bittypes.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -34,7 +34,7 @@ typedef unsigned char u_int8_t; typedef signed char int8_t; #endif /* HAVE_U_INT8_T */ -#ifndef HAVE_U_INT16_T +#ifndef HAVE_U_INT16_T typedef unsigned short u_int16_t; typedef signed short int16_t; #endif /* HAVE_U_INT16_T */ diff --git a/Win32/Include/cdecl_ext.h b/Win32/Include/cdecl_ext.h index 9591db26..9d40b84c 100644 --- a/Win32/Include/cdecl_ext.h +++ b/Win32/Include/cdecl_ext.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/Win32/Include/net/if.h b/Win32/Include/net/if.h index bf926b6e..58d3c16e 100644 --- a/Win32/Include/net/if.h +++ b/Win32/Include/net/if.h @@ -36,7 +36,7 @@ #ifndef _NET_IF_H_ #define _NET_IF_H_ - + /* * does not depend on on most other systems. This * helps userland compatability. (struct timeval ifi_lastchange) diff --git a/Win32/Include/sockstorage.h b/Win32/Include/sockstorage.h index 557eb4df..cbad1900 100644 --- a/Win32/Include/sockstorage.h +++ b/Win32/Include/sockstorage.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/Win32/Prj/libpcap.dsp b/Win32/Prj/libpcap.dsp index 17e5a703..7082122c 100644 --- a/Win32/Prj/libpcap.dsp +++ b/Win32/Prj/libpcap.dsp @@ -7,19 +7,19 @@ CFG=libpcap - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "libpcap.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "libpcap.mak" CFG="libpcap - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "libpcap - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "libpcap - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -74,7 +74,7 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo -!ENDIF +!ENDIF # Begin Target diff --git a/Win32/Src/gai_strerror.c b/Win32/Src/gai_strerror.c index edd970b9..a36c35d8 100644 --- a/Win32/Src/gai_strerror.c +++ b/Win32/Src/gai_strerror.c @@ -67,7 +67,7 @@ static char *ai_errlist[] = { #define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0])) #endif -/* on MingW, gai_strerror is available. +/* on MingW, gai_strerror is available. We need to compile gai_strerrorA only for Cygwin */ #ifndef gai_strerror diff --git a/Win32/Src/getaddrinfo.c b/Win32/Src/getaddrinfo.c index 19ffa68a..d3ebda08 100644 --- a/Win32/Src/getaddrinfo.c +++ b/Win32/Src/getaddrinfo.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,11 +49,11 @@ * Mingw64 has its own implementation of getaddrinfo, mingw32 no */ #ifndef __MINGW64__ - + #ifdef HAVE_CONFIG_H #include -#endif +#endif #include #if 0 @@ -71,17 +71,17 @@ #ifndef HAVE_PORTABLE_PROTOTYPE #include "cdecl_ext.h" -#endif +#endif #ifndef HAVE_U_INT32_T #include "bittypes.h" -#endif +#endif #ifndef HAVE_SOCKADDR_STORAGE #ifndef __MINGW32__ #include "sockstorage.h" #endif -#endif +#endif #ifdef NEED_ADDRINFO_H #include "addrinfo.h" @@ -109,7 +109,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in6_addrany[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in_loopback[] = { 127, 0, 0, 1 }; static const char in6_loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; @@ -127,7 +127,7 @@ static const struct afd { int a_socklen; int a_off; const char *a_addrany; - const char *a_loopback; + const char *a_loopback; int a_scoped; } afdl [] = { #ifdef INET6 @@ -330,7 +330,7 @@ getaddrinfo(hostname, servname, hints, res) pai->ai_canonname = NULL; pai->ai_addr = NULL; pai->ai_next = NULL; - + if (hostname == NULL && servname == NULL) return EAI_NONAME; if (hints) { @@ -820,7 +820,7 @@ explore_numeric(pai, hostname, servname, res) } while (cur && cur->ai_next) cur = cur->ai_next; - } else + } else ERR(EAI_FAMILY); /*xxx*/ } @@ -955,7 +955,7 @@ get_name(addr, afd, res, numaddr, pai, servname) GET_AI(cur, afd, numaddr); GET_PORT(cur, servname); } - + #ifdef USE_GETIPNODEBY if (hp) freehostent(hp); diff --git a/Win32/Src/getnetent.c b/Win32/Src/getnetent.c index d4cceb33..95281a54 100644 --- a/Win32/Src/getnetent.c +++ b/Win32/Src/getnetent.c @@ -85,7 +85,7 @@ again: net.n_net = inet_network(cp); net.n_addrtype = AF_INET; q = net.n_aliases = net_aliases; - if (p != NULL) + if (p != NULL) cp = p; while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { diff --git a/Win32/Src/inet_aton.c b/Win32/Src/inet_aton.c index cbd43619..db97bcea 100644 --- a/Win32/Src/inet_aton.c +++ b/Win32/Src/inet_aton.c @@ -2,27 +2,27 @@ * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Kungliga Tekniska * Högskolan and its contributors. - * + * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/Win32/Src/inet_pton.c b/Win32/Src/inet_pton.c index fe89bb59..7fe3813a 100644 --- a/Win32/Src/inet_pton.c +++ b/Win32/Src/inet_pton.c @@ -2,27 +2,27 @@ * Copyright (c) 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Kungliga Tekniska * Högskolan and its contributors. - * + * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/aclocal.m4 b/aclocal.m4 index 31a18e10..02502b27 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -231,7 +231,7 @@ AC_DEFUN(AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR, # We're assuming this is clang, where # -Werror=unknown-warning-option is the appropriate # option to force the compiler to fail. - # + # ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option" ], [ @@ -1274,7 +1274,7 @@ dnl dnl AC_LBL_DL_PASSIVE_REQ_T dnl dnl results: -dnl +dnl dnl HAVE_DLPI_PASSIVE (defined) dnl AC_DEFUN(AC_LBL_DL_PASSIVE_REQ_T, diff --git a/doc/pcap.html b/doc/pcap.html index 94e35140..cb6abe55 100644 --- a/doc/pcap.html +++ b/doc/pcap.html @@ -16,7 +16,7 @@ font-weight: bold; text-align: right; font-family: helvetica, arial, sans-serif; background-color: transparent; } - td.rfcbug { background-color: #000000 ; width: 30px ; height: 30px ; + td.rfcbug { background-color: #000000 ; width: 30px ; height: 30px ; text-align: justify; vertical-align: middle ; padding-top: 2px ; } td.rfcbug span.RFC { color: #666666; font-weight: bold; text-decoration: none; background-color: #000000 ; @@ -205,8 +205,8 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          Block Type                           |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -287,13 +287,13 @@ Intellectual Property and Copyright Statements
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SHB v1.0 | Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - Typical configuration with a single Section Header Block + Typical configuration with a single Section Header Block |-- 1st Section --|-- 2nd Section --|-- 3rd Section --| | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | SHB v1.0 | Data | SHB V1.1 | Data | SHB V1.0 | Data | + | SHB v1.0 | Data | SHB V1.1 | Data | SHB V1.0 | Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Configuration with three different Section Header Blocks
@@ -321,16 +321,16 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                            Magic                              |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |              Major            |             Minor             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
+   /                                                               /
+   /                      Options (variable)                       /
+   /                                                               /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
 Section Header Block format. 

@@ -386,16 +386,16 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Interface ID         |           LinkType            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                            SnapLen                            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
+   /                                                               /
+   /                      Options (variable)                       /
+   /                                                               /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  
 Interface Description Block format. 

@@ -495,8 +495,8 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         Interface ID          |          Drops Count          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -514,9 +514,9 @@ Intellectual Property and Copyright Statements
| /* variable length, byte-aligned */ | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 Packet Block format. 

@@ -555,8 +555,8 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          Packet Len                           |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -589,10 +589,10 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |      Record Type              |         Record Length         | 
+   |      Record Type              |         Record Length         |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                       Record Value                            |
    |              /* variable length, byte-aligned */              |
@@ -602,9 +602,9 @@ Intellectual Property and Copyright Statements
. . . other records . . . | Record Type == end_of_recs | Record Length == 00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 Name Resolution Block format. 

@@ -666,8 +666,8 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                         IfRecv                                |
    |                          (high + low)                         |
@@ -686,9 +686,9 @@ Intellectual Property and Copyright Statements
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Interface ID | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 Interface Statistics Block format. 

@@ -759,10 +759,10 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |      Option Code              |         Option Length         | 
+   |      Option Code              |         Option Length         |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                       Option Value                            |
    |              /* variable length, byte-aligned */              |
@@ -814,8 +814,8 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |  Compr. Type  |                                               |
    +-+-+-+-+-+-+-+-+                                               |
@@ -842,8 +842,8 @@ Intellectual Property and Copyright Statements



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |   Encr. Type  |                                               |
    +-+-+-+-+-+-+-+-+                                               |
@@ -871,8 +871,8 @@ A Fixed Length Block stores records with constant size. It contains a set of Blo
 



-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Cell Size            |                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
diff --git a/doc/pcap.xml b/doc/pcap.xml
index ebbf3217..1fb0eb71 100644
--- a/doc/pcap.xml
+++ b/doc/pcap.xml
@@ -72,8 +72,8 @@
 
 
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Block Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -136,13 +136,13 @@ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SHB v1.0 | Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - Typical configuration with a single Section Header Block + Typical configuration with a single Section Header Block |-- 1st Section --|-- 2nd Section --|-- 3rd Section --| | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | SHB v1.0 | Data | SHB V1.1 | Data | SHB V1.0 | Data | + | SHB v1.0 | Data | SHB V1.1 | Data | SHB V1.0 | Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Configuration with three different Section Header Blocks @@ -170,16 +170,16 @@ The Section Header Block is mandatory. It identifies the beginning of a section of the capture dump file. Its format is shown in .
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Magic | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Major | Minor | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -227,16 +227,16 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Interface ID | LinkType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SnapLen | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -296,7 +296,7 @@ 9 4 Time zone for GMT support (TODO: specify better). - + if_flags 10 4 @@ -323,8 +323,8 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Interface ID | Drops Count | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -342,9 +342,9 @@ | /* variable length, byte-aligned */ | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -374,8 +374,8 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Packet Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -408,10 +408,10 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Record Type | Record Length | + | Record Type | Record Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Record Value | | /* variable length, byte-aligned */ | @@ -421,9 +421,9 @@ . . . other records . . . | Record Type == end_of_recs | Record Length == 00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -479,8 +479,8 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | IfRecv | | (high + low) | @@ -499,9 +499,9 @@ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Interface ID | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - / / - / Options (variable) / - / / + / / + / Options (variable) / + / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -561,10 +561,10 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Option Code | Option Length | + | Option Code | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Value | | /* variable length, byte-aligned */ | @@ -615,8 +615,8 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Compr. Type | | +-+-+-+-+-+-+-+-+ | @@ -644,8 +644,8 @@
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encr. Type | | +-+-+-+-+-+-+-+-+ | @@ -673,8 +673,8 @@ A Fixed Length Block stores records with constant size. It contains a set of Blo
- 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cell Size | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | diff --git a/fad-gifc.c b/fad-gifc.c index 5c3357c7..b0a4105a 100644 --- a/fad-gifc.c +++ b/fad-gifc.c @@ -217,12 +217,12 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) /* * XXX - The 32-bit compatibility layer for Linux on IA-64 * is slightly broken. It correctly converts the structures - * to and from kernel land from 64 bit to 32 bit but - * doesn't update ifc.ifc_len, leaving it larger than the - * amount really used. This means we read off the end - * of the buffer and encounter an interface with an - * "empty" name. Since this is highly unlikely to ever - * occur in a valid case we can just finish looking for + * to and from kernel land from 64 bit to 32 bit but + * doesn't update ifc.ifc_len, leaving it larger than the + * amount really used. This means we read off the end + * of the buffer and encounter an interface with an + * "empty" name. Since this is highly unlikely to ever + * occur in a valid case we can just finish looking for * interfaces if we see an empty name. */ if (!(*ifrp->ifr_name)) diff --git a/fad-win32.c b/fad-win32.c index 0de893ef..0c856b18 100644 --- a/fad-win32.c +++ b/fad-win32.c @@ -12,9 +12,9 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -127,7 +127,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) char *AdaptersName; ULONG NameLength; char *name; - + /* * Find out how big a buffer we need. * @@ -170,7 +170,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) { snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters."); return (-1); - } + } if (!PacketGetAdapterNames(AdaptersName, &NameLength)) { snprintf(errbuf, PCAP_ERRBUF_SIZE, @@ -179,7 +179,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) free(AdaptersName); return (-1); } - + /* * "PacketGetAdapterNames()" returned a list of * null-terminated ASCII interface name strings, @@ -195,7 +195,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) desc = &AdaptersName[0]; while (*desc != '\0' || *(desc + 1) != '\0') desc++; - + /* * Found it - "desc" points to the first of the two * nulls at the end of the list of names, so the @@ -203,7 +203,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) * after it. */ desc += 2; - + /* * Loop over the elements in the first list. */ @@ -231,7 +231,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) if (pcap_platform_finddevs(&devlist, errbuf) < 0) ret = -1; } - + if (ret == -1) { /* * We had an error; free the list we've been constructing. @@ -241,7 +241,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) devlist = NULL; } } - + *alldevsp = devlist; free(AdaptersName); return (ret); diff --git a/gencode.c b/gencode.c index 33e7ee9c..ad938d47 100644 --- a/gencode.c +++ b/gencode.c @@ -8284,7 +8284,7 @@ gen_geneve_offsets(void) s = new_stmt(BPF_ALU|BPF_ADD|BPF_K); s->s.k = off_linkpl.constant_part + off_nl + 8; - /* Stash this in X since we'll need it later. */ + /* Stash this in X since we'll need it later. */ s1 = new_stmt(BPF_MISC|BPF_TAX); sappend(s, s1); diff --git a/gencode.h b/gencode.h index 6c05b393..67ed0dc0 100644 --- a/gencode.h +++ b/gencode.h @@ -161,7 +161,7 @@ #define A_CONNECTACK 44 /* Connect Ack message */ #define A_RELEASE 45 /* Release message */ #define A_RELEASE_DONE 46 /* Release message */ - + /* ATM field types */ #define A_VPI 51 #define A_VCI 52 diff --git a/grammar.y b/grammar.y index ad989646..995a514e 100644 --- a/grammar.y +++ b/grammar.y @@ -300,7 +300,7 @@ pfaction_to_num(const char *action) %token IPV6 ICMPV6 AH ESP %token VLAN MPLS %token PPPOED PPPOES GENEVE -%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP +%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP %token STP %token IPX %token NETBEUI @@ -310,7 +310,7 @@ pfaction_to_num(const char *action) %token RADIO %token FISU LSSU MSU HFISU HLSSU HMSU %token SIO OPC DPC SLS HSIO HOPC HDPC HSLS - + %type ID %type EID @@ -386,7 +386,7 @@ nid: ID { $$.b = gen_scode($1, $$.q = $0.q); } "in this configuration"); #endif /*INET6*/ } - | EID { + | EID { $$.b = gen_ecode($1, $$.q = $0.q); /* * $1 was allocated by "pcap_ether_aton()", diff --git a/install-sh b/install-sh index ebc66913..058b26c8 100755 --- a/install-sh +++ b/install-sh @@ -115,7 +115,7 @@ fi if [ x"$dir_arg" != x ]; then dst=$src src="" - + if [ -d $dst ]; then instcmd=: else @@ -124,7 +124,7 @@ if [ x"$dir_arg" != x ]; then else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] @@ -134,7 +134,7 @@ else echo "install: $src does not exist" exit 1 fi - + if [ x"$dst" = x ] then echo "install: no destination specified" @@ -162,7 +162,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' +defaultIFS=' ' IFS="${IFS-${defaultIFS}}" @@ -201,17 +201,17 @@ else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] + if [ x"$transformarg" = x ] then dstfile=`basename $dst` else - dstfile=`basename $dst $transformbasename | + dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] + if [ x"$dstfile" = x ] then dstfile=`basename $dst` else @@ -242,7 +242,7 @@ else # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $mvcmd $dsttmp $dstdir/$dstfile fi && diff --git a/lbl/os-osf4.h b/lbl/os-osf4.h index 6b87bc05..f461eeaf 100644 --- a/lbl/os-osf4.h +++ b/lbl/os-osf4.h @@ -23,4 +23,4 @@ int snprintf(char *, size_t, const char *, ...); int vsnprintf(char *, size_t, const char *, va_list); int pfopen(char *, int); - + diff --git a/lbl/os-osf5.h b/lbl/os-osf5.h index 4c73c69f..52ab1750 100644 --- a/lbl/os-osf5.h +++ b/lbl/os-osf5.h @@ -27,4 +27,4 @@ int snprintf(char *, size_t, const char *, ...); int vsnprintf(char *, size_t, const char *, va_list); int pfopen(char *, int); - + diff --git a/msdos/makefile.dj b/msdos/makefile.dj index 28e3f2d7..ae20ada3 100644 --- a/msdos/makefile.dj +++ b/msdos/makefile.dj @@ -104,7 +104,7 @@ depend: $(PREREQUISITES) # # Manually generated dependencies -# +# msdos/pktdrvr.c: msdos/pkt_stub.inc scanner.c: scanner.l grammar.c tokdefs.h: grammar.y diff --git a/msdos/readme.dos b/msdos/readme.dos index 913c4e69..353d0cca 100644 --- a/msdos/readme.dos +++ b/msdos/readme.dos @@ -132,7 +132,7 @@ Extensions to libpcap I've included some extra functions to DOS-libpcap: - `pcap_config_hook (const char *name, const char *value)' + `pcap_config_hook (const char *name, const char *value)' Allows an application to set values of internal libpcap variables. `name' is typically a left-side keyword with an associated `value' diff --git a/pcap-bpf.c b/pcap-bpf.c index 2dedd4ad..b1da1a00 100644 --- a/pcap-bpf.c +++ b/pcap-bpf.c @@ -235,7 +235,7 @@ static int pcap_set_datalink_bpf(pcap_t *p, int dlt); */ static int pcap_getnonblock_bpf(pcap_t *p, char *errbuf) -{ +{ #ifdef HAVE_ZEROCOPY_BPF struct pcap_bpf *pb = p->priv; @@ -247,7 +247,7 @@ pcap_getnonblock_bpf(pcap_t *p, char *errbuf) static int pcap_setnonblock_bpf(pcap_t *p, int nonblock, char *errbuf) -{ +{ #ifdef HAVE_ZEROCOPY_BPF struct pcap_bpf *pb = p->priv; diff --git a/pcap-bpf.h b/pcap-bpf.h index 93745229..ebb64c3f 100644 --- a/pcap-bpf.h +++ b/pcap-bpf.h @@ -4,7 +4,7 @@ * * This code is derived from the Stanford/CMU enet packet filter, * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence * Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c index a32691d3..5bb627a8 100644 --- a/pcap-bt-linux.c +++ b/pcap-bt-linux.c @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -31,7 +31,7 @@ * By Paolo Abeni * */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -73,7 +73,7 @@ struct pcap_bt { int dev_id; /* device ID of device we're bound to */ }; -int +int bt_findalldevs(pcap_if_t **alldevsp, char *err_str) { struct hci_dev_list_req *dev_list; @@ -84,7 +84,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (sock < 0) { - /* if bluetooth is not supported this this is not fatal*/ + /* if bluetooth is not supported this this is not fatal*/ if (errno == EAFNOSUPPORT) return 0; snprintf(err_str, PCAP_ERRBUF_SIZE, @@ -93,7 +93,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) } dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list)); - if (!dev_list) + if (!dev_list) { snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list", HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list)); @@ -103,7 +103,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) dev_list->dev_num = HCI_MAX_DEV; - if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0) + if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0) { snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't get Bluetooth device list via ioctl: %s", @@ -115,11 +115,11 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) dev_req = dev_list->dev_req; for (i = 0; i < dev_list->dev_num; i++, dev_req++) { char dev_name[20], dev_descr[30]; - + snprintf(dev_name, 20, BT_IFACE"%d", dev_req->dev_id); snprintf(dev_descr, 30, "Bluetooth adapter number %d", i); - - if (pcap_add_if(alldevsp, dev_name, 0, + + if (pcap_add_if(alldevsp, dev_name, 0, dev_descr, err_str) < 0) { ret = -1; @@ -193,7 +193,7 @@ bt_activate(pcap_t* handle) if (sscanf(handle->opt.source, BT_IFACE"%d", &dev_id) != 1) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't get Bluetooth device index from %s", + "Can't get Bluetooth device index from %s", handle->opt.source); return PCAP_ERROR; } @@ -212,7 +212,7 @@ bt_activate(pcap_t* handle) handle->setnonblock_op = pcap_setnonblock_fd; handle->stats_op = bt_stats_linux; handlep->dev_id = dev_id; - + /* Create HCI socket */ handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (handle->fd < 0) { @@ -242,10 +242,10 @@ bt_activate(pcap_t* handle) goto close_fail; } - /* Setup filter, do not call hci function to avoid dependence on + /* Setup filter, do not call hci function to avoid dependence on * external libs */ memset(&flt, 0, sizeof(flt)); - memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask)); + memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask)); memset((void *) &flt.event_mask, 0xff, sizeof(flt.event_mask)); if (setsockopt(handle->fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, @@ -309,7 +309,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us bthdr = (pcap_bluetooth_h4_header*) &handle->buffer[handle->offset]; iv.iov_base = &handle->buffer[handle->offset+sizeof(pcap_bluetooth_h4_header)]; iv.iov_len = handle->snapshot; - + memset(&msg, 0, sizeof(msg)); msg.msg_iov = &iv; msg.msg_iovlen = 1; @@ -334,7 +334,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us pkth.caplen = ret; - /* get direction and timestamp*/ + /* get direction and timestamp*/ cmsg = CMSG_FIRSTHDR(&msg); int in=0; while (cmsg) { @@ -349,7 +349,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us } cmsg = CMSG_NXTHDR(&msg, cmsg); } - if ((in && (handle->direction == PCAP_D_OUT)) || + if ((in && (handle->direction == PCAP_D_OUT)) || ((!in) && (handle->direction == PCAP_D_IN))) return 0; @@ -371,10 +371,10 @@ bt_inject_linux(pcap_t *handle, const void *buf, size_t size) snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on " "bluetooth devices"); return (-1); -} +} -static int +static int bt_stats_linux(pcap_t *handle, struct pcap_stat *stats) { struct pcap_bt *handlep = handle->priv; @@ -382,28 +382,28 @@ bt_stats_linux(pcap_t *handle, struct pcap_stat *stats) struct hci_dev_info dev_info; struct hci_dev_stats * s = &dev_info.stat; dev_info.dev_id = handlep->dev_id; - + /* ignore eintr */ do { ret = ioctl(handle->fd, HCIGETDEVINFO, (void *)&dev_info); } while ((ret == -1) && (errno == EINTR)); - + if (ret < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't get stats via ioctl: %s", strerror(errno)); return (-1); - + } - /* we receive both rx and tx frames, so comulate all stats */ - stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx + + /* we receive both rx and tx frames, so comulate all stats */ + stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx + s->acl_tx +s->sco_tx; stats->ps_drop = s->err_rx + s->err_tx; stats->ps_ifdrop = 0; return 0; } -static int +static int bt_setdirection_linux(pcap_t *p, pcap_direction_t d) { p->direction = d; diff --git a/pcap-bt-linux.h b/pcap-bt-linux.h index cacbd2f1..e098654d 100644 --- a/pcap-bt-linux.h +++ b/pcap-bt-linux.h @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS diff --git a/pcap-canusb-linux.c b/pcap-canusb-linux.c index 99776f4d..f44c45e8 100644 --- a/pcap-canusb-linux.c +++ b/pcap-canusb-linux.c @@ -93,7 +93,7 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str) libusb_device** devs; unsigned char sernum[65]; int cnt, i; - + if (libusb_init(&fdctx) != 0) { /* * XXX - if this doesn't just mean "no USB file system mounted", @@ -101,7 +101,7 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str) * saying "no CANUSB devices". */ return 0; - } + } cnt = libusb_get_device_list(fdctx,&devs); @@ -112,24 +112,24 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str) struct libusb_device_descriptor desc; libusb_get_device_descriptor(devs[i],&desc); - if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID)) + if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID)) continue; //It is not, check next device - + //It is! libusb_device_handle *dh = NULL; if ((ret = libusb_open(devs[i],&dh)) == 0) { char dev_name[30]; - char dev_descr[50]; + char dev_descr[50]; int n = libusb_get_string_descriptor_ascii(dh,desc.iSerialNumber,sernum,64); sernum[n] = 0; snprintf(dev_name, 30, CANUSB_IFACE"%s", sernum); snprintf(dev_descr, 50, "CanUSB [%s]", sernum); - + libusb_close(dh); - + if (pcap_add_if(alldevsp, dev_name, 0, dev_descr, err_str) < 0) { libusb_free_device_list(devs,1); @@ -149,18 +149,18 @@ static libusb_device_handle* canusb_opendevice(struct libusb_context *ctx, char* libusb_device** devs; unsigned char serial[65]; int cnt,i,n; - + cnt = libusb_get_device_list(ctx,&devs); for(i=0;iwrpipe, F_SETFL, O_NONBLOCK); + + fcntl(canusb->wrpipe, F_SETFL, O_NONBLOCK); while(canusb->loop) { int sz; struct CAN_Msg msg; - + + libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100); + //HACK!!!!! -> drop buffered data, read new one by reading twice. libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100); - //HACK!!!!! -> drop buffered data, read new one by reading twice. - libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100); for(i = 0; idev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100); + libusb_bulk_transfer(canusb->dev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100); if(write(canusb->wrpipe, &msg, sizeof(msg)) < 0) fprintf(stderr,"write() error: %s\n", strerror(errno)); } } - + return NULL; } @@ -297,7 +297,7 @@ static int canusb_startcapture(struct pcap_canusb* this) this->rdpipe = pipefd[0]; this->wrpipe = pipefd[1]; - this->loop = 1; + this->loop = 1; pthread_create(&this->worker, NULL, canusb_capture_thread, this); return this->rdpipe; @@ -312,7 +312,7 @@ static void canusb_clearbufs(struct pcap_canusb* this) cmd[1] = 1; //Empty outgoing buffer cmd[3] = 0; //Not a write to serial number memset(&cmd[4],0,16-4); - + libusb_interrupt_transfer(this->dev, 0x1,cmd,16,&al,100); } @@ -328,7 +328,7 @@ static void canusb_close(pcap_t* handle) { libusb_close(canusb->dev); canusb->dev = NULL; - } + } if (canusb->ctx) { libusb_exit(canusb->ctx); @@ -347,9 +347,9 @@ static int canusb_activate(pcap_t* handle) /* * XXX - what causes this to fail? */ - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "libusb_init() failed"); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "libusb_init() failed"); return PCAP_ERROR; - } + } handle->read_op = canusb_read_linux; @@ -373,7 +373,7 @@ static int canusb_activate(pcap_t* handle) if (!canusb->dev) { libusb_exit(canusb->ctx); - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't open USB Device"); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't open USB Device"); return PCAP_ERROR; } @@ -395,7 +395,7 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char int i = 0; struct CAN_Msg msg; struct pcap_pkthdr pkth; - + while(i < max_packets) { int n; @@ -406,10 +406,10 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char pkth.caplen = pkth.len = n; pkth.caplen -= 4; pkth.caplen -= 8 - msg.length; - + if ((firstpacket.tv_sec == -1) && (firstpacket.tv_usec == -1)) gettimeofday(&firstpacket, NULL); - + pkth.ts.tv_usec = firstpacket.tv_usec + (msg.timestamp % 100) * 10000; pkth.ts.tv_sec = firstpacket.tv_usec + (msg.timestamp / 100); if (pkth.ts.tv_usec > 1000000) @@ -421,7 +421,7 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char callback(user, &pkth, (void*)&msg.id); i++; } - + return i; } diff --git a/pcap-common.c b/pcap-common.c index 85c0a7c1..4db49688 100644 --- a/pcap-common.c +++ b/pcap-common.c @@ -386,7 +386,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The Link Types are used for prepending meta-information * like interface index, interface name * before standard Ethernet, PPP, Frelay & C-HDLC Frames @@ -403,7 +403,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * voice Adapter Card (PIC) */ @@ -478,7 +478,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * integrated service module (ISM). */ @@ -519,7 +519,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for capturing data on a secure tunnel interface. */ #define LINKTYPE_JUNIPER_ST 200 @@ -611,11 +611,11 @@ */ #define LINKTYPE_IEEE802_15_4_NONASK_PHY 215 -/* +/* * David Gibson requested this for * captures from the Linux kernel /dev/input/eventN devices. This * is used to communicate keystrokes and mouse movements from the - * Linux kernel to display systems, such as Xorg. + * Linux kernel to display systems, such as Xorg. */ #define LINKTYPE_LINUX_EVDEV 216 @@ -777,7 +777,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . */ #define LINKTYPE_JUNIPER_VS 232 #define LINKTYPE_JUNIPER_SRX_E2E 233 @@ -809,12 +809,12 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . */ #define LINKTYPE_JUNIPER_ATM_CEMIC 238 /* - * NetFilter LOG messages + * NetFilter LOG messages * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) * * Requested by Jakub Zawadzki @@ -922,7 +922,7 @@ /* * Link-layer header type for upper-protocol layer PDU saves from wireshark. - * + * * the actual contents are determined by two TAGs stored with each * packet: * EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the @@ -1170,7 +1170,7 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, */ /* - * The URB id is a totally opaque value; do we really need to + * The URB id is a totally opaque value; do we really need to * convert it to the reading host's byte order??? */ offset += 8; /* skip past id */ diff --git a/pcap-dag.c b/pcap-dag.c index 099127f7..49152489 100644 --- a/pcap-dag.c +++ b/pcap-dag.c @@ -151,7 +151,7 @@ dag_platform_cleanup(pcap_t *p) #ifdef HAVE_DAG_STREAMS_API if(dag_stop_stream(p->fd, pd->dag_stream) < 0) fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno)); - + if(dag_detach_stream(p->fd, pd->dag_stream) < 0) fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno)); #else @@ -222,7 +222,7 @@ dag_erf_ext_header_count(uint8_t * erf, size_t len) /* loop over the extension headers */ do { - + /* sanity check we have enough bytes */ if ( len < (24 + (hdr_num * 8)) ) return hdr_num; @@ -253,7 +253,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Get the next bufferful of packets (if necessary). */ while (pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size) { - + /* * Has "pcap_breakloop()" been called? */ @@ -292,7 +292,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Pcap is configured to process only available packets, and there aren't any, return immediately. */ return 0; } - + if(!nonblocking && pd->dag_timeout && (pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size)) @@ -302,14 +302,14 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } - + /* Process the packets. */ while (pd->dag_mem_top - pd->dag_mem_bottom >= dag_record_size) { - + unsigned short packet_len = 0; int caplen = 0; struct pcap_pkthdr pcap_header; - + #ifdef HAVE_DAG_STREAMS_API dag_record_t *header = (dag_record_t *)(pd->dag_mem_bottom); #else @@ -318,7 +318,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) u_char *dp = ((u_char *)header); /* + dag_record_size; */ unsigned short rlen; - + /* * Has "pcap_breakloop()" been called? */ @@ -331,7 +331,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) p->break_loop = 0; return -2; } - + rlen = ntohs(header->rlen); if (rlen < dag_record_size) { @@ -361,7 +361,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } } - + if ((header->type & 0x7f) == TYPE_PAD) { continue; } @@ -369,13 +369,13 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) num_ext_hdr = dag_erf_ext_header_count(dp, rlen); /* ERF encapsulation */ - /* The Extensible Record Format is not dropped for this kind of encapsulation, + /* The Extensible Record Format is not dropped for this kind of encapsulation, * and will be handled as a pseudo header by the decoding application. * The information carried in the ERF header and in the optional subheader (if present) * could be merged with the libpcap information, to offer a better decoding. * The packet length is * o the length of the packet on the link (header->wlen), - * o plus the length of the ERF header (dag_record_size), as the length of the + * o plus the length of the ERF header (dag_record_size), as the length of the * pseudo header will be adjusted during the decoding, * o plus the length of the optional subheader (if present). * @@ -417,7 +417,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) dp += dag_record_size; /* Skip over extension headers */ dp += 8 * num_ext_hdr; - + switch((header->type & 0x7f)) { case TYPE_ATM: case TYPE_AAL5: @@ -445,13 +445,13 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) if (p->linktype == DLT_SUNATM) { struct sunatm_hdr *sunatm = (struct sunatm_hdr *)dp; unsigned long rawatm; - + rawatm = ntohl(*((unsigned long *)dp)); sunatm->vci = htons((rawatm >> 4) & 0xffff); sunatm->vpi = (rawatm >> 20) & 0x00ff; - sunatm->flags = ((header->flags.iface & 1) ? 0x80 : 0x00) | + sunatm->flags = ((header->flags.iface & 1) ? 0x80 : 0x00) | ((sunatm->vpi == 0 && sunatm->vci == htons(5)) ? 6 : - ((sunatm->vpi == 0 && sunatm->vci == htons(16)) ? 5 : + ((sunatm->vpi == 0 && sunatm->vci == htons(16)) ? 5 : ((dp[ATM_HDR_SIZE] == 0xaa && dp[ATM_HDR_SIZE+1] == 0xaa && dp[ATM_HDR_SIZE+2] == 0x03) ? 2 : 1))); @@ -509,7 +509,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Add the MTP2 Pseudo Header */ caplen += MTP2_HDR_LEN; packet_len += MTP2_HDR_LEN; - + TempPkt[MTP2_SENT_OFFSET] = 0; TempPkt[MTP2_ANNEX_A_USED_OFFSET] = MTP2_ANNEX_A_USED_UNKNOWN; *(TempPkt+MTP2_LINK_NUMBER_OFFSET) = ((header->rec.mc_hdlc.mc_header>>16)&0x01); @@ -547,16 +547,16 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } /* switch type */ } /* ERF encapsulation */ - + if (caplen > p->snapshot) caplen = p->snapshot; /* Run the packet filter if there is one. */ if ((p->fcode.bf_insns == NULL) || bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen)) { - + /* convert between timestamp formats */ register unsigned long long ts; - + if (IS_BIGENDIAN()) { ts = SWAPLL(header->ts); } else { @@ -576,7 +576,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) pcap_header.ts.tv_sec = ts >> 32; ts = (ts & 0xffffffffULL) * ticks_per_second; ts += 0x80000000; /* rounding */ - pcap_header.ts.tv_usec = ts >> 32; + pcap_header.ts.tv_usec = ts >> 32; if (pcap_header.ts.tv_usec >= ticks_per_second) { pcap_header.ts.tv_usec -= ticks_per_second; pcap_header.ts.tv_sec++; @@ -585,13 +585,13 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Fill in our own header data */ pcap_header.caplen = caplen; pcap_header.len = packet_len; - + /* Count the packet. */ pd->stat.ps_recv++; - + /* Call the user supplied callback function */ callback(user, &pcap_header, dp); - + /* Only count packets that pass the filter, for consistency with standard Linux behaviour. */ processed++; if (processed == cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) @@ -618,7 +618,7 @@ dag_inject(pcap_t *p, const void *buf _U_, size_t size _U_) * device will result in a failure. The promisc flag is ignored because DAG * cards are always promiscuous. The to_ms parameter is used in setting the * API polling parameters. - * + * * snaplen is now also ignored, until we get per-stream slen support. Set * slen with approprite DAG tool BEFORE pcap_activate(). * @@ -654,7 +654,7 @@ static int dag_activate(pcap_t* handle) snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't allocate string for device name: %s\n", pcap_strerror(errno)); goto fail; } - + /* Parse input name to get dag device and stream number if provided */ if (dag_parse_name(device, newDev, strlen(device) + 16, &handlep->dag_stream) < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_parse_name: %s\n", pcap_strerror(errno)); @@ -700,7 +700,7 @@ static int dag_activate(pcap_t* handle) snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno)); goto faildetach; } - + if (handle->opt.immediate) { /* Call callback immediately. * XXX - is this the right way to handle this? @@ -725,7 +725,7 @@ static int dag_activate(pcap_t* handle) snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno)); goto faildetach; } - + #else if((handlep->dag_mem_base = dag_mmap(handle->fd)) == MAP_FAILED) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_mmap %s: %s\n", device, pcap_strerror(errno)); @@ -748,14 +748,14 @@ static int dag_activate(pcap_t* handle) handle->snapshot = MIN_DAG_SNAPLEN; } /* snap len has to be a multiple of 4 */ - snprintf(conf, 30, "varlen slen=%d", (snaplen + 3) & ~3); + snprintf(conf, 30, "varlen slen=%d", (snaplen + 3) & ~3); if(dag_configure(handle->fd, conf) < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_configure %s: %s\n", device, pcap_strerror(errno)); goto faildetach; } -#endif - +#endif + #ifdef HAVE_DAG_STREAMS_API if(dag_start_stream(handle->fd, handlep->dag_stream) < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_start_stream %s: %s\n", device, pcap_strerror(errno)); @@ -822,7 +822,7 @@ static int dag_activate(pcap_t* handle) handle->linktype = -1; if (dag_get_datalink(handle) < 0) goto failstop; - + handle->bufsize = 0; if (new_pcap_dag(handle) < 0) { @@ -853,12 +853,12 @@ static int dag_activate(pcap_t* handle) handlep->stat.ps_ifdrop = 0; return 0; -#ifdef HAVE_DAG_STREAMS_API +#ifdef HAVE_DAG_STREAMS_API failstop: if (dag_stop_stream(handle->fd, handlep->dag_stream) < 0) { fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno)); } - + faildetach: if (dag_detach_stream(handle->fd, handlep->dag_stream) < 0) fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno)); @@ -867,7 +867,7 @@ failstop: if (dag_stop(handle->fd) < 0) fprintf(stderr,"dag_stop: %s\n", strerror(errno)); #endif /* HAVE_DAG_STREAMS_API */ - + failclose: if (dag_close(handle->fd) < 0) fprintf(stderr,"dag_close: %s\n", strerror(errno)); @@ -969,9 +969,9 @@ dag_stats(pcap_t *p, struct pcap_stat *ps) { */ /*pd->stat.ps_recv = 0;*/ /*pd->stat.ps_drop = 0;*/ - + *ps = pd->stat; - + return 0; } @@ -1028,13 +1028,13 @@ dag_findalldevs(pcap_if_t **devlistp, char *errbuf) */ ret = -1; } - + rxstreams--; if(rxstreams <= 0) { break; } } - } + } } #endif /* HAVE_DAG_STREAMS_API */ dag_close(dagfd); @@ -1094,13 +1094,13 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf) uint32_t mindata; struct timeval maxwait; struct timeval poll; - + if (dag_get_stream_poll(p->fd, pd->dag_stream, &mindata, &maxwait, &poll) < 0) { snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno)); return -1; } - + /* Amount of data to collect in Bytes before calling callbacks. * Important for efficiency, but can introduce latency * at low packet rates if to_ms not set! @@ -1109,7 +1109,7 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf) mindata = 0; else mindata = 65536; - + if (dag_set_stream_poll(p->fd, pd->dag_stream, mindata, &maxwait, &poll) < 0) { snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno)); @@ -1124,7 +1124,7 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf) } return (0); } - + static int dag_get_datalink(pcap_t *p) { @@ -1145,18 +1145,18 @@ dag_get_datalink(pcap_t *p) /* Get list of possible ERF types for this card */ if (dag_get_stream_erf_types(p->fd, pd->dag_stream, types, 255) < 0) { snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_stream_erf_types: %s", pcap_strerror(errno)); - return (-1); + return (-1); } - + while (types[index]) { #elif defined HAVE_DAG_GET_ERF_TYPES /* Get list of possible ERF types for this card */ if (dag_get_erf_types(p->fd, types, 255) < 0) { snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_erf_types: %s", pcap_strerror(errno)); - return (-1); + return (-1); } - + while (types[index]) { #else /* Check the type through a dagapi call. */ @@ -1202,7 +1202,7 @@ dag_get_datalink(pcap_t *p) p->linktype = DLT_EN10MB; break; - case TYPE_ATM: + case TYPE_ATM: case TYPE_AAL5: case TYPE_MC_ATM: case TYPE_MC_AAL5: diff --git a/pcap-dbus.c b/pcap-dbus.c index c878353b..ab3f1258 100644 --- a/pcap-dbus.c +++ b/pcap-dbus.c @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -122,7 +122,7 @@ dbus_write(pcap_t *handle, const void *buf, size_t size) dbus_message_unref(msg); return 0; -} +} static int dbus_stats(pcap_t *handle, struct pcap_stat *stats) @@ -250,8 +250,8 @@ dbus_create(const char *device, char *ebuf, int *is_ours) { pcap_t *p; - if (strcmp(device, "dbus-system") && - strcmp(device, "dbus-session") && + if (strcmp(device, "dbus-system") && + strcmp(device, "dbus-session") && strncmp(device, "dbus://", 7)) { *is_ours = 0; @@ -267,7 +267,7 @@ dbus_create(const char *device, char *ebuf, int *is_ours) return (p); } -int +int dbus_findalldevs(pcap_if_t **alldevsp, char *err_str) { if (pcap_add_if(alldevsp, "dbus-system", 0, "D-Bus system bus", err_str) < 0) diff --git a/pcap-dlpi.c b/pcap-dlpi.c index 45986006..c0071352 100644 --- a/pcap-dlpi.c +++ b/pcap-dlpi.c @@ -298,7 +298,7 @@ pcap_inject_dlpi(pcap_t *p, const void *buf, size_t size) ret = -1; #endif /* raw mode */ return (ret); -} +} #ifndef DL_IPATM #define DL_IPATM 0x12 /* ATM Classical IP interface */ diff --git a/pcap-dos.c b/pcap-dos.c index 43f50c7f..8632cee6 100644 --- a/pcap-dos.c +++ b/pcap-dos.c @@ -166,7 +166,7 @@ pcap_t *pcap_create_interface (const char *device, char *ebuf) * network packets. */ static int pcap_activate_dos (pcap_t *pcap) -{ +{ struct pcap_dos *pcapd = pcap->priv; if (pcap->opt.rfmon) { @@ -197,7 +197,7 @@ static int pcap_activate_dos (pcap_t *pcap) !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc)) { return (PCAP_ERROR); - } + } atexit (close_driver); } else if (stricmp(active_dev->name,pcap->opt.source)) @@ -401,7 +401,7 @@ int pcap_stats_ex (pcap_t *p, struct pcap_stat_ex *se) strlcpy (p->errbuf, "pktdrvr doesn't have detailed statistics", PCAP_ERRBUF_SIZE); return (-1); - } + } memcpy (se, (*dev->get_stats)(dev), sizeof(*se)); return (0); } @@ -520,7 +520,7 @@ int pcap_lookupnet (const char *device, bpf_u_int32 *localnet, } ARGSUSED (device); return (0); -} +} /* * Get a list of all interfaces that are present and that we probe okay. @@ -960,7 +960,7 @@ static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf) * have default values. Should be taken from another * ini-file/environment in any case (ref. tcpdump.ini) */ - _watt_is_init = 1; + _watt_is_init = 1; if (!using_pktdrv || !has_ip_addr) /* for now .... */ { @@ -1092,7 +1092,7 @@ static int pkt_open (struct device *dev) if (!PktInitDriver(mode)) return (0); - + PktResetStatistics (pktInfo.handle); PktQueueBusy (FALSE); return (1); @@ -1290,7 +1290,7 @@ struct device rtl8139_dev LOCKED_VAR = { 0,0,0,0,0,0, &cs89_dev, rtl8139_probe /* dev->probe routine */ - }; + }; /* * Dequeue routine is called by polling. diff --git a/pcap-dos.h b/pcap-dos.h index 8f92252b..bf47fb51 100644 --- a/pcap-dos.h +++ b/pcap-dos.h @@ -214,7 +214,7 @@ extern void _w32_os_yield (void); /* Watt-32's misc.c */ #define PCAP_ASSERT(x) ((void)0) #else - void pcap_assert (const char *what, const char *file, unsigned line); + void pcap_assert (const char *what, const char *file, unsigned line); #define PCAP_ASSERT(x) do { \ if (!(x)) \ diff --git a/pcap-filter.manmisc.in b/pcap-filter.manmisc.in index 4c84ebf5..d7401946 100644 --- a/pcap-filter.manmisc.in +++ b/pcap-filter.manmisc.in @@ -697,7 +697,7 @@ changes the decoding offsets for the remainder of \fIexpression\fR on the assumption that the packet is a MPLS-encapsulated IP packet. The \fBmpls \fI[label_num]\fR expression may be used more than once, to filter on MPLS hierarchies. Each use of that expression increments the -filter offsets by 4. +filter offsets by 4. .IP For example: .in +.5i diff --git a/pcap-linux.c b/pcap-linux.c index 32faeb7d..cd32e065 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -25,10 +25,10 @@ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Modifications: Added PACKET_MMAP support - * Paolo Abeni + * Paolo Abeni * Added TPACKET_V3 support * Gabor Tatarka - * + * * based on previous works of: * Simon Patarin * Phil Wood @@ -47,7 +47,7 @@ * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -56,12 +56,12 @@ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. @@ -188,7 +188,7 @@ # endif /* PACKET_HOST */ - /* check for memory mapped access avaibility. We assume every needed + /* check for memory mapped access avaibility. We assume every needed * struct is defined if the macro TPACKET_HDRLEN is defined, because it * uses many ring related structs and macros */ # ifdef PCAP_SUPPORT_PACKET_RING @@ -1032,7 +1032,7 @@ linux_if_drops(const char * if_name) FILE * file; int field_to_convert = 3, if_name_sz = strlen(if_name); long int dropped_pkts = 0; - + file = fopen("/proc/net/dev", "r"); if (!file) return 0; @@ -1047,7 +1047,7 @@ linux_if_drops(const char * if_name) field_to_convert = 4; continue; } - + /* find iface and make sure it actually matches -- space before the name and : after it */ if ((bufptr = strstr(buffer, if_name)) && (bufptr == buffer || *(bufptr-1) == ' ') && @@ -1061,20 +1061,20 @@ linux_if_drops(const char * if_name) while (*bufptr != '\0' && *(bufptr++) == ' '); while (*bufptr != '\0' && *(bufptr++) != ' '); } - + /* get rid of any final spaces */ while (*bufptr != '\0' && *bufptr == ' ') bufptr++; - + if (*bufptr != '\0') dropped_pkts = strtol(bufptr, NULL, 10); break; } } - + fclose(file); return dropped_pkts; -} +} /* @@ -1309,12 +1309,12 @@ pcap_activate_linux(pcap_t *handle) pcap_strerror(errno) ); return PCAP_ERROR; } - + /* copy timeout value */ handlep->timeout = handle->opt.timeout; /* - * If we're in promiscuous mode, then we probably want + * If we're in promiscuous mode, then we probably want * to see when the interface drops packets too, so get an * initial count from /proc/net/dev */ @@ -1874,7 +1874,7 @@ pcap_inject_linux(pcap_t *handle, const void *buf, size_t size) return (-1); } return (ret); -} +} /* * Get the statistics for the given packet capture handle. @@ -1912,8 +1912,8 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) #endif /* HAVE_TPACKET_STATS */ long if_dropped = 0; - - /* + + /* * To fill in ps_ifdrop, we parse /proc/net/dev for the number */ if (handle->opt.promisc) @@ -1943,7 +1943,7 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * dropped by the interface driver. It counts only * packets that passed the filter. * - * See above for ps_ifdrop. + * See above for ps_ifdrop. * * Both statistics include packets not yet read from * the kernel by libpcap, and thus not yet seen by @@ -1972,7 +1972,7 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * "tp_packets" as the count of packets and "tp_drops" * as the count of drops. * - * Keep a running total because each call to + * Keep a running total because each call to * getsockopt(handle->fd, SOL_PACKET, PACKET_STATISTICS, .... * resets the counters to zero. */ @@ -2018,10 +2018,10 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * We maintain the count of packets processed by libpcap in * "handlep->packets_read", for reasons described in the comment * at the end of pcap_read_packet(). We have no idea how many - * packets were dropped by the kernel buffers -- but we know + * packets were dropped by the kernel buffers -- but we know * how many the interface dropped, so we can return that. */ - + stats->ps_recv = handlep->packets_read; stats->ps_drop = 0; stats->ps_ifdrop = handlep->stat.ps_ifdrop; @@ -2682,7 +2682,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int sock_fd, int arptype, handle->linktype = DLT_RAW; return; } - + /* * Is this a real Ethernet device? If so, give it a * link-layer-type list with DLT_EN10MB and DLT_DOCSIS, so @@ -3472,7 +3472,7 @@ activate_new(pcap_t *handle) * On error, returns -1, and sets *status to the appropriate error code; * if that is PCAP_ERROR, sets handle->errbuf to the appropriate message. */ -static int +static int activate_mmap(pcap_t *handle, int *status) { struct pcap_linux *handlep = handle->priv; @@ -3556,7 +3556,7 @@ activate_mmap(pcap_t *handle, int *status) return 1; } #else /* HAVE_PACKET_RING */ -static int +static int activate_mmap(pcap_t *handle _U_, int *status _U_) { return 0; @@ -3945,12 +3945,12 @@ create_ring(pcap_t *handle, int *status) return -1; } - /* compute the minumum block size that will handle this frame. - * The block has to be page size aligned. - * The max block size allowed by the kernel is arch-dependent and + /* compute the minumum block size that will handle this frame. + * The block has to be page size aligned. + * The max block size allowed by the kernel is arch-dependent and * it's not explicitly checked here. */ req.tp_block_size = getpagesize(); - while (req.tp_block_size < req.tp_frame_size) + while (req.tp_block_size < req.tp_frame_size) req.tp_block_size <<= 1; frames_per_block = req.tp_block_size/req.tp_frame_size; @@ -4048,8 +4048,8 @@ create_ring(pcap_t *handle, int *status) } if (setsockopt(handle->fd, SOL_PACKET, PACKET_TIMESTAMP, (void *)×ource, sizeof(timesource))) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "can't set PACKET_TIMESTAMP: %s", + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "can't set PACKET_TIMESTAMP: %s", pcap_strerror(errno)); *status = PCAP_ERROR; return -1; @@ -4064,7 +4064,7 @@ retry: /* req.tp_frame_nr is requested to match frames_per_block*req.tp_block_nr */ req.tp_frame_nr = req.tp_block_nr * frames_per_block; - + #ifdef HAVE_TPACKET3 /* timeout value to retire block - use the configured buffering timeout, or default if <0. */ req.tp_retire_blk_tov = (handlep->timeout>=0)?handlep->timeout:0; @@ -4197,7 +4197,7 @@ pcap_oneshot_mmap(u_char *user, const struct pcap_pkthdr *h, memcpy(handlep->oneshot_buffer, bytes, h->caplen); *sp->pkt = handlep->oneshot_buffer; } - + static void pcap_cleanup_linux_mmap( pcap_t *handle ) { @@ -4891,7 +4891,7 @@ again: } #endif /* HAVE_TPACKET3 */ -static int +static int pcap_setfilter_linux_mmap(pcap_t *handle, struct bpf_program *filter) { struct pcap_linux *handlep = handle->priv; @@ -5903,7 +5903,7 @@ iface_ethtool_flag_ioctl(pcap_t *handle, int cmd, const char *cmdname) cmdname, strerror(errno)); return -1; } - return eval.data; + return eval.data; } static int diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c index 9e61e455..3ee6faa3 100644 --- a/pcap-netfilter-linux.c +++ b/pcap-netfilter-linux.c @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -57,14 +57,14 @@ #include /* NOTE: if your program drops privilages after pcap_activate() it WON'T work with nfqueue. - * It took me quite some time to debug ;/ + * It took me quite some time to debug ;/ * * Sending any data to nfnetlink socket requires CAP_NET_ADMIN privilages, * and in nfqueue we need to send verdict reply after recving packet. * * In tcpdump you can disable dropping privilages with -Z root */ - + #include "pcap-netfilter-linux.h" #define HDR_LENGTH (NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct nfgenmsg)))) @@ -116,10 +116,10 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c return -1; } - if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG && - NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET) + if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG && + NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET) type = NFLOG; - else if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_QUEUE && + else if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_QUEUE && NFNL_MSG_TYPE(nlh->nlmsg_type) == NFQNL_MSG_PACKET) type = NFQUEUE; @@ -184,7 +184,7 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c gettimeofday(&pkth.ts, NULL); if (handle->fcode.bf_insns == NULL || - bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen)) + bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen)) { handlep->packets_read++; callback(user, &pkth, payload); @@ -234,7 +234,7 @@ netfilter_inject_linux(pcap_t *handle, const void *buf, size_t size) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on netfilter devices"); return (-1); -} +} struct my_nfattr { u_int16_t nfa_len; @@ -252,7 +252,7 @@ netfilter_send_config_msg(const pcap_t *handle, u_int16_t msg_type, int ack, u_i struct sockaddr_nl snl; static unsigned int seq_id; - + if (!seq_id) seq_id = time(NULL); ++seq_id; @@ -344,7 +344,7 @@ nflog_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, u_ return nflog_send_config_msg(handle, family, group_id, &nfa); } -static int +static int nflog_send_config_mode(const pcap_t *handle, u_int16_t group_id, u_int8_t copy_mode, u_int32_t copy_range) { struct nfulnl_msg_config_mode msg; @@ -398,7 +398,7 @@ nfqueue_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, return nfqueue_send_config_msg(handle, AF_UNSPEC, group_id, &nfa); } -static int +static int nfqueue_send_config_mode(const pcap_t *handle, u_int16_t group_id, u_int8_t copy_mode, u_int32_t copy_range) { struct nfqnl_msg_config_params msg; @@ -431,7 +431,7 @@ netfilter_activate(pcap_t* handle) dev += strlen(NFQUEUE_IFACE); type = NFQUEUE; } - + if (type != OTHER && *dev == ':') { dev++; while (*dev) { @@ -440,7 +440,7 @@ netfilter_activate(pcap_t* handle) if (group_count == 32) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Maximum 32 netfilter groups! dev: %s", + "Maximum 32 netfilter groups! dev: %s", handle->opt.source); return PCAP_ERROR; } @@ -465,7 +465,7 @@ netfilter_activate(pcap_t* handle) if (type == OTHER || *dev) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't get netfilter group(s) index from %s", + "Can't get netfilter group(s) index from %s", handle->opt.source); return PCAP_ERROR; } @@ -602,7 +602,7 @@ netfilter_create(const char *device, char *ebuf, int *is_ours) /* Does it begin with NFLOG_IFACE or NFQUEUE_IFACE? */ if (strncmp(cp, NFLOG_IFACE, sizeof NFLOG_IFACE - 1) == 0) cp += sizeof NFLOG_IFACE - 1; - else if (strncmp(cp, NFQUEUE_IFACE, sizeof NFQUEUE_IFACE - 1) == 0) + else if (strncmp(cp, NFQUEUE_IFACE, sizeof NFQUEUE_IFACE - 1) == 0) cp += sizeof NFQUEUE_IFACE - 1; else { /* Nope, doesn't begin with NFLOG_IFACE nor NFQUEUE_IFACE */ @@ -631,11 +631,11 @@ netfilter_create(const char *device, char *ebuf, int *is_ours) return (p); } -int +int netfilter_findalldevs(pcap_if_t **alldevsp, char *err_str) { int sock; - + sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER); if (sock < 0) { /* if netlink is not supported this is not fatal */ diff --git a/pcap-netfilter-linux.h b/pcap-netfilter-linux.h index 882a4021..01d9b394 100644 --- a/pcap-netfilter-linux.h +++ b/pcap-netfilter-linux.h @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS diff --git a/pcap-nit.c b/pcap-nit.c index ea81eb57..a8355f9d 100644 --- a/pcap-nit.c +++ b/pcap-nit.c @@ -211,7 +211,7 @@ pcap_inject_nit(pcap_t *p, const void *buf, size_t size) return (-1); } return (ret); -} +} static int nit_setflags(pcap_t *p) diff --git a/pcap-pf.c b/pcap-pf.c index 96a4a509..e03b2ed1 100644 --- a/pcap-pf.c +++ b/pcap-pf.c @@ -237,7 +237,7 @@ pcap_inject_pf(pcap_t *p, const void *buf, size_t size) return (-1); } return (ret); -} +} static int pcap_stats_pf(pcap_t *p, struct pcap_stat *ps) diff --git a/pcap-savefile.manfile.in b/pcap-savefile.manfile.in index 2b93c143..622f6c6e 100644 --- a/pcap-savefile.manfile.in +++ b/pcap-savefile.manfile.in @@ -22,7 +22,7 @@ pcap-savefile \- libpcap savefile format .SH DESCRIPTION NOTE: applications and libraries should, if possible, use libpcap to -read savefiles, rather than having their own code to read savefiles. +read savefiles, rather than having their own code to read savefiles. If, in the future, a new file format is supported by libpcap, applications and libraries using libpcap to read savefiles will be able to read the new format of savefiles, but applications and libraries diff --git a/pcap-septel.c b/pcap-septel.c index 2f0ff33b..61cd2f57 100644 --- a/pcap-septel.c +++ b/pcap-septel.c @@ -194,9 +194,9 @@ septel_inject(pcap_t *handle, const void *buf _U_, size_t size _U_) * See also pcap(3). */ static pcap_t *septel_activate(pcap_t* handle) { - /* Initialize some components of the pcap structure. */ + /* Initialize some components of the pcap structure. */ handle->linktype = DLT_MTP2; - + handle->bufsize = 0; /* @@ -244,9 +244,9 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps) { struct pcap_septel *handlep = p->priv; /*handlep->stat.ps_recv = 0;*/ /*handlep->stat.ps_drop = 0;*/ - + *ps = handlep->stat; - + return 0; } diff --git a/pcap-sita.c b/pcap-sita.c index d507e1ee..b35b106e 100644 --- a/pcap-sita.c +++ b/pcap-sita.c @@ -183,7 +183,7 @@ static int read_client_nbytes(int fd, int count, unsigned char *buf) { find_unit_by_fd(fd, &chassis, &geoslot, &u); while (count) { if ((len = recv(fd, buf, count, 0)) <= 0) return -1; /* read in whatever data was sent to us */ - count -= len; + count -= len; buf += len; } /* till we have everything we are looking for */ return 0; @@ -211,7 +211,7 @@ static void empty_unit(int chassis, int geoslot) { u->imsg = (char *)realloc(u->imsg, 1); /* and re-allocate the old large buffer into a new small one */ if (u->imsg == NULL) { /* oops, realloc call failed */ fprintf(stderr, "Warning...call to realloc() failed, value of errno is %d\n", errno); - + } } @@ -553,10 +553,10 @@ static void sort_if_table(void) { } if (has_swapped == 0) return; - } + } return; } - + static int process_client_data (char *errbuf) { /* returns: -1 = error, 0 = OK */ int chassis, geoslot; unit_t *u; diff --git a/pcap-snf.c b/pcap-snf.c index a2ba495d..03dc08de 100644 --- a/pcap-snf.c +++ b/pcap-snf.c @@ -476,7 +476,7 @@ snf_create(const char *device, char *ebuf, int *is_ours) ps = p->priv; /* - * We support microsecond and nanosecond time stamps. + * We support microsecond and nanosecond time stamps. */ p->tstamp_precision_count = 2; p->tstamp_precision_list = malloc(2 * sizeof(u_int)); diff --git a/pcap-snit.c b/pcap-snit.c index e6232c2e..0ce78603 100644 --- a/pcap-snit.c +++ b/pcap-snit.c @@ -211,7 +211,7 @@ static int pcap_inject_snit(pcap_t *p, const void *buf, size_t size) { struct strbuf ctl, data; - + /* * XXX - can we just do * diff --git a/pcap-snoop.c b/pcap-snoop.c index 7993e70e..f622f31f 100644 --- a/pcap-snoop.c +++ b/pcap-snoop.c @@ -114,7 +114,7 @@ again: caplen = (datalen < p->snapshot) ? datalen : p->snapshot; cp = (u_char *)(sh + 1) + p->offset; /* XXX */ - /* + /* * XXX unfortunately snoop loopback isn't exactly like * BSD's. The address family is encoded in the first 2 * bytes rather than the first 4 bytes! Luckily the last @@ -155,7 +155,7 @@ pcap_inject_snoop(pcap_t *p, const void *buf, size_t size) return (-1); } return (ret); -} +} static int pcap_stats_snoop(pcap_t *p, struct pcap_stat *ps) diff --git a/pcap-tstamp.manmisc.in b/pcap-tstamp.manmisc.in index 6cb066c9..74a9a35d 100644 --- a/pcap-tstamp.manmisc.in +++ b/pcap-tstamp.manmisc.in @@ -104,12 +104,12 @@ precision of this time stamp is unspecified; it might or might not be synchronized with the host operating system's clock. .TP 5 .BR PCAP_TSTAMP_HOST_LOWPREC " - " host_lowprec -Time stamp provided by the host on which the capture is being done. +Time stamp provided by the host on which the capture is being done. This is a low-precision time stamp, synchronized with the host operating system's clock. .TP 5 .BR PCAP_TSTAMP_HOST_HIPREC " - " host_hiprec -Time stamp provided by the host on which the capture is being done. +Time stamp provided by the host on which the capture is being done. This is a high-precision time stamp; it might or might not be synchronized with the host operating system's clock. It might be more expensive to fetch than @@ -129,7 +129,7 @@ the host operating system's clock. By default, when performing a live capture or reading from a savefile, time stamps are supplied as seconds since January 1, 1970, 00:00:00 UTC, and microseconds since that seconds value, even if higher-resolution -time stamps are available from the capture device or in the savefile. +time stamps are available from the capture device or in the savefile. If, when reading a savefile, the time stamps in the file have a higher resolution than one microsecond, the additional digits of resolution are discarded. diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 63eb11eb..957273a8 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -32,7 +32,7 @@ * Modifications: Kris Katterjohn * */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -139,21 +139,21 @@ static int usb_setdirection_linux(pcap_t *, pcap_direction_t); static void usb_cleanup_linux_mmap(pcap_t *); /* facility to add an USB device to the device list*/ -static int +static int usb_dev_add(pcap_if_t** alldevsp, int n, char *err_str) { char dev_name[10]; - char dev_descr[30]; + char dev_descr[30]; snprintf(dev_name, 10, USB_IFACE"%d", n); snprintf(dev_descr, 30, "USB bus number %d", n); - if (pcap_add_if(alldevsp, dev_name, 0, + if (pcap_add_if(alldevsp, dev_name, 0, dev_descr, err_str) < 0) return -1; - return 0; + return 0; } -int +int usb_findalldevs(pcap_if_t **alldevsp, char *err_str) { struct dirent* data; @@ -172,7 +172,7 @@ usb_findalldevs(pcap_if_t **alldevsp, char *err_str) if (strncmp(name, "usb", 3) != 0) continue; - if (sscanf(&name[3], "%d", &n) == 0) + if (sscanf(&name[3], "%d", &n) == 0) continue; ret = usb_dev_add(alldevsp, n, err_str); @@ -193,7 +193,7 @@ usb_findalldevs(pcap_if_t **alldevsp, char *err_str) if ((len < 1) || !isdigit(name[--len])) continue; while (isdigit(name[--len])); - if (sscanf(&name[len+1], "%d", &n) != 1) + if (sscanf(&name[len+1], "%d", &n) != 1) continue; ret = usb_dev_add(alldevsp, n, err_str); @@ -207,12 +207,12 @@ usb_findalldevs(pcap_if_t **alldevsp, char *err_str) return 0; } -static +static int usb_mmap(pcap_t* handle) { struct pcap_usb_linux *handlep = handle->priv; int len = ioctl(handle->fd, MON_IOCQ_RING_SIZE); - if (len < 0) + if (len < 0) return 0; handlep->mmapbuflen = len; @@ -260,7 +260,7 @@ probe_devices(int bus) continue; snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d/%s", bus, data->d_name); - + fd = open(buf, O_RDWR); if (fd == -1) continue; @@ -363,7 +363,7 @@ usb_activate(pcap_t* handle) } /*now select the read method: try to open binary interface */ - snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index); + snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index); handle->fd = open(full_path, O_RDONLY, 0); if (handle->fd >= 0) { @@ -402,7 +402,7 @@ usb_activate(pcap_t* handle) } else { /*Binary interface not available, try open text interface */ - snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handlep->bus_index); + snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handlep->bus_index); handle->fd = open(full_path, O_RDONLY, 0); if (handle->fd < 0) { @@ -412,7 +412,7 @@ usb_activate(pcap_t* handle) * Not found at the new location; try * the old location. */ - snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handlep->bus_index); + snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handlep->bus_index); handle->fd = open(full_path, O_RDONLY, 0); } if (handle->fd < 0) { @@ -453,22 +453,22 @@ usb_activate(pcap_t* handle) return 0; } -static inline int +static inline int ascii_to_int(char c) { return c < 'A' ? c- '0': ((c<'a') ? c - 'A' + 10: c-'a'+10); } /* - * see /Documentation/usb/usbmon.txt and - * /drivers/usb/mon/mon_text.c for urb string + * see /Documentation/usb/usbmon.txt and + * /drivers/usb/mon/mon_text.c for urb string * format description */ static int usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user) { /* see: - * /usr/src/linux/Documentation/usb/usbmon.txt + * /usr/src/linux/Documentation/usb/usbmon.txt * for message format */ struct pcap_usb_linux *handlep = handle->priv; @@ -501,11 +501,11 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u return -1; } - /* read urb header; %n argument may increment return value, but it's + /* read urb header; %n argument may increment return value, but it's * not mandatory, so does not count on it*/ string[ret] = 0; - ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, ×tamp, &etype, - &pipeid1, &pipeid2, &dev_addr, &ep_num, status, + ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, ×tamp, &etype, + &pipeid1, &pipeid2, &dev_addr, &ep_num, status, &cnt); if (ret < 8) { @@ -521,10 +521,10 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u string += cnt; /* don't use usbmon provided timestamp, since it have low precision*/ - if (gettimeofday(&pkth.ts, NULL) < 0) + if (gettimeofday(&pkth.ts, NULL) < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't get timestamp for message '%s' %d:%s", + "Can't get timestamp for message '%s' %d:%s", string, errno, strerror(errno)); return -1; } @@ -567,11 +567,11 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u if (ret != 1) { /* this a setup packet, setup data can be filled with underscore if - * usbmon has not been able to read them, so we must parse this fields as + * usbmon has not been able to read them, so we must parse this fields as * strings */ pcap_usb_setup* shdr; char str1[3], str2[3], str3[5], str4[5], str5[5]; - ret = sscanf(string, "%s %s %s %s %s%n", str1, str2, str3, str4, + ret = sscanf(string, "%s %s %s %s %s%n", str1, str2, str3, str4, str5, &cnt); if (ret < 5) { @@ -592,7 +592,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u uhdr->setup_flag = 0; } - else + else uhdr->setup_flag = 1; /* read urb data */ @@ -605,7 +605,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u } string += cnt; - /* urb tag is not present if urb length is 0, so we can stop here + /* urb tag is not present if urb length is 0, so we can stop here * text parsing */ pkth.len = urb_len+pkth.caplen; uhdr->urb_len = urb_len; @@ -622,7 +622,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u return -1; } - if (urb_tag != '=') + if (urb_tag != '=') goto got; /* skip urb tag and following space */ @@ -631,7 +631,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u /* if we reach this point we got some urb data*/ uhdr->data_flag = 0; - /* read all urb data; if urb length is greater then the usbmon internal + /* read all urb data; if urb length is greater then the usbmon internal * buffer length used by the kernel to spool the URB, we get only * a partial information. * At least until linux 2.6.17 there is no way to set usbmon intenal buffer @@ -670,7 +670,7 @@ usb_inject_linux(pcap_t *handle, const void *buf, size_t size) return (-1); } -static int +static int usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) { struct pcap_usb_linux *handlep = handle->priv; @@ -695,7 +695,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) } if (fd < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't open USB stats file %s: %s", + "Can't open USB stats file %s: %s", string, strerror(errno)); return -1; } @@ -717,11 +717,11 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) /* extract info on dropped urbs */ for (consumed=0; consumed < ret; ) { - /* from the sscanf man page: - * The C standard says: "Execution of a %n directive does + /* from the sscanf man page: + * The C standard says: "Execution of a %n directive does * not increment the assignment count returned at the completion * of execution" but the Corrigendum seems to contradict this. - * Do not make any assumptions on the effect of %n conversions + * Do not make any assumptions on the effect of %n conversions * on the return value and explicitly check for cnt assignmet*/ int ntok; @@ -733,7 +733,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) ptr += cnt; if (strcmp(token, "nreaders") == 0) ret = sscanf(ptr, "%d", &stats->ps_drop); - else + else ret = sscanf(ptr, "%d", &dummy); if (ntok != 1) break; @@ -746,7 +746,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) return 0; } -static int +static int usb_setdirection_linux(pcap_t *p, pcap_direction_t d) { p->direction = d; @@ -754,7 +754,7 @@ usb_setdirection_linux(pcap_t *p, pcap_direction_t d) } -static int +static int usb_stats_linux_bin(pcap_t *handle, struct pcap_stat *stats) { struct pcap_usb_linux *handlep = handle->priv; @@ -775,7 +775,7 @@ usb_stats_linux_bin(pcap_t *handle, struct pcap_stat *stats) } /* - * see /Documentation/usb/usbmon.txt and + * see /Documentation/usb/usbmon.txt and * /drivers/usb/mon/mon_bin.c binary ABI */ static int @@ -833,7 +833,7 @@ usb_read_linux_bin(pcap_t *handle, int max_packets, pcap_handler callback, u_cha } /* - * see /Documentation/usb/usbmon.txt and + * see /Documentation/usb/usbmon.txt and * /drivers/usb/mon/mon_bin.c binary ABI */ #define VEC_SIZE 32 @@ -887,7 +887,7 @@ usb_read_linux_mmap(pcap_t *handle, int max_packets, pcap_handler callback, u_ch for (i=0; immapbuf[vec[i]]; - if (hdr->event_type == '@') + if (hdr->event_type == '@') continue; /* we can get less that than really captured from kernel, depending on diff --git a/pcap-usb-linux.h b/pcap-usb-linux.h index 06dee013..234a262f 100644 --- a/pcap-usb-linux.h +++ b/pcap-usb-linux.h @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS diff --git a/pcap-win32.c b/pcap-win32.c index f63b5c47..f449f796 100644 --- a/pcap-win32.c +++ b/pcap-win32.c @@ -12,9 +12,9 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -108,7 +108,7 @@ BOOL WINAPI DllMain( } /* Start winsock */ -int +int wsockinit() { WORD wVersionRequested; @@ -118,13 +118,13 @@ wsockinit() if (done) return err; - - wVersionRequested = MAKEWORD( 1, 1); + + wVersionRequested = MAKEWORD( 1, 1); err = WSAStartup( wVersionRequested, &wsaData ); atexit ((void(*)(void))WSACleanup); InitializeCriticalSection(&g_PcapCompileCriticalSection); done = 1; - + if ( err != 0 ) err = -1; return err; @@ -220,11 +220,11 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error: PacketReceivePacket failed"); return (PCAP_ERROR); } - + cc = p->Packet->ulBytesReceived; bp = p->Packet->Buffer; - } + } else bp = p->bp; @@ -328,14 +328,14 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* The timeout has expired but we no packets arrived */ return 0; header = (dag_record_t*)p->adapter->DagBuffer; - } + } else header = (dag_record_t*)p->bp; - + endofbuf = (char*)header + cc; - - /* - * Cycle through the packets + + /* + * Cycle through the packets */ do { @@ -345,12 +345,12 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Increase the number of captured packets */ pw->stat.ps_recv++; - + /* Find the beginning of the packet */ dp = ((u_char *)header) + dag_record_size; /* Determine actual packet len */ - switch(header->type) + switch(header->type) { case TYPE_ATM: packet_len = ATM_SNAPLEN; @@ -368,9 +368,9 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) caplen = packet_len; } dp += 2; - + break; - + case TYPE_HDLC_POS: swt = SWAPS(header->wlen); packet_len = swt - (pw->dag_fcs_bits); @@ -379,10 +379,10 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { caplen = packet_len; } - + break; } - + if(caplen > p->snapshot) caplen = p->snapshot; @@ -395,14 +395,14 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) * out of the loop without having read any packets, and * return the number of packets we've processed so far. */ - if (p->break_loop) + if (p->break_loop) { - if (n == 0) + if (n == 0) { p->break_loop = 0; return (-2); - } - else + } + else { p->bp = (char*)header; p->cc = endofbuf - (char*)header; @@ -423,30 +423,30 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) pcap_header.ts.tv_sec++; } } - + /* No underlaying filtering system. We need to filter on our own */ - if (p->fcode.bf_insns) + if (p->fcode.bf_insns) { - if (bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen) == 0) + if (bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen) == 0) { /* Move to next packet */ header = (dag_record_t*)((char*)header + erf_record_len); continue; } } - + /* Fill the header for the user suppplied callback function */ pcap_header.caplen = caplen; pcap_header.len = packet_len; - + /* Call the callback function */ (*callback)(user, &pcap_header, dp); - + /* Move to next packet */ header = (dag_record_t*)((char*)header + erf_record_len); /* Stop if the number of packets requested by user has been reached*/ - if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) + if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) { p->bp = (char*)header; p->cc = endofbuf - (char*)header; @@ -454,24 +454,24 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } while((u_char*)header < endofbuf); - + return 1; } #endif /* HAVE_DAG_API */ /* Send a packet to the network */ -static int +static int pcap_inject_win32(pcap_t *p, const void *buf, size_t size){ LPPACKET PacketToSend; PacketToSend=PacketAllocatePacket(); - + if (PacketToSend == NULL) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketAllocatePacket failed"); return -1; } - + PacketInitPacket(PacketToSend,(PVOID)buf,size); if(PacketSendPacket(p->adapter,PacketToSend,TRUE) == FALSE){ snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketSendPacket failed"); @@ -522,28 +522,28 @@ pcap_activate_win32(pcap_t *p) wsockinit(); p->adapter = PacketOpenAdapter(p->opt.source); - + if (p->adapter == NULL) { /* Adapter detected but we are not able to open it. Return failure. */ snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error opening adapter: %s", pcap_win32strerror()); return PCAP_ERROR; } - + /*get network type*/ if(PacketGetNetType (p->adapter,&type) == FALSE) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Cannot determine the network type: %s", pcap_win32strerror()); goto bad; } - + /*Set the linktype*/ - switch (type.LinkType) + switch (type.LinkType) { case NdisMediumWan: p->linktype = DLT_EN10MB; break; - + case NdisMedium802_3: p->linktype = DLT_EN10MB; /* @@ -566,27 +566,27 @@ pcap_activate_win32(pcap_t *p) p->dlt_count = 2; } break; - + case NdisMediumFddi: p->linktype = DLT_FDDI; break; - - case NdisMedium802_5: - p->linktype = DLT_IEEE802; + + case NdisMedium802_5: + p->linktype = DLT_IEEE802; break; - + case NdisMediumArcnetRaw: p->linktype = DLT_ARCNET; break; - + case NdisMediumArcnet878_2: p->linktype = DLT_ARCNET; break; - + case NdisMediumAtm: p->linktype = DLT_ATM_RFC1483; break; - + case NdisMediumCHDLC: p->linktype = DLT_CHDLC; break; @@ -617,7 +617,7 @@ pcap_activate_win32(pcap_t *p) } /* Set promiscuous mode */ - if (p->opt.promisc) + if (p->opt.promisc) { if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_PROMISCUOUS) == FALSE) @@ -626,7 +626,7 @@ pcap_activate_win32(pcap_t *p) goto bad; } } - else + else { if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_ALL_LOCAL) == FALSE) { @@ -647,8 +647,8 @@ pcap_activate_win32(pcap_t *p) if(!(p->adapter->Flags & INFO_FLAG_DAG_CARD)) { - /* - * Traditional Adapter + /* + * Traditional Adapter */ /* * If the buffer size wasn't explicitly set, default to @@ -662,16 +662,16 @@ pcap_activate_win32(pcap_t *p) snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: not enough memory to allocate the kernel buffer"); goto bad; } - + p->buffer = (u_char *)malloc(p->bufsize); - if (p->buffer == NULL) + if (p->buffer == NULL) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); goto bad; } - + PacketInitPacket(p->Packet,(BYTE*)p->buffer,p->bufsize); - + if (p->opt.immediate) { /* tell the driver to copy the buffer as soon as data arrives */ @@ -694,8 +694,8 @@ pcap_activate_win32(pcap_t *p) else #ifdef HAVE_DAG_API { - /* - * Dag Card + /* + * Dag Card */ LONG status; HKEY dagkey; @@ -703,8 +703,8 @@ pcap_activate_win32(pcap_t *p) DWORD lpcbdata; int postype = 0; char keyname[512]; - - snprintf(keyname, sizeof(keyname), "%s\\CardParams\\%s", + + snprintf(keyname, sizeof(keyname), "%s\\CardParams\\%s", "SYSTEM\\CurrentControlSet\\Services\\DAG", strstr(_strlwr(p->opt.source), "dag")); do @@ -712,36 +712,36 @@ pcap_activate_win32(pcap_t *p) status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname, 0, KEY_READ, &dagkey); if(status != ERROR_SUCCESS) break; - + status = RegQueryValueEx(dagkey, "PosType", NULL, &lptype, (char*)&postype, &lpcbdata); - + if(status != ERROR_SUCCESS) { postype = 0; } - + RegCloseKey(dagkey); } while(FALSE); - - + + p->snapshot = PacketSetSnapLen(p->adapter, snaplen); - - /* Set the length of the FCS associated to any packet. This value + + /* Set the length of the FCS associated to any packet. This value * will be subtracted to the packet length */ pw->dag_fcs_bits = p->adapter->DagFcsLen; } #else goto bad; #endif /* HAVE_DAG_API */ - + PacketSetReadTimeout(p->adapter, p->opt.timeout); - + #ifdef HAVE_DAG_API if(p->adapter->Flags & INFO_FLAG_DAG_CARD) { @@ -882,23 +882,23 @@ pcap_setfilter_win32_npf(pcap_t *p, struct bpf_program *fp) /* * We filter at user level, since the kernel driver does't process the packets */ -static int +static int pcap_setfilter_win32_dag(pcap_t *p, struct bpf_program *fp) { - - if(!fp) + + if(!fp) { strncpy(p->errbuf, "setfilter: No filter specified", sizeof(p->errbuf)); return -1; } - + /* Install a user level filter */ - if (install_bpf_program(p, fp) < 0) + if (install_bpf_program(p, fp) < 0) { snprintf(p->errbuf, sizeof(p->errbuf), "setfilter, unable to install the filter: %s", pcap_strerror(errno)); return -1; } - + return (0); } diff --git a/pcap.3pcap.in b/pcap.3pcap.in index cbbbcf9d..c02ac43e 100644 --- a/pcap.3pcap.in +++ b/pcap.3pcap.in @@ -575,7 +575,7 @@ bytes of the packet on success, and NULL on error. .BR pcap_next_ex () is passed two pointer arguments, one of which points to a .IR struct pcap_pkthdr * -and one of which points to a +and one of which points to a .IR "const u_char" *. It sets the first pointer to point to a .I struct pcap_pkthdr diff --git a/pcap/bluetooth.h b/pcap/bluetooth.h index 7cb0a8e8..01bd5a2e 100644 --- a/pcap/bluetooth.h +++ b/pcap/bluetooth.h @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -30,7 +30,7 @@ * bluetooth data struct * By Paolo Abeni */ - + #ifndef _PCAP_BLUETOOTH_STRUCTS_H__ #define _PCAP_BLUETOOTH_STRUCTS_H__ diff --git a/pcap/bpf.h b/pcap/bpf.h index f71abfed..215d5ca0 100644 --- a/pcap/bpf.h +++ b/pcap/bpf.h @@ -4,7 +4,7 @@ * * This code is derived from the Stanford/CMU enet packet filter, * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence * Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without @@ -88,7 +88,7 @@ typedef u_int bpf_u_int32; #endif /* - * Alignment macros. BPF_WORDALIGN rounds up to the next + * Alignment macros. BPF_WORDALIGN rounds up to the next * even multiple of BPF_ALIGNMENT. * * Tcpdump's print-pflog.c uses this, so we define it here. @@ -107,7 +107,7 @@ struct bpf_program { u_int bf_len; struct bpf_insn *bf_insns; }; - + /* * Link-layer header type codes. * @@ -429,7 +429,7 @@ struct bpf_program { */ #define DLT_SUNATM 123 /* Solaris+SunATM */ -/* +/* * Reserved as per request from Kent Dahlgren * for private use. */ @@ -672,7 +672,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ are used for prepending meta-information * like interface index, interface name * before standard Ethernet, PPP, Frelay & C-HDLC Frames @@ -689,7 +689,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * voice Adapter Card (PIC) */ @@ -764,7 +764,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * integrated service module (ISM). */ @@ -807,7 +807,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for capturing data on a secure tunnel interface. */ #define DLT_JUNIPER_ST 200 @@ -899,11 +899,11 @@ struct bpf_program { */ #define DLT_IEEE802_15_4_NONASK_PHY 215 -/* +/* * David Gibson requested this for * captures from the Linux kernel /dev/input/eventN devices. This * is used to communicate keystrokes and mouse movements from the - * Linux kernel to display systems, such as Xorg. + * Linux kernel to display systems, such as Xorg. */ #define DLT_LINUX_EVDEV 216 @@ -1103,7 +1103,7 @@ struct bpf_program { #define DLT_JUNIPER_ATM_CEMIC 238 /* - * NetFilter LOG messages + * NetFilter LOG messages * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) * * Requested by Jakub Zawadzki @@ -1212,7 +1212,7 @@ struct bpf_program { /* * DLT type for upper-protocol layer PDU saves from wireshark. - * + * * the actual contents are determined by two TAGs stored with each * packet: * EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the @@ -1495,7 +1495,7 @@ struct bpf_aux_data { #if __STDC__ || defined(__cplusplus) extern int bpf_validate(const struct bpf_insn *, int); extern u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); -extern u_int bpf_filter_with_aux_data(const struct bpf_insn *, const u_char *, u_int, u_int, const struct bpf_aux_data *); +extern u_int bpf_filter_with_aux_data(const struct bpf_insn *, const u_char *, u_int, u_int, const struct bpf_aux_data *); #else extern int bpf_validate(); extern u_int bpf_filter(); diff --git a/pcap/usb.h b/pcap/usb.h index 52cb5a32..83955271 100644 --- a/pcap/usb.h +++ b/pcap/usb.h @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -30,11 +30,11 @@ * Basic USB data struct * By Paolo Abeni */ - + #ifndef _PCAP_USB_STRUCTS_H__ #define _PCAP_USB_STRUCTS_H__ -/* +/* * possible transfer mode */ #define URB_TRANSFER_IN 0x80 diff --git a/pcap_breakloop.3pcap b/pcap_breakloop.3pcap index a3958206..6744924d 100644 --- a/pcap_breakloop.3pcap +++ b/pcap_breakloop.3pcap @@ -91,7 +91,7 @@ If \-2 is returned from .B pcap_dispatch() or .BR pcap_loop() , -the flag is cleared, so a subsequent call will resume reading packets. +the flag is cleared, so a subsequent call will resume reading packets. If a positive number is returned, the flag is not cleared, so a subsequent call will return \-2 and clear the flag. .SH SEE ALSO diff --git a/pcap_dump.3pcap b/pcap_dump.3pcap index c7d29f51..95f3040a 100644 --- a/pcap_dump.3pcap +++ b/pcap_dump.3pcap @@ -40,9 +40,9 @@ Note that its calling arguments are suitable for use with .B pcap_dispatch() or .BR pcap_loop() . -If called directly, the +If called directly, the .I user -parameter is of type +parameter is of type .B pcap_dumper_t as returned by .BR pcap_dump_open() . diff --git a/pcap_list_datalinks.3pcap.in b/pcap_list_datalinks.3pcap.in index 607efdec..f8493466 100644 --- a/pcap_list_datalinks.3pcap.in +++ b/pcap_list_datalinks.3pcap.in @@ -38,7 +38,7 @@ is used to get a list of the supported link-layer header types of the interface associated with the pcap descriptor. .B pcap_list_datalinks() allocates an array to hold the list and sets -.IR *dlt_buf +.IR *dlt_buf to point to that array. .LP The caller is responsible for freeing the array with diff --git a/pcap_setdirection.3pcap b/pcap_setdirection.3pcap index 70920b17..871a5b04 100644 --- a/pcap_setdirection.3pcap +++ b/pcap_setdirection.3pcap @@ -37,7 +37,7 @@ is used to specify a direction that packets will be captured. is one of the constants .BR PCAP_D_IN , .B PCAP_D_OUT -or +or .BR PCAP_D_INOUT . .B PCAP_D_IN will only capture packets received by the device, diff --git a/runlex.sh b/runlex.sh index 24c3c2e1..06b8bd45 100755 --- a/runlex.sh +++ b/runlex.sh @@ -177,7 +177,7 @@ else # # OK, rename lex.yy.c to the right output file. # - mv lex.yy.c "$outfile" + mv lex.yy.c "$outfile" # # Did that succeed? @@ -228,6 +228,6 @@ cat <$header_file $prefixline #ifndef YY_DECL #define YY_DECL int yylex(void) -#endif +#endif YY_DECL; EOF diff --git a/savefile.c b/savefile.c index abe1d2dd..783ec45b 100644 --- a/savefile.c +++ b/savefile.c @@ -218,14 +218,14 @@ pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision, FILE *file; fd = _open_osfhandle(osfd, _O_RDONLY); - if ( fd < 0 ) + if ( fd < 0 ) { snprintf(errbuf, PCAP_ERRBUF_SIZE, pcap_strerror(errno)); return NULL; } file = _fdopen(fd, "rb"); - if ( file == NULL ) + if ( file == NULL ) { snprintf(errbuf, PCAP_ERRBUF_SIZE, pcap_strerror(errno)); return NULL; diff --git a/sf-pcap-ng.c b/sf-pcap-ng.c index ea621570..100f33e0 100644 --- a/sf-pcap-ng.c +++ b/sf-pcap-ng.c @@ -664,7 +664,7 @@ pcap_ng_check_header(bpf_u_int32 magic, FILE *fp, u_int precision, char *errbuf, /* * Check whether the first 4 bytes of the file are the block - * type for a pcap-ng savefile. + * type for a pcap-ng savefile. */ if (magic != BT_SHB) { /* @@ -1000,7 +1000,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) epbp->timestamp_low; } goto found; - + case BT_SPB: /* * Get a pointer to the fixed-length portion of the @@ -1192,7 +1192,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) * Not a packet block, IDB, or SHB; ignore it. */ break; - } + } } found: diff --git a/sf-pcap.c b/sf-pcap.c index 3d0db184..eaeddfa8 100644 --- a/sf-pcap.c +++ b/sf-pcap.c @@ -682,7 +682,7 @@ pcap_dump_open(pcap_t *p, const char *fname) */ pcap_dumper_t * pcap_dump_fopen(pcap_t *p, FILE *f) -{ +{ int linktype; linktype = dlt_to_linktype(p->linktype); diff --git a/tests/BPF/4.txt b/tests/BPF/4.txt index f705d8ff..3fd2e663 100644 --- a/tests/BPF/4.txt +++ b/tests/BPF/4.txt @@ -1,2 +1,2 @@ # or pullup -ether[12:2] = 0x800 or ether[12:2] = 0x8100 or ether[0] & 0x80 != 0 or ether[12:2] = 0x9100 +ether[12:2] = 0x800 or ether[12:2] = 0x8100 or ether[0] & 0x80 != 0 or ether[12:2] = 0x9100 diff --git a/tests/pcap_compile_test.c b/tests/pcap_compile_test.c index e80ad62c..924ec732 100644 --- a/tests/pcap_compile_test.c +++ b/tests/pcap_compile_test.c @@ -1,11 +1,11 @@ - pcap = pcap_open_dead(link, snaplen); - /* todo: hook together argv to a single string */ - prog = argv[0]; - if (pcap_compile(pcap, &p, prog, optimize, 0) < 0) { - fprintf(stderr, pcap_geterr(pcap)); - exit(1); - } - bpf_dump(&p, option); - pcap_freecode(&p); - pcap_close(pcap); - + pcap = pcap_open_dead(link, snaplen); + /* todo: hook together argv to a single string */ + prog = argv[0]; + if (pcap_compile(pcap, &p, prog, optimize, 0) < 0) { + fprintf(stderr, pcap_geterr(pcap)); + exit(1); + } + bpf_dump(&p, option); + pcap_freecode(&p); + pcap_close(pcap); + diff --git a/tests/valgrindtest.c b/tests/valgrindtest.c index 1d883776..72786e41 100644 --- a/tests/valgrindtest.c +++ b/tests/valgrindtest.c @@ -231,7 +231,7 @@ main(int argc, char **argv) dorfmon = 0; useactivate = 0; infile = NULL; - + if ((cp = strrchr(argv[0], '/')) != NULL) program_name = cp + 1; else diff --git a/tests/visopts.py b/tests/visopts.py index f3853125..ab4f396d 100755 --- a/tests/visopts.py +++ b/tests/visopts.py @@ -5,7 +5,7 @@ This program parse the output from pcap_compile() to visualize the CFG after each optimize phase. Usage guide: -1. Enable optimizier debugging code when configure libpcap, +1. Enable optimizier debugging code when configure libpcap, and build libpcap & filtertest ./configure --enable-optimizer-dbg make @@ -14,23 +14,23 @@ Usage guide: ./filtertest EN10MB host 192.168.1.1 > a.txt 3. Send a.txt to this program's standard input cat a.txt | tests/visopts.py -4. Step 2&3 can be merged: +4. Step 2&3 can be merged: ./filtertest EN10MB host 192.168.1.1 | tests/visopts.py 5. The standard output is something like this: generated files under directory: /tmp/visopts-W9ekBw the directory will be removed when this programs finished. open this link: http://localhost:39062/expr1.html -6. Using open link at the 3rd line `http://localhost:39062/expr1.html' +6. Using open link at the 3rd line `http://localhost:39062/expr1.html' Note: 1. CFG graph is translated to SVG document, expr1.html embeded them as external - document. If you open expr1.html as local file using file:// protocol, some + document. If you open expr1.html as local file using file:// protocol, some browsers will deny such requests so the web pages will not shown properly. - For chrome, you can run it using following command to avoid this: + For chrome, you can run it using following command to avoid this: chromium --disable-web-security That's why this program start a localhost http server. -2. expr1.html use jquery from http://ajax.googleapis.com, so you need internet - access to show the web page. +2. expr1.html use jquery from http://ajax.googleapis.com, so you need internet + access to show the web page. """ import sys, os @@ -67,9 +67,9 @@ html_template = string.Template(""" index += 1; if (index < 10) s = "00" + index; - else if (index < 100) + else if (index < 100) s = "0" + index; - else + else s = "" + index; return "./expr" + exprid + "_g" + s + ".svg" } @@ -82,7 +82,7 @@ html_template = string.Template(""" $$(this).removeAttr('opacity'); }); }); - + $$(leftsvg).find("[id|='block']").each(function() { var has = $$(rightsvg).find("#" + this.id).length != 0; if (!has) $$(this).attr("opacity", "0.4"); @@ -106,7 +106,7 @@ html_template = string.Template(""" target.focus(); }); } - }); + }); } function init_svgroot(svg) { @@ -160,7 +160,7 @@ html_template = string.Template(""" $$(document).ready(function() { for (var i = 0; i < gcount; i++) { - var opt = ""; + var opt = ""; $$("#lselect").append(opt); $$("#rselect").append(opt); } @@ -168,7 +168,7 @@ html_template = string.Template(""" var index = parseInt($$(this).children("option:selected").val()); if (this.id == "lselect") load_left(index); - else + else load_right(index); } $$("#lselect").change(on_selected); @@ -179,7 +179,7 @@ html_template = string.Template(""" if (index <= 0) return; $$("#lselect").val(index - 1).change(); $$("#rselect").val(index).change(); - }); + }); $$("#forward").click(function() { var index = parseInt($$("#rselect option:selected").val()); if (index >= gcount - 1) return; @@ -225,7 +225,7 @@ html_template = string.Template(""" def write_html(expr, gcount, logs): logs = map(lambda s: s.strip().replace("\n", "
"), logs) - + global html_template html = html_template.safe_substitute(expr=expr.encode("string-escape"), gcount=gcount, logs=json.dumps(logs).encode("string-escape")) with file("expr1.html", "wt") as f: @@ -252,7 +252,7 @@ def render_on_html(infile): indot = 2 else: log += line - + if indot == 2: p = subprocess.Popen(['dot', '-Tsvg'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) svg = p.communicate(dot)[0] @@ -264,7 +264,7 @@ def render_on_html(infile): log = "" dot = "" indot = 0 - + if indot != 0: #unterminated dot graph for expression return False @@ -277,7 +277,7 @@ def render_on_html(infile): def run_httpd(): import SimpleHTTPServer import SocketServer - + class MySocketServer(SocketServer.TCPServer): allow_reuse_address = True Handler = SimpleHTTPServer.SimpleHTTPRequestHandler @@ -301,7 +301,7 @@ def main(): return 1 run_httpd() return 0 - + if __name__ == "__main__": if '-h' in sys.argv or '--help' in sys.argv: print __doc__