aboutsummaryrefslogtreecommitdiffstats
path: root/dns/dualserver
diff options
context:
space:
mode:
authorpawel <pawel@FreeBSD.org>2012-12-21 06:56:10 +0800
committerpawel <pawel@FreeBSD.org>2012-12-21 06:56:10 +0800
commitef2d32d3ee306a3d34e3c887a21b5add02bc5ffd (patch)
treefe7552343ce7bd4d57fdbef5ba754c3dee2d169e /dns/dualserver
parentc272a0b533d6ef5d93d1f59ff51443c731dbb2de (diff)
downloadfreebsd-ports-gnome-ef2d32d3ee306a3d34e3c887a21b5add02bc5ffd.tar.gz
freebsd-ports-gnome-ef2d32d3ee306a3d34e3c887a21b5add02bc5ffd.tar.zst
freebsd-ports-gnome-ef2d32d3ee306a3d34e3c887a21b5add02bc5ffd.zip
- Update to version 6.94 [1]
- Use CXXFLAGS, PTHREAD_LIBS during build - Fix typo in pkg-descr - Give maintainership to submitter PR: ports/174005 [1] Submitted by: Rodrigo (ros) OSORIO <rodrigo@bebik.net>
Diffstat (limited to 'dns/dualserver')
-rw-r--r--dns/dualserver/Makefile24
-rw-r--r--dns/dualserver/distinfo4
-rw-r--r--dns/dualserver/files/patch-dualserverd.cpp179
-rw-r--r--dns/dualserver/files/patch-dualserverd.h41
-rw-r--r--dns/dualserver/pkg-descr2
5 files changed, 234 insertions, 16 deletions
diff --git a/dns/dualserver/Makefile b/dns/dualserver/Makefile
index f329d2aa8337..9c5e70911e98 100644
--- a/dns/dualserver/Makefile
+++ b/dns/dualserver/Makefile
@@ -1,35 +1,33 @@
-# Ports collection Makefile for: dualserver
-# Date created: 10 Dec 2005
-# Whom: Gabor Kovesdan
+# Created by: Gabor Kovesdan
# $FreeBSD$
PORTNAME= dualserver
-PORTVERSION= 3.0
+PORTVERSION= 6.94
CATEGORIES= dns net
-MASTER_SITES= SF/dhcp-dns-server/OldFiles
+MASTER_SITES= SF/dhcp-dns-server/Dual%20DHCP%20DNS%20Server/
DISTNAME= ${PORTNAME}V${PORTVERSION}
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= rodrigo@bebik.net
COMMENT= Combined DHCP/DNS server for small LANs
USE_DOS2UNIX= yes
USE_RC_SUBR= dualserver
PLIST_FILES= sbin/dualserver etc/dualserver.conf.sample
-.include <bsd.port.pre.mk>
-
post-extract:
@${MV} ${WRKDIR}/${PORTNAME} ${WRKSRC}
-pre-patch:
- ${REINPLACE_CMD} 's|/etc/dualserver.ini|${PREFIX}/etc/dualserver.conf|' ${WRKSRC}/dualserver.cpp
- ${REINPLACE_CMD} 's|/etc/dualserver.state|/var/run/dualserver.state|' ${WRKSRC}/dualserver.cpp
+#pre-patch:
+#post-patch:
+# ${REINPLACE_CMD} 's|/etc/dualserver.ini|${PREFIX}/etc/dualserver.conf|' ${WRKSRC}/dualserverd.cpp
+# ${REINPLACE_CMD} 's|/etc/dualserver.state|/var/run/dualserver.state|' ${WRKSRC}/dualserverd.cpp
do-build:
- ${CXX} -o ${WRKSRC}/dualserver ${WRKSRC}/dualserver.cpp
+ ${CXX} ${CXXFLAGS} -o ${WRKSRC}/dualserver \
+ ${WRKSRC}/dualserverd.cpp ${PTHREAD_LIBS}
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/dualserver ${PREFIX}/sbin
${INSTALL_DATA} ${WRKSRC}/dualserver.ini ${PREFIX}/etc/dualserver.conf.sample
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/dns/dualserver/distinfo b/dns/dualserver/distinfo
index 94313f4e19ad..261bb379d301 100644
--- a/dns/dualserver/distinfo
+++ b/dns/dualserver/distinfo
@@ -1,2 +1,2 @@
-SHA256 (dualserverV3.0.tar.gz) = ff0b9b42df598ed06b6cd5378daba1fd8265513f6268414ff7bbc96cd7617d00
-SIZE (dualserverV3.0.tar.gz) = 61992
+SHA256 (dualserverV6.94.tar.gz) = 3007e6508eb95d06f3c8764951ff6d3276733409e2119f6299c9485060b9445c
+SIZE (dualserverV6.94.tar.gz) = 796893
diff --git a/dns/dualserver/files/patch-dualserverd.cpp b/dns/dualserver/files/patch-dualserverd.cpp
new file mode 100644
index 000000000000..4c553185d826
--- /dev/null
+++ b/dns/dualserver/files/patch-dualserverd.cpp
@@ -0,0 +1,179 @@
+--- dualserverd.cpp 2012-11-09 17:02:36.000000000 +0100
++++ dualserverd.cpp 2012-11-12 13:17:25.000000000 +0100
+@@ -22,10 +22,16 @@
+ #include <math.h>
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
++#ifdef __FreeBSD__
++#include <sys/socket.h>
++#endif
+ #include <limits.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <net/if.h>
++#ifdef __FreeBSD__
++#include <net/if_dl.h>
++#endif
+ #include <arpa/inet.h>
+ #include <netdb.h>
+ #include <unistd.h>
+@@ -39,6 +45,9 @@
+ #include <syslog.h>
+ #include <pthread.h>
+ #include <map>
++#ifdef __FreeBSD__
++#include <ifaddrs.h>
++#endif
+ using namespace std;
+ #include "dualserverd.h"
+
+@@ -84,7 +93,11 @@
+ const char send200[] = "HTTP/1.1 200 OK\r\nDate: %s\r\nLast-Modified: %s\r\nContent-Type: text/html\r\nConnection: Close\r\nContent-Length: \r\n\r\n";
+ //const char send200[] = "HTTP/1.1 200 OK\r\nDate: %s\r\nLast-Modified: %s\r\nContent-Type: text/html\r\nConnection: Close\r\nTransfer-Encoding: chunked\r\n";
+ const char line200[] = "<td>%s</td>";
++#ifdef __FreeBSD__
++const char sVersion[] = "Dual DHCP DNS Server Version 6.94 for FreeBSD";
++#else
+ const char sVersion[] = "Dual DHCP DNS Server Version 6.94 Linux Build 7011";
++#endif
+ const data4 opData[] =
+ {
+ { "SubnetMask", DHCP_OPTION_NETMASK, 3 },
+@@ -261,7 +274,7 @@
+ strcpy(leaFile, "/tmp/dualserver.state");
+
+ if (!iniFile[0])
+- strcpy(iniFile, "/etc/dualserver.ini");
++ strcpy(iniFile, "/usr/local/etc/dualserver.conf");
+
+ if (verbatim)
+ {
+@@ -4002,7 +4015,13 @@
+ else if (req->dhcpp.header.bp_broadcast || !req->remote.sin_addr.s_addr || req->reqIP)
+ {
+ req->remote.sin_port = htons(IPPORT_DHCPC);
++#ifdef __FreeBSD__
++ req->remote.sin_addr.s_addr = network.dhcpConn[req->sockInd].addr.sin_addr.s_addr |
++ (~network.dhcpConn[req->sockInd].mask);
++ //printf("broadcast dhcp response to %s\n",inet_ntoa(req->remote.sin_addr));
++#else
+ req->remote.sin_addr.s_addr = INADDR_BROADCAST;
++#endif
+ req->dhcpp.header.bp_broadcast = 1;
+ }
+ else
+@@ -8983,6 +9002,10 @@
+ newNetwork.dhcpConn[i].broadCastSize = sizeof(newNetwork.dhcpConn[i].broadCastVal);
+
+ setsockopt(newNetwork.dhcpConn[i].sock, SOL_SOCKET, SO_BROADCAST, (char*)&newNetwork.dhcpConn[i].broadCastVal, newNetwork.dhcpConn[i].broadCastSize);
++#ifdef __FreeBSD__
++ // See man ip
++ setsockopt(newNetwork.dhcpConn[i].sock,IPPROTO_IP, IP_ONESBCAST,(char*)&newNetwork.dhcpConn[i].broadCastVal, newNetwork.dhcpConn[i].broadCastSize);
++#endif
+ int nRet = bind(newNetwork.dhcpConn[i].sock, (sockaddr*)&newNetwork.dhcpConn[i].addr, sizeof(struct sockaddr_in));
+
+ if (nRet == SOCKET_ERROR)
+@@ -9034,7 +9057,11 @@
+ setsockopt(newNetwork.dhcpListener.sock, SOL_SOCKET, SO_REUSEADDR, (char*)&newNetwork.dhcpListener.reUseVal, newNetwork.dhcpListener.reUseSize);
+ newNetwork.dhcpListener.pktinfoVal = true;
+ newNetwork.dhcpListener.pktinfoSize = sizeof(newNetwork.dhcpListener.pktinfoVal);
++#ifdef __FreeBSD__
++ setsockopt(newNetwork.dhcpListener.sock, IPPROTO_IP, IP_RECVIF, &newNetwork.dhcpListener.pktinfoVal, newNetwork.dhcpListener.pktinfoSize);
++#else
+ setsockopt(newNetwork.dhcpListener.sock, IPPROTO_IP, IP_PKTINFO, &newNetwork.dhcpListener.pktinfoVal, newNetwork.dhcpListener.pktinfoSize);
++#endif
+
+ newNetwork.dhcpListener.addr.sin_family = AF_INET;
+ newNetwork.dhcpListener.addr.sin_addr.s_addr = INADDR_ANY;
+@@ -9496,8 +9523,11 @@
+
+ if (addr && !(flags & IFF_LOOPBACK))
+ addServer(network->allServers, addr);
+-
++#ifdef __FreeBSD__
++ if (addr && mask && !(flags & IFF_POINTOPOINT) && !(flags & IFF_LOOPBACK))
++#else
+ if (addr && mask && !(flags & IFF_POINTOPOINT) && !(flags & IFF_LOOPBACK) && !(flags & IFF_DYNAMIC))
++#endif
+ {
+ if ((flags & IFF_RUNNING) && (flags & IFF_UP))
+ {
+@@ -9656,6 +9686,12 @@
+
+ MYWORD gdmess(data9 *req, MYBYTE sockInd)
+ {
++#ifdef __FreeBSD__
++ struct cmsghdr *cmsg;
++ struct sockaddr_dl * isdl;
++ struct sockaddr_in *isin;
++ struct ifaddrs *ifap, *ifa;
++#endif
+ //sprintf(logBuff, "Socket=%u", sockInd);
+ //logDHCPMess(logBuff, 1);
+ memset(req, 0, sizeof(data9));
+@@ -9671,7 +9707,11 @@
+ req->msg.msg_name = &req->remote;
+ req->msg.msg_namelen = sizeof(sockaddr_in);
+ req->msg.msg_control = &req->msgcontrol;
++#ifdef __FreeBSD__
++ req->msg.msg_controllen = sizeof(req->msgcontrol);
++#else
+ req->msg.msg_controllen = sizeof(msg_control);
++#endif
+ req->msg.msg_flags = msgflags;
+
+ int flags = 0;
+@@ -9680,6 +9720,45 @@
+ if (errno || req->bytes <= 0)
+ return 0;
+
++#ifdef __FreeBSD__
++ isdl = NULL;
++ isin = NULL;
++ MYDWORD addr=0;
++ bool found_addr = false;
++
++ if (req->msg.msg_controllen>0){
++ for (cmsg=CMSG_FIRSTHDR(&req->msg);cmsg;cmsg=CMSG_NXTHDR(&req->msg,cmsg)){
++ if (cmsg->cmsg_type==IP_RECVIF) {
++ isdl=(struct sockaddr_dl *)CMSG_DATA(cmsg);
++ }
++ }
++ }
++
++ if (!isdl || getifaddrs(&ifap))
++ return 0;
++
++ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
++ if(ifa->ifa_addr->sa_family == AF_INET &&
++ strcmp(ifa->ifa_name,isdl->sdl_data) == 0){
++ isin = (struct sockaddr_in *)ifa->ifa_addr;
++ addr = isin->sin_addr.s_addr;
++ for (int i = 0; (i < MAX_SERVERS || !network.dhcpConn[i].server);i++){
++ if (addr == network.dhcpConn[i].server){
++ found_addr = true;
++ req->sockInd = i;
++ break;
++ }
++ }
++ }
++ }
++ freeifaddrs(ifap);
++
++ if(!found_addr) return 0;
++
++ //printf("IF = %s\n", isdl->sdl_data);
++ //printf("RADDR = %s\n", inet_ntoa(isin->sin_addr));
++
++#else
+ //printf("%u\n", req->msg.msg_controllen);
+ //msgcontrol = (msg_control*)msg.msg_control;
+
+@@ -9711,6 +9790,7 @@
+ break;
+ }
+ }
++#endif
+ }
+ else
+ {
diff --git a/dns/dualserver/files/patch-dualserverd.h b/dns/dualserver/files/patch-dualserverd.h
new file mode 100644
index 000000000000..319c64ef9e15
--- /dev/null
+++ b/dns/dualserver/files/patch-dualserverd.h
@@ -0,0 +1,41 @@
+--- dualserverd.h 2012-11-09 15:45:52.000000000 +0100
++++ dualserverd.h 2012-11-09 15:55:00.000000000 +0100
+@@ -52,9 +52,11 @@
+ #define INADDR_NONE ULONG_MAX
+ #endif
+
++#ifndef __FreeBSD__
+ #ifndef IFF_DYNAMIC
+ #define IFF_DYNAMIC 0x8000
+ #endif
++#endif
+
+ #define MYWORD unsigned short
+ #define MYBYTE unsigned char
+@@ -594,10 +596,15 @@
+
+ struct msg_control
+ {
+- ulong cmsg_len;
++ u_long cmsg_len;
+ int cmsg_level;
+ int cmsg_type;
+- in_pktinfo pktinfo;
++ #ifdef __FreeBSD__
++ // Arbitrary size, when the size is required we use sizeof
++ unsigned char pktinfo[100];
++ #else
++ in_pktinfo pktinfo;
++ #endif
+ };
+
+ #if defined(__hppa__) || \
+@@ -713,7 +720,7 @@
+ union
+ {
+ int broadCastVal;
+- bool pktinfoVal;
++ int pktinfoVal;
+ };
+ union
+ {
diff --git a/dns/dualserver/pkg-descr b/dns/dualserver/pkg-descr
index c21be9ed5f9f..35980c5a7fe8 100644
--- a/dns/dualserver/pkg-descr
+++ b/dns/dualserver/pkg-descr
@@ -1,5 +1,5 @@
Combined DHCP/DNS Server for Small LAN. Dynamic DHCP allocates/renew host
-addresses while Caching DNS Server first try resolving from DHCP alotted
+addresses while Caching DNS Server first try resolving from DHCP allotted
names then from Cache then only forwarding to External DNS Servers. Auto
Config and auto Dynamic DNS update.