From ff7fd0e703f595103dc45ba808752ee55f2455cb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 24 Oct 2014 22:03:50 +0100 Subject: [PATCH] Config parsing: Ignore some BIND9-specific resolv.conf options Debian #411263. I also read wheezy's resolv.conf(5). Signed-off-by: Ian Jackson --- regress/case-unkopts.err | 0 regress/case-unkopts.out | 7 +++++++ regress/case-unkopts.sys | 34 ++++++++++++++++++++++++++++++++++ regress/init-unkopts.text | 6 ++++++ src/setup.c | 17 +++++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 regress/case-unkopts.err create mode 100644 regress/case-unkopts.out create mode 100644 regress/case-unkopts.sys create mode 100644 regress/init-unkopts.text diff --git a/regress/case-unkopts.err b/regress/case-unkopts.err new file mode 100644 index 0000000..e69de29 diff --git a/regress/case-unkopts.out b/regress/case-unkopts.out new file mode 100644 index 0000000..5117bf3 --- /dev/null +++ b/regress/case-unkopts.out @@ -0,0 +1,7 @@ +adns debug: using nameserver 172.18.45.6 +adns: :5: unknown option `wombat' +adns: :6: unknown configuration directive `stoat' +chiark.greenend.org.uk flags 0 type 1 A(-) submitted +chiark.greenend.org.uk flags 0 type A(-): OK; nrrs=1; cname=$; owner=$; ttl=3600 + 212.13.197.229 +rc=0 diff --git a/regress/case-unkopts.sys b/regress/case-unkopts.sys new file mode 100644 index 0000000..dadf4c3 --- /dev/null +++ b/regress/case-unkopts.sys @@ -0,0 +1,34 @@ +./adnstest unkopts +:0x0|1 chiark.greenend.org.uk + start 1414184606.322883 + socket domain=AF_INET type=SOCK_DGRAM + socket=6 + +0.000116 + fcntl fd=6 cmd=F_GETFL + fcntl=~O_NONBLOCK&... + +0.000047 + fcntl fd=6 cmd=F_SETFL O_NONBLOCK|... + fcntl=OK + +0.000040 + sendto fd=6 addr=172.18.45.6:53 + 311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267 + 02756b00 00010001. + sendto=40 + +0.000202 + select max=7 rfds=[6] wfds=[] efds=[] to=1.999798 + select=1 rfds=[6] wfds=[] efds=[] + +0.002958 + recvfrom fd=6 buflen=512 + recvfrom=OK addr=172.18.45.6:53 + 311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267 + 02756b00 00010001 c00c0001 00010000 0e100004 d40dc5e5 c0130002 00010001 + 51800011 036e7331 0a72656c 61746976 697479c0 13c01300 02000100 01518000 + 06036e73 30c048c0 61000100 01000151 800004ac 122d06c0 44000100 01000151 + 800004ac 122d0b. + +0.000383 + recvfrom fd=6 buflen=512 + recvfrom=EAGAIN + +0.000138 + close fd=6 + close=OK + +0.000180 diff --git a/regress/init-unkopts.text b/regress/init-unkopts.text new file mode 100644 index 0000000..2688162 --- /dev/null +++ b/regress/init-unkopts.text @@ -0,0 +1,6 @@ +nameserver 172.18.45.6 +sortlist 127.0.0.1/32 172.18.45.0/28 172.18.45.0/24 +search davenant.greenend.org.uk greenend.org.uk +lwserver 127.0.0.1 +options timeout:1 attempts:30 rotate no-check-names inet6 edns0 wombat +stoat diff --git a/src/setup.c b/src/setup.c index 3ebcd21..17a0d8e 100644 --- a/src/setup.c +++ b/src/setup.c @@ -321,6 +321,18 @@ static void ccf_options(adns_state ads, const char *fn, } continue; } + if (/* adns's query strategy is not configurable */ + OPTION_STARTS("timeout:") || + OPTION_STARTS("attempts:") || + OPTION_IS("rotate") || + /* adns provides the application with knob for this */ + OPTION_IS("no-check-names") || + /* adns normally does IPv6 if the application wants it; control + * this with the adns_af: option if you like */ + OPTION_IS("inet6") || + /* adns does not do edns0 and this is not a problem */ + OPTION_IS("edns0")) + continue; adns__diag(ads,-1,0,"%s:%d: unknown option `%.*s'", fn,lno, l,word); } @@ -372,6 +384,10 @@ static void ccf_lookup(adns_state ads, const char *fn, int lno, adns__diag(ads,-1,0,"%s:%d: `lookup' specified, but not `bind'", fn,lno); } +static void ccf_ignore(adns_state ads, const char *fn, int lno, + const char *buf) { +} + static const struct configcommandinfo { const char *name; void (*fn)(adns_state ads, const char *fn, int lno, const char *buf); @@ -384,6 +400,7 @@ static const struct configcommandinfo { { "clearnameservers", ccf_clearnss }, { "include", ccf_include }, { "lookup", ccf_lookup }, /* OpenBSD */ + { "lwserver", ccf_ignore }, /* BIND9 lwresd */ { 0 } }; -- 2.11.0