summaryrefslogtreecommitdiff
path: root/src/grp-resolve
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-08-10 15:48:20 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-08-10 15:48:20 -0400
commitc73db02271a67e9ceb42115dde6be997ec4b89ef (patch)
tree7bf9b14a3e741cfa37a2f93be964538b959964a5 /src/grp-resolve
parentae3660f9eb1618b0cc54bf5dffcc5d13ced8922e (diff)
split up grp-{hostname,locale}, grp-resolve/systemd-resolve{,d}; shell completion
Diffstat (limited to 'src/grp-resolve')
-rw-r--r--src/grp-resolve/Makefile3
-rw-r--r--src/grp-resolve/libbasic-dns/Makefile115
-rw-r--r--src/grp-resolve/libbasic-dns/dns-type.c (renamed from src/grp-resolve/systemd-resolved/dns-type.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/dns-type.h (renamed from src/grp-resolve/systemd-resolved/dns-type.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-def.h (renamed from src/grp-resolve/systemd-resolved/resolved-def.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-answer.c (renamed from src/grp-resolve/systemd-resolved/resolved-dns-answer.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-answer.h (renamed from src/grp-resolve/systemd-resolved/resolved-dns-answer.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-dnssec.c (renamed from src/grp-resolve/systemd-resolved/resolved-dns-dnssec.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-dnssec.h (renamed from src/grp-resolve/systemd-resolved/resolved-dns-dnssec.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-packet.c (renamed from src/grp-resolve/systemd-resolved/resolved-dns-packet.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-packet.h (renamed from src/grp-resolve/systemd-resolved/resolved-dns-packet.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-question.c (renamed from src/grp-resolve/systemd-resolved/resolved-dns-question.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-question.h (renamed from src/grp-resolve/systemd-resolved/resolved-dns-question.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-rr.c (renamed from src/grp-resolve/systemd-resolved/resolved-dns-rr.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/resolved-dns-rr.h (renamed from src/grp-resolve/systemd-resolved/resolved-dns-rr.h)0
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/_443._tcp.fedoraproject.org.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/_443._tcp.fedoraproject.org.pkts)bin169 -> 169 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/_openpgpkey.fedoraproject.org.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/_openpgpkey.fedoraproject.org.pkts)bin986 -> 986 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/fake-caa.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/fake-caa.pkts)bin196 -> 196 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/fedoraproject.org.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/fedoraproject.org.pkts)bin1483 -> 1483 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/gandi.net.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/gandi.net.pkts)bin1010 -> 1010 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/google.com.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/google.com.pkts)bin747 -> 747 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/kyhwana.org.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/kyhwana.org.pkts)bin1803 -> 1803 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/root.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/root.pkts)bin1061 -> 1061 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts)bin330 -> 330 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/teamits.com.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/teamits.com.pkts)bin1021 -> 1021 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-data/zbyszek@fedoraproject.org.pkts (renamed from src/grp-resolve/systemd-resolved/test-data/zbyszek@fedoraproject.org.pkts)bin2533 -> 2533 bytes
-rw-r--r--src/grp-resolve/libbasic-dns/test-dns-packet.c (renamed from src/grp-resolve/systemd-resolved/test-dns-packet.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/test-dnssec-complex.c (renamed from src/grp-resolve/systemd-resolved/test-dnssec-complex.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/test-dnssec.c (renamed from src/grp-resolve/systemd-resolved/test-dnssec.c)0
-rw-r--r--src/grp-resolve/libbasic-dns/test-resolve-tables.c (renamed from src/grp-resolve/systemd-resolved/test-resolve-tables.c)0
-rw-r--r--src/grp-resolve/systemd-resolve/Makefile52
l---------src/grp-resolve/systemd-resolve/gcrypt-util.c1
l---------src/grp-resolve/systemd-resolve/gcrypt-util.h1
-rw-r--r--src/grp-resolve/systemd-resolve/resolve-tool.c (renamed from src/grp-resolve/systemd-resolved/resolve-tool.c)0
-rw-r--r--src/grp-resolve/systemd-resolve/systemd-resolve.completion.bash64
-rw-r--r--src/grp-resolve/systemd-resolve/systemd-resolve.completion.zsh64
-rw-r--r--src/grp-resolve/systemd-resolved/Makefile109
37 files changed, 301 insertions, 108 deletions
diff --git a/src/grp-resolve/Makefile b/src/grp-resolve/Makefile
index 4cea7de4c6..7969cc1298 100644
--- a/src/grp-resolve/Makefile
+++ b/src/grp-resolve/Makefile
@@ -23,6 +23,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-nested.subdirs += systemd-resolved nss-resolve
+nested.subdirs += libbasic-dns
+nested.subdirs += systemd-resolved systemd-resolve nss-resolve
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-resolve/libbasic-dns/Makefile b/src/grp-resolve/libbasic-dns/Makefile
new file mode 100644
index 0000000000..3c9fe3e783
--- /dev/null
+++ b/src/grp-resolve/libbasic-dns/Makefile
@@ -0,0 +1,115 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+$(outdir)/dns_type-list.txt: $(srcdir)/dns-type.h
+ $(AM_V_GEN)$(SED) -n -r 's/.* DNS_TYPE_(\w+).*/\1/p' <$< >$@
+
+$(outdir)/dns_type-to-name.h: $(outdir)/dns_type-list.txt
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *dns_type_to_string(int type) {\n\tswitch(type) {" } {printf " case DNS_TYPE_%s: return ", $$1; sub(/_/, "-"); printf "\"%s\";\n", $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@
+
+$(outdir)/dns_type-from-name.gperf: $(outdir)/dns_type-list.txt
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct dns_type_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { s=$$1; sub(/_/, "-", s); printf "%s, ", $$s; printf "DNS_TYPE_%s\n", $$1 }' <$< >$@
+
+basic_dns_sources =
+libbasic_dns_la_SOURCES = \
+ src/resolve/resolved-dns-dnssec.c \
+ src/resolve/resolved-dns-dnssec.h \
+ src/resolve/resolved-dns-packet.c \
+ src/resolve/resolved-dns-packet.h \
+ src/resolve/resolved-dns-rr.c \
+ src/resolve/resolved-dns-rr.h \
+ src/resolve/resolved-dns-answer.c \
+ src/resolve/resolved-dns-answer.h \
+ src/resolve/resolved-dns-question.c \
+ src/resolve/resolved-dns-question.h \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h
+
+
+tests += \
+ test-dns-packet \
+ test-resolve-tables \
+ test-dnssec
+
+manual_tests += \
+ test-dnssec-complex
+
+test_resolve_tables_SOURCES = \
+ src/resolve/test-resolve-tables.c \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h \
+ $(basic_dns_sources) \
+ src/shared/test-tables.h
+
+test_resolve_tables_LDADD = \
+ libbasic-dns.la \
+ libshared.la
+
+test_dns_packet_SOURCES = \
+ src/resolve/test-dns-packet.c \
+ $(basic_dns_sources)
+
+test_dns_packet_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -DRESOLVE_TEST_DIR=\"$(abs_top_srcdir)/src/resolve/test-data\"
+
+test_dns_packet_LDADD = \
+ libbasic-dns.la \
+ libshared.la
+
+EXTRA_DIST += \
+ src/resolve/test-data/_openpgpkey.fedoraproject.org.pkts \
+ src/resolve/test-data/fedoraproject.org.pkts \
+ src/resolve/test-data/gandi.net.pkts \
+ src/resolve/test-data/google.com.pkts \
+ src/resolve/test-data/root.pkts \
+ src/resolve/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts \
+ src/resolve/test-data/teamits.com.pkts \
+ src/resolve/test-data/zbyszek@fedoraproject.org.pkts \
+ src/resolve/test-data/_443._tcp.fedoraproject.org.pkts \
+ src/resolve/test-data/kyhwana.org.pkts \
+ src/resolve/test-data/fake-caa.pkts
+
+test_dnssec_SOURCES = \
+ src/resolve/test-dnssec.c \
+ $(basic_dns_sources)
+
+test_dnssec_LDADD = \
+ libbasic-dns.la \
+ libshared.la
+
+test_dnssec_complex_SOURCES = \
+ src/resolve/test-dnssec-complex.c \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h
+
+test_dnssec_complex_LDADD = \
+ libshared.la
+
+noinst_LTLIBRARIES = libbasic-dns.la
+libbasic_dns_la_LIBADD = libshared.la
+$(outdir)/dns-type.lo: $(outdir)/dns_type-from-name.h $(outdir)/dns_type-to-name.h
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-resolve/systemd-resolved/dns-type.c b/src/grp-resolve/libbasic-dns/dns-type.c
index 6d5b9d616f..6d5b9d616f 100644
--- a/src/grp-resolve/systemd-resolved/dns-type.c
+++ b/src/grp-resolve/libbasic-dns/dns-type.c
diff --git a/src/grp-resolve/systemd-resolved/dns-type.h b/src/grp-resolve/libbasic-dns/dns-type.h
index a8ee105e16..a8ee105e16 100644
--- a/src/grp-resolve/systemd-resolved/dns-type.h
+++ b/src/grp-resolve/libbasic-dns/dns-type.h
diff --git a/src/grp-resolve/systemd-resolved/resolved-def.h b/src/grp-resolve/libbasic-dns/resolved-def.h
index c4c1915b18..c4c1915b18 100644
--- a/src/grp-resolve/systemd-resolved/resolved-def.h
+++ b/src/grp-resolve/libbasic-dns/resolved-def.h
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-answer.c b/src/grp-resolve/libbasic-dns/resolved-dns-answer.c
index 1ade0507db..1ade0507db 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-answer.c
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-answer.c
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-answer.h b/src/grp-resolve/libbasic-dns/resolved-dns-answer.h
index 92557a410a..92557a410a 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-answer.h
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-answer.h
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-dnssec.c b/src/grp-resolve/libbasic-dns/resolved-dns-dnssec.c
index 39afbada25..39afbada25 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-dnssec.c
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-dnssec.c
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-dnssec.h b/src/grp-resolve/libbasic-dns/resolved-dns-dnssec.h
index 81879e287f..81879e287f 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-dnssec.h
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-dnssec.h
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-packet.c b/src/grp-resolve/libbasic-dns/resolved-dns-packet.c
index 37c0244b7e..37c0244b7e 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-packet.c
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-packet.c
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-packet.h b/src/grp-resolve/libbasic-dns/resolved-dns-packet.h
index 2e0eba83b6..2e0eba83b6 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-packet.h
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-packet.h
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-question.c b/src/grp-resolve/libbasic-dns/resolved-dns-question.c
index ee53dbff9d..ee53dbff9d 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-question.c
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-question.c
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-question.h b/src/grp-resolve/libbasic-dns/resolved-dns-question.h
index 320bf53488..320bf53488 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-question.h
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-question.h
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-rr.c b/src/grp-resolve/libbasic-dns/resolved-dns-rr.c
index c6a60b65b7..c6a60b65b7 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-rr.c
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-rr.c
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-rr.h b/src/grp-resolve/libbasic-dns/resolved-dns-rr.h
index daf9c8c210..daf9c8c210 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-rr.h
+++ b/src/grp-resolve/libbasic-dns/resolved-dns-rr.h
diff --git a/src/grp-resolve/systemd-resolved/test-data/_443._tcp.fedoraproject.org.pkts b/src/grp-resolve/libbasic-dns/test-data/_443._tcp.fedoraproject.org.pkts
index a383c6286d..a383c6286d 100644
--- a/src/grp-resolve/systemd-resolved/test-data/_443._tcp.fedoraproject.org.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/_443._tcp.fedoraproject.org.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/_openpgpkey.fedoraproject.org.pkts b/src/grp-resolve/libbasic-dns/test-data/_openpgpkey.fedoraproject.org.pkts
index 15de02e997..15de02e997 100644
--- a/src/grp-resolve/systemd-resolved/test-data/_openpgpkey.fedoraproject.org.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/_openpgpkey.fedoraproject.org.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/fake-caa.pkts b/src/grp-resolve/libbasic-dns/test-data/fake-caa.pkts
index 1c3ecc5491..1c3ecc5491 100644
--- a/src/grp-resolve/systemd-resolved/test-data/fake-caa.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/fake-caa.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/fedoraproject.org.pkts b/src/grp-resolve/libbasic-dns/test-data/fedoraproject.org.pkts
index 17874844d9..17874844d9 100644
--- a/src/grp-resolve/systemd-resolved/test-data/fedoraproject.org.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/fedoraproject.org.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/gandi.net.pkts b/src/grp-resolve/libbasic-dns/test-data/gandi.net.pkts
index 5ef51e0c8e..5ef51e0c8e 100644
--- a/src/grp-resolve/systemd-resolved/test-data/gandi.net.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/gandi.net.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/google.com.pkts b/src/grp-resolve/libbasic-dns/test-data/google.com.pkts
index f98c4cd855..f98c4cd855 100644
--- a/src/grp-resolve/systemd-resolved/test-data/google.com.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/google.com.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/kyhwana.org.pkts b/src/grp-resolve/libbasic-dns/test-data/kyhwana.org.pkts
index e28a725c9a..e28a725c9a 100644
--- a/src/grp-resolve/systemd-resolved/test-data/kyhwana.org.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/kyhwana.org.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/root.pkts b/src/grp-resolve/libbasic-dns/test-data/root.pkts
index 54ba668c75..54ba668c75 100644
--- a/src/grp-resolve/systemd-resolved/test-data/root.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/root.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts b/src/grp-resolve/libbasic-dns/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts
index a854249532..a854249532 100644
--- a/src/grp-resolve/systemd-resolved/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/teamits.com.pkts b/src/grp-resolve/libbasic-dns/test-data/teamits.com.pkts
index 11deb39677..11deb39677 100644
--- a/src/grp-resolve/systemd-resolved/test-data/teamits.com.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/teamits.com.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-data/zbyszek@fedoraproject.org.pkts b/src/grp-resolve/libbasic-dns/test-data/zbyszek@fedoraproject.org.pkts
index f0a6f982df..f0a6f982df 100644
--- a/src/grp-resolve/systemd-resolved/test-data/zbyszek@fedoraproject.org.pkts
+++ b/src/grp-resolve/libbasic-dns/test-data/zbyszek@fedoraproject.org.pkts
Binary files differ
diff --git a/src/grp-resolve/systemd-resolved/test-dns-packet.c b/src/grp-resolve/libbasic-dns/test-dns-packet.c
index 18d04b930d..18d04b930d 100644
--- a/src/grp-resolve/systemd-resolved/test-dns-packet.c
+++ b/src/grp-resolve/libbasic-dns/test-dns-packet.c
diff --git a/src/grp-resolve/systemd-resolved/test-dnssec-complex.c b/src/grp-resolve/libbasic-dns/test-dnssec-complex.c
index ef78cd1ea5..ef78cd1ea5 100644
--- a/src/grp-resolve/systemd-resolved/test-dnssec-complex.c
+++ b/src/grp-resolve/libbasic-dns/test-dnssec-complex.c
diff --git a/src/grp-resolve/systemd-resolved/test-dnssec.c b/src/grp-resolve/libbasic-dns/test-dnssec.c
index 1f05196d8e..1f05196d8e 100644
--- a/src/grp-resolve/systemd-resolved/test-dnssec.c
+++ b/src/grp-resolve/libbasic-dns/test-dnssec.c
diff --git a/src/grp-resolve/systemd-resolved/test-resolve-tables.c b/src/grp-resolve/libbasic-dns/test-resolve-tables.c
index 0eaab70687..0eaab70687 100644
--- a/src/grp-resolve/systemd-resolved/test-resolve-tables.c
+++ b/src/grp-resolve/libbasic-dns/test-resolve-tables.c
diff --git a/src/grp-resolve/systemd-resolve/Makefile b/src/grp-resolve/systemd-resolve/Makefile
new file mode 100644
index 0000000000..46322830ac
--- /dev/null
+++ b/src/grp-resolve/systemd-resolve/Makefile
@@ -0,0 +1,52 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+basic_dns_sources =
+
+systemd_resolve_SOURCES = \
+ src/resolve/resolve-tool.c \
+ $(basic_dns_sources) \
+ src/shared/gcrypt-util.c \
+ src/shared/gcrypt-util.h
+
+nodist_systemd_resolve_SOURCES = \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h
+
+systemd_resolve_LDADD = \
+ libshared.la
+
+bin_PROGRAMS += \
+ systemd-resolve
+
+dist_bashcompletion_data += \
+ shell-completion/bash/systemd-resolve
+
+dist_zshcompletion_data += \
+ shell-completion/zsh/_systemd-resolve
+
+systemd_resolve_LDADD += libbasic-dns.la
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-resolve/systemd-resolve/gcrypt-util.c b/src/grp-resolve/systemd-resolve/gcrypt-util.c
new file mode 120000
index 0000000000..5b2fae92e2
--- /dev/null
+++ b/src/grp-resolve/systemd-resolve/gcrypt-util.c
@@ -0,0 +1 @@
+../../libshared/src/gcrypt-util.c \ No newline at end of file
diff --git a/src/grp-resolve/systemd-resolve/gcrypt-util.h b/src/grp-resolve/systemd-resolve/gcrypt-util.h
new file mode 120000
index 0000000000..e1ad70b84f
--- /dev/null
+++ b/src/grp-resolve/systemd-resolve/gcrypt-util.h
@@ -0,0 +1 @@
+../../libshared/include/shared/gcrypt-util.h \ No newline at end of file
diff --git a/src/grp-resolve/systemd-resolved/resolve-tool.c b/src/grp-resolve/systemd-resolve/resolve-tool.c
index d9f28576b7..d9f28576b7 100644
--- a/src/grp-resolve/systemd-resolved/resolve-tool.c
+++ b/src/grp-resolve/systemd-resolve/resolve-tool.c
diff --git a/src/grp-resolve/systemd-resolve/systemd-resolve.completion.bash b/src/grp-resolve/systemd-resolve/systemd-resolve.completion.bash
new file mode 100644
index 0000000000..0c501c9405
--- /dev/null
+++ b/src/grp-resolve/systemd-resolve/systemd-resolve.completion.bash
@@ -0,0 +1,64 @@
+# systemd-resolve(1) completion -*- shell-script -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2016 Zbigniew Jędrzejewski-Szmek
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+__contains_word () {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
+__get_interfaces(){
+ { cd /sys/class/net && echo *; } | \
+ while read -d' ' -r name; do
+ [[ "$name" != "lo" ]] && echo "$name"
+ done
+}
+
+_systemd-resolve() {
+ local i comps
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local -A OPTS=(
+ [STANDALONE]='-h --help --version -4 -6
+ --service --openpgp --tlsa --statistics --reset-statistics
+ --service-address=no --service-txt=no
+ --cname=no --search=no --legend=no'
+ [ARG]='-i --interface -p --protocol -t --type -c --class'
+ )
+
+ if __contains_word "$prev" ${OPTS[ARG]}; then
+ case $prev in
+ --interface|-i)
+ comps=$( __get_interfaces )
+ ;;
+ --protocol|-p|--type|-t|--class|-c)
+ comps=$( systemd-resolve --legend=no "$prev" help; echo help )
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+ return 0
+ fi
+}
+
+complete -F _systemd-resolve systemd-resolve
diff --git a/src/grp-resolve/systemd-resolve/systemd-resolve.completion.zsh b/src/grp-resolve/systemd-resolve/systemd-resolve.completion.zsh
new file mode 100644
index 0000000000..c318ab50f1
--- /dev/null
+++ b/src/grp-resolve/systemd-resolve/systemd-resolve.completion.zsh
@@ -0,0 +1,64 @@
+#compdef systemd-resolve
+
+#
+# This file is part of systemd.
+#
+# Copyright 2016 Zbigniew Jędrzejewski-Szmek
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+_dns_protocol() {
+ local -a _protocol
+ _protocol=( $(_call_program protocol ${service} --legend=no --protocol help; echo help) )
+ _values 'protocol' "$_protocol[@]"
+}
+
+_dns_type() {
+ local -a _type
+ _type=( $(_call_program type ${service} --legend=no --type help; echo help) )
+ _values 'type' "$_type[@]"
+}
+
+_dns_class() {
+ local -a _class
+ _class=( $(_call_program class ${service} --legend=no --class help; echo help) )
+ _values 'class' "$_class[@]"
+}
+
+_systemd-resolve_none() {
+ _alternative : \
+ 'domain:DNS address:' \
+ 'address:email address:'
+}
+
+_arguments \
+ {-h,--help}'[Print a short help text and exit]' \
+ '--version[Print a short version string and exit]' \
+ '--legend=no[Do not show headers and footers]' \
+ '-4[Resolve IPv4 addresses]' \
+ '-6[Resolve IPv6 addresses]' \
+ {-i+,--interface=}'[Look on interface]:interface:_net_interfaces' \
+ {-p+,--protocol=}'[Look via protocol]:protocol:_dns_protocol' \
+ {-t+,--type=}'[Query RR with DNS type]:type:_dns_type' \
+ {-c+,--class=}'[Query RR with DNS class]:class:_dns_class' \
+ '--service[Resolve services]' \
+ '--service-address=no[Do not resolve address for services]' \
+ '--service-txt=no[Do not resolve TXT records for services]' \
+ '--openpgp[Query OpenPGP public key]' \
+ '--tlsa[Query TLS public key]' \
+ '--cname=no[Do not follow CNAME redirects]' \
+ '--search=no[Do not use search domains]' \
+ '--statistics[Show resolver statistics]' \
+ '--reset-statistics[Reset resolver statistics]' \
+ '*::default: _systemd-resolve_none'
diff --git a/src/grp-resolve/systemd-resolved/Makefile b/src/grp-resolve/systemd-resolved/Makefile
index 8574d3f71a..7a2cff2f2e 100644
--- a/src/grp-resolve/systemd-resolved/Makefile
+++ b/src/grp-resolve/systemd-resolved/Makefile
@@ -23,31 +23,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-
-$(outdir)/dns_type-list.txt: $(srcdir)/dns-type.h
- $(AM_V_GEN)$(SED) -n -r 's/.* DNS_TYPE_(\w+).*/\1/p' <$< >$@
-
-$(outdir)/dns_type-to-name.h: $(outdir)/dns_type-list.txt
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *dns_type_to_string(int type) {\n\tswitch(type) {" } {printf " case DNS_TYPE_%s: return ", $$1; sub(/_/, "-"); printf "\"%s\";\n", $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@
-
-$(outdir)/dns_type-from-name.gperf: $(outdir)/dns_type-list.txt
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct dns_type_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { s=$$1; sub(/_/, "-", s); printf "%s, ", $$s; printf "DNS_TYPE_%s\n", $$1 }' <$< >$@
-
-ifneq ($(ENABLE_RESOLVED),)
-
-basic_dns_sources = \
- src/resolve/resolved-dns-dnssec.c \
- src/resolve/resolved-dns-dnssec.h \
- src/resolve/resolved-dns-packet.c \
- src/resolve/resolved-dns-packet.h \
- src/resolve/resolved-dns-rr.c \
- src/resolve/resolved-dns-rr.h \
- src/resolve/resolved-dns-answer.c \
- src/resolve/resolved-dns-answer.h \
- src/resolve/resolved-dns-question.c \
- src/resolve/resolved-dns-question.h \
- src/resolve/dns-type.c \
- src/resolve/dns-type.h
+basic_dns_sources =
systemd_resolved_SOURCES = \
src/resolve/resolved.c \
@@ -130,87 +106,6 @@ GENERAL_ALIASES += \
nodist_pkgsysconf_DATA += \
src/resolve/resolved.conf
-systemd_resolve_SOURCES = \
- src/resolve/resolve-tool.c \
- $(basic_dns_sources) \
- src/shared/gcrypt-util.c \
- src/shared/gcrypt-util.h
-
-nodist_systemd_resolve_SOURCES = \
- src/resolve/dns_type-from-name.h \
- src/resolve/dns_type-to-name.h
-
-systemd_resolve_LDADD = \
- libshared.la
-
-bin_PROGRAMS += \
- systemd-resolve
-
-dist_bashcompletion_data += \
- shell-completion/bash/systemd-resolve
-
-dist_zshcompletion_data += \
- shell-completion/zsh/_systemd-resolve
-
-tests += \
- test-dns-packet \
- test-resolve-tables \
- test-dnssec
-
-manual_tests += \
- test-dnssec-complex
-
-test_resolve_tables_SOURCES = \
- src/resolve/test-resolve-tables.c \
- src/resolve/dns_type-from-name.h \
- src/resolve/dns_type-to-name.h \
- $(basic_dns_sources) \
- src/shared/test-tables.h
-
-test_resolve_tables_LDADD = \
- libshared.la
-
-test_dns_packet_SOURCES = \
- src/resolve/test-dns-packet.c \
- $(basic_dns_sources)
-
-test_dns_packet_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- -DRESOLVE_TEST_DIR=\"$(abs_top_srcdir)/src/resolve/test-data\"
-
-test_dns_packet_LDADD = \
- libshared.la
-
-EXTRA_DIST += \
- src/resolve/test-data/_openpgpkey.fedoraproject.org.pkts \
- src/resolve/test-data/fedoraproject.org.pkts \
- src/resolve/test-data/gandi.net.pkts \
- src/resolve/test-data/google.com.pkts \
- src/resolve/test-data/root.pkts \
- src/resolve/test-data/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts \
- src/resolve/test-data/teamits.com.pkts \
- src/resolve/test-data/zbyszek@fedoraproject.org.pkts \
- src/resolve/test-data/_443._tcp.fedoraproject.org.pkts \
- src/resolve/test-data/kyhwana.org.pkts \
- src/resolve/test-data/fake-caa.pkts
-
-test_dnssec_SOURCES = \
- src/resolve/test-dnssec.c \
- $(basic_dns_sources)
-
-test_dnssec_LDADD = \
- libshared.la
-
-test_dnssec_complex_SOURCES = \
- src/resolve/test-dnssec-complex.c \
- src/resolve/dns-type.c \
- src/resolve/dns-type.h
-
-test_dnssec_complex_LDADD = \
- libshared.la
-
-endif # ENABLE_RESOLVED
-
gperf_txt_sources += \
src/resolve/dns_type-list.txt
@@ -221,8 +116,8 @@ EXTRA_DIST += \
units/systemd-resolved.service.m4.in \
src/resolve/resolved.conf.in
+systemd_resolved_LDADD += libbasic-dns.la
-$(outdir)/dns-type.o: $(outdir)/dns_type-from-name.h $(outdir)/dns_type-to-name.h
sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
include $(topsrcdir)/build-aux/Makefile.tail.mk