Skip to content

Commit

Permalink
LGTM, README, packages, scan-build
Browse files Browse the repository at this point in the history
- Add LGTM and fix alerts
- `README.md`: Update dependencies and install instructions
- Remove `ports/dsc-collector` as we don't maintain it
- Add GeoIP to packages
- Update `pcap-thread` to v4.0.0
- Update `pcap_layers` with fixes for `scan-build` warnings
- Fix `scan-build` warnings
  • Loading branch information
jelu committed Dec 6, 2018
1 parent 108d6b4 commit 473387b
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 68 deletions.
14 changes: 14 additions & 0 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extraction:
cpp:
prepare:
packages:
- build-essential
- automake
- autoconf
- libtool
- libpcap-dev
- libgeoip-dev
configure:
command:
- ./autogen.sh
- ./configure
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ SUBDIRS = src cron

dist_doc_DATA = README.md CHANGES LICENSE UPGRADE.md

EXTRA_DIST = m4 doc ports autogen.sh .clang-format fmt.sh
EXTRA_DIST = m4 doc autogen.sh .clang-format fmt.sh

test: check
56 changes: 43 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DNS Statistics Collector

[![Build Status](https://travis-ci.org/DNS-OARC/dsc.svg?branch=develop)](https://travis-ci.org/DNS-OARC/dsc) [![Coverity Scan Build Status](https://scan.coverity.com/projects/8773/badge.svg)](https://scan.coverity.com/projects/dns-oarc-dsc)
[![Build Status](https://travis-ci.org/DNS-OARC/dsc.svg?branch=develop)](https://travis-ci.org/DNS-OARC/dsc) [![Coverity Scan Build Status](https://scan.coverity.com/projects/8773/badge.svg)](https://scan.coverity.com/projects/dns-oarc-dsc) [![Total alerts](https://img.shields.io/lgtm/alerts/g/DNS-OARC/dsc.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DNS-OARC/dsc/alerts/)

DNS Statistics Collector (DSC) is a tool used for collecting and exploring
statistics from busy DNS servers. It uses a distributed architecture with
Expand All @@ -21,37 +21,67 @@ Issues should be reported here:
Mailinglist:
- https://lists.dns-oarc.net/mailman/listinfo/dsc

# Install
## Dependencies

Following build tools are needed, example for Debian/Ubuntu.
`dsc` requires a couple of libraries beside a normal C compiling
environment with autoconf, automake and libtool.

`dsc` has a non-optional dependency on the PCAP library and optional
dependency on the GeoIP library (for the `asn` and `country` indexer).

To install the dependencies under Debian/Ubuntu:
```
apt-get install -y libpcap-dev libproc-pid-file-perl
```

To install the dependencies under CentOS (with EPEL enabled):
```
sudo apt-get install build-essential automake autoconf
yum install -y libpcap-devel perl-Proc-PID-File
```

Following dependencies are needed, example for Debian/Ubuntu.
To install the dependencies under FreeBSD 10+ using `pkg`:
```
pkg install -y libpcap p5-Proc-PID-File
```

To install the dependencies under OpenBSD 5+ using `pkg_add`:
```
sudo apt-get install libpcap-dev libproc-pid-file-perl
pkg_add p5-Proc-PID-File
```

If you are installing from the GitHub repository you need to initialize the
submodule first and generate configure.
NOTE: It is recommended to install the PCAP library from source/ports on
OpenBSD since the bundled version is an older and modified version.

## Building from source tarball

The source tarball from DNS-OARC comes prepared with `configure`:

```
git submodule update --init
./autogen.sh
tar zxvf dsc-version.tar.gz
cd dsc-version
./configure [options]
make
make install
```

Now you can compile with optional options and install.
## Building from Git repository

If you are building `dsc` from it's Git repository you will first need
to initiate the Git submodules that exists and later create autoconf/automake
files, this will require a build environment with autoconf, automake and
libtool to be installed.

```
./configure [options ... ]
git clone https://github.com/DNS-OARC/dsc.git
cd dsc
git submodule update --init
./autogen.sh
./configure [options]
make
make install
```

# Puppet
## Puppet

John Bond at ICANN DNS Engineering team has developed a puppet module for DSC,
the module and code can be found here:
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Jerry Lundström <lundstrom.jerry@gmail.com>
Build-Depends: debhelper (>= 8.0.0), build-essential, automake, autoconf,
libpcap-dev, libproc-pid-file-perl, netbase
libpcap-dev, libproc-pid-file-perl, netbase, libgeoip-dev
Standards-Version: 3.9.4
Homepage: https://www.dns-oarc.net/oarc/data/dsc
Vcs-Git: https://github.com/DNS-OARC/dsc.git
Expand Down
25 changes: 0 additions & 25 deletions ports/dsc-collector/Makefile

This file was deleted.

3 changes: 0 additions & 3 deletions ports/dsc-collector/distinfo

This file was deleted.

13 changes: 0 additions & 13 deletions ports/dsc-collector/pkg-descr

This file was deleted.

1 change: 1 addition & 0 deletions rpm/dsc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ URL: https://www.dns-oarc.net/oarc/data/dsc
Source0: %{name}_%{version}.orig.tar.gz

BuildRequires: libpcap-devel
BuildRequires: GeoIP-devel
BuildRequires: perl
BuildRequires: perl(Proc::PID::File)
BuildRequires: autoconf
Expand Down
7 changes: 4 additions & 3 deletions src/config_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ int no_wait_interval = 0;
int pt_timeout = 100;
int drop_ip_fragments = 0;

extern int ip_local_address(const char*, const char*);
extern void pcap_set_match_vlan(int);

int open_interface(const char* interface)
{
dsyslogf(LOG_INFO, "Opening interface %s", interface);
Expand All @@ -94,7 +97,6 @@ int set_bpf_program(const char* s)

int add_local_address(const char* s, const char* m)
{
extern int ip_local_address(const char*, const char*);
dsyslogf(LOG_INFO, "adding local address %s%s%s", s, m ? " mask " : "", m ? m : "");
return ip_local_address(s, m);
}
Expand Down Expand Up @@ -202,8 +204,7 @@ int set_bpf_vlan_tag_byte_order(const char* which)

int set_match_vlan(const char* s)
{
extern void pcap_set_match_vlan(int);
int i;
int i;
dsyslogf(LOG_INFO, "match_vlan %s", s);
i = atoi(s);
if (0 == i && 0 != strcmp(s, "0"))
Expand Down
4 changes: 2 additions & 2 deletions src/dns_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ int add_qname_filter(const char* name, const char* pat)
regerror(x, r, errbuf, 512);
dsyslogf(LOG_ERR, "regcomp: %s", errbuf);
}
fl = md_array_filter_list_append(fl, md_array_create_filter(name, qname_filter, r));
(void)md_array_filter_list_append(fl, md_array_create_filter(name, qname_filter, r));
return 1;
}

Expand Down Expand Up @@ -495,5 +495,5 @@ void dns_message_init(void)
fl = md_array_filter_list_append(fl, md_array_create_filter("chaos-class", chaos_class_filter, 0));
fl = md_array_filter_list_append(fl, md_array_create_filter("priming-query", priming_query_filter, 0));
fl = md_array_filter_list_append(fl, md_array_create_filter("servfail-only", servfail_filter, 0));
fl = md_array_filter_list_append(fl, md_array_create_filter("authentic-data-only", ad_filter, 0));
(void)md_array_filter_list_append(fl, md_array_create_filter("authentic-data-only", ad_filter, 0));
}
2 changes: 1 addition & 1 deletion src/dns_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ grok_question(const u_char* buf, int len, off_t offset, char* qname, unsigned sh
if (0 != x)
return 0;
if ('\0' == *qname) {
*qname = '.';
*qname = '.';
*(qname + 1) = 0;
}
/* XXX remove special characters from QNAME */
Expand Down
4 changes: 2 additions & 2 deletions src/ext/base64.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
* Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
Expand Down Expand Up @@ -61,7 +61,7 @@ base64_encode(const void *data, int size, char **str)
if (p == NULL)
return -1;
q = (const unsigned char *) data;
i = 0;
// i = 0;
for (i = 0; i < size;) {
c = q[i++];
c *= 256;
Expand Down
2 changes: 1 addition & 1 deletion src/pcap-thread
Submodule pcap-thread updated 104 files
4 changes: 2 additions & 2 deletions src/pcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ pcap_tcp_handler(const struct tcphdr* tcp, int len, void* udata)

if (debug_flag > 1) {
char* p = label;
*p = 0;
*p = 0;
inXaddr_ntop(&key.src_ip_addr, p, 128);
p += strlen(p);
p += snprintf(p, 32, ":%d ", key.sport);
Expand Down Expand Up @@ -744,7 +744,7 @@ void handle_raw(const u_char* pkt, int len, void* userdata);
#endif
void handle_ether(const u_char* pkt, int len, void* userdata);
#ifdef DLT_LINUX_SLL
void handle_linux_sll(const u_char * pkt, int len, void *userdata);
void handle_linux_sll(const u_char* pkt, int len, void* userdata);
#endif

static void
Expand Down
2 changes: 1 addition & 1 deletion src/pcap_layers
Submodule pcap_layers updated 1 files
+2 −2 pcap_layers.c

0 comments on commit 473387b

Please sign in to comment.