Browse Source

Added Knot DNS server with utilities version 1.5.0-rc2.

Signed-off-by: Daniel Salzman <daniel.salzman@nic.cz>
Daniel Salzman 10 years ago
parent
commit
fd2af5030f

+ 143
- 0
net/knot/Makefile View File

@@ -0,0 +1,143 @@
1
+#
2
+# Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=knot
11
+PKG_VERSION:=1.5.0-rc2
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16
+PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-dns/
17
+PKG_MD5SUM:=9a93226c200813ee7bfe27dcf7b6cbc9
18
+
19
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
20
+PKG_BUILD_PARALLEL:=1
21
+PKG_FIXUP:=autoreconf
22
+PKG_INSTALL:=1
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+
26
+define Package/knot/Default
27
+	SECTION:=net
28
+	CATEGORY:=Network
29
+	TITLE:=Knot DNS
30
+	URL:=https://www.knot-dns.cz
31
+	MAINTAINER:=daniel.salzman@nic.cz
32
+	SUBMENU:=IP Addresses and Names
33
+	DEPENDS:=+libopenssl +liburcu
34
+endef
35
+
36
+define Package/knot-libknot
37
+	$(call Package/knot/Default)
38
+	TITLE+= (library)
39
+endef
40
+
41
+define Package/knot
42
+	$(call Package/knot/Default)
43
+	TITLE+= (server)
44
+	DEPENDS+=+knot-libknot
45
+endef
46
+
47
+define Package/knot-utils
48
+	$(call Package/knot/Default)
49
+	TITLE+= (utils)
50
+	DEPENDS+=+knot-libknot
51
+endef
52
+
53
+define Package/knot-tests
54
+	$(call Package/knot/Default)
55
+	TITLE+= (tests)
56
+	DEPENDS+=+knot-libknot
57
+endef
58
+
59
+define Package/knot-libknot/description
60
+	Knot DNS library.
61
+endef
62
+
63
+define Package/knot/description
64
+	High-performance authoritative-only DNS server.
65
+endef
66
+
67
+define Package/knot-utils/description
68
+	DNS utilities: kdig, khost, knsupdate and knsec3hash.
69
+endef
70
+
71
+define Package/knot-tests/description
72
+	Unit tests for Knot DNS server.
73
+	Usage: /usr/share/knot/runtests.sh
74
+endef
75
+
76
+CONFIGURE_ARGS += 			\
77
+	--enable-recvmmsg=no		\
78
+	--disable-fastparser		\
79
+	--with-rundir=/var/run		\
80
+	--with-storage=/etc/knot
81
+
82
+TARGET_CFLAGS += -std=gnu99 -DPSELECT_COMPAT
83
+
84
+define Build/Compile
85
+	$(MAKE) -C $(PKG_BUILD_DIR)
86
+	$(MAKE) -C $(PKG_BUILD_DIR)/libtap check
87
+	$(MAKE) -C $(PKG_BUILD_DIR)/tests check-compile-only
88
+	$(MAKE) -C $(PKG_BUILD_DIR)/src/zscanner check-compile-only
89
+endef
90
+
91
+define Package/knot-libknot/install
92
+	$(INSTALL_DIR) 						$(1)/usr/lib
93
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libknot.so.*		$(1)/usr/lib/
94
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzscanner.so.*	$(1)/usr/lib/
95
+endef
96
+
97
+define Package/knot/install
98
+	$(INSTALL_DIR) 						$(1)/usr/sbin
99
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/knotc	$(1)/usr/sbin/
100
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/knotd	$(1)/usr/sbin/
101
+
102
+	$(INSTALL_DIR) 							$(1)/etc/knot
103
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/knot/knot.sample.conf	$(1)/etc/knot/knot.conf
104
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/knot/example.com.zone	$(1)/etc/knot/
105
+
106
+	$(INSTALL_DIR)				$(1)/etc/init.d
107
+	$(INSTALL_BIN) ./files/knotd.init	$(1)/etc/init.d/knotd
108
+endef
109
+
110
+define Package/knot-utils/install
111
+	$(INSTALL_DIR)						$(1)/usr/bin
112
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/kdig		$(1)/usr/bin/
113
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/khost		$(1)/usr/bin/
114
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/knsupdate	$(1)/usr/bin/
115
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/knsec3hash	$(1)/usr/bin/
116
+endef
117
+
118
+define Package/knot-tests/install
119
+	$(INSTALL_DIR) 						$(1)/usr/share/knot
120
+	$(INSTALL_BIN) ./files/runtests.sh			$(1)/usr/share/knot
121
+
122
+	$(INSTALL_DIR) 						$(1)/usr/share/knot/tap
123
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/libtap/runtests		$(1)/usr/share/knot/tap/
124
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/libtap/tap/libtap.sh	$(1)/usr/share/knot/tap/
125
+
126
+	$(INSTALL_DIR)								$(1)/usr/share/knot/tests
127
+	find $(PKG_BUILD_DIR)/tests/.libs -maxdepth 1 -executable -type f | \
128
+		xargs -I{} basename {} | \
129
+		xargs -I{} $(INSTALL_BIN) -T $(PKG_BUILD_DIR)/tests/.libs/{}	$(1)/usr/share/knot/tests/test_{}
130
+
131
+	$(INSTALL_DIR)						$(1)/usr/share/knot/tests/data
132
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/tests/data/sample_conf	$(1)/usr/share/knot/tests/data/
133
+
134
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/zscanner/tests/.libs/zscanner-tool	$(1)/usr/share/knot/tests/
135
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/zscanner/tests/unittests		$(1)/usr/share/knot/tests/test_zscanner
136
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/src/zscanner/tests/TESTS		$(1)/usr/share/knot/tests/
137
+	cp -a $(PKG_BUILD_DIR)/src/zscanner/tests/data				$(1)/usr/share/knot/tests/
138
+endef
139
+
140
+$(eval $(call BuildPackage,knot-libknot))
141
+$(eval $(call BuildPackage,knot))
142
+$(eval $(call BuildPackage,knot-utils))
143
+$(eval $(call BuildPackage,knot-tests))

+ 45
- 0
net/knot/files/knotd.init View File

@@ -0,0 +1,45 @@
1
+#!/bin/sh /etc/rc.common
2
+START=70
3
+
4
+knot_bin="/usr/sbin/knotd"
5
+knot_ctl="/usr/sbin/knotc"
6
+config_file="/etc/knot/knot.conf"
7
+pid_file="/var/run/knot.pid"
8
+
9
+start() {
10
+  echo "Starting Knot DNS"
11
+
12
+  if [ -e $pid_file ]; then
13
+     echo "  Already running with PID `cat $pid_file`"
14
+     return 1
15
+  fi
16
+
17
+  $knot_bin -c $config_file -d
18
+
19
+  if [ $? -ne 0 ]; then
20
+    echo "  Failed to start"
21
+  fi
22
+}
23
+
24
+stop() {
25
+  echo "Stopping Knot DNS"
26
+
27
+  if [ -e $pid_file ]; then
28
+    kill `cat $pid_file`
29
+    rm -f $pid_file
30
+  else
31
+    echo "  No PID file $pid_file"
32
+    return 1
33
+  fi
34
+}
35
+
36
+restart() {
37
+  stop
38
+  start
39
+}
40
+
41
+reload() {
42
+  echo "Reloading Knot DNS"
43
+
44
+  $knot_ctl -c $config_file reload
45
+}

+ 9
- 0
net/knot/files/runtests.sh View File

@@ -0,0 +1,9 @@
1
+#!/bin/sh
2
+
3
+cd `dirname "$0"`/tests
4
+../tap/runtests -b /tmp ./test_*
5
+
6
+ret=$?
7
+cd -
8
+
9
+return $ret

+ 21
- 0
net/knot/patches/01_strptime_susv3.patch View File

@@ -0,0 +1,21 @@
1
+diff --git a/src/libknot/dnssec/key.c b/src/libknot/dnssec/key.c
2
+index 7dc0540..3e351bb 100644
3
+--- a/src/libknot/dnssec/key.c
4
++++ b/src/libknot/dnssec/key.c
5
+@@ -260,7 +260,15 @@ static int key_param_time(const void *save_to, char *value)
6
+ 
7
+ 	struct tm parsed = { 0 };
8
+ 
9
+-	if (!strptime(value, "%Y%m%d%H%M%S", &parsed)) {
10
++	if (strlen(value) != 14) {
11
++		return KNOT_EINVAL;
12
++	}
13
++
14
++	char *v = value;
15
++	char buf[32] = "";
16
++	int ret = sprintf(buf, "%.4s %.2s %.2s %.2s %.2s %.2s",
17
++	                  v, v + 4, v + 6, v + 8, v + 10, v + 12);
18
++	if (ret != 19 || !strptime(buf, "%Y %m %d %H %M %S", &parsed)) {
19
+ 		return KNOT_EINVAL;
20
+ 	}
21
+ 

+ 28
- 0
net/knot/patches/02_knot.conf.patch View File

@@ -0,0 +1,28 @@
1
+diff --git a/samples/knot.sample.conf.in b/samples/knot.sample.conf.in
2
+index 956e8a9..a068e67 100644
3
+--- a/samples/knot.sample.conf.in
4
++++ b/samples/knot.sample.conf.in
5
+@@ -14,7 +14,7 @@ system {
6
+ 
7
+   # User for running server
8
+   # May also specify user.group (e.g. knot.knot)
9
+-  user knot.knot;
10
++  user root.root;
11
+ 
12
+   # Directory for storing run-time data
13
+   # e.g. PID file and control sockets
14
+@@ -63,11 +63,11 @@ zones {
15
+ #  storage "@storage_dir@";
16
+ #
17
+ #  Example master zone
18
+-#  example.com {
19
+-#    file "@config_dir@/example.com.zone";
20
++  example.com {
21
++    file "example.com.zone";
22
+ #    xfr-out slave0;
23
+ #    notify-out slave0;
24
+-#  }
25
++  }
26
+ #
27
+ #  Example slave zone
28
+ #  example.net {

+ 41
- 0
net/knot/patches/03_zscanner_tests.patch View File

@@ -0,0 +1,41 @@
1
+diff --git a/src/zscanner/tests/TESTS b/src/zscanner/tests/TESTS
2
+index c88aef1..4e2148f 100644
3
+--- a/src/zscanner/tests/TESTS
4
++++ b/src/zscanner/tests/TESTS
5
+@@ -18,10 +18,8 @@
6
+ 05-2_TTL
7
+ 05-3_TTL
8
+ 05-4_TTL
9
+-06-0_INCLUDE
10
+ 06-1_INCLUDE
11
+ 06-2_INCLUDE
12
+-06-3_INCLUDE
13
+ 06-4_INCLUDE
14
+ 06-5_INCLUDE
15
+ 06-6_INCLUDE
16
+diff --git a/src/zscanner/tests/unittests.in b/src/zscanner/tests/unittests.in
17
+index 846f351..272856c 100644
18
+--- a/src/zscanner/tests/unittests.in
19
++++ b/src/zscanner/tests/unittests.in
20
+@@ -1,9 +1,9 @@
21
+ #!/bin/sh
22
+ 
23
+-SOURCE=@top_srcdir@/src/zscanner/tests
24
+-BUILD=@top_builddir@/src/zscanner/tests
25
++SOURCE="."
26
++BUILD="."
27
+ 
28
+-. @top_srcdir@/libtap/tap/libtap.sh
29
++. ../tap/libtap.sh
30
+ 
31
+ cd "$BUILD"
32
+ 
33
+@@ -11,7 +11,7 @@ TMPDIR=$(test_tmpdir)
34
+ TESTS_DIR="$SOURCE"/data
35
+ ZSCANNER_TOOL="$BUILD"/zscanner-tool
36
+ 
37
+-plan 68
38
++plan 66
39
+ 
40
+ mkdir -p "$TMPDIR"/includes/
41
+ for a in 1 2 3 4 5 6; do