--- /dev/null
+#!/bin/bash
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2012 IPFire Network Development Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program 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 General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+# This is a proxy script which is started instead of the real helper.
+# However, the only thing this script does it to call the actual helper script.
+
+script="/usr/lib/network/helpers/miredo-helper"
+
+if [ -x "${script}" ]; then
+ exec ${script}
+fi
+
+echo "${script} could not be found." >&2
+exit 1
--- /dev/null
+###############################################################################
+# IPFire.org - An Open Source Firewall Solution #
+# Copyright (C) - IPFire Development Team <info@ipfire.org> #
+###############################################################################
+
+name = miredo
+version = 1.2.5
+release = 1
+
+groups = Network/VPN
+url = http://www.remlab.net/miredo/
+license = GPLv2+
+summary = Tunneling of IPv6 over UDP through NATs.
+
+description
+ Miredo is an implementation of the "Teredo: Tunneling IPv6 over UDP
+ through NATs" proposed Internet standard (RFC4380). It can serve
+ either as a Teredo client, a stand-alone Teredo relay, or a Teredo
+ server, please install the miredo-server or miredo-client aproprietly.
+ It is meant to provide IPv6 connectivity to hosts behind NAT
+ devices, most of which do not support IPv6, and not even
+ IPv6-over-IPv4 (including 6to4).
+end
+
+source_dl = http://www.remlab.net/files/miredo/
+sources = %{thisapp}.tar.xz
+
+build
+ requires
+ libcap-devel
+ shadow-utils
+ systemd-units
+ end
+
+ configure_options += \
+ --disable-static \
+ --disable-rpath \
+ --enable-miredo-user
+
+ install_cmds
+ install -v -m 755 %{DIR_SOURCE}/client-hook \
+ %{BUILDROOT}%{sysconfdir}/miredo/client-hook
+
+ touch %{BUILDROOT}%{sysconfdir}/miredo/miredo-server.conf
+ end
+end
+
+packages
+ package %{name}-client
+ summary = This is the client part of miredo.
+
+ # There is not "miredo" package, so the -client
+ # package has an alias for it.
+ provides = miredo = %{thisver}
+
+ requires
+ %{name}-libs = %{thisver}
+ network
+ end
+
+ script postin
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ script postup
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ systemctl try-restart miredo-client.service >/dev/null 2>&1 || :
+ end
+
+ script preun
+ systemctl --no-reload disable miredo-client.service >/dev/null 2>&1 || :
+ systemctl stop miredo-client.service >/dev/null 2>&1 || :
+ end
+
+ script postun
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ configfiles
+ %{sysconfdir}/miredo/miredo.conf
+ end
+
+ files
+ %{sysconfdir}/miredo/client-hook
+ %{sysconfdir}/miredo/miredo.conf
+ %{sbindir}/miredo
+ %{unitdir}/miredo-client@.service
+ %{mandir}/man?/miredo.*
+ end
+ end
+
+ package %{name}-server
+ summary = This is the server part of miredo.
+
+ requires = %{name}-libs = %{thisver}
+
+ script postin
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ script postup
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ systemctl try-restart miredo-server.service >/dev/null 2>&1 || :
+ end
+
+ script preun
+ systemctl --no-reload disable miredo-server.service >/dev/null 2>&1 || :
+ systemctl stop miredo-server.service >/dev/null 2>&1 || :
+ end
+
+ script postun
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ configfiles
+ %{sysconfdir}/miredo/miredo-server.conf
+ end
+
+ files
+ %{bindir}/teredo-mire
+ %{sbindir}/miredo-server
+ %{sbindir}/miredo-checkconf
+ %{unitdir}/miredo-server.service
+ %{mandir}/man?/teredo-mire*
+ %{mandir}/man?/miredo-server*
+ %{mandir}/man?/miredo-checkconf*
+ end
+ end
+
+ package %{name}-libs
+ template LIBS
+
+ files += %{libdir}/miredo
+
+ script prein
+ getent group miredo >/dev/null || groupadd -r miredo
+ getent passwd miredo >/dev/null || useradd -r -g miredo \
+ -d %{sysconfdir}/miredo -s /sbin/nologin -c "Miredo Daemon" miredo
+ end
+ end
+
+ package %{name}-devel
+ template DEVEL
+
+ requires = %{name}-libs = %{thisver}
+ end
+
+ package %{name}-debuginfo
+ template DEBUGINFO
+ end
+end
--- /dev/null
+diff -ru miredo-1.1.6/misc/client-hook.iproute miredo-1.1.6-new/misc/client-hook.iproute
+--- miredo-1.1.6/misc/client-hook.iproute 2008-12-17 16:14:23.000000000 +0100
++++ miredo-1.1.6-new/misc/client-hook.iproute 2009-06-28 01:24:22.000000000 +0200
+@@ -1,4 +1,4 @@
+-#! /bin/sh
++#!/bin/sh
+ #
+ # Miredo client hook script for Linux/iproute2
+ # Copyright © 2007 Rémi Denis-Courmont.
+diff -ru miredo-1.1.6/misc/miredo.conf-in miredo-1.1.6-new/misc/miredo.conf-in
+--- miredo-1.1.6/misc/miredo.conf-in 2009-04-09 18:31:30.000000000 +0200
++++ miredo-1.1.6-new/misc/miredo.conf-in 2009-06-28 01:24:29.000000000 +0200
+@@ -1,4 +1,3 @@
+-#! @sbindir@/miredo -f -c
+ #
+ # Sample configuration file for Miredo
+
--- /dev/null
+@@ -, +, @@
+ libteredo/maintain.c | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+--- a/libteredo/maintain.c
++++ a/libteredo/maintain.c
+@@ -262,6 +262,9 @@ void maintenance_thread (teredo_maintenance *m)
+ /* Resolve server IPv4 addresses */
+ while (server_ip == 0)
+ {
++ /* Reread resolv.conf, it could have changed */
++ res_init();
++
+ /* FIXME: mutex kept while resolving - very bad */
+ int val = getipv4byname (m->server, &server_ip);
+ gettime (&deadline);
+