Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsd-control says "input in flex scanner failed"#119

Closed
hdatma opened this issue Aug 31, 2020 · 5 comments
Closed

nsd-control says "input in flex scanner failed" #119

hdatma opened this issue Aug 31, 2020 · 5 comments

Comments

@hdatma
Copy link

hdatma commented Aug 31, 2020

I am at pains with this error message.

This is how I configured:

>configure --prefix=$prefix \
   --sysconfdir=$etc --with-configdir=$etc --with-nsd_conf_file=$etc \
   --localstatedir=$var \
   --mandir=$man \
   --with-chroot=$prefix \
   --with-xfrdir=$var/tmp \
   --with-user=$username \
   --with-ssl=$foot/share/openssl \
   --with-libevent=no \
   --enable-checking \
   --enable-ratelimit \
   --enable-pie \
   --enable-relro-now \
   --disable-flto \
   --disable-largefile

[...]
checking for gawk... gawk
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/grep -E
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -lfl
checking whether yytext is a pointer... yes
checking for bison... bison -y
checking whether ln -s works... yes
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether lex accepts -i... yes
checking if lex defines yy_current_buffer... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for uid_t in sys/types.h... yes
...

This is what the compiler says:

In file included from dns.c:24:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

In file included from rdata.c:25:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

In file included from tsig.c:16:
./tsig-openssl.h:25:27: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void tsig_openssl_finalize();
                          ^
                           void

In file included from tsig-openssl.c:14:
./tsig-openssl.h:25:27: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void tsig_openssl_finalize();
                          ^
                           void

In file included from util.c:38:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

ipc.c:53:2: warning: code will never be executed [-Wunreachable-code]
        exit(0);
        ^~~~

server.c:1657:4: warning: code will never be executed [-Wunreachable-code]
                        exit(0);
                        ^~~~
server.c:1854:3: warning: code will never be executed [-Wunreachable-code]
                log_crypto_err("Error in SSL_CTX_ecdh_auto, not enabling ECDHE");
                ^~~~~~~~~~~~~~

In file included from dbaccess.c:29:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

In file included from zlexer.lex:26:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

In file included from zonec.c:35:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

In file included from zparser.y:19:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

In file included from nsd-checkzone.c:23:
./zonec.h:120:37: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void zadd_rdata_txt_clean_wireformat();
                                    ^
                                     void

nsd-control.c:66:18: warning: this function declaration is not a prototype [-Wstrict-prototypes]
static void usage() ATTR_NORETURN;
                 ^
                  void

The server starts and runs, however.

@hdatma
Copy link
Author

hdatma commented Aug 31, 2020

I removed the part "--with-configdir=$etc --with-nsd_conf_file=$etc" and the problem disappeared.

@wcawijngaards
Copy link
Member

Thank you for the report, I fixed the compiler warnings, that is good to fix.

The error seems to be because nsd-control by default reads the default config file. And you set it to a particular one with the configure statement. This caused that file to be read. But it has lots of syntax failures, I guess it is not an nsd.conf file at all, this error is printed if the flex code tries to read the file but there is an IO error while reading the file. I would like to print a better error at this time, for which I would like to reproduce it, can you tell me what was at the $etc location for config file? Or did you set it to read a directory as a config file, perhaps?

@wcawijngaards
Copy link
Member

Yes, reproduced this by reading a directory. That causes the flex code to exit. There is code to print a warning about the impending problem, it prints that it is trying to read a directory. Also implemented that for zone files. That should make is easier to figure out what the problem is.

Thanks for the report! The code is in the github repo, and should be in the next release.

@hdatma
Copy link
Author

hdatma commented Sep 1, 2020

Hey!

The $etc was an alias for $prefix/etc/nsd/. I noted one time too many that configure ignores --sysconfdir, in the sense that it adds a nsd subfolder to it. So that may have been the root problem with --sysconfdir=$etc in this case.

The origin of this config is the attempt to chroot, similarly to how I do it with unbound. Unbound allows me to install sbin on a read-only side of the disk, and write under var, even if I have to write etc also under var. By comparison, nsd demands sbin to be inside chroot, which means I cannot have a read-only part. I do not know why netlabs decided to implement two different solutions for essentially the same problem.

@wcawijngaards
Copy link
Member

For NSD the sbin does not have to be in the chroot, I think? Just pass all absolute pathnames (that start with the chroot dir) and then NSD should strip off the leading chroot part when it needs that path, from nsd.conf. The nsd-checkconf tool should print warnings when chroot paths are wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants