summaryrefslogtreecommitdiff
path: root/astraceroute.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-19astraceroute: change type of variables from int to bool in struct ctxuno200011-23/+23
Signed-off-by: uno20001 <regisztralo111@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-10-02all: change bug report instructions in copyright messageTobias Klauser1-1/+2
The bugs@netsniff-ng.org e-mail bounces. Also it's more convenient to report bugs using GitHub rather than via e-mail, so consistently mention https://github.com/netsniff-ng/netsniff-ng/issues for where to report bugs. Fixes #226 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-10-02astraceroute: reorder function declarationsuno200011-4/+4
Group functions for the same protocol together. Signed-off-by: uno20001 <regisztralo111@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-12-11astraceroute: checksum calculation for ICMP and TCPuno200011-44/+106
Calculate ICMP and TCP checksums for both IPv4 and IPv6, Fixes #198 Fixes #200 Signed-off-by: uno20001 <regisztralo111@gmail.com> [tk: code formatting, C89 compatibility] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-10-20astraceroute: use switch instead of lookup table for short proto idcoverity_scanTobias Klauser1-6/+14
Avoid having a 58 entry array on stack of which only 3 are ever used. Just look up the short protocol identifier via a good'ol switch. Fixes Coverity CID 1381806 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-05-10all: use <net/*> headers instead of <linux/*> where possibleTobias Klauser1-1/+1
The musl libc headers redefine some of the structs in linux/if_arp.h and linux/if_ether.h, leading to compilation errors. Fix those by using the libc provided versions of these headers and provide compatibility defines for those that aren't present in older glibc versions. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-02-06geoip: Fix memory leak when using GeoIPRecordVadim Kochan1-2/+8
GeoIP_record_by_ipnum{,_v6} returns allocated pointer to GeoIPRecord with allocated city, region & postal_code which is not freed after the call. Fixed by xstrdup-ing required GeoIPRecord member (city/region) and after calling GeoIPRecord_delete to free the geoip record. Of course it is needed to also free obtained city/region in netsniff-ng, astraceroute & flowtop tools. Fixes #169 Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-12-08all: Remove unused longindex parameter to getopt_long()Tobias Klauser1-2/+2
All tools (except mausezahn) use getopt_long() and pass a pointer to a local opt_index variable for the longindex parameter. However, this variable is never read afterwards. According to getopt(3) it's perfectly fine to pass NULL as the longindex parameter instead, so do that. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-17build: Define _DEFAULT_SOURCE to fix compilation warnings with glibc>=2.20arch3y1-0/+1
Fixes depracation issues for glibc>=2.20 if we define _BSD_SOURCE we must also define _DEFAULT_SOURCE as well from tprintf.c warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" from astraceroute.c warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" Signed-off-by: Arch3y <arch3y@archstrike.org> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-14astraceroute: Use proper type for ctx.sd_lenTobias Klauser1-1/+2
The sd_len member of struct ctx stores a copy of struct addrinfo member ai_addrlen which is of type socklen_t. Also it is used in a sendto() call which also expects a socklen_t. Adjust sd_len to be socklen_t too. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-28all: Change reporting bugs emailVadim Kochan1-1/+1
Replace bugs@netsniff-ng.com with netsniff-ng@googlegroups.com which is used in REPORTING-BUGS file. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-12-12all: Reduce amount of empty liens in usage and version output a bitTobias Klauser1-5/+5
No need for some of the empty lines, remove them to make the output a bit denser. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05astraceroute: Don't duplicate copyright/bug report/license stringTobias Klauser1-14/+11
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of astraceroute.o slightly smaller: before: text data bss dec hex filename 18481 0 4 18485 4835 astraceroute/astraceroute.o after: text data bss dec hex filename 18201 0 4 18205 471d astraceroute/astraceroute.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-07-23build: astraceroute: Only build ioops with GeoIP support enabledTobias Klauser1-1/+0
The ioops module is only needed in geoip.o, thus make it dependent on CONFIG_GEOIP. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-06-25xmalloc: Add and use xcallocTobias Klauser1-1/+1
Add a wrapper for calloc which checks for integer overflows in the calculation of the size to allocate. Use xcalloc to allocate an array of objects instead of calculating the size ourselves, which might cause an integer overflow. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-27geoip: Pass struct sockaddr_in{,6} as pointer instead of by valueTobias Klauser1-8/+8
Change the interface to the geoip_* functions to take a pointer to a struct sockaddr_in{,6} instead of the struct itself. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-05-09ring: Merge common ring_{rx,tx} initialization into own functionTobias Klauser1-2/+2
Instead of having to perform the individual steps to initialize a ring and open coding them in multiple places, provide convenience functions to do all at once. This has the nice side effect of allowing to make most of these *_{rx,tx}_ring() functions static in their respective module. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-03-16Typo: longitudeKartik Mistry1-1/+1
Fixed typo in astraceroute.* files. Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
2014-02-22astraceroute: Exit gracefully for all possible termination signalsTobias Klauser1-0/+4
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-08-21astraceroute: Support binding to a specific IP address.Oliver Smith1-4/+28
In a situation where the IP that you wish to use as the source address differs from the interface it needs to be sent from, it is now possible to manually specify an address to bind to whilst still being able to specify the physical interface to send from. [Fixed up whitespace, minor coding style and added man-page entry --DB] Signed-off-by: Oliver Smith <oliver@zerolag.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-08-08astraceroute: Fix compiler warnings with "-W -Wall -Wextra"Tobias Klauser1-13/+17
Fix the following compiler warnings that occur when building with "-W -Wall -Wextra": astraceroute.c: In function ‘__assemble_data’: astraceroute.c:255:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c:262:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c: In function ‘check_ipv4’: astraceroute.c:425:56: warning: unused parameter ‘ttl’ [-Wunused-parameter] astraceroute.c: In function ‘handle_ipv4’: astraceroute.c:451:49: warning: unused parameter ‘len’ [-Wunused-parameter] astraceroute.c: In function ‘check_ipv6’: astraceroute.c:511:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c:491:56: warning: unused parameter ‘ttl’ [-Wunused-parameter] astraceroute.c: In function ‘handle_ipv6’: astraceroute.c:517:49: warning: unused parameter ‘len’ [-Wunused-parameter] astraceroute.c: In function ‘__process_node’: astraceroute.c:690:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c: In function ‘__process_time’: astraceroute.c:738:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c:755:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c:765:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c: In function ‘__process_ttl’: astraceroute.c:846:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] astraceroute.c: In function ‘main’: astraceroute.c:1060:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-08-08astraceroute: Use size_t for struct members storing packet lengthsTobias Klauser1-5/+6
Packet lengths are strictly positive and the functions dealing with them (sendto(), recvfrom() etc.) take size_t, thus use size_t. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-07-09all: show git id in --version informationDaniel Borkmann1-2/+4
In order to be able to better track regressions or to give support, let us track the Git id as well in version information. This makes the ``--version'' switch actually useful. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04xutils: eliminate xutils, move rest to epoll2Daniel Borkmann1-1/+0
Finally eliminate xutils.{c,h} and move the rest to epoll2. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04sig: add signal handling functionsDaniel Borkmann1-0/+1
Add an extra file for signal handling functions. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04sock: add socket management functionsDaniel Borkmann1-0/+1
Remove them from xutils, and add them to socket management. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04xutils: move device management functions out of xutilsDaniel Borkmann1-0/+1
Move those functions out so that they can be more easily maintained in its separate file. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04xio: rename xio to ioops and reduce its includesDaniel Borkmann1-1/+1
Rename xio to ioops (io-ops) and boil its include files down to a minimum. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04xio: add ioexact operationsDaniel Borkmann1-1/+1
Break this out so that we only need to have sigint non-static where it is really needed. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-23make: include build nameDaniel Borkmann1-1/+1
Include long version string into tools when called with --version. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-17astraceroute: Add __noreturn attribute to exiting functionsTobias Klauser1-2/+2
Add the __noreturn attribute to all functions which wont return but call die() themselves to exit(). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-05-16astraceroute: Mention exit after printing information in built-in helpTobias Klauser1-2/+2
Mention the fact that astraceroute exits after printing either the help of the version information. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-03-16misc: remove dead/unreachable code from switch statementsDaniel Borkmann1-2/+0
Remove various unreachable sections from the switch statements. This was detected by the coverty scanner. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-03-16astraceroute: fix getnameinfo argumentsDaniel Borkmann1-4/+4
Coverty detected a misuse of the getnameinfo API, thus, we need to fix the length parameter. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-03-15all: import netsniff-ng 0.5.8-rc0 sourceDaniel Borkmann1-0/+1077
We decided to get rid of the old Git history and start a new one for several reasons: *) Allow / enforce only high-quality commits (which was not the case for many commits in the history), have a policy that is more close to the one from the Linux kernel. With high quality commits, we mean code that is logically split into commits and commit messages that are signed-off and have a proper subject and message body. We do not allow automatic Github merges anymore, since they are total bullshit. However, we will either cherry-pick your patches or pull them manually. *) The old archive was about ~27MB for no particular good reason. This basically derived from the bad decision that also some PDF files where stored there. From this moment onwards, no binary objects are allowed to be stored in this repository anymore. The old archive is not wiped away from the Internet. You will still be able to find it, e.g. on git.cryptoism.org etc. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>