diff --git a/base/dnsmasq/.gitignore b/base/dnsmasq/.gitignore new file mode 100644 index 000000000..f12bf17d6 --- /dev/null +++ b/base/dnsmasq/.gitignore @@ -0,0 +1,7 @@ +!.distro +.distro/centos7/rpmbuild/RPMS +.distro/centos7/rpmbuild/SRPMS +.distro/centos7/rpmbuild/BUILD +.distro/centos7/rpmbuild/BUILDROOT +.distro/centos7/rpmbuild/SOURCES/dnsmasq*tar.gz +.distro/centos7/rpmbuild/SOURCES/*.patch diff --git a/base/dnsmasq/PKG-INFO b/base/dnsmasq/PKG-INFO new file mode 100644 index 000000000..bc8e08304 --- /dev/null +++ b/base/dnsmasq/PKG-INFO @@ -0,0 +1,13 @@ +Metadata-Version: 1.1 +Name: nova-api-proxy +Version: 1.0 +Summary: Nova Computer API Proxy +Home-page: +Author: Windriver +Author-email: info@windriver.com +License: Apache-2.0 + +Description: Nova Computer API Proxy + + +Platform: UNKNOWN diff --git a/base/dnsmasq/centos/build_srpm.data b/base/dnsmasq/centos/build_srpm.data new file mode 100644 index 000000000..3a9f62926 --- /dev/null +++ b/base/dnsmasq/centos/build_srpm.data @@ -0,0 +1,2 @@ +COPY_LIST="files/*" +TIS_PATCH_VER=6 diff --git a/base/dnsmasq/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch b/base/dnsmasq/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch new file mode 100644 index 000000000..e90daa0d0 --- /dev/null +++ b/base/dnsmasq/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch @@ -0,0 +1,25 @@ +From 402d56affb9e0767c4406260522fb356ecc420a0 Mon Sep 17 00:00:00 2001 +From: jmckenna +Date: Fri, 9 Feb 2018 13:51:24 -0500 +Subject: [PATCH] update package patching + +--- + SPECS/dnsmasq.spec | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/SPECS/dnsmasq.spec b/SPECS/dnsmasq.spec +index b3f178f..a583cf2 100644 +--- a/SPECS/dnsmasq.spec ++++ b/SPECS/dnsmasq.spec +@@ -13,7 +13,7 @@ + + Name: dnsmasq + Version: 2.76 +-Release: 2%{?extraversion}%{?dist}.2 ++Release: 2.el7_4.2%{?_tis_dist}.%{tis_patch_ver} + Summary: A lightweight DHCP/caching DNS server + + Group: System Environment/Daemons +-- +1.8.3.1 + diff --git a/base/dnsmasq/centos/meta_patches/PATCH_ORDER b/base/dnsmasq/centos/meta_patches/PATCH_ORDER new file mode 100644 index 000000000..8dc707716 --- /dev/null +++ b/base/dnsmasq/centos/meta_patches/PATCH_ORDER @@ -0,0 +1,4 @@ +spec-include-TiS-patch.patch +dnsmasq-spec-add-init-script.patch +patch-tftp-to-close-sockets-immediately.patch +0001-Update-package-versioning-for-TIS-format.patch diff --git a/base/dnsmasq/centos/meta_patches/dnsmasq-spec-add-init-script.patch b/base/dnsmasq/centos/meta_patches/dnsmasq-spec-add-init-script.patch new file mode 100644 index 000000000..bec68a3dd --- /dev/null +++ b/base/dnsmasq/centos/meta_patches/dnsmasq-spec-add-init-script.patch @@ -0,0 +1,71 @@ +From 13714ffa05d7d8a7ca9f9f61bfa75a3f7e8c2503 Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 17:27:13 -0400 +Subject: [PATCH 2/5] WRS: dnsmasq-spec-add-init-script.patch + +Conflicts: + SPECS/dnsmasq.spec +--- + SPECS/dnsmasq.spec | 26 ++++++++++++++++---------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +diff --git a/SPECS/dnsmasq.spec b/SPECS/dnsmasq.spec +index 63ff820..f8aace1 100644 +--- a/SPECS/dnsmasq.spec ++++ b/SPECS/dnsmasq.spec +@@ -21,6 +21,7 @@ License: GPLv2 or GPLv3 + URL: http://www.thekelleys.org.uk/dnsmasq/ + Source0: http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.gz + Source1: %{name}.service ++Source2: init + # upstream git: git://thekelleys.org.uk/dnsmasq.git + + # https://bugzilla.redhat.com/show_bug.cgi?id=1367772 +@@ -140,22 +141,26 @@ mkdir -p %{buildroot}%{_unitdir} + install -m644 %{SOURCE1} %{buildroot}%{_unitdir} + rm -rf %{buildroot}%{_initrddir} + ++# Systemv ++mkdir -p %{buildroot}/etc/init.d ++install -m 755 %{SOURCE2} %{buildroot}/etc/init.d/dnsmasq ++ + %clean + rm -rf $RPM_BUILD_ROOT + +-%post +-%systemd_post dnsmasq.service ++#%post ++#%systemd_post dnsmasq.service + +-%preun +-%systemd_preun dnsmasq.service ++#%preun ++#%systemd_preun dnsmasq.service + +-%postun +-%systemd_postun_with_restart dnsmasq.service ++#%postun ++#%systemd_postun_with_restart dnsmasq.service + +-%triggerun -- dnsmasq < 2.52-3 +-%{_bindir}/systemd-sysv-convert --save dnsmasq >/dev/null 2>&1 ||: +-/sbin/chkconfig --del dnsmasq >/dev/null 2>&1 || : +-/bin/systemctl try-restart dnsmasq.service >/dev/null 2>&1 || : ++#%triggerun -- dnsmasq < 2.52-3 ++#%{_bindir}/systemd-sysv-convert --save dnsmasq >/dev/null 2>&1 ||: ++#/sbin/chkconfig --del dnsmasq >/dev/null 2>&1 || : ++#/bin/systemctl try-restart dnsmasq.service >/dev/null 2>&1 || : + + %files + %defattr(-,root,root,-) +@@ -167,6 +172,7 @@ rm -rf $RPM_BUILD_ROOT + %{_unitdir}/%{name}.service + %{_sbindir}/dnsmasq + %{_mandir}/man8/dnsmasq* ++/etc/init.d/dnsmasq + + %files utils + %{_bindir}/dhcp_* +-- +1.9.1 + diff --git a/base/dnsmasq/centos/meta_patches/patch-tftp-to-close-sockets-immediately.patch b/base/dnsmasq/centos/meta_patches/patch-tftp-to-close-sockets-immediately.patch new file mode 100644 index 000000000..f0ed9eb59 --- /dev/null +++ b/base/dnsmasq/centos/meta_patches/patch-tftp-to-close-sockets-immediately.patch @@ -0,0 +1,34 @@ +From e257b88db5d62a1e44e94373917dd3f97de12522 Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 17:27:13 -0400 +Subject: [PATCH 3/5] WRS: patch-tftp-to-close-sockets-immediately.patch + +Conflicts: + SPECS/dnsmasq.spec +--- + SPECS/dnsmasq.spec | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/SPECS/dnsmasq.spec b/SPECS/dnsmasq.spec +index f8aace1..a3a9e08 100644 +--- a/SPECS/dnsmasq.spec ++++ b/SPECS/dnsmasq.spec +@@ -42,6 +42,7 @@ Patch8: dnsmasq-2.76-coverity.patch + + # WRS patches + Patch30: dnsmasq-update-ipv6-leases-from-config.patch ++Patch31: close-tftp-sockets-immediately.patch + + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +@@ -88,6 +89,7 @@ query/remove a DHCP server's leases. + + # WRS patches + %patch30 -p1 ++%patch31 -p1 + + # use /var/lib/dnsmasq instead of /var/lib/misc + for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do +-- +1.9.1 + diff --git a/base/dnsmasq/centos/meta_patches/spec-include-TiS-patch.patch b/base/dnsmasq/centos/meta_patches/spec-include-TiS-patch.patch new file mode 100644 index 000000000..7073afc9a --- /dev/null +++ b/base/dnsmasq/centos/meta_patches/spec-include-TiS-patch.patch @@ -0,0 +1,49 @@ +From ecbe3b4e138cb5076b8cbbedf86fea3044449132 Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 17:27:13 -0400 +Subject: [PATCH 1/5] WRS: spec-include-TiS-patch.patch + +Conflicts: + SPECS/dnsmasq.spec +--- + SPECS/dnsmasq.spec | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/SPECS/dnsmasq.spec b/SPECS/dnsmasq.spec +index 8a6450a..63ff820 100644 +--- a/SPECS/dnsmasq.spec ++++ b/SPECS/dnsmasq.spec +@@ -39,6 +39,9 @@ Patch6: dnsmasq-2.76-label-warning.patch + Patch7: dnsmasq-2.76-label-man.patch + Patch8: dnsmasq-2.76-coverity.patch + ++# WRS patches ++Patch30: dnsmasq-update-ipv6-leases-from-config.patch ++ + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + + BuildRequires: dbus-devel +@@ -82,6 +85,9 @@ query/remove a DHCP server's leases. + %patch7 -p1 + %patch8 -p1 -b .coverity + ++# WRS patches ++%patch30 -p1 ++ + # use /var/lib/dnsmasq instead of /var/lib/misc + for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do + sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file" +@@ -154,8 +160,8 @@ rm -rf $RPM_BUILD_ROOT + %files + %defattr(-,root,root,-) + %doc CHANGELOG COPYING COPYING-v3 FAQ doc.html setup.html dbus/DBus-interface +-%config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf +-%dir /etc/dnsmasq.d ++%config(noreplace) %attr(640,root,root) %{_sysconfdir}/dnsmasq.conf ++%dir %attr(750,root,root) /etc/dnsmasq.d + %dir %{_var}/lib/dnsmasq + %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/dnsmasq.conf + %{_unitdir}/%{name}.service +-- +1.9.1 + diff --git a/base/dnsmasq/centos/patches/close-tftp-sockets-immediately.patch b/base/dnsmasq/centos/patches/close-tftp-sockets-immediately.patch new file mode 100644 index 000000000..9ca838b09 --- /dev/null +++ b/base/dnsmasq/centos/patches/close-tftp-sockets-immediately.patch @@ -0,0 +1,28 @@ +From 858e259bf7125695c068301d0ef56cc4750d6544 Mon Sep 17 00:00:00 2001 +From: Don Penney +Date: Thu, 15 Sep 2016 13:32:03 -0400 +Subject: [PATCH 1/1] Close tftp sockets immediately + +--- + src/tftp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/tftp.c b/src/tftp.c +index d7d050f..ecc6ce8 100644 +--- a/src/tftp.c ++++ b/src/tftp.c +@@ -768,9 +768,11 @@ int do_tftp_script_run(void) + if ((transfer = daemon->tftp_done_trans)) + { + daemon->tftp_done_trans = transfer->next; ++#if 0 /* Disable delayed closing of TFTP UDP socket */ + #ifdef HAVE_SCRIPT + queue_tftp(transfer->file->size, transfer->file->filename, &transfer->peer); + #endif ++#endif + free_transfer(transfer); + return 1; + } +-- +1.9.1 + diff --git a/base/dnsmasq/centos/patches/dnsmasq-update-ipv6-leases-from-config.patch b/base/dnsmasq/centos/patches/dnsmasq-update-ipv6-leases-from-config.patch new file mode 100644 index 000000000..87bfc24f8 --- /dev/null +++ b/base/dnsmasq/centos/patches/dnsmasq-update-ipv6-leases-from-config.patch @@ -0,0 +1,84 @@ +From c68370ac5678b1052592877ede04886d5f62d2dc Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Tue, 18 Oct 2016 13:07:56 -0400 +Subject: [PATCH 1/4] WRS: Patch22: + dnsmasq-update-ipv6-leases-from-config.patch + +--- + src/lease.c | 53 +++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 43 insertions(+), 10 deletions(-) + +diff --git a/src/lease.c b/src/lease.c +index e5fe8a6..ffa683a 100644 +--- a/src/lease.c ++++ b/src/lease.c +@@ -179,6 +179,18 @@ void lease_init(time_t now) + dns_dirty = 1; + } + ++static int lease_match_config_addr(struct dhcp_lease *lease, struct dhcp_config *config) ++{ ++ if (!(lease->flags & (LEASE_TA | LEASE_NA)) && (config->flags & CONFIG_ADDR)) ++ return (lease->addr.s_addr == config->addr.s_addr); ++#ifdef HAVE_DHCP6 ++ else if ((lease->flags & (LEASE_TA | LEASE_NA)) && (config->flags & CONFIG_ADDR6)) ++ return IN6_ARE_ADDR_EQUAL(&config->addr6, &lease->addr6); ++#endif ++ else ++ return 0; ++} ++ + void lease_update_from_configs(void) + { + /* changes to the config may change current leases. */ +@@ -187,16 +199,37 @@ void lease_update_from_configs(void) + struct dhcp_config *config; + char *name; + +- for (lease = leases; lease; lease = lease->next) +- if (lease->flags & (LEASE_TA | LEASE_NA)) +- continue; +- else if ((config = find_config(daemon->dhcp_conf, NULL, lease->clid, lease->clid_len, +- lease->hwaddr, lease->hwaddr_len, lease->hwaddr_type, NULL)) && +- (config->flags & CONFIG_NAME) && +- (!(config->flags & CONFIG_ADDR) || config->addr.s_addr == lease->addr.s_addr)) +- lease_set_hostname(lease, config->hostname, 1, get_domain(lease->addr), NULL); +- else if ((name = host_from_dns(lease->addr))) +- lease_set_hostname(lease, name, 1, get_domain(lease->addr), NULL); /* updates auth flag only */ ++ for (lease = leases; lease; lease = lease->next) { ++ if (lease->flags & LEASE_TA) ++ continue; /* we do not update temporary ipv6 leases */ ++ ++ config = find_config(daemon->dhcp_conf, NULL, lease->clid, lease->clid_len, ++ (lease->hwaddr_len > 0 ? lease->hwaddr : NULL), ++ lease->hwaddr_len, lease->hwaddr_type, NULL); ++ if (config) ++ { ++ if ((!(config->flags & (CONFIG_ADDR | CONFIG_ADDR6))) || ++ lease_match_config_addr(lease, config)) ++ { ++ /* ++ * Either we matched on a config that doesn't have an address in ++ * which case we'll just use the hostname, or we matched on a ++ * config that has the same IP address. ++ */ ++ if (!(lease->flags & (LEASE_TA | LEASE_NA))) ++ lease_set_hostname(lease, config->hostname, 1, get_domain(lease->addr), NULL); ++#ifdef HAVE_DHCP6 ++ else ++ lease_set_hostname(lease, config->hostname, 1, get_domain6(&lease->addr6), NULL); ++#endif ++ continue; /* lease updated; move on to next lease */ ++ } ++ } ++ ++ /* attempt to find a matching DNS cache entry for an IPv4 entry */ ++ if (!(lease->flags & (LEASE_TA | LEASE_NA)) && (name = host_from_dns(lease->addr))) ++ lease_set_hostname(lease, name, 1, get_domain(lease->addr), NULL); /* updates auth flag only */ ++ } + } + + static void ourprintf(int *errp, char *format, ...) +-- +1.9.1 + diff --git a/base/dnsmasq/centos/srpm_path b/base/dnsmasq/centos/srpm_path new file mode 100644 index 000000000..afdf8db63 --- /dev/null +++ b/base/dnsmasq/centos/srpm_path @@ -0,0 +1 @@ +mirror:Source/dnsmasq-2.76-2.el7_4.2.src.rpm diff --git a/base/dnsmasq/files/init b/base/dnsmasq/files/init new file mode 100644 index 000000000..1517197fb --- /dev/null +++ b/base/dnsmasq/files/init @@ -0,0 +1,59 @@ +#!/bin/sh +if [ -f /etc/centos-release ]; then + DAEMON=/usr/sbin/dnsmasq +else + DAEMON=/usr/bin/dnsmasq +fi +NAME=dnsmasq +DESC="DNS forwarder and DHCP server" +PIDFILE="/var/run/dnsmasq.pid" + +test -f $DAEMON || exit 0 + +case "$1" in + start) + echo -n "starting $DESC: $NAME... " + test -d /var/lib/misc/ || mkdir /var/lib/misc/ + start-stop-daemon -S -x $DAEMON --pidfile $PIDFILE -- $ARGS + echo "done." + echo -n "Refresh hosts cache" + nscd -i hosts + echo "done." + ;; + stop) + echo -n "stopping $DESC: $NAME... " + start-stop-daemon -K -x $DAEMON --pidfile $PIDFILE + rm -f $PIDFILE + echo "done." + ;; + status) + echo -n "dnsmasq " + start-stop-daemon -q -K -t -x $DAEMON --pidfile $PIDFILE + RET=$? + if [ "$RET" = "0" ]; then + PID=`cat $PIDFILE` + echo "($PID) is running" + else + echo "is not running" + # For lsb compliance return 3 if process not running + exit 3 + fi + ;; + restart) + echo "restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + reload) + echo -n "reloading $DESC: $NAME... " + killall -HUP $(basename ${DAEMON}) + echo "done." + ;; + *) + echo "Usage: $0 {start|stop|status|restart|reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/centos_pkg_dirs b/centos_pkg_dirs index b112c0010..e128a0ca3 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -141,3 +141,4 @@ database/mariadb networking/iptables database/python-psycopg2 base/crontabs +base/dnsmasq