pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

freevrrpd: Make the package build and pkglint(8). I have not tried running it, yet.



Module Name:	pkgsrc-wip
Committed By:	Hauke Fath <hauke%NetBSD.org@localhost>
Pushed By:	hauke
Date:		Wed Mar 15 12:00:14 2017 +0100
Changeset:	343d698887d49eb30e2d52a939af007bc2480faa

Modified Files:
	freevrrpd/DESCR
	freevrrpd/Makefile
	freevrrpd/PLIST
	freevrrpd/distinfo
	freevrrpd/files/freevrrpd.sh
Added Files:
	freevrrpd/patches/patch-Makefile
	freevrrpd/patches/patch-vrrp_ah.h
	freevrrpd/patches/patch-vrrp_conf.c
	freevrrpd/patches/patch-vrrp_interface.c
	freevrrpd/patches/patch-vrrp_interface.h
	freevrrpd/patches/patch-vrrp_main.c
	freevrrpd/patches/patch-vrrp_network.c
	freevrrpd/patches/patch-vrrp_signal.c
Removed Files:
	freevrrpd/MESSAGE

Log Message:
freevrrpd: Make the package build and pkglint(8). I have not tried
running it, yet.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=343d698887d49eb30e2d52a939af007bc2480faa

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 freevrrpd/DESCR                          | 32 ++++++++--------
 freevrrpd/MESSAGE                        | 12 ------
 freevrrpd/Makefile                       | 31 +++++++++-------
 freevrrpd/PLIST                          |  7 ++--
 freevrrpd/distinfo                       | 10 ++++-
 freevrrpd/files/freevrrpd.sh             |  9 +++--
 freevrrpd/patches/patch-Makefile         | 29 +++++++++++++++
 freevrrpd/patches/patch-vrrp_ah.h        | 17 +++++++++
 freevrrpd/patches/patch-vrrp_conf.c      | 21 +++++++++++
 freevrrpd/patches/patch-vrrp_interface.c | 63 ++++++++++++++++++++++++++++++++
 freevrrpd/patches/patch-vrrp_interface.h | 14 +++++++
 freevrrpd/patches/patch-vrrp_main.c      | 31 ++++++++++++++++
 freevrrpd/patches/patch-vrrp_network.c   | 18 +++++++++
 freevrrpd/patches/patch-vrrp_signal.c    | 16 ++++++++
 14 files changed, 260 insertions(+), 50 deletions(-)

diffs:
diff --git a/freevrrpd/DESCR b/freevrrpd/DESCR
index 58394877b5..9af3cf1bf5 100644
--- a/freevrrpd/DESCR
+++ b/freevrrpd/DESCR
@@ -3,19 +3,19 @@ daemon under FreeBSD, NetBSD and OpenBSD.
 This daemon has been rewritten from scratch and is not based on
 existing projects.  In this second public release, you can find:
 
-       * A daemon RFC 2338 Compliant adapted on FreeBSD systems
-       * Implementation of Virtual Adresses
-       * Support for multiples VRID
-       * Master announce state by sending multicast packets via BPF
-       * Changing routes and IP in 3 seconds
-       * Doing gratuitous ARP requests to clean the cache of all hosts
-       * Election between different slave servers
-       * Same host can be Slave and Master at the same time
-       * Automatic Downgrade to Slave if a Master is up again
-       * Anti-Address Conflict system
-       * Multi-threaded vrrp daemon
-       * Plain text password authentication
-       * Using now only one BPF device for all VRID
-       * Support netmask for Virtual IP addresses
-       * Support for monitored circuit and dependances between VRIDs
-       * Support for VLAN pseudo devices under *BSD
+* A daemon RFC 2338 Compliant adapted on FreeBSD systems
+* Implementation of Virtual Adresses
+* Support for multiples VRID
+* Master announce state by sending multicast packets via BPF
+* Changing routes and IP in 3 seconds
+* Doing gratuitous ARP requests to clean the cache of all hosts
+* Election between different slave servers
+* Same host can be Slave and Master at the same time
+* Automatic Downgrade to Slave if a Master is up again
+* Anti-Address Conflict system
+* Multi-threaded vrrp daemon
+* Plain text password authentication
+* Using now only one BPF device for all VRID
+* Support netmask for Virtual IP addresses
+* Support for monitored circuit and dependances between VRIDs
+* Support for VLAN pseudo devices under *BSD
diff --git a/freevrrpd/MESSAGE b/freevrrpd/MESSAGE
deleted file mode 100644
index 588b4638f2..0000000000
--- a/freevrrpd/MESSAGE
+++ /dev/null
@@ -1,12 +0,0 @@
-===========================================================================
-$Id: MESSAGE,v 1.2 2005/11/23 04:43:56 rillig Exp $
-
-	${PREFIX}/sbin/freevrrpd must be run as "root".
-
-	Please copy ${PREFIX}/etc/freevrrpd.conf.sample to
-		${PREFIX}/etc/freevrrpd.conf and modify it
-		before starting freevrrpd
-
-	Add freevrrpd=YES to /etc/rc.conf for automatic startup
-
-===========================================================================
diff --git a/freevrrpd/Makefile b/freevrrpd/Makefile
index 688f9469e8..3a8673704d 100644
--- a/freevrrpd/Makefile
+++ b/freevrrpd/Makefile
@@ -6,21 +6,26 @@ CATEGORIES=	net
 MASTER_SITES=	${MASTER_SITE_GITHUB:=gvnn3/}
 GITHUB_TAG=	v${PKGVERSION_NOREV}
 
-#https://github.com/gvnn3/FreeVRRPd/archive/v0.9.3.tar.gz
-#https://github.com/gvnn3/FreeVRRPd/archive/v1.1.zip
-
-MAINTAINER=	spe%phear.org@localhost
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 COMMENT=	BSD licensed implementation of the VRRP protocol (V2 and V3)
+LICENSE=	2-clause-bsd
+
+# Instead of -Wno-error=pointer-sign -Wno-error=char-subscripts
+#            -Wno-error=unused-but-set-variable etc.
+BUILDLINK_TRANSFORM+=	rm:-Werror
+
+EGDIR=		share/examples/freevrrpd
+CONF_FILES=	${PREFIX}/${EGDIR}/freevrrpd.conf ${PKG_SYSCONFDIR}/freevrrpd.conf
+
+RCD_SCRIPTS=			freevrrpd
+RCD_SCRIPT_SRC.freevrrpd=	${FILESDIR}/freevrrpd.sh
 
-#MAKE_ENV+=	PTHREAD_CFLAGS=${PTHREAD_CFLAGS:Q}
-#MAKE_ENV+=	PTHREAD_LIBS=${PTHREAD_LIBS:Q}
+INSTALLATION_DIRS=		sbin ${PKGMANDIR}/man8 ${EGDIR}
 
-#INSTALLATION_DIRS=	bin ${PKGMANDIR}/man8 share/examples/rc.d
-#
-#do-install:
-#	${INSTALL_PROGRAM} ${WRKSRC}/freevrrpd ${DESTDIR}${PREFIX}/sbin
-#	${INSTALL_DATA} ${WRKSRC}/freevrrpd.conf.sample ${DESTDIR}${PREFIX}/share/examples
-#	${INSTALL_SCRIPT} ${FILESDIR}/freevrrpd.sh ${DESTDIR}${PREFIX}/share/examples/rc.d
-#	${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/freevrrpd ${DESTDIR}${PREFIX}/sbin/freevrrpd
+	${INSTALL_DATA} ${WRKSRC}/freevrrpd.conf.sample \
+		${DESTDIR}${PREFIX}/${EGDIR}/freevrrpd.conf
+	${INSTALL_MAN} ${WRKSRC}/freevrrpd.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
 
 .include "../../mk/bsd.pkg.mk"
diff --git a/freevrrpd/PLIST b/freevrrpd/PLIST
index 75dc81af1e..0eafc542bc 100644
--- a/freevrrpd/PLIST
+++ b/freevrrpd/PLIST
@@ -1,5 +1,4 @@
-@comment $Id: PLIST,v 1.2 2005/11/23 04:43:57 rillig Exp $
-@unexec if cmp -s %D/etc/freevrrpd.conf %D/etc/freevrrpd.conf.sample; then rm -f %D/etc/freevrrpd.conf; fi
-etc/freevrrpd.conf.sample
-etc/rc.d/freevrrpd.sh
+@comment $NetBSD$
+man/man8/freevrrpd.8
 sbin/freevrrpd
+share/examples/freevrrpd/freevrrpd.conf
diff --git a/freevrrpd/distinfo b/freevrrpd/distinfo
index 1f5255439e..6cfa71a06b 100644
--- a/freevrrpd/distinfo
+++ b/freevrrpd/distinfo
@@ -1,6 +1,14 @@
-$NetBSD: distinfo,v 1.3 2005/09/28 06:41:14 rillig Exp $
+$NetBSD$
 
 SHA1 (freevrrpd-1.1.tar.gz) = 182d665bb5513b2b78d53dbf782f28f76a54e9db
 RMD160 (freevrrpd-1.1.tar.gz) = 899bd069e08aa7958d5c1e8f045037a27ea9bbd7
 SHA512 (freevrrpd-1.1.tar.gz) = 342203c766678aca6b211c7f7ca4fa1189efec4fa7bd26fdf1999b8f824274ec0302cb2b2570a24ea1a3ed561f152fb1c886ecb16fa794b5dcd29799906e4f05
 Size (freevrrpd-1.1.tar.gz) = 41852 bytes
+SHA1 (patch-Makefile) = 77b814b71ef6a6e10a8655e5dc6401caf2ab1b0b
+SHA1 (patch-vrrp_ah.h) = 976f5e210d35afbfe80714f1988a4e4a8e11124e
+SHA1 (patch-vrrp_conf.c) = 191f41ad809e8ec34429a0721780e4458279a1c2
+SHA1 (patch-vrrp_interface.c) = a0eabdc0a30ab5b6249740a0efddc7410dc9cd84
+SHA1 (patch-vrrp_interface.h) = 5d2078e224023c0f70ec097c9c61680ddd4b08e2
+SHA1 (patch-vrrp_main.c) = 01e75327db1b173dc4e020cf65b8861260d4fe77
+SHA1 (patch-vrrp_network.c) = c16f7c0bd85e96ff261e401124abdcd6f0445a94
+SHA1 (patch-vrrp_signal.c) = 7acc898b2971928849e8d224db360bb9d3ae6ccf
diff --git a/freevrrpd/files/freevrrpd.sh b/freevrrpd/files/freevrrpd.sh
index a93277e425..05ba819a20 100755
--- a/freevrrpd/files/freevrrpd.sh
+++ b/freevrrpd/files/freevrrpd.sh
@@ -5,7 +5,8 @@
 # PROVIDE: freevrrpd
 # KEYWORD: shutdown
 #
-# You will need to set some variables in /etc/rc.conf to start FreeVRRPd:
+# You will need to set the following variable in /etc/rc.conf to 
+# start FreeVRRPd:
 #
 # freevrrpd=YES 
 
@@ -15,10 +16,10 @@ fi
 
 name="freevrrpd"
 rcvar=${name}
-required_files="/usr/pkg/etc/freevrrpd.conf"
-command="/usr/pkg/sbin/${name}"
+required_files="%SYSCONFDIR%/freevrrpd.conf"
+command="%PREFIX%/sbin/${name}"
 command_args="-f ${required_files}"
-pidfile="/var/run/${name}.pid"
+pidfile="%VARBASE%/run/${name}.pid"
 extra_commands="reload"
 
 if [ -f /etc/rc.subr ]; then
diff --git a/freevrrpd/patches/patch-Makefile b/freevrrpd/patches/patch-Makefile
new file mode 100644
index 0000000000..be00eedbae
--- /dev/null
+++ b/freevrrpd/patches/patch-Makefile
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Clean up and make usable for NetBSD - maybe we should just use a separate Makefile?
+
+--- Makefile.orig	2015-02-04 00:39:49.000000000 +0000
++++ Makefile
+@@ -2,13 +2,14 @@
+ 
+ PROG=		freevrrpd
+-SRCS=		vrrp_misc.c vrrp_multicast.c vrrp_main.c vrrp_thread.c vrrp_state.c vrrp_network.c vrrp_interface.c vrrp_conf.c vrrp_signal.c vrrp_list.c vrrp_vlanlist.c vrrp_moncircuit.c md5.c vrrp_ah.c vrrp_netgraph.c
++SRCS=		vrrp_misc.c vrrp_multicast.c vrrp_main.c vrrp_thread.c vrrp_state.c vrrp_network.c vrrp_interface.c vrrp_conf.c vrrp_signal.c vrrp_list.c vrrp_vlanlist.c vrrp_moncircuit.c md5.c vrrp_ah.c 
++
++.if defined(__FreeBSD__)
++SRCS+=		vrrp_netgraph.c
++.endif
++
+ # Add -DENABLE_VRRP_AH to enable simple implementation of Authentication Header
+-CFLAGS=		-O3 -Wall -ansi -pedantic -fomit-frame-pointer -D_REENTRANT -Wall -ggdb
+-# use for AH only - currently in progress
+-#CFLAGS+=	-D_REENTRANT -Wall -ggdb -DENABLE_VRRP_AH -DKAME_BASED
+-#CFLAGS+=	-D_REENTRANT -Wall -ggdb -DENABLE_VRRP_AH
+-#LDADD=		-fomit-frame-pointer -ansi -lm -pthread -lipsec
+-# end of AH
+-LDADD=		-static -lm -pthread -lutil -lnetgraph
++CFLAGS=		-O2 -Wall -pedantic -D_REENTRANT -ggdb -DENABLE_VRRP_AH
++
++LDADD=		-lm -pthread -lutil
+ WARNS=		0
+ BINDIR=		/usr/local/sbin
diff --git a/freevrrpd/patches/patch-vrrp_ah.h b/freevrrpd/patches/patch-vrrp_ah.h
new file mode 100644
index 0000000000..d2a4233498
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_ah.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Conditionally #include FreeBSD-only headers
+
+--- vrrp_ah.h.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_ah.h
+@@ -18,8 +18,10 @@
+ #ifdef KAME_BASED
+ #include <netinet6/ipsec.h>
+ #include <net/pfkeyv2.h>
++#ifdef __FreeBSD__
+ #include <netkey/keydb.h>
+ #include <netkey/key_debug.h>
++#endif /* __FreeBSD__ */
+ #endif /* end of KAME BASED */
+ /* #include "md5.h" */
+ 
diff --git a/freevrrpd/patches/patch-vrrp_conf.c b/freevrrpd/patches/patch-vrrp_conf.c
new file mode 100644
index 0000000000..d7d118a808
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_conf.c
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Fix bogus condition - fpos_t is an opaque struct, not an integer. And
+if the intent was to make sure we are at the beginning of the input
+stream, ftell(3) is the better choice.
+
+--- vrrp_conf.c.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_conf.c
+@@ -173,11 +173,9 @@ vrrp_conf_lecture_fichier(struct vrrp_vr
+ 	char          **temp3;
+ 	char            option[1024], arg[1024];
+ 	int             i, j;
+-	fpos_t          pos;
+ 	int		optok;
+ 
+-	fgetpos(stream, &pos);
+-	if (!pos) {
++	if (0 == ftell(stream)) {
+ 		while (ligne[0] == '#' || ligne[0] == 0 || ligne[0] == '\n')
+ 			fgets(ligne, 1024, stream);
+ 		if (strncmp(ligne, "[VRID]", 6)) {
diff --git a/freevrrpd/patches/patch-vrrp_interface.c b/freevrrpd/patches/patch-vrrp_interface.c
new file mode 100644
index 0000000000..5c5cb0b2da
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_interface.c
@@ -0,0 +1,63 @@
+$NetBSD$
+
+Use (hopefully) equivalent ioctls for NetBSD, and exclude references
+to struct elements it does not have.
+
+--- vrrp_interface.c.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_interface.c
+@@ -63,7 +63,11 @@ vrrp_interface_mac_set(char *if_name, st
+ 	ifr.ifr_addr.sa_len = ETHER_ADDR_LEN;
+ 	ifr.ifr_addr.sa_family = AF_LINK;
+ 	bcopy(ethaddr, ifr.ifr_addr.sa_data, ETHER_ADDR_LEN);
++#if defined(__FreeBSD__) || defined(__OpenBSD__)	
+ 	if (ioctl(sd, SIOCSIFLLADDR, (caddr_t) & ifr) == -1) {
++#else /* __NetBSD__ */		
++	if (ioctl(sd, SIOCGLIFADDR, (caddr_t) & ifr) == -1) {
++#endif		
+ 		syslog(LOG_ERR, "cannot set mac address for interface %s (ioctl): %s", if_name, strerror(errno));
+ 		return -1;
+ 	}
+@@ -214,16 +218,20 @@ vrrp_interface_set_flags(char *if_name, 
+ 		close(sd);
+ 		return -1;
+ 	}
++#if defined(__FreeBSD__)	
+ 	flags = (ifr.ifr_flags & 0xffff) | (ifr.ifr_flagshigh << 16);
+-
++#else /* NetBSD */
++	flags = (ifr.ifr_flags & 0xffff);
++#endif	
+         if (value < 0) {
+                 value = -value;
+                 flags &= ~value;
+         } else
+                 flags |= value;
+         ifr.ifr_flags = flags & 0xffff;
++#if defined(__FreeBSD__)
+         ifr.ifr_flagshigh = flags >> 16;
+-
++#endif
+ 	if (ioctl(sd, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) {
+ 		close(sd);
+ 		return -1;
+@@ -236,12 +244,20 @@ vrrp_interface_set_flags(char *if_name, 
+ 
+ char
+ vrrp_interface_promiscuous(char *if_name) {
++#if defined(__FreeBSD__)
+ 	return vrrp_interface_set_flags(if_name, IFF_PPROMISC);
++#else /* __NetBSD__ */
++	return vrrp_interface_set_flags(if_name, IFF_PROMISC);
++#endif	
+ }
+ 
+ char
+ vrrp_interface_nopromiscuous(char *if_name) {
++#if defined(__FreeBSD__)
+ 	return vrrp_interface_set_flags(if_name, -IFF_PPROMISC);
++#else /* __NetBSD__ */
++	return vrrp_interface_set_flags(if_name, -IFF_PROMISC);
++#endif	
+ }
+ 
+ char 
diff --git a/freevrrpd/patches/patch-vrrp_interface.h b/freevrrpd/patches/patch-vrrp_interface.h
new file mode 100644
index 0000000000..b87afe3db5
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_interface.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Remove duplicate #include
+
+--- vrrp_interface.h.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_interface.h
+@@ -53,7 +53,6 @@
+ #include <unistd.h>
+ #include <stdarg.h>
+ #include <net/if.h>
+-#include <net/ethernet.h>
+ #include <net/if_bridgevar.h>
+ #include "vrrp_define.h"
+ #include "vrrp_proto.h"
diff --git a/freevrrpd/patches/patch-vrrp_main.c b/freevrrpd/patches/patch-vrrp_main.c
new file mode 100644
index 0000000000..0f7ec5de76
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_main.c
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Conditionally compile netgraph calls
+
+--- vrrp_main.c.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_main.c
+@@ -104,20 +104,22 @@ vrrp_main_post_init(struct vrrp_vr * vr,
+ 		syslog(LOG_CRIT, "exiting...");
+ 		exit(-1);
+ 	}
+-
++#if defined (__FreeBSD__)
+ 	rc = vrrp_netgraph_bridge_create(vr->vr_if->if_name);
++#endif	
+ 	if ((rc < 0) && (errno != EEXIST)) {
+ 		syslog(LOG_CRIT, "cannot create a bridge device: %s", strerror(errno));
+ 		syslog(LOG_CRIT, "aborting...");
+ 		exit(-1);
+ 	}
++#if defined (__FreeBSD__)
+ 	rc = vrrp_netgraph_create_virtualiface(vr);
+ 	if (rc < 0) {
+ 		syslog(LOG_CRIT, "cannot create a virtual interface via netgraph: %s\n", strerror(errno));
+ 		syslog(LOG_CRIT, "check that ng_socket, ng_ether, ng_eiface and ng_bridge are loaded\n");
+ 		exit(-1);
+ 	}
+-
++#endif
+ 	return;
+ }
+ 
diff --git a/freevrrpd/patches/patch-vrrp_network.c b/freevrrpd/patches/patch-vrrp_network.c
new file mode 100644
index 0000000000..c69d3d4c32
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_network.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Sort out preprocessor conditionals 
+
+--- vrrp_network.c.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_network.c
+@@ -312,10 +312,10 @@ vrrp_network_delete_local_route(struct i
+ 	rtm.rtm_version = RTM_VERSION;
+ #ifdef __FreeBSD__
+ 	rtm.rtm_flags = RTF_UP | RTF_HOST | RTF_LOCAL;
+-#endif
+ #if __FreeBSD_version < 800059
+ 	rtm.rtm_flags |= RTF_WASCLONED;
+ #endif
++#endif
+ #ifdef __NetBSD__
+ 	rtm.rtm_flags = RTF_UP | RTF_HOST | RTF_CLONED;
+ #endif
diff --git a/freevrrpd/patches/patch-vrrp_signal.c b/freevrrpd/patches/patch-vrrp_signal.c
new file mode 100644
index 0000000000..cd739269f4
--- /dev/null
+++ b/freevrrpd/patches/patch-vrrp_signal.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Conditionally compile netgraph call
+
+--- vrrp_signal.c.orig	2015-02-04 00:39:49.000000000 +0000
++++ vrrp_signal.c
+@@ -60,7 +60,9 @@ vrrp_signal_quit(int sig)
+ 	struct ether_addr ethaddr;
+ 
+ 	vrrp_thread_mutex_lock();
++#if defined (__FreeBSD__)
+ 	vrrp_netgraph_shutdown_allnodes();
++#endif	
+ 	while (vr_ptr[cpt]) {
+ 		ethaddr = vrrp_list_get_first(vr_ptr[cpt]);
+ 		vrrp_interface_vripaddr_delete(vr_ptr[cpt]);


Home | Main Index | Thread Index | Old Index