summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am7
-rw-r--r--addrmap.c11
-rw-r--r--conffile.c6
-rw-r--r--configure.ac17
-rw-r--r--debian/README.source15
-rw-r--r--debian/changelog18
-rw-r--r--debian/control18
-rw-r--r--debian/patches/0001-use-var-spool.patch (renamed from debian/patches/01-use-var-spool.patch)4
-rw-r--r--debian/patches/0002-manpage.patch (renamed from debian/patches/02-manpage.patch)4
-rw-r--r--debian/patches/0003-configure-no-CFLAGS.patch (renamed from debian/patches/03-configure-no-CFLAGS.patch)2
-rw-r--r--debian/patches/0004-quote-make-var.patch (renamed from debian/patches/04-quote-make-var.patch)2
-rw-r--r--debian/patches/0005-guard-chdir.patch (renamed from debian/patches/05-guard-chdir.patch)2
-rw-r--r--debian/patches/0006-guard-write.patch (renamed from debian/patches/06-guard-write.patch)2
-rw-r--r--debian/patches/0007-static-EAM.patch (renamed from debian/patches/07-static-EAM.patch)41
-rw-r--r--debian/patches/0008-manpage-RFC.patch (renamed from debian/patches/08-manpage-RFC.patch)7
-rw-r--r--debian/patches/0009-systemd-service-file-for-tayga.patch93
-rw-r--r--debian/patches/0010-include-for-writev.patch24
-rw-r--r--debian/patches/0011-null-char.patch36
-rw-r--r--debian/patches/series19
-rw-r--r--tayga.conf.52
-rw-r--r--tayga.h1
-rw-r--r--tayga.service31
22 files changed, 321 insertions, 41 deletions
diff --git a/Makefile.am b/Makefile.am
index 55fce24..b90354b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,3 +7,10 @@ dist_sysconf_DATA = tayga.conf.example
dist_man_MANS = tayga.8 tayga.conf.5
tayga_SOURCES = nat64.c addrmap.c dynamic.c tayga.c conffile.c tayga.h list.h
+
+# See daemon(7)
+AM_DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = tayga.service
+endif
diff --git a/addrmap.c b/addrmap.c
index 895c3fc..24926d8 100644
--- a/addrmap.c
+++ b/addrmap.c
@@ -22,10 +22,6 @@ extern time_t now;
int validate_ip4_addr(const struct in_addr *a)
{
- /* First octet == 0 */
- if (!(a->s_addr & htonl(0xff000000)))
- return -1;
-
/* First octet == 127 */
if ((a->s_addr & htonl(0xff000000)) == htonl(0x7f000000))
return -1;
@@ -97,7 +93,12 @@ int is_private_ip4_addr(const struct in_addr *a)
int calc_ip4_mask(struct in_addr *mask, const struct in_addr *addr, int len)
{
- mask->s_addr = htonl(~((1 << (32 - len)) - 1));
+ if (len) {
+ mask->s_addr = htonl(~((1 << (32 - len)) - 1));
+ } else {
+ /* len==0 */
+ mask->s_addr = 0;
+ }
if (addr && (addr->s_addr & ~mask->s_addr))
return -1;
return 0;
diff --git a/conffile.c b/conffile.c
index 1c77371..0406cfd 100644
--- a/conffile.c
+++ b/conffile.c
@@ -222,7 +222,7 @@ static void config_map(int ln, int arg_count, char **args)
unsigned int prefix4 = 32;
if (slash) {
prefix4 = atoi(slash+1);
- slash[0] = NULL;
+ slash[0] = '\0';
}
if (!inet_pton(AF_INET, args[0], &m->map4.addr)) {
@@ -237,12 +237,12 @@ static void config_map(int ln, int arg_count, char **args)
slash = strchr(args[1], '/');
if (slash) {
prefix6 = atoi(slash+1);
- slash[0] = NULL;
+ slash[0] = '\0';
}
if ((32 - prefix4) != (128 - prefix6)) {
slog(LOG_CRIT, "IPv4 and IPv6 subnet must be of the same size, but found"
- " %s and %s line %d\n", args[0], args[1], ln);
+ " %s and %s on line %d\n", args[0], args[1], ln);
exit(1);
}
diff --git a/configure.ac b/configure.ac
index fa99305..ca65097 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,23 @@ AC_CONFIG_SRCDIR(nat64.c)
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AC_CONFIG_HEADERS(config.h)
+dnl Stanza taken from daemon(7)
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+ [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
+ [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
+ def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+
+ AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+ [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+ [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
+ with_systemdsystemunitdir=no],
+ [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+ [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+
AC_PROG_CC
tayga_conf_path='${sysconfdir}/tayga.conf'
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..10ffac4
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,15 @@
+Uploading tayga
+===============
+
+Please consider using dgit when uploading tayga. When your source
+changes are ready, run:
+
+ dgit --quilt=gbp build-source
+
+That will do basic sanity checks (e.g. that there are no uncommitted changes)
+and generate a source package in the parent directory. Then run:
+
+ dgit --quilt=gbp push
+
+This will add the commit hash to the .dsc file, sign the changes file, push
+your changes to dgit and upload the source package to the archive.
diff --git a/debian/changelog b/debian/changelog
index 68da3f9..12d13cd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+tayga (0.9.2-8) unstable; urgency=medium
+
+ [ Benda Xu ]
+ * Update 0007-static-EAM.patch to support 0.0.0.0/0 subset.
+
+ [ Barak A. Pearlmutter ]
+ * Canonicalize patch filenames and header.
+ * Man page fixes (thanks to Benda Xu)
+ * Take the liberty of adding Benda Xu as co-maintainer.
+ * Add systemd service file taken from Fedora.
+ * Address lintian tag systemd-service-file-refers-to-obsolete-target.
+ * Squelch some GCC warnings.
+
+ [ Andrej Shadura ]
+ * Wrap and sort debian/control.
+
+ -- Andrej Shadura <andrewsh@debian.org> Sun, 24 Feb 2019 08:48:52 +0100
+
tayga (0.9.2-7) unstable; urgency=medium
[ Ondřej Nový ]
diff --git a/debian/control b/debian/control
index 47d0da7..4dff839 100644
--- a/debian/control
+++ b/debian/control
@@ -1,9 +1,12 @@
Source: tayga
Section: net
Priority: optional
-Maintainer: Andrew Shadura <andrewsh@debian.org>
-Uploaders: Barak A. Pearlmutter <bap@debian.org>
-Build-Depends: debhelper-compat (= 12)
+Maintainer: Andrej Shadura <andrewsh@debian.org>
+Uploaders:
+ Barak A. Pearlmutter <bap@debian.org>,
+ Benda Xu <heroxbd@gentoo.org>
+Build-Depends:
+ debhelper-compat (= 12)
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/debian/tayga
Homepage: http://www.litech.org/tayga/
@@ -11,8 +14,13 @@ Vcs-Git: https://salsa.debian.org/debian/tayga.git
Package: tayga
Architecture: linux-any
-Pre-Depends: ${misc:Pre-Depends}
-Depends: ${misc:Depends}, ${shlibs:Depends}, lsb-base, init-system-helpers (>= 1.50)
+Pre-Depends:
+ ${misc:Pre-Depends}
+Depends:
+ init-system-helpers (>= 1.50),
+ lsb-base,
+ ${misc:Depends},
+ ${shlibs:Depends}
Description: userspace stateless NAT64
TAYGA is an out-of-kernel stateless NAT64 implementation for Linux
that uses the TUN driver to exchange IPv4 and IPv6 packets with
diff --git a/debian/patches/01-use-var-spool.patch b/debian/patches/0001-use-var-spool.patch
index 3f900ea..bf22719 100644
--- a/debian/patches/01-use-var-spool.patch
+++ b/debian/patches/0001-use-var-spool.patch
@@ -1,8 +1,8 @@
From: "Andrew O. Shadura" <bugzilla@tut.by>
Date: Wed, 15 Jun 2011 15:56:55 +0300
-Subject: 01-use-var-spool
+Subject: use /var/spool
-use /var/spool/tayga instead of /var/db/tayga
+Modify sample configuration file to use /var/spool/tayga instead of /var/db/tayga
---
tayga.conf.example | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/patches/02-manpage.patch b/debian/patches/0002-manpage.patch
index d430a34..bba9c6b 100644
--- a/debian/patches/02-manpage.patch
+++ b/debian/patches/0002-manpage.patch
@@ -1,8 +1,8 @@
From: "Andrew O. Shadura" <bugzilla@tut.by>
Date: Wed, 15 Jun 2011 15:56:55 +0300
-Subject: 02-manpage
+Subject: manpage
-don't use hyphen as minus sign
+Don't use hyphen as minus sign in man pages.
---
tayga.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/patches/03-configure-no-CFLAGS.patch b/debian/patches/0003-configure-no-CFLAGS.patch
index be1a77e..c3a82e8 100644
--- a/debian/patches/03-configure-no-CFLAGS.patch
+++ b/debian/patches/0003-configure-no-CFLAGS.patch
@@ -1,6 +1,6 @@
From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
Date: Wed, 18 Apr 2012 09:07:57 +0100
-Subject: 03 configure no-CFLAGS
+Subject: configure no-CFLAGS
Allow CFLAGS to default in configure.ac instead of hardwiring to -g -O2
---
diff --git a/debian/patches/04-quote-make-var.patch b/debian/patches/0004-quote-make-var.patch
index f3f0939..307f05c 100644
--- a/debian/patches/04-quote-make-var.patch
+++ b/debian/patches/0004-quote-make-var.patch
@@ -1,6 +1,6 @@
From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
Date: Wed, 18 Apr 2012 09:09:11 +0100
-Subject: 04 quote make var
+Subject: quote make var
Quote filename containing variable modifiable at make time.
---
diff --git a/debian/patches/05-guard-chdir.patch b/debian/patches/0005-guard-chdir.patch
index e2f94e3..384328e 100644
--- a/debian/patches/05-guard-chdir.patch
+++ b/debian/patches/0005-guard-chdir.patch
@@ -1,6 +1,6 @@
From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
Date: Wed, 18 Apr 2012 11:37:58 +0100
-Subject: 05 guard chdir
+Subject: guard chdir
Guard chdir calls to avoid ignored-return-value warnings.
---
diff --git a/debian/patches/06-guard-write.patch b/debian/patches/0006-guard-write.patch
index f85491a..b2cab90 100644
--- a/debian/patches/06-guard-write.patch
+++ b/debian/patches/0006-guard-write.patch
@@ -1,6 +1,6 @@
From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
Date: Wed, 18 Apr 2012 11:47:19 +0100
-Subject: 06 guard write
+Subject: guard write
Guard write call, avoid ignored-return-value warning.
diff --git a/debian/patches/07-static-EAM.patch b/debian/patches/0007-static-EAM.patch
index 48c451a..2a9de34 100644
--- a/debian/patches/07-static-EAM.patch
+++ b/debian/patches/0007-static-EAM.patch
@@ -9,15 +9,40 @@ Introduce Explicit Address Mapping as defined in RFC7757. This extends the
Forwarded: Nathan Lutchansky <lutchann@litech.org>
---
- addrmap.c | 18 +++++++++++++++++-
+ addrmap.c | 29 +++++++++++++++++++++++------
conffile.c | 40 +++++++++++++++++++++++++++++++++++++---
- 2 files changed, 54 insertions(+), 4 deletions(-)
+ 2 files changed, 60 insertions(+), 9 deletions(-)
diff --git a/addrmap.c b/addrmap.c
-index 7a4bf8b..895c3fc 100644
+index 7a4bf8b..24926d8 100644
--- a/addrmap.c
+++ b/addrmap.c
-@@ -422,6 +422,9 @@ int map_ip4_to_ip6(struct in6_addr *addr6, const struct in_addr *addr4,
+@@ -22,10 +22,6 @@ extern time_t now;
+
+ int validate_ip4_addr(const struct in_addr *a)
+ {
+- /* First octet == 0 */
+- if (!(a->s_addr & htonl(0xff000000)))
+- return -1;
+-
+ /* First octet == 127 */
+ if ((a->s_addr & htonl(0xff000000)) == htonl(0x7f000000))
+ return -1;
+@@ -97,7 +93,12 @@ int is_private_ip4_addr(const struct in_addr *a)
+
+ int calc_ip4_mask(struct in_addr *mask, const struct in_addr *addr, int len)
+ {
+- mask->s_addr = htonl(~((1 << (32 - len)) - 1));
++ if (len) {
++ mask->s_addr = htonl(~((1 << (32 - len)) - 1));
++ } else {
++ /* len==0 */
++ mask->s_addr = 0;
++ }
+ if (addr && (addr->s_addr & ~mask->s_addr))
+ return -1;
+ return 0;
+@@ -422,6 +423,9 @@ int map_ip4_to_ip6(struct in6_addr *addr6, const struct in_addr *addr4,
case MAP_TYPE_STATIC:
s = container_of(map4, struct map_static, map4);
*addr6 = s->map6.addr;
@@ -27,7 +52,7 @@ index 7a4bf8b..895c3fc 100644
break;
case MAP_TYPE_RFC6052:
s = container_of(map4, struct map_static, map4);
-@@ -564,7 +567,13 @@ int map_ip6_to_ip4(struct in_addr *addr4, const struct in6_addr *addr6,
+@@ -564,7 +568,13 @@ int map_ip6_to_ip4(struct in_addr *addr4, const struct in6_addr *addr6,
switch (map6->type) {
case MAP_TYPE_STATIC:
s = container_of(map6, struct map_static, map6);
@@ -42,7 +67,7 @@ index 7a4bf8b..895c3fc 100644
break;
case MAP_TYPE_RFC6052:
if (extract_from_prefix(addr4, addr6, map6->prefix_len) < 0)
-@@ -629,3 +638,10 @@ void addrmap_maint(void)
+@@ -629,3 +639,10 @@ void addrmap_maint(void)
}
}
}
@@ -54,7 +79,7 @@ index 7a4bf8b..895c3fc 100644
+End:
+*/
diff --git a/conffile.c b/conffile.c
-index ec6433c..1c77371 100644
+index ec6433c..dd4193c 100644
--- a/conffile.c
+++ b/conffile.c
@@ -217,16 +217,43 @@ static void config_map(int ln, int arg_count, char **args)
@@ -88,7 +113,7 @@ index ec6433c..1c77371 100644
+
+ if ((32 - prefix4) != (128 - prefix6)) {
+ slog(LOG_CRIT, "IPv4 and IPv6 subnet must be of the same size, but found"
-+ " %s and %s line %d\n", args[0], args[1], ln);
++ " %s and %s on line %d\n", args[0], args[1], ln);
+ exit(1);
+ }
+
diff --git a/debian/patches/08-manpage-RFC.patch b/debian/patches/0008-manpage-RFC.patch
index e51c9d4..b048b31 100644
--- a/debian/patches/08-manpage-RFC.patch
+++ b/debian/patches/0008-manpage-RFC.patch
@@ -1,7 +1,8 @@
From: Benda Xu <heroxbd@gentoo.org>
Date: Fri, 28 Dec 2018 00:00:00 +0000
-Subject: manpage-RFC
+Subject: manpage RFC
+Forwarded: Nathan Lutchansky <lutchann@litech.org>
---
tayga.8 | 10 +++++-----
tayga.conf.5 | 19 ++++++++++++++-----
@@ -33,7 +34,7 @@ index efb746f..e69cfc3 100644
As a stateless NAT, TAYGA requires a one-to-one mapping between IPv4 addresses
and IPv6 addresses. Mapping multiple IPv6 addresses onto a single IPv4
diff --git a/tayga.conf.5 b/tayga.conf.5
-index 3e084aa..76b1df8 100644
+index 3e084aa..7522c9d 100644
--- a/tayga.conf.5
+++ b/tayga.conf.5
@@ -1,4 +1,4 @@
@@ -58,7 +59,7 @@ index 3e084aa..76b1df8 100644
to be used when translating IPv4 packets to IPv6 or IPv6 packets to IPv4.
+If
+.I /length
-+is not present,
++is not present, the
+.I /length
+after
+.I ipv4_address
diff --git a/debian/patches/0009-systemd-service-file-for-tayga.patch b/debian/patches/0009-systemd-service-file-for-tayga.patch
new file mode 100644
index 0000000..cbee7d0
--- /dev/null
+++ b/debian/patches/0009-systemd-service-file-for-tayga.patch
@@ -0,0 +1,93 @@
+From: "Barak A. Pearlmutter" <barak+git@pearlmutter.net>
+Date: Wed, 13 Feb 2019 01:16:25 +0000
+Subject: systemd service file for tayga
+
+Snarfed from
+https://ingvar.fedorapeople.org/tayga/tayga-0.9.2_redhat_initscripts_and_systemd.patch
+---
+ Makefile.am | 7 +++++++
+ configure.ac | 17 +++++++++++++++++
+ tayga.service | 31 +++++++++++++++++++++++++++++++
+ 3 files changed, 55 insertions(+)
+ create mode 100644 tayga.service
+
+diff --git a/Makefile.am b/Makefile.am
+index 55fce24..b90354b 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -7,3 +7,10 @@ dist_sysconf_DATA = tayga.conf.example
+ dist_man_MANS = tayga.8 tayga.conf.5
+
+ tayga_SOURCES = nat64.c addrmap.c dynamic.c tayga.c conffile.c tayga.h list.h
++
++# See daemon(7)
++AM_DISTCHECK_CONFIGURE_FLAGS = \
++ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
++if HAVE_SYSTEMD
++systemdsystemunit_DATA = tayga.service
++endif
+diff --git a/configure.ac b/configure.ac
+index fa99305..ca65097 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3,6 +3,23 @@ AC_CONFIG_SRCDIR(nat64.c)
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AC_CONFIG_HEADERS(config.h)
+
++dnl Stanza taken from daemon(7)
++PKG_PROG_PKG_CONFIG
++AC_ARG_WITH([systemdsystemunitdir],
++ [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
++ [with_systemdsystemunitdir=auto])
++AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
++ def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
++
++ AS_IF([test "x$def_systemdsystemunitdir" = "x"],
++ [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
++ [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
++ with_systemdsystemunitdir=no],
++ [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
++AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
++ [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
++AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
++
+ AC_PROG_CC
+
+ tayga_conf_path='${sysconfdir}/tayga.conf'
+diff --git a/tayga.service b/tayga.service
+new file mode 100644
+index 0000000..939b5c4
+--- /dev/null
++++ b/tayga.service
+@@ -0,0 +1,31 @@
++[Unit]
++Description=Simple, no-fuss NAT64
++After=network.target
++
++[Service]
++
++# To enable a tayga service with the default config
++#
++# systemctl enable tayga@default.service
++#
++# To set up an extra tayga service instance, create a new tayga config in
++# /etc/tayga/instancename.conf. Then enable this config as a systemd alias
++#
++# systemctl enable tayga@instancename.service
++#
++# If you want to make changes to this file, please symlink it to
++# /etc/systemd/system/tayga@instancename.service and make your changes there.
++# Configuration may be done in /etc/tayga/instancename.conf
++
++PIDFile=/run/tayga-%i.pid
++
++# Maximum size of the corefile.
++LimitCORE=infinity
++
++Type=simple
++PrivateTmp=true
++ExecStart=/usr/sbin/tayga --pidfile /var/run/tayga-%i.pid -d --config /etc/tayga/%i.conf
++
++
++[Install]
++WantedBy=multi-user.target
diff --git a/debian/patches/0010-include-for-writev.patch b/debian/patches/0010-include-for-writev.patch
new file mode 100644
index 0000000..60d6680
--- /dev/null
+++ b/debian/patches/0010-include-for-writev.patch
@@ -0,0 +1,24 @@
+From: "Barak A. Pearlmutter" <barak+git@pearlmutter.net>
+Date: Tue, 19 Feb 2019 12:02:21 +0000
+Subject: include for writev
+
+nat64.c:119:6: warning: implicit declaration of function `writev'; did you mean `write'? [-Wimplicit-function-declaration]
+ if (writev(gcfg->tun_fd, iov, data_len ? 2 : 1) < 0)
+ ^~~~~~
+ write
+---
+ tayga.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tayga.h b/tayga.h
+index 2284d2a..c8aadb8 100644
+--- a/tayga.h
++++ b/tayga.h
+@@ -20,6 +20,7 @@
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
++#include <sys/uio.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <unistd.h>
diff --git a/debian/patches/0011-null-char.patch b/debian/patches/0011-null-char.patch
new file mode 100644
index 0000000..092a331
--- /dev/null
+++ b/debian/patches/0011-null-char.patch
@@ -0,0 +1,36 @@
+From: "Barak A. Pearlmutter" <barak+git@pearlmutter.net>
+Date: Tue, 19 Feb 2019 12:06:01 +0000
+Subject: null char
+
+conffile.c:225:12: warning: assignment to `char' from `void *' makes integer from pointer without a cast [-Wint-conversion]
+ slash[0] = NULL;
+ ^
+conffile.c:240:12: warning: assignment to `char' from `void *' makes integer from pointer without a cast [-Wint-conversion]
+ slash[0] = NULL;
+ ^
+---
+ conffile.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/conffile.c b/conffile.c
+index dd4193c..0406cfd 100644
+--- a/conffile.c
++++ b/conffile.c
+@@ -222,7 +222,7 @@ static void config_map(int ln, int arg_count, char **args)
+ unsigned int prefix4 = 32;
+ if (slash) {
+ prefix4 = atoi(slash+1);
+- slash[0] = NULL;
++ slash[0] = '\0';
+ }
+
+ if (!inet_pton(AF_INET, args[0], &m->map4.addr)) {
+@@ -237,7 +237,7 @@ static void config_map(int ln, int arg_count, char **args)
+ slash = strchr(args[1], '/');
+ if (slash) {
+ prefix6 = atoi(slash+1);
+- slash[0] = NULL;
++ slash[0] = '\0';
+ }
+
+ if ((32 - prefix4) != (128 - prefix6)) {
diff --git a/debian/patches/series b/debian/patches/series
index 2ae3195..ec312e9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,8 +1,11 @@
-01-use-var-spool.patch
-02-manpage.patch
-03-configure-no-CFLAGS.patch
-04-quote-make-var.patch
-05-guard-chdir.patch
-06-guard-write.patch
-07-static-EAM.patch
-08-manpage-RFC.patch
+0001-use-var-spool.patch
+0002-manpage.patch
+0003-configure-no-CFLAGS.patch
+0004-quote-make-var.patch
+0005-guard-chdir.patch
+0006-guard-write.patch
+0007-static-EAM.patch
+0008-manpage-RFC.patch
+0009-systemd-service-file-for-tayga.patch
+0010-include-for-writev.patch
+0011-null-char.patch
diff --git a/tayga.conf.5 b/tayga.conf.5
index 76b1df8..7522c9d 100644
--- a/tayga.conf.5
+++ b/tayga.conf.5
@@ -83,7 +83,7 @@ and
to be used when translating IPv4 packets to IPv6 or IPv6 packets to IPv4.
If
.I /length
-is not present,
+is not present, the
.I /length
after
.I ipv4_address
diff --git a/tayga.h b/tayga.h
index 2284d2a..c8aadb8 100644
--- a/tayga.h
+++ b/tayga.h
@@ -20,6 +20,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
diff --git a/tayga.service b/tayga.service
new file mode 100644
index 0000000..939b5c4
--- /dev/null
+++ b/tayga.service
@@ -0,0 +1,31 @@
+[Unit]
+Description=Simple, no-fuss NAT64
+After=network.target
+
+[Service]
+
+# To enable a tayga service with the default config
+#
+# systemctl enable tayga@default.service
+#
+# To set up an extra tayga service instance, create a new tayga config in
+# /etc/tayga/instancename.conf. Then enable this config as a systemd alias
+#
+# systemctl enable tayga@instancename.service
+#
+# If you want to make changes to this file, please symlink it to
+# /etc/systemd/system/tayga@instancename.service and make your changes there.
+# Configuration may be done in /etc/tayga/instancename.conf
+
+PIDFile=/run/tayga-%i.pid
+
+# Maximum size of the corefile.
+LimitCORE=infinity
+
+Type=simple
+PrivateTmp=true
+ExecStart=/usr/sbin/tayga --pidfile /var/run/tayga-%i.pid -d --config /etc/tayga/%i.conf
+
+
+[Install]
+WantedBy=multi-user.target