PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.63k stars 904 forks source link

gcc 8.3 compile error of dnsscope.cc #8060

Open miesi opened 5 years ago

miesi commented 5 years ago

Short description

Trying to help with #2654. Compiling auth-4.2.0rc2 on illumos with gcc-8.3.0.

dnsscope.cc: In function 'int main(int, char**)':
dnsscope.cc:240:35: error: 'IP_OFFMASK' was not declared in this scope
      if((frag & IP_MF) || (frag & IP_OFFMASK)) { // more fragments or IS a fragment
                                   ^~~~~~~~~~
dnsscope.cc:240:35: note: suggested alternative: 'IP6F_OFF_MASK'
      if((frag & IP_MF) || (frag & IP_OFFMASK)) { // more fragments or IS a fragment
                                   ^~~~~~~~~~
                                   IP6F_OFF_MASK

using the compiler hint make the error disappear, but I don't that this produces correct code.

Environment

Steps to reproduce

  1. download https://downloads.powerdns.com/releases/pdns-4.2.0-rc2.tar.bz2
  2. gtar jxvf pdns-4.2.0-rc2.tar.bz2; cd pdns-4.2.0-rc2
  3. CFLAGS="-m64 -O2" CXXFLAGS="-m64 -O2" ./configure --enable-tools --enable-ixfrdist --with-sqlite3 --with-lua --with-protobuf --with-modules="" --with-dynmodules="bind gmysql gpgsql lua mydns pipe remote" --sysconfdir=/etc/pdns --with-mysql-config=/usr/mariadb/10.3/bin/mysql_config --with-pg-config=/usr/postgres/11/bin/pg_config
  4. gmake -j6

Expected behaviour

compiles everything

Actual behaviour

dnsscope.cc: In function 'int main(int, char**)':
dnsscope.cc:240:35: error: 'IP_OFFMASK' was not declared in this scope
      if((frag & IP_MF) || (frag & IP_OFFMASK)) { // more fragments or IS a fragment
                                   ^~~~~~~~~~
dnsscope.cc:240:35: note: suggested alternative: 'IP6F_OFF_MASK'
      if((frag & IP_MF) || (frag & IP_OFFMASK)) { // more fragments or IS a fragment
                                   ^~~~~~~~~~
                                   IP6F_OFF_MASK

Usecase

help with #2654

miesi commented 5 years ago

illumos /usr/include/netinet/ip.h has no line

#define IP_OFFMASK 0x1fff

is adding something like this to dnsscope.cc feasible?

#if !defined (IP_OFFMASK)
#define  IP_OFFMASK 0x1fff
#endif
Habbie commented 5 years ago

feasible?

No - we have no idea what that number would mean to your kernel.

Habbie commented 5 years ago

No - we have no idea what that number would mean to your kernel.

Wait, ignore that.

Habbie commented 5 years ago

is adding something like this to dnsscope.cc feasible?

yes

miesi commented 5 years ago

Okay, illumos is still

ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88

whereas Linux has

 @(#)ip.h        8.1 (Berkeley) 6/10/93

I'll create pull requests.

zeha commented 5 years ago

Okay, illumos is still

ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88

Why not fix illumos instead, then?

miesi commented 5 years ago

I will request that, but updating ip.h in an OS is a different ballpark.

Adding this small enhancement to a small tool, not the core product, to make it just work, is acceptable I hope.

Habbie commented 5 years ago

Adding this small enhancement to a small tool, not the core product, to make it just work, is acceptable I hope.

Yes