Index: head/net-mgmt/rancid/Makefile =================================================================== --- head/net-mgmt/rancid/Makefile (revision 393587) +++ head/net-mgmt/rancid/Makefile (revision 393588) @@ -1,93 +1,93 @@ # Created by: Janos.Mohacsi@bsd.hu # $FreeBSD$ PORTNAME= rancid PORTVERSION= 2.3.8 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= net-mgmt MASTER_SITES= ftp://ftp.shrubbery.net/pub/rancid/ MAINTAINER= jmohacsi@bsd.hu COMMENT= Really Awesome New Cisco confIg Differ LIB_DEPENDS= libexpect.so:${PORTSDIR}/lang/expect RUN_DEPENDS= p5-LockFile-Simple>=0:${PORTSDIR}/devel/p5-LockFile-Simple USES= gmake perl5 shebangfix perl_OLD_CMD= @PERLV_PATH@ SHEBANG_FILES= bin/* SUB_FILES= pkg-message GNU_CONFIGURE= yes CONFIGURE_ARGS= --localstatedir=${PREFIX}/var/${PORTNAME}/ \ --bindir=${PREFIX}/libexec/${PORTNAME}/ \ --sysconfdir=${PREFIX}/etc/${PORTNAME}/ OLDCONFIG_FILE1= bin/env OLDCONFIG_FILE2= util/lg/lg.conf NEWERCONFIG_FILES1= etc/rancid.conf NEWERCONFIG_FILES2= etc/lg.conf NEWCONFIG_FILES= rancid.conf lg.conf OPTIONS_DEFINE= SVN SVN_DESC= Use Subversion instead of CVS .include .if ${PORT_OPTIONS:MSVN} CONFIGURE_ARGS+= --with-svn BUILD_DEPENDS+= svn:${PORTSDIR}/devel/subversion .else CONFIGURE_ARGS+= --without-svn .if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1000000 RUN_DEPENDS+= cvs>0:${PORTSDIR}/devel/cvs .endif .endif pre-everything:: @ ${ECHO} "Make sure your rancid repository is quiet before upgrading; disable rancid cron jobs" post-patch: ${REINPLACE_CMD} "s|par.1|rancid-par.1|" ${WRKSRC}/man/Makefile.in ${WRKSRC}/man/Makefile.am ${MV} ${WRKSRC}/man/par.1 ${WRKSRC}/man/rancid-par.1 post-install: ${LN} -s ${PREFIX}/libexec/${PORTNAME}/rancid-cvs ${STAGEDIR}${PREFIX}/bin ${LN} -s ${PREFIX}/libexec/${PORTNAME}/rancid-run ${STAGEDIR}${PREFIX}/bin .for file in ${NEWCONFIG_FILES} @ if [ -f ${PREFIX}/etc/${PORTNAME}/${file} ] ; then \ ${ECHO} "WARNING: *** new ${file} file is installed as ${PREFIX}/rancid/${file}.sample"; \ ${ECHO} " : *** review ${file}.sample for new/deprecated switches or install in place ${file}"; \ fi .endfor @ if [ -f ${PREFIX}/rancid/${NEWERCONFIG_FILE1} ] ; then \ ${ECHO} "WARNING: *** ${PREFIX}/rancid/${NEWERCONFIG_FILE1} has been replaced with "; \ ${ECHO} " : *** ${PREFIX}/etc/${PORTNAME}/rancid.conf. Merge from sample and old file "; \ fi @ if [ -f ${PREFIX}/rancid/${NEWERCONFIG_FILE2} ] ; then \ ${ECHO} "WARNING: *** ${PREFIX}/rancid/${NEWERCONFIG_FILE2} has been replaced with "; \ ${ECHO} " : *** ${PREFIX}/etc/${PORTNAME}/lg.conf. Merge from sample and old file "; \ fi @ if [ -f ${PREFIX}/rancid/${NEWERCONFIG_FILE1} -o \ -f ${PREFIX}/rancid/${NEWERCONFIG_FILE2} ] ; then \ ${ECHO} "WARNING: *** New CVS Repository will be stored ${PREFIX}/var/${PORTNAME}/ "; \ ${ECHO} " : *** Copy the repository if you want to keep the history "; \ fi @ if [ -f ${PREFIX}/rancid/${OLDCONFIG_FILE1} ] ; then \ ${ECHO} "WARNING: *** ${PREFIX}/rancid/${OLDCONFIG_FILE1} has been replaced with "; \ ${ECHO} " : *** ${PREFIX}/etc/${PORTNAME}/rancid.conf. Merge from sample and old file "; \ fi @ if [ -f ${PREFIX}/rancid/${OLDCONFIG_FILE2} ] ; then \ ${ECHO} "WARNING: *** ${PREFIX}/rancid/${OLDCONFIG_FILE2} has been replaced with "; \ ${ECHO} " : *** ${PREFIX}/etc/${PORTNAME}/lg.conf. Merge from sample and old file "; \ fi @ if [ -f ${PREFIX}/rancid/${OLDCONFIG_FILE1} -o \ -f ${PREFIX}/rancid/${OLDCONFIG_FILE2} ] ; then \ ${ECHO} "WARNING: *** New CVS Repository will be stored ${PREFIX}/rancid/var "; \ ${ECHO} " : *** Copy the repository if you want to keep the history "; \ fi .include Index: head/net-mgmt/rancid/files/patch-bin__rancid.in =================================================================== --- head/net-mgmt/rancid/files/patch-bin__rancid.in (revision 393587) +++ head/net-mgmt/rancid/files/patch-bin__rancid.in (revision 393588) @@ -1,45 +1,53 @@ ---- bin/rancid.in.orig 2015-06-09 15:46:07.000000000 +0100 -+++ bin/rancid.in 2015-06-09 15:57:24.000000000 +0100 +--- bin/rancid.in.orig 2015-07-03 17:22:07.000000000 +0100 ++++ bin/rancid.in 2015-07-06 07:10:54.000000000 +0100 +@@ -45,6 +45,7 @@ + # usage: rancid [-dV] [-l] [-f filename | hostname] + # + use Getopt::Std; ++use Socket qw(AF_INET AF_INET6 inet_pton); + getopts('dflV'); + if ($opt_V) { + print "rancid 2.3.8\n"; @@ -162,13 +162,38 @@ @sorted_lines; } -# These two routines will sort based upon IP addresses +# ipaddrval(IPaddr) converts and IPv4/v6 address to a string for comparison. sub ipaddrval { - my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#); - $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0])); + my($a) = @_; + my($norder); + + if ($a =~ /:/) { + my($l); + if ($a =~ /\//) { + ($a, $l) = split(/\//, $a); + } else { + $l = 128; + } + $norder = inet_pton(AF_INET6, $a); + return unpack("H*", $norder) . unpack("H*", pack("C", $l)); + } else { + my($l); + if ($a =~ /\//) { + ($a, $l) = split(/\//, $a); + } else { + $l = 32; + } + $norder = inet_pton(AF_INET, $a); + return(unpack("H*", $norder) . unpack("H*", pack("C", $l))); + } + + # otherwise return the original key value, so as not to sort on null + return($_[0]); } + +# sortbyipaddr(IPaddr, IPaddr) compares two IPv4/v6 addresses like strcmp(). sub sortbyipaddr { - &ipaddrval($a) <=> &ipaddrval($b); + &ipaddrval($a) cmp &ipaddrval($b); } # This routine parses "show version"