diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/Suse/README | 6 | ||||
-rw-r--r-- | contrib/Suse/README.susefirewall | 27 | ||||
-rw-r--r-- | contrib/Suse/dnsmasq-SuSE.patch | 23 | ||||
-rw-r--r-- | contrib/Suse/dnsmasq-suse.spec | 111 | ||||
-rw-r--r-- | contrib/Suse/rc.dnsmasq-suse | 79 | ||||
-rw-r--r-- | contrib/lease-tools/dhcp_release.c | 1 | ||||
-rw-r--r-- | contrib/lease-tools/dhcp_release6.c | 37 |
7 files changed, 24 insertions, 260 deletions
diff --git a/contrib/Suse/README b/contrib/Suse/README deleted file mode 100644 index 3fdc186..0000000 --- a/contrib/Suse/README +++ /dev/null @@ -1,6 +0,0 @@ -This packaging is now unmaintained in the dnsmasq source: dnsmasq is -included in Suse proper, and up-to-date packages are now available -from - -ftp://ftp.suse.com/pub/people/ug/ - diff --git a/contrib/Suse/README.susefirewall b/contrib/Suse/README.susefirewall deleted file mode 100644 index 0b94108..0000000 --- a/contrib/Suse/README.susefirewall +++ /dev/null @@ -1,27 +0,0 @@ -This is a patch against SuSEfirewall2-3.1-206 (SuSE 9.x and older) -It fixes the dependency from the dns daemon name 'named' -After appending the patch, the SuSEfirewall is again able to autodetect -the dnsmasq named service. -This is a very old bug in the SuSEfirewall script. -The SuSE people think the name of the dns server will always 'named' - - ---- /sbin/SuSEfirewall2.orig 2004-01-23 13:30:09.000000000 +0100 -+++ /sbin/SuSEfirewall2 2004-01-23 13:31:56.000000000 +0100 -@@ -764,7 +764,7 @@ - echo 'FW_ALLOW_INCOMING_HIGHPORTS_UDP should be set to yes, if you are running a DNS server!' - - test "$FW_SERVICE_AUTODETECT" = yes -o "$FW_SERVICE_AUTODETECT" = dmz -o "$FW_SERVICE_AUTODETECT" = ext && { -- test "$FW_SERVICE_DNS" = no -a '!' "$START_NAMED" = no && check_srv named && { -+ test "$FW_SERVICE_DNS" = no -a '!' "$START_NAMED" = no && check_srv dnsmasq && { - echo -e 'Warning: detected activated named, enabling FW_SERVICE_DNS! - You still have to allow tcp/udp port 53 on internal, dmz and/or external.' - FW_SERVICE_DNS=$FW_SERVICE_AUTODETECT -@@ -878,7 +878,7 @@ - test -e /etc/resolv.conf || echo "Warning: /etc/resolv.conf not found" - # Get ports/IP bindings of NAMED/SQUID - test "$FW_SERVICE_DNS" = yes -o "$FW_SERVICE_DNS" = dmz -o "$FW_SERVICE_DNS" = ext -o "$START_NAMED" = yes && DNS_PORT=`$LSOF -i -n -P | \ -- $AWK -F: '/^named .* UDP / {print $2}'| $GREP -vw 53 | $SORT -un` -+ $AWK -F: '/^dnsmasq .* UDP / {print $2}'| $GREP -vw 53 | $SORT -un` - test "$FW_SERVICE_SQUID" = yes -o "$FW_SERVICE_SQUID" = dmz -o "$FW_SERVICE_SQUID" = ext -o "$START_SQUID" = yes && SQUID_PORT=`$LSOF -i -n -P | \ - $AWK -F: '/^squid .* UDP/ {print $2}'| $SORT -un` diff --git a/contrib/Suse/dnsmasq-SuSE.patch b/contrib/Suse/dnsmasq-SuSE.patch deleted file mode 100644 index 626245f..0000000 --- a/contrib/Suse/dnsmasq-SuSE.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- man/dnsmasq.8 2004-08-08 20:57:56.000000000 +0200 -+++ man/dnsmasq.8 2004-08-12 00:40:01.000000000 +0200 -@@ -69,7 +69,7 @@ - .TP - .B \-g, --group=<groupname> - Specify the group which dnsmasq will run --as. The defaults to "dip", if available, to facilitate access to -+as. The defaults to "dialout", if available, to facilitate access to - /etc/ppp/resolv.conf which is not normally world readable. - .TP - .B \-v, --version ---- src/config.h 2004-08-11 11:39:18.000000000 +0200 -+++ src/config.h 2004-08-12 00:40:01.000000000 +0200 -@@ -44,7 +44,7 @@ - #endif - #define DEFLEASE 3600 /* default lease time, 1 hour */ - #define CHUSER "nobody" --#define CHGRP "dip" -+#define CHGRP "dialout" - #define DHCP_SERVER_PORT 67 - #define DHCP_CLIENT_PORT 68 - - diff --git a/contrib/Suse/dnsmasq-suse.spec b/contrib/Suse/dnsmasq-suse.spec deleted file mode 100644 index ff8ba8f..0000000 --- a/contrib/Suse/dnsmasq-suse.spec +++ /dev/null @@ -1,111 +0,0 @@ -############################################################################### -# -# General -# -############################################################################### - -Name: dnsmasq -Version: 2.33 -Release: 1 -Copyright: GPL -Group: Productivity/Networking/DNS/Servers -Vendor: Simon Kelley -Packager: Simon Kelley -URL: http://www.thekelleys.org.uk/dnsmasq -Provides: dns_daemon -Conflicts: bind bind8 bind9 -PreReq: %fillup_prereq %insserv_prereq -Autoreqprov: on -Source0: %{name}-%{version}.tar.bz2 -BuildRoot: /var/tmp/%{name}-%{version} -Summary: A lightweight caching nameserver - -%description -Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server. It -is designed to provide DNS and, optionally, DHCP, to a small network. It can -serve the names of local machines which are not in the global DNS. The DHCP -server integrates with the DNS server and allows machines with DHCP-allocated -addresses to appear in the DNS with names configured either in each host or -in a central configuration file. Dnsmasq supports static and dynamic DHCP -leases and BOOTP for network booting of diskless machines. - - - -############################################################################### -# -# Build -# -############################################################################### - -%prep -%setup -q -patch -p0 <rpm/%{name}-SuSE.patch - -%build -%{?suse_update_config:%{suse_update_config -f}} -make all-i18n DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr - -############################################################################### -# -# Install -# -############################################################################### - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p ${RPM_BUILD_ROOT}/etc/init.d -make install-i18n DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr -install -o root -g root -m 755 rpm/rc.dnsmasq-suse $RPM_BUILD_ROOT/etc/init.d/dnsmasq -install -o root -g root -m 644 dnsmasq.conf.example $RPM_BUILD_ROOT/etc/dnsmasq.conf -strip $RPM_BUILD_ROOT/usr/sbin/dnsmasq -ln -sf ../../etc/init.d/dnsmasq $RPM_BUILD_ROOT/usr/sbin/rcdnsmasq - -############################################################################### -# -# Clean up -# -############################################################################### - -%clean -rm -rf $RPM_BUILD_ROOT - -############################################################################### -# -# Post-install scriptlet -# -############################################################################### - -%post -%{fillup_and_insserv dnsmasq} - -############################################################################### -# -# Post-uninstall scriptlet -# -# The %postun script executes after the package has been removed. It is the -# last chance for a package to clean up after itself. -# -############################################################################### - -%postun -%{insserv_cleanup} - -############################################################################### -# -# File list -# -############################################################################### - -%files -%defattr(-,root,root) -%doc CHANGELOG COPYING FAQ doc.html setup.html UPGRADING_to_2.0 rpm/README.susefirewall -%doc contrib -%config /etc/init.d/dnsmasq -%config /etc/dnsmasq.conf -/usr/sbin/rcdnsmasq -/usr/sbin/dnsmasq -/usr/share/locale/*/LC_MESSAGES/* -%doc %{_mandir}/man8/dnsmasq.8.gz -%doc %{_mandir}/*/man8/dnsmasq.8.gz - - diff --git a/contrib/Suse/rc.dnsmasq-suse b/contrib/Suse/rc.dnsmasq-suse deleted file mode 100644 index 71f4c72..0000000 --- a/contrib/Suse/rc.dnsmasq-suse +++ /dev/null @@ -1,79 +0,0 @@ -#! /bin/sh -# -# init.d/dnsmasq -# -### BEGIN INIT INFO -# Provides: dnsmasq -# Required-Start: $network $remote_fs $syslog -# Required-Stop: -# Default-Start: 3 5 -# Default-Stop: -# Description: Starts internet name service masq caching server (DNS) -### END INIT INFO - -NAMED_BIN=/usr/sbin/dnsmasq -NAMED_PID=/var/run/dnsmasq.pid -NAMED_CONF=/etc/dnsmasq.conf - -if [ ! -x $NAMED_BIN ] ; then - echo -n "dnsmasq not installed ! " - exit 5 -fi - -. /etc/rc.status -rc_reset - -case "$1" in - start) - echo -n "Starting name service masq caching server " - checkproc -p $NAMED_PID $NAMED_BIN - if [ $? -eq 0 ] ; then - echo -n "- Warning: dnsmasq already running ! " - else - [ -e $NAMED_PID ] && echo -n "- Warning: $NAMED_PID exists ! " - fi - startproc -p $NAMED_PID $NAMED_BIN -u nobody - rc_status -v - ;; - stop) - echo -n "Shutting name service masq caching server " - checkproc -p $NAMED_PID $NAMED_BIN - [ $? -ne 0 ] && echo -n "- Warning: dnsmasq not running ! " - killproc -p $NAMED_PID -TERM $NAMED_BIN - rc_status -v - ;; - try-restart) - $0 stop && $0 start - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - $0 reload - rc_status - ;; - reload) - echo -n "Reloading name service masq caching server " - checkproc -p $NAMED_PID $NAMED_BIN - [ $? -ne 0 ] && echo -n "- Warning: dnsmasq not running ! " - killproc -p $NAMED_PID -HUP $NAMED_BIN - rc_status -v - ;; - status) - echo -n "Checking for name service masq caching server " - checkproc -p $NAMED_PID $NAMED_BIN - rc_status -v - ;; - probe) - test $NAMED_CONF -nt $NAMED_PID && echo reload - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" - exit 1 - ;; -esac -rc_exit - diff --git a/contrib/lease-tools/dhcp_release.c b/contrib/lease-tools/dhcp_release.c index c1c835b..84f5610 100644 --- a/contrib/lease-tools/dhcp_release.c +++ b/contrib/lease-tools/dhcp_release.c @@ -280,6 +280,7 @@ int main(int argc, char **argv) /* This voodoo fakes up a packet coming from the correct interface, which really matters for a DHCP server */ + memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)-1); ifr.ifr_name[sizeof(ifr.ifr_name)-1] = '\0'; if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) == -1) diff --git a/contrib/lease-tools/dhcp_release6.c b/contrib/lease-tools/dhcp_release6.c index d680222..9b3438f 100644 --- a/contrib/lease-tools/dhcp_release6.c +++ b/contrib/lease-tools/dhcp_release6.c @@ -318,6 +318,12 @@ void usage(const char* arg, FILE* stream) fprintf (stream, "Usage: %s %s\n", arg, usage_string); } +static void fail_fatal(const char *errstr, int exitcode) +{ + perror(errstr); + exit(exitcode); +} + int send_release_packet(const char* iface, struct dhcp6_packet* packet) { struct sockaddr_in6 server_addr, client_addr; @@ -343,18 +349,19 @@ int send_release_packet(const char* iface, struct dhcp6_packet* packet) client_addr.sin6_port = htons(DHCP6_CLIENT_PORT); client_addr.sin6_flowinfo = 0; client_addr.sin6_scope_id =0; - inet_pton(AF_INET6, "::", &client_addr.sin6_addr); - bind(sock, (struct sockaddr*)&client_addr, sizeof(struct sockaddr_in6)); - inet_pton(AF_INET6, DHCP6_MULTICAST_ADDRESS, &server_addr.sin6_addr); + if (inet_pton(AF_INET6, "::", &client_addr.sin6_addr) <= 0) + fail_fatal("inet_pton", 5); + if (bind(sock, (struct sockaddr*)&client_addr, sizeof(struct sockaddr_in6)) != 0) + perror("bind"); /* continue on bind error */ + if (inet_pton(AF_INET6, DHCP6_MULTICAST_ADDRESS, &server_addr.sin6_addr) <= 0) + fail_fatal("inet_pton", 5); server_addr.sin6_port = htons(DHCP6_SERVER_PORT); - int16_t recv_size = 0; + ssize_t recv_size = 0; + int result; for (i = 0; i < 5; i++) { if (sendto(sock, packet->buf, packet->len, 0, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) - { - perror("sendto failed"); - exit(4); - } + fail_fatal("sendto failed", 4); recv_size = recvfrom(sock, response, sizeof(response), MSG_DONTWAIT, NULL, 0); if (recv_size == -1) @@ -367,16 +374,18 @@ int send_release_packet(const char* iface, struct dhcp6_packet* packet) else { perror("recvfrom"); + result = UNSPEC_FAIL; } } - - int16_t result = parse_packet(response, recv_size); - if (result == NOT_REPLY_CODE) + else { - sleep(1); - continue; + result = parse_packet(response, recv_size); + if (result == NOT_REPLY_CODE) + { + sleep(1); + continue; + } } - close(sock); return result; } |