spamhaus / rbldnsd

A small and fast DNS daemon especially made to serve DNSBL zones.
https://rbldnsd.io/
GNU General Public License v2.0
57 stars 12 forks source link

Warnings - Something to worry about? #25

Open Skeeve opened 2 years ago

Skeeve commented 2 years ago

I compiled under alpine linux in a docker container.

/rbldnsd-0.998b # ./configure
configure: rbldnsd... 0.998a (06 Sep 2016)
checking for C compiler... gcc
checking whether C compiler (gcc) is GNU CC... yes
checking whether the C compiler (gcc -Wall -W -O2 -pipe)
           can produce executables... yes
checking for ranlib... ranlib
checking for stdint.h... yes
checking whether C compiler defines __SIZEOF_POINTER__... yes
checking byte order... little-endian
checking for inline... yes
checking for socklen_t... yes
checking for libraries needed for connect()... ok (none needed)
checking for IPv6... yes
checking for mallinfo()... no
checking for poll()... yes
checking for vsnprintf()... yes
checking for writev()/readv()... yes
checking for setitimer()... yes
checking for zlib support... no
creating Makefile... ok
creating config.h... ok
creating config.status... ok
all done.
/rbldnsd-0.998b # make

 rbldnsd VERSION="0.998a (06 Sep 2016)"

gcc -Wall -W -O2 -pipe  -c rbldnsd.c -DVERSION="\"0.998a (06 Sep 2016)\""
In file included from rbldnsd.c:30:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~
gcc -Wall -W -O2 -pipe  -c rbldnsd_zones.c
rbldnsd_zones.c: In function 'ds_special':
rbldnsd_zones.c:207:2: warning: #warning NS record compatibility mode: remove for 1.0 final [-Wcpp]
  207 | #warning NS record compatibility mode: remove for 1.0 final
      |  ^~~~~~~
gcc -Wall -W -O2 -pipe  -c rbldnsd_packet.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_ip4set.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_ip4tset.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_ip4trie.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_ip6tset.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_ip6trie.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_dnset.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_generic.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_combined.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_acl.c
gcc -Wall -W -O2 -pipe  -c rbldnsd_util.c
rbldnsd_util.c: In function 'parse_time':
rbldnsd_util.c:50:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
   50 |     case 'w': case 'W': m *= 7;  /* week */
      |                         ~~^~~~
rbldnsd_util.c:51:5: note: here
   51 |     case 'd': case 'D': m *= 24; /* day */
      |     ^~~~
rbldnsd_util.c:51:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
   51 |     case 'd': case 'D': m *= 24; /* day */
      |                         ~~^~~~~
rbldnsd_util.c:52:5: note: here
   52 |     case 'h': case 'H': m *= 60; /* hours */
      |     ^~~~
rbldnsd_util.c:52:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
   52 |     case 'h': case 'H': m *= 60; /* hours */
      |                         ~~^~~~~
rbldnsd_util.c:53:5: note: here
   53 |     case 'm': case 'M': m *= 60; /* minues */
      |     ^~~~
rbldnsd_util.c:55:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
   55 |       *tp *= m;
      |       ~~~~^~~~
rbldnsd_util.c:56:5: note: here
   56 |     case 's': case 'S':   /* secounds */
      |     ^~~~
gcc -Wall -W -O2 -pipe  -c dns_ptodn.c
gcc -Wall -W -O2 -pipe  -c dns_dntop.c
gcc -Wall -W -O2 -pipe  -c dns_dntol.c
gcc -Wall -W -O2 -pipe  -c dns_dnlen.c
gcc -Wall -W -O2 -pipe  -c dns_dnlabels.c
gcc -Wall -W -O2 -pipe  -c dns_dnequ.c
gcc -Wall -W -O2 -pipe  -c dns_dnreverse.c
gcc -Wall -W -O2 -pipe  -c dns_findname.c
awk -f dns_maketab.awk dns.h > dns_nametab.c.tmp
mv -f dns_nametab.c.tmp dns_nametab.c
gcc -Wall -W -O2 -pipe  -c dns_nametab.c
gcc -Wall -W -O2 -pipe  -c ip4parse.c
gcc -Wall -W -O2 -pipe  -c ip4atos.c
gcc -Wall -W -O2 -pipe  -c ip4mask.c
gcc -Wall -W -O2 -pipe  -c ip6addr.c
gcc -Wall -W -O2 -pipe  -c mempool.c
gcc -Wall -W -O2 -pipe  -c istream.c
gcc -Wall -W -O2 -pipe  -c btrie.c
rm -f librbldnsd.a
ar rv librbldnsd.a dns_ptodn.o dns_dntop.o dns_dntol.o dns_dnlen.o dns_dnlabels.o dns_dnequ.o dns_dnreverse.o dns_findname.o dns_nametab.o ip4parse.o ip4atos.o ip4mask.o ip6addr.o mempool.o istream.o btrie.o
ar: creating librbldnsd.a
a - dns_ptodn.o
a - dns_dntop.o
a - dns_dntol.o
a - dns_dnlen.o
a - dns_dnlabels.o
a - dns_dnequ.o
a - dns_dnreverse.o
a - dns_findname.o
a - dns_nametab.o
a - ip4parse.o
a - ip4atos.o
a - ip4mask.o
a - ip6addr.o
a - mempool.o
a - istream.o
a - btrie.o
ranlib librbldnsd.a
gcc  -o rbldnsd rbldnsd.o rbldnsd_zones.o rbldnsd_packet.o rbldnsd_ip4set.o rbldnsd_ip4tset.o rbldnsd_ip4trie.o rbldnsd_ip6tset.o rbldnsd_ip6trie.o rbldnsd_dnset.o rbldnsd_generic.o rbldnsd_combined.o rbldnsd_acl.o rbldnsd_util.o librbldnsd.a 

Dockerfile used:

FROM alpine:3.14 AS builder

ENV RBLDNS_URL=https://github.com/spamhaus/rbldnsd/archive/refs/tags/0.998b.zip
RUN apk add \
    alpine-sdk \
 && VERSION=$( basename "${RBLDNS_URL}" .zip ) \
 && curl -L -O "$RBLDNS_URL" \
 && unzip $VERSION \
 && cd "rbldnsd-$VERSION" \
 && ./configure \
 && make \
 && mv rbldnsd /usr/local/bin/ \
;

FROM alpine:3.14

COPY --from=builder /usr/local/bin/rbldnsd /usr/local/bin/
# Timezone Berlin
RUN apk add \
    tzdata \
    util-linux \
 && cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
 && echo "Europe/Berlin" > /etc/timezone \
 && apk del tzdata \
;
orlitzky commented 1 year ago
gcc -Wall -W -O2 -pipe  -c rbldnsd.c -DVERSION="\"0.998a (06 Sep 2016)\""
In file included from rbldnsd.c:30:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~

POSIX has said to use <poll.h> for at least 20 years, so this is an easy fix: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/poll.h.html

rbldnsd_util.c: In function 'parse_time':
rbldnsd_util.c:50:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
   50 |     case 'w': case 'W': m *= 7;  /* week */
      |                         ~~^~~~

These aren't usually problems and are only shown because of -Wall. I hid them in https://github.com/spamhaus/rbldnsd/commit/befeec83ec00a8909c4d7c85c736e9c1499745d5.

rbldnsd_zones.c:207:2: warning: #warning NS record compatibility mode: remove for 1.0 final [-Wcpp]
  207 | #warning NS record compatibility mode: remove for 1.0 final
      |  ^~~~~~~

This was fixed in https://github.com/spamhaus/rbldnsd/commit/b656295f68ba0b6e3dd76e480eb79e2b8e2e7493. so I think the sys/poll.h thing is all that's left. Then maybe it's time for a new release :)

orlitzky commented 1 year ago

I hid them in befeec8.

I had a vague memory of working on this, but looking back, it wasn't actually me that fixed it. Sorry!