From db890b7ae3414134ad50f62ee2502bb29d1cc121 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Wed, 6 Dec 2017 00:07:59 -0500 Subject: [PATCH] Add wide-dhcpv6 --- src/wide-dhcpv6/.gitignore | 8 + src/wide-dhcpv6/0000-noyywrap-option.patch | 9 ++ src/wide-dhcpv6/0001-Fix-manpages.patch | 168 +++++++++++++++++++++ src/wide-dhcpv6/0001-renew.patch | 11 ++ src/wide-dhcpv6/0002-Fix-makefile.patch | 25 +++ src/wide-dhcpv6/PKGBUILD | 79 ++++++++++ src/wide-dhcpv6/dhcp6c.conf | 48 ++++++ src/wide-dhcpv6/dhcp6c.install | 10 ++ src/wide-dhcpv6/dhcp6c.service | 16 ++ src/wide-dhcpv6/dhcp6c@.service | 16 ++ src/wide-dhcpv6/startpd.conf | 2 + 11 files changed, 392 insertions(+) create mode 100644 src/wide-dhcpv6/.gitignore create mode 100644 src/wide-dhcpv6/0000-noyywrap-option.patch create mode 100644 src/wide-dhcpv6/0001-Fix-manpages.patch create mode 100644 src/wide-dhcpv6/0001-renew.patch create mode 100644 src/wide-dhcpv6/0002-Fix-makefile.patch create mode 100644 src/wide-dhcpv6/PKGBUILD create mode 100644 src/wide-dhcpv6/dhcp6c.conf create mode 100644 src/wide-dhcpv6/dhcp6c.install create mode 100644 src/wide-dhcpv6/dhcp6c.service create mode 100644 src/wide-dhcpv6/dhcp6c@.service create mode 100644 src/wide-dhcpv6/startpd.conf diff --git a/src/wide-dhcpv6/.gitignore b/src/wide-dhcpv6/.gitignore new file mode 100644 index 0000000..aa1165d --- /dev/null +++ b/src/wide-dhcpv6/.gitignore @@ -0,0 +1,8 @@ +pkg/* +src/* +*.tar.gz +*.tar.xz +*.tar.bz2 +*.zip +*.swp +*.log diff --git a/src/wide-dhcpv6/0000-noyywrap-option.patch b/src/wide-dhcpv6/0000-noyywrap-option.patch new file mode 100644 index 0000000..2d01ab1 --- /dev/null +++ b/src/wide-dhcpv6/0000-noyywrap-option.patch @@ -0,0 +1,9 @@ +--- a/cftoken.l 2007-03-21 11:52:55.000000000 +0200 ++++ b/cftoken.l 2014-03-20 21:05:15.598230461 +0200 +@@ -1,5 +1,6 @@ + /* $KAME: cftoken.l,v 1.35 2005/01/12 06:06:11 suz Exp $ */ + ++%option noyywrap + %{ + /* + * Copyright (C) 2002 WIDE Project. diff --git a/src/wide-dhcpv6/0001-Fix-manpages.patch b/src/wide-dhcpv6/0001-Fix-manpages.patch new file mode 100644 index 0000000..76622f7 --- /dev/null +++ b/src/wide-dhcpv6/0001-Fix-manpages.patch @@ -0,0 +1,168 @@ +From e9fd60840eb125dcd55aab859dd838a47c02931f Mon Sep 17 00:00:00 2001 +From: Jeremie Corbier +Date: Tue, 6 Apr 2010 15:51:03 +0200 +Subject: [PATCH] Fix manpages + +This patch fixes wide-dhcpv6 manpages (paths, typos, ...). + +Signed-off-by: Jeremie Corbier +--- + dhcp6c.8 | 8 ++++---- + dhcp6c.conf.5 | 4 ++-- + dhcp6ctl.8 | 13 ++++++------- + dhcp6relay.8 | 1 - + dhcp6s.8 | 10 +++++----- + dhcp6s.conf.5 | 2 +- + 6 files changed, 18 insertions(+), 20 deletions(-) + +diff --git a/dhcp6c.8 b/dhcp6c.8 +index 6824ae0..1d69c9d 100644 +--- a/dhcp6c.8 ++++ b/dhcp6c.8 +@@ -114,13 +114,13 @@ In either case, + will send DHCPv6 Release messages to release resources assigned from servers. + .\" + .Sh FILES +-.Bl -tag -width /usr/local/etc/dhcp6c.conf -compact ++.Bl -tag -width /etc/wide-dhcpv6/dhcp6c.conf -compact + .It Pa /var/run/dhcp6c.pid + is the default file that contains pid of the currently running + .Nm dhcp6c . +-.It Pa /usr/local/etc/dhcp6c.conf ++.It Pa /etc/wide-dhcpv6/dhcp6c.conf + is the default configuration file. +-.It Pa /var/db/dhcp6c_duid ++.It Pa /var/lib/dhcpv6/dhcp6c_duid + is the file to store the client's DUID. + .El + .Sh Configuration Script +@@ -203,6 +203,6 @@ command first appeared in WIDE/KAME IPv6 protocol stack kit. + is incomplete and violates DHCPv6 protocol spec, in several aspects. + In particular, temporary address assignment is intentionally omitted. + .Pp +-Information Refresh Time Option is not recognied in Info-req mode, since ++Information Refresh Time Option is not recognized in Info-req mode, since + .Nm + terminates after it receives a REPLY message. +diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5 +index 611ab4f..5fc03d3 100644 +--- a/dhcp6c.conf.5 ++++ b/dhcp6c.conf.5 +@@ -36,7 +36,7 @@ + .Nd DHCPv6 client configuration file + .\" + .Sh SYNOPSIS +-.Pa /usr/local/etc/dhcp6c.conf ++.Pa /etc/wide-dhcpv6/dhcp6c.conf + .\" + .Sh DESCRIPTION + The +@@ -630,7 +630,7 @@ execute the + .Xr openssl 1 + command (when available) as follows, + .Bd -literal -offset +-% openssl rand -base64 16 ++% openssl rand \-base64 16 + .Ed + .Pp + and copy the output to the +diff --git a/dhcp6ctl.8 b/dhcp6ctl.8 +index 86ea0e1..e11889b 100644 +--- a/dhcp6ctl.8 ++++ b/dhcp6ctl.8 +@@ -85,12 +85,11 @@ Use + .Ar keyfile + to provide the shared secret to communicate with the process. + The default file name used when unspecified is +-.Pa /usr/local/etc/dhcp6cctlkey ++.Pa /etc/wide-dhcpv6/dhcp6cctlkey + with a client, + and +-.Pa /usr/local/etc/dhcp6sctlkey ++.Pa /etc/wide-dhcpv6/dhcp6sctlkey + with a server. +- + .It Fl p Ar port + Specify + .Ar port +@@ -99,7 +98,7 @@ The default port number used when unspecified is 5546 for a client, + and 5547 for a server. + .It Fl s Ar address + Specify +-.A address ++.Ar address + as the listening address of the process. + The default address used when unspecified is ::1. + .El +@@ -183,10 +182,10 @@ information (if any) and exits. + .El + .\" + .Sh FILES +-.Bl -tag -width /usr/local/etc/dhcp6cctlkey -compact +-.It Pa /usr/local/etc/dhcp6cctlkey ++.Bl -tag -width /etc/wide-dhcpv6/dhcp6cctlkey -compact ++.It Pa /etc/wide-dhcpv6/dhcp6cctlkey + is the default key file to communicate with a client. +-.It Pa /usr/local/etc/dhcp6sctlkey ++.It Pa /etc/wide-dhcpv6/dhcp6sctlkey + is the default key file to communicate with a server. + .El + .\" +diff --git a/dhcp6relay.8 b/dhcp6relay.8 +index 4f761b0..7ad8ada 100644 +--- a/dhcp6relay.8 ++++ b/dhcp6relay.8 +@@ -107,7 +107,6 @@ to dump the process ID of + is the default file that contains pid of the currently running + .Nm . + .El +- + .Sh SEE ALSO + .Xr dhcp6c 8 , + .Xr dhcp6s 8 +diff --git a/dhcp6s.8 b/dhcp6s.8 +index 888117a..29dcc7b 100644 +--- a/dhcp6s.8 ++++ b/dhcp6s.8 +@@ -102,7 +102,7 @@ Use + to store the shared secret to authenticate the communication with + .Nm dhcp6ctl . + The default file name used when unspecified is +-.Pa /usr/local/etc/dhcp6sctlkey . ++.Pa /etc/wide-dhcpv6/dhcp6sctlkey . + The default name is intentionally same as that for + .Nm dhcp6ctl + so that the server and the control command can share the file when +@@ -122,12 +122,12 @@ to dump the process ID of + .El + .\" + .Sh FILES +-.Bl -tag -width /usr/local/etc/dhcp6s.conf -compact +-.It Pa /usr/local/etc/dhcp6s.conf ++.Bl -tag -width /etc/wide-dhcpv6/dhcp6s.conf -compact ++.It Pa /etc/wide-dhcpv6/dhcp6s.conf + is the default configuration file. +-.It Pa /var/db/dhcp6s_duid ++.It Pa /var/lib/dhcpv6/dhcp6s_duid + is the default file to store the server's DUID. +-.It Pa /usr/local/etc/dhcp6sctlkey ++.It Pa /etc/wide-dhcpv6/dhcp6sctlkey + is the default key file to communicate with the control command. + See + .Xr dhcp6ctl 8 +diff --git a/dhcp6s.conf.5 b/dhcp6s.conf.5 +index 1206764..2cb08ce 100644 +--- a/dhcp6s.conf.5 ++++ b/dhcp6s.conf.5 +@@ -36,7 +36,7 @@ + .Nd DHCPv6 server configuration file + .\" + .Sh SYNOPSIS +-.Pa /usr/local/etc/dhcp6s.conf ++.Pa /etc/wide-dhcpv6/dhcp6s.conf + .\" + .Sh DESCRIPTION + The +-- +1.5.6.5 + diff --git a/src/wide-dhcpv6/0001-renew.patch b/src/wide-dhcpv6/0001-renew.patch new file mode 100644 index 0000000..3319a28 --- /dev/null +++ b/src/wide-dhcpv6/0001-renew.patch @@ -0,0 +1,11 @@ +--- dir_orig/addrconf.c 2008-06-15 09:48:40.000000000 +0200 ++++ dir_release/addrconf.c 2013-02-13 10:35:59.000000000 +0100 +@@ -173,7 +173,7 @@ + sacreate ? "create" : "update", + in6addr2str(&addr->addr, 0), addr->pltime, addr->vltime); + +- if (sa->addr.vltime != 0) ++ if ((sa->addr.vltime != 0) && sacreate) + if (na_ifaddrconf(IFADDRCONF_ADD, sa) < 0) + return (-1); + diff --git a/src/wide-dhcpv6/0002-Fix-makefile.patch b/src/wide-dhcpv6/0002-Fix-makefile.patch new file mode 100644 index 0000000..a2b6a04 --- /dev/null +++ b/src/wide-dhcpv6/0002-Fix-makefile.patch @@ -0,0 +1,25 @@ +--- a/Makefile.in.orig 2007-03-21 11:52:58.000000000 +0200 ++++ b/Makefile.in 2013-07-20 19:07:08.123014142 +0300 +@@ -102,14 +102,14 @@ + expand bootp-dhcp-parameters | perl gentab.pl > ianaopts.h + + install:: +- -mkdir -p $(sbindir) $(mandir)/man5 $(mandir)/man8 +- $(INSTALL_PROGRAM) -s -o $(user) -g $(group) $(TARGET) $(sbindir) +- $(INSTALL_DATA) -o $(user) -g $(group) dhcp6c.8 $(mandir)/man8 +- $(INSTALL_DATA) -o $(user) -g $(group) dhcp6s.8 $(mandir)/man8 +- $(INSTALL_DATA) -o $(user) -g $(group) dhcp6relay.8 $(mandir)/man8 +- $(INSTALL_DATA) -o $(user) -g $(group) dhcp6ctl.8 $(mandir)/man8 +- $(INSTALL_DATA) -o $(user) -g $(group) dhcp6c.conf.5 $(mandir)/man5 +- $(INSTALL_DATA) -o $(user) -g $(group) dhcp6s.conf.5 $(mandir)/man5 ++ mkdir -p $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man8 ++ $(INSTALL_PROGRAM) -s -o $(user) -g $(group) $(TARGET) $(DESTDIR)$(sbindir) ++ $(INSTALL_DATA) -o $(user) -g $(group) dhcp6c.8 $(DESTDIR)$(mandir)/man8 ++ $(INSTALL_DATA) -o $(user) -g $(group) dhcp6s.8 $(DESTDIR)$(mandir)/man8 ++ $(INSTALL_DATA) -o $(user) -g $(group) dhcp6relay.8 $(DESTDIR)$(mandir)/man8 ++ $(INSTALL_DATA) -o $(user) -g $(group) dhcp6ctl.8 $(DESTDIR)$(mandir)/man8 ++ $(INSTALL_DATA) -o $(user) -g $(group) dhcp6c.conf.5 $(DESTDIR)$(mandir)/man5 ++ $(INSTALL_DATA) -o $(user) -g $(group) dhcp6s.conf.5 $(DESTDIR)$(mandir)/man5 + + includes:: + diff --git a/src/wide-dhcpv6/PKGBUILD b/src/wide-dhcpv6/PKGBUILD new file mode 100644 index 0000000..665856e --- /dev/null +++ b/src/wide-dhcpv6/PKGBUILD @@ -0,0 +1,79 @@ +# Maintainer: Spyros Stathopoulos +pkgname=wide-dhcpv6 +pkgver=20080615 +pkgrel=13 +pkgdesc="An open source implementation of DHCPv6 developed by KAME project (with Debian patches)" +arch=('i686' 'x86_64') +url="http://wide-dhcpv6.sourceforge.net/" +license=('custom') +backup=('etc/wide-dhcpv6/dhcp6c.conf' 'etc/conf.d/startpd.conf') +options=('emptydirs') + +source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz" + "http://ftp.de.debian.org/debian/pool/main/w/${pkgname}/${pkgname}_${pkgver}-11.1.debian.tar.gz" + "0000-noyywrap-option.patch" + "0001-renew.patch" + "0002-Fix-makefile.patch" + "dhcp6c.service" + "dhcp6c@.service" + "startpd.conf" + "dhcp6c.conf") + +install="dhcp6c.install" + +md5sums=('1011e165850fe40d3e332dad2bfd30b3' + 'e6bb556a2791b8a825ea2209ce10f27e' + '6bc5f3779f04cd1c74469b4942c1061d' + '678789721081e90e9a0822de1bb1d347' + 'dfba035ab0fd99ae56ab2e37a000cba0' + '7606280036a1a2c7c0a38af84803f41c' + '897c6ccb3608e6ac33c3022631a49ee6' + '8ec3740147eb2ff9ee7bec7070d2f008' + '54866e3bdd4093efe89a2fc245e7f5ab') + +prepare() { + cd ${srcdir} + cp debian/patches/*patch ${srcdir} + # this is included in the new 0002 patch, so rm it + rm "0002-Don-t-strip-binaries.patch" + cd ${srcdir}/$pkgname-$pkgver + for i in ../*patch ; do + patch -p1 < ${i}; + done +} + +build() { + cd "$srcdir/$pkgname-$pkgver" + pwd + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --with-localdbdir=/var/lib/dhcpv6 \ + --sysconfdir=/etc/wide-dhcpv6 \ + --sbindir=/usr/bin + # -j > 1 breaks build dependencies + make -j1 +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + mkdir -p "${pkgdir}/var/lib/dhcpv6" + mkdir -p "${pkgdir}/usr/share/man" + mkdir -p "${pkgdir}/usr/share/man/man5" + mkdir -p "${pkgdir}/usr/share/man/man8" + #install -D -m644 ${srcdir}/${pkgname}-${pkgver}/dhcp6c.conf.sample \ + # ${pkgdir}/etc/wide-dhcpv6/dhcp6c.conf + install -D -m644 ${srcdir}/dhcp6c.conf \ + ${pkgdir}/etc/wide-dhcpv6/dhcp6c.conf + install -D -m644 ${srcdir}/${pkgname}-${pkgver}/dhcp6s.conf.sample \ + ${pkgdir}/etc/wide-dhcpv6/dhcp6s.conf + install -D -m644 ${srcdir}/dhcp6c.service \ + ${pkgdir}/usr/lib/systemd/system/dhcp6c.service + install -D -m644 ${srcdir}/dhcp6c@.service \ + ${pkgdir}/usr/lib/systemd/system/dhcp6c@.service + install -D -m644 ${srcdir}/${pkgname}-${pkgver}/COPYRIGHT \ + ${pkgdir}/usr/share/licenses/wide-dhcpv6/LICENSE + install -D -m644 ${srcdir}/startpd.conf \ + ${pkgdir}/etc/conf.d/startpd.conf + make DESTDIR="$pkgdir/" install +} + diff --git a/src/wide-dhcpv6/dhcp6c.conf b/src/wide-dhcpv6/dhcp6c.conf new file mode 100644 index 0000000..439e76a --- /dev/null +++ b/src/wide-dhcpv6/dhcp6c.conf @@ -0,0 +1,48 @@ +interface ext0 { # external facing interface - WAN + #send ia-na 0; + send ia-pd 0; + send rapid-commit; + + request domain-name-servers; + request domain-name; + # send authentication ; +}; + +id-assoc pd 0 { # prefix delegation request + + ## Request a specific prefix + ## pltime and vltime are the "preferred" and "valid" lifetimes of the requested prefix. + # prefix []; + prefix-interface int0 { #internal facing interface - LAN + ## site-level aggregator - SLA - subnet address + sla-id 0; + ## IP address "postfix". Default is the EUI-64 address of the interface. Can be + ## any desired subnet address, in decimal. Combined with SLA-ID prefix to + ## create full IP address of interface. + ifid 1; + ## (WAN prefix) + (sla-len) must equal 64. If your ISP provides you + ## with a /56 prefix add 8 to make it /64 + sla-len 8; + }; + +}; + +# id-assoc na 0 { # non-temporary address allocation request +# ## Request a specific address. +# ## pltime and vltime are the "preferred" and "valid" lifetimes +# ## of the requested address. +# address []; +# }; + +# authentication { +# protocol delayed; +# algorithm hmac-md5; +# rdm monocounter; # replay-detection-method +# }; + +# keyinfo kame-key { +# realm "kame.net"; +# keyid 1; +# secret "5xnrt8irOKD16otstK1y=A=Z"; +# }; + diff --git a/src/wide-dhcpv6/dhcp6c.install b/src/wide-dhcpv6/dhcp6c.install new file mode 100644 index 0000000..6b3d094 --- /dev/null +++ b/src/wide-dhcpv6/dhcp6c.install @@ -0,0 +1,10 @@ +post_install() { + echo "Edit the DHCPv6 client configuration in /etc/wide-dhcpv6/dhcp6c.conf" + echo "Also add your internal and external interface to /etc/conf.d/startpd.conf" + echo "and enable dhcp6c.service." +} + +post_upgrade() { + post_install +} + diff --git a/src/wide-dhcpv6/dhcp6c.service b/src/wide-dhcpv6/dhcp6c.service new file mode 100644 index 0000000..5f6cace --- /dev/null +++ b/src/wide-dhcpv6/dhcp6c.service @@ -0,0 +1,16 @@ +[Unit] +Description=WIDE-DHCPv6 Client on interface %I +After=network.target +Requires=network.target +Before=dnsmasq.service +Before=NetworkManager.service +Documentation=man:dhcp6c(8) man:dhcp6c.conf(5) + +[Service] +EnvironmentFile=/etc/conf.d/startpd.conf +ExecStart=/usr/bin/dhcp6c -c /etc/wide-dhcpv6/dhcp6c.conf -fp /var/run/dhcp6c.pid $DHCP6C_WAN +ExecReload=/usr/bin/kill -s SIGHUP $MAINPID +ExecStop=/usr/bin/kill -s SIGTERM $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/src/wide-dhcpv6/dhcp6c@.service b/src/wide-dhcpv6/dhcp6c@.service new file mode 100644 index 0000000..597f53e --- /dev/null +++ b/src/wide-dhcpv6/dhcp6c@.service @@ -0,0 +1,16 @@ +[Unit] +Description=WIDE-DHCPv6 Client on interface %I +After=network.target +Requires=network.target +Before=dnsmasq.service +Before=NetworkManager.service +Documentation=man:dhcp6c(8) man:dhcp6c.conf(5) + +[Service] +EnvironmentFile=/etc/conf.d/startpd.conf +ExecStart=/usr/bin/dhcp6c -c /etc/wide-dhcpv6/dhcp6c.conf -fp /var/run/dhcp6c.pid %I +ExecReload=/usr/bin/kill -s SIGHUP $MAINPID +ExecStop=/usr/bin/kill -s SIGTERM $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/src/wide-dhcpv6/startpd.conf b/src/wide-dhcpv6/startpd.conf new file mode 100644 index 0000000..d6805fd --- /dev/null +++ b/src/wide-dhcpv6/startpd.conf @@ -0,0 +1,2 @@ +DHCP6C_WAN=ext0 +DHCP6C_LAN=int0