summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2020-08-07 13:47:09 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-08-18 10:06:25 +0200
commit1c7466aa2e5663b5595f9cef5cbece9ec63bcc14 (patch)
treece70e9a311ad709664d97b4f32759f914fd3cb39
parentMerge pull request #16761 from keszybz/missing-syscall-cleanup (diff)
downloadsystemd-1c7466aa2e5663b5595f9cef5cbece9ec63bcc14.tar.xz
systemd-1c7466aa2e5663b5595f9cef5cbece9ec63bcc14.zip
resolve: lift limits on search domains count or length
glibc 2.26 lifted restrictions on search domains count or length to unlimited. This has also been backported to 2.17 in some distributions (RHEL 7 and derivatives). Other softwares may have their own limits for search domains, but we should not restrict what is written out any more. https://sourceware.org/legacy-ml/libc-announce/2017/msg00001.html
-rw-r--r--src/resolve/resolved-resolv-conf.c10
-rwxr-xr-xtest/networkd-test.py35
2 files changed, 1 insertions, 44 deletions
diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c
index c6f48d6d88..befd8d7949 100644
--- a/src/resolve/resolved-resolv-conf.c
+++ b/src/resolve/resolved-resolv-conf.c
@@ -231,7 +231,6 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) {
static void write_resolv_conf_search(
OrderedSet *domains,
FILE *f) {
- unsigned length = 0, count = 0;
Iterator i;
char *domain;
@@ -241,15 +240,6 @@ static void write_resolv_conf_search(
fputs("search", f);
ORDERED_SET_FOREACH(domain, domains, i) {
- if (++count > MAXDNSRCH) {
- fputs("\n# Too many search domains configured, remaining ones ignored.", f);
- break;
- }
- length += strlen(domain) + 1;
- if (length > 256) {
- fputs("\n# Total length of all search domains is too long, remaining ones ignored.", f);
- break;
- }
fputc(' ', f);
fputs(domain, f);
}
diff --git a/test/networkd-test.py b/test/networkd-test.py
index b225694819..140561d25d 100755
--- a/test/networkd-test.py
+++ b/test/networkd-test.py
@@ -917,40 +917,7 @@ Domains= one two three four five six seven eight nine ten''')
if ' one' in contents:
break
time.sleep(0.1)
- self.assertRegex(contents, 'search .*one two three four')
- self.assertNotIn('seven\n', contents)
- self.assertIn('# Too many search domains configured, remaining ones ignored.\n', contents)
-
- def test_search_domains_too_long(self):
-
- # we don't use this interface for this test
- self.if_router = None
-
- name_prefix = 'a' * 60
-
- self.write_network('test.netdev', '''\
-[NetDev]
-Name=dummy0
-Kind=dummy
-MACAddress=12:34:56:78:9a:bc''')
- self.write_network('test.network', '''\
-[Match]
-Name=dummy0
-[Network]
-Address=192.168.42.100/24
-DNS=192.168.42.1
-Domains={p}0 {p}1 {p}2 {p}3 {p}4'''.format(p=name_prefix))
-
- self.start_unit('systemd-networkd')
-
- for timeout in range(50):
- with open(RESOLV_CONF) as f:
- contents = f.read()
- if ' one' in contents:
- break
- time.sleep(0.1)
- self.assertRegex(contents, 'search .*{p}0 {p}1 {p}2'.format(p=name_prefix))
- self.assertIn('# Total length of all search domains is too long, remaining ones ignored.', contents)
+ self.assertRegex(contents, 'search .*one two three four five six seven eight nine ten')
def test_dropin(self):
# we don't use this interface for this test