Bug 48001 - New port: ASpath-tree a IPv6 route stability and correctness monitoring tool
Summary: New port: ASpath-tree a IPv6 route stability and correctness monitoring tool
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-06 12:00 UTC by Mohacsi Janos
Modified: 2003-04-27 02:37 UTC (History)
1 user (show)

See Also:


Attachments
file.shar (22.26 KB, text/plain)
2003-02-06 12:00 UTC, Mohacsi Janos
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mohacsi Janos 2003-02-06 12:00:30 UTC
New port: Aspath-tree version 4.1. A IPv6 route stability and correctness 
monitoring tool. It is working on Cisco/Juniper/Zebra routers.

How-To-Repeat: 
Apply this shar.
Comment 1 corecode@corecode.ath.cx 2003-02-06 23:52:32 UTC
Lately Janos Mohacsi told:

> sed 's/^X//' >aspathtree/pkg-plist << 'END-of-aspathtree/pkg-plist'
> Xaspathtree/etc/ASpath-tree.config.orig
> Xaspathtree/etc/ASpath-tree.config.bak

woo? .orig && .bak?
[several follow]
> END-of-aspathtree/pkg-plist

can't this be squeezed into a hier(7) conformant structure, using
${PREFIX}/{bin,libexec(?),share}?

> sed 's/^X//' >aspathtree/Makefile << 'END-of-aspathtree/Makefile'
> X# New ports collection makefile for:    aspathtree
> X# Date created:         06.05.2002
> X# Whom: Janos Mohacsi <janos.mohacsi@bsd.hu>
> X#
> X# $FreeBSD$
> X
> XPORTNAME=	aspathtree
> XPORTVERSION=	4.1
> XCATEGORIES=	ipv6 net

first category must be a real one:
CATEGORIES=	net ipv6

[...]
> XWRKSRC=			${WRKDIR}/ASpath-tree-v4.1/

use ${PORTVERSION}?

> XRESTRICTED=		"not redistributable, license agreement required"
> XNO_CDROM=	${RESTRICTED}
> XNO_PACKAGE=	${RESTRICTED}

how about:

RESTRICTED=		"not redistributable, license agreement required"

.include <bsd.port.pre.mk>

.if !exists(${DISTDIR}/${DISTNAME}${EXTRACT_SUFX})
IGNORE=	"You need to read the license and disclaimer on http://carmen.ipv6.tilab.com/cgi-bin/download.pl?pkg=ASpath-tree and download ${DISTFILES} into ${DISTDIR}"
.endif

> XNO_BUILD=	yes
> XUSE_PERL5=	yes
> XSCRIPTS_ENV+=	PERL5=${PERL5}
> XPKGMESSAGE=	${WRKDIR}/pkg-message
> X
> Xdo-fetch:
> X	@if [ ! -f ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ]; then \
> X	${ECHO} '======================================================='; \
> X	${ECHO} 'You need to read the license and disclaimer on '; \
> X	${ECHO} 'http://carmen.ipv6.tilab.com/cgi-bin/download.pl?pkg=ASpath-tree'; \
> X	${ECHO} 'and fetch on your own.'; \
> X	${ECHO} 'Once ${DISTFILES} has been downloaded, move it to '; \
> X	${ECHO} '${DISTDIR} and then restart this build '; \
> X	${ECHO} '======================================================='; \
> X	fi

obsolete if you use above version. use ${TEST} instead of [ ?

> Xdo-install:
> X	@if [ ! -d ${PREFIX}/aspathtree ]; then \
> X		${MKDIR} ${PREFIX}/aspathtree ; fi

just ${MKDIR}?

> X	${CP} -R ${WRKSRC}/* ${PREFIX}/aspathtree/
> X	${CHMOD} +x ${PREFIX}/aspathtree/update-rtree

${INSTALL_DATA},${INSTALL_SCRIPT}?

> Xpost-install:
> X	@${SED} -e "s:%%PREFIX%%:${PREFIX}:g" pkg-message >${PKGMESSAGE}
> X.if !defined(BATCH)
> X	@${ECHO}
> X	@${CAT} ${PKGMESSAGE}
> X	@${ECHO}
> X.endif

this is not the preferred way of handling pkg-message. usual way would
be:

post-install:
	@${SED} -e 's#%%PREFIX%%#${PREFIX}#' ${PKGMESSAGE}


and not modify ${PKGMESSAGE} at all. if you insist in your way, use
${.CURDIR}/pkg-message

> sed 's/^X//' >aspathtree/files/patch-update-rtree << 'END-of-aspathtree/files/patch-update-rtree'
[...]
> X@@ -111,7 +112,7 @@
> X 	die "ERROR in configuration file: parameter HOMEDIR not correct!\n"    unless (-e "$HOMEDIR/update-rtree");
> X 	# enabling log to file if required
> X 	$LOGDIR = "$HOMEDIR/log";
> X-	unless (-e "$LOGDIR") {mkdir("$LOGDIR", 0777)};
> X+	unless (-e "$LOGDIR") {mkdir("$LOGDIR", 0775)};

better log to /var/log/...?

> X 	if ($DEBUG) {
> X 		open(LOGFILE,"> $LOGDIR/runlog.txt");
> X 		print LOGFILE "ASpath-tree DEBUG log file\n\n";
> X@@ -229,28 +230,28 @@
> X 
> X # Creating directories if required...

does this mean that this program needs to run as root?

> sed 's/^X//' >aspathtree/pkg-message << 'END-of-aspathtree/pkg-message'
> XFor to configuration information please look at 
> X%%PREFIX%%/aspathtree/readme.txt. 
> X
> XCopy %%PREFIX%%/aspathtree/etc/ASpath-tree.config.dist to 
> X%%PREFIX%%/etc/ASpath-tree.config
> Xand modify accordingly to your environment.

how about installing right to ${PREFIX}/etc?

> sed 's/^X//' >aspathtree/scripts/configure << 'END-of-aspathtree/scripts/configure'
> X#!/bin/sh
> X#
> X# $FreeBSD$
> X
> XFILES_CONF="update-rtree etc/ASpath-tree.config"
> X
> Xfor f in $FILES_CONF ; do
> X	mv ${WRKSRC}/${f} ${WRKSRC}/$f.bak && sed <${WRKSRC}/${f}.bak \
> X		s+%%PATHPERLBIN%%+${PERL5}+g >${WRKSRC}/${f}
> X	mv ${WRKSRC}/${f} ${WRKSRC}/$f.bak && sed <${WRKSRC}/${f}.bak \
> X		s+%%PREFIX%%+${PREFIX}+g >${WRKSRC}/${f}
> Xdone
> X
> X# rename to dist
> Xmv ${WRKSRC}/etc/ASpath-tree.config ${WRKSRC}/etc/ASpath-tree.config.dist
> END-of-aspathtree/scripts/configure

how about in Makefile:

USE_REINPLACE=	yes

post-patch:
	@${REINPLACE_CMD} -e 's#%%PATHPERLBIN%%#${PERL5}#; \
		s#%%PREFIX%%#${PREFIX}#' ${WRKSRC}/update-rtree \
			${WRKSRC}/etc/ASpath-tree-config

cheers
  simon

-- 
/"\   http://corecode.ath.cx/#donate
\ /
 \     ASCII Ribbon Campaign
/ \  Against HTML Mail and News
Comment 2 Mohacsi Janos 2003-02-07 05:51:22 UTC
On Fri, 7 Feb 2003, Simon 'portlint' Schubert wrote:

> Lately Janos Mohacsi told:
>
> > sed 's/^X//' >aspathtree/pkg-plist << 'END-of-aspathtree/pkg-plist'
> > Xaspathtree/etc/ASpath-tree.config.orig
> > Xaspathtree/etc/ASpath-tree.config.bak

I generated automatically the package files  after temporary installation.
The .orig is created since it has patched. The .bak is created since it
has SED-ed.

>
> woo? .orig && .bak?
> [several follow]
> > END-of-aspathtree/pkg-plist
>
> can't this be squeezed into a hier(7) conformant structure, using
> ${PREFIX}/{bin,libexec(?),share}?

It is a bit difficult, since the running program generates a large amount
of data under its home directory in several places. The code is hardcoded
to use its structure...


>
> > sed 's/^X//' >aspathtree/Makefile << 'END-of-aspathtree/Makefile'
> > X# New ports collection makefile for:    aspathtree
> > X# Date created:         06.05.2002
> > X# Whom: Janos Mohacsi <janos.mohacsi@bsd.hu>
> > X#
> > X# $FreeBSD$
> > X
> > XPORTNAME=	aspathtree
> > XPORTVERSION=	4.1
> > XCATEGORIES=	ipv6 net
>
> first category must be a real one:
> CATEGORIES=	net ipv6

You are right. I will correct it.

>
> [...]
> > XWRKSRC=			${WRKDIR}/ASpath-tree-v4.1/
>
> use ${PORTVERSION}?

The previous version used ${WRKDIR}/aspathtree-v3_3/, if I remember well.
I blindly replaced.
How about:
WRKSRC=			${WRKDIR}/ASpath-tree-v${PORTVERSION}/

>
> > XRESTRICTED=		"not redistributable, license agreement required"
> > XNO_CDROM=	${RESTRICTED}
> > XNO_PACKAGE=	${RESTRICTED}
>
> how about:
>
> RESTRICTED=		"not redistributable, license agreement required"
>
> .include <bsd.port.pre.mk>
>
> .if !exists(${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}) IGNORE= "You need to
> read the license and disclaimer on
> http://carmen.ipv6.tilab.com/cgi-bin/download.pl?pkg=ASpath-tree and
> download ${DISTFILES} into ${DISTDIR}" .endif

Is it working under FREEBSD 4.x STABLE? I got strange messages if I use
this method.

>
> > XNO_BUILD=	yes
> > XUSE_PERL5=	yes
> > XSCRIPTS_ENV+=	PERL5=${PERL5}
> > XPKGMESSAGE=	${WRKDIR}/pkg-message
> > X
> > Xdo-fetch:
> > X	@if [ ! -f ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ]; then \
> > X	${ECHO} '======================================================='; \
> > X	${ECHO} 'You need to read the license and disclaimer on '; \
> > X	${ECHO} 'http://carmen.ipv6.tilab.com/cgi-bin/download.pl?pkg=ASpath-tree'; \
> > X	${ECHO} 'and fetch on your own.'; \
> > X	${ECHO} 'Once ${DISTFILES} has been downloaded, move it to '; \
> > X	${ECHO} '${DISTDIR} and then restart this build '; \
> > X	${ECHO} '======================================================='; \
> > X	fi
>
> obsolete if you use above version. use ${TEST} instead of [ ?

Portlint did not complain about using [.
>
> > Xdo-install:
> > X	@if [ ! -d ${PREFIX}/aspathtree ]; then \
> > X		${MKDIR} ${PREFIX}/aspathtree ; fi
>
> just ${MKDIR}?
>
> > X	${CP} -R ${WRKSRC}/* ${PREFIX}/aspathtree/
> > X	${CHMOD} +x ${PREFIX}/aspathtree/update-rtree
>
> ${INSTALL_DATA},${INSTALL_SCRIPT}?

The port has large amount of files. I have to write an installer script if
I want to use ${INSTALL_DATA} and ${INSTALL_SCRIPT}. This way the .bak and
.orig can be eliminated. However I saw several ports using simple ${CP}


>
> > Xpost-install:
> > X	@${SED} -e "s:%%PREFIX%%:${PREFIX}:g" pkg-message >${PKGMESSAGE}
> > X.if !defined(BATCH)
> > X	@${ECHO}
> > X	@${CAT} ${PKGMESSAGE}
> > X	@${ECHO}
> > X.endif
>
> this is not the preferred way of handling pkg-message. usual way would
> be:
>
> post-install:
> 	@${SED} -e 's#%%PREFIX%%#${PREFIX}#' ${PKGMESSAGE}
>
>
> and not modify ${PKGMESSAGE} at all. if you insist in your way, use
> ${.CURDIR}/pkg-message
>
> > sed 's/^X//' >aspathtree/files/patch-update-rtree << 'END-of-aspathtree/files/patch-update-rtree'
> [...]
> > X@@ -111,7 +112,7 @@
> > X 	die "ERROR in configuration file: parameter HOMEDIR not correct!\n"    unless (-e "$HOMEDIR/update-rtree");
> > X 	# enabling log to file if required
> > X 	$LOGDIR = "$HOMEDIR/log";
> > X-	unless (-e "$LOGDIR") {mkdir("$LOGDIR", 0777)};
> > X+	unless (-e "$LOGDIR") {mkdir("$LOGDIR", 0775)};
>
> better log to /var/log/...?

Maybe. But It is generating large amount of logs in several different
files.

>
> > X 	if ($DEBUG) {
> > X 		open(LOGFILE,"> $LOGDIR/runlog.txt");
> > X 		print LOGFILE "ASpath-tree DEBUG log file\n\n";
> > X@@ -229,28 +230,28 @@
> > X
> > X # Creating directories if required...
>
> does this mean that this program needs to run as root?

No. I usually run under an unprivileged user. Manually chown-ing to that
user the /usr/local/aspathtree. If you thing the makefile can generate a
new user for that purpose.

>
> > sed 's/^X//' >aspathtree/pkg-message << 'END-of-aspathtree/pkg-message'
> > XFor to configuration information please look at
> > X%%PREFIX%%/aspathtree/readme.txt.
> > X
> > XCopy %%PREFIX%%/aspathtree/etc/ASpath-tree.config.dist to
> > X%%PREFIX%%/etc/ASpath-tree.config
> > Xand modify accordingly to your environment.
>
> how about installing right to ${PREFIX}/etc?

Can be done. Probably better...

>
> > sed 's/^X//' >aspathtree/scripts/configure << 'END-of-aspathtree/scripts/configure'
> > X#!/bin/sh
> > X#
> > X# $FreeBSD$
> > X
> > XFILES_CONF="update-rtree etc/ASpath-tree.config"
> > X
> > Xfor f in $FILES_CONF ; do
> > X	mv ${WRKSRC}/${f} ${WRKSRC}/$f.bak && sed <${WRKSRC}/${f}.bak \
> > X		s+%%PATHPERLBIN%%+${PERL5}+g >${WRKSRC}/${f}
> > X	mv ${WRKSRC}/${f} ${WRKSRC}/$f.bak && sed <${WRKSRC}/${f}.bak \
> > X		s+%%PREFIX%%+${PREFIX}+g >${WRKSRC}/${f}
> > Xdone
> > X
> > X# rename to dist
> > Xmv ${WRKSRC}/etc/ASpath-tree.config ${WRKSRC}/etc/ASpath-tree.config.dist
> > END-of-aspathtree/scripts/configure
>
> how about in Makefile:
>
> USE_REINPLACE=	yes
>
> post-patch:
> 	@${REINPLACE_CMD} -e 's#%%PATHPERLBIN%%#${PERL5}#; \
> 		s#%%PREFIX%%#${PREFIX}#' ${WRKSRC}/update-rtree \
> 			${WRKSRC}/etc/ASpath-tree-config
>

Better. Unfortunately the Porters' Handbook does not say anything about
the USE_REINPLACE....

Cheers,
	Janos

> cheers
>   simon
>
> --
> /"\   http://corecode.ath.cx/#donate
> \ /
>  \     ASCII Ribbon Campaign
> / \  Against HTML Mail and News
>
Comment 3 Mohacsi Janos 2003-03-10 15:01:29 UTC
Dear All,

Here is an update to aspathtree. It is using now the hier(7) structure.
Accepted most of the suggested changes from Simon Schubert.

What should I do know? Should I submit a separate PR? Or you can use this
new shar file?
Regards,
	Janos Mohacsi

NEW SHAR file:



# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	aspathtree/
#	aspathtree/pkg-plist
#	aspathtree/pkg-descr
#	aspathtree/distinfo
#	aspathtree/Makefile
#	aspathtree/files
#	aspathtree/files/patch-update-rtree
#	aspathtree/files/patch-readme.txt
#	aspathtree/files/patch-etc::ASpath-tree.config
#	aspathtree/files/patch-lib::getbgptable.pl
#	aspathtree/pkg-message
#
echo c - aspathtree/
mkdir -p aspathtree/ > /dev/null 2>&1
echo x - aspathtree/pkg-plist
sed 's/^X//' >aspathtree/pkg-plist << 'END-of-aspathtree/pkg-plist'
Xetc/ASpath-tree.config.dist
Xvar/aspathtree/htdocs/icons/bnew.gif
Xvar/aspathtree/htdocs/icons/bold.gif
Xvar/aspathtree/htdocs/icons/e.gif
Xvar/aspathtree/htdocs/icons/h.gif
Xvar/aspathtree/htdocs/icons/l.gif
Xvar/aspathtree/htdocs/icons/p.gif
Xvar/aspathtree/htdocs/icons/t.gif
Xvar/aspathtree/htdocs/icons/v.gif
Xvar/aspathtree/data/6bone.db
Xvar/aspathtree/data/force.as.name
Xvar/aspathtree/data/rirs.db
Xlibexec/aspathtree/bgp-tree-changes.pl
Xlibexec/aspathtree/bgp-tree.pl
Xlibexec/aspathtree/create-homepage.pl
Xlibexec/aspathtree/elaborate-aspaths.pl
Xlibexec/aspathtree/getbgptable.pl
Xlibexec/aspathtree/history.pl
Xlibexec/aspathtree/ipv6prefix.pl
Xlibexec/aspathtree/odd-as.pl
Xlibexec/aspathtree/odd-routes.pl
Xlibexec/aspathtree/route-stability.pl
Xlibexec/aspathtree/utility.pl
Xlibexec/aspathtree/ASmain.pl
Xbin/update-rtree
X%%PORTDOCS%%share/doc/aspathtree/DISCLAIMER
X%%PORTDOCS%%share/doc/aspathtree/readme.txt
X%%PORTDOCS%%share/doc/aspathtree/changes.txt
X@dirrm var/aspathtree/htdocs/changes
X@dirrm var/aspathtree/htdocs/details
X@dirrm var/aspathtree/htdocs/icons
X@dirrm var/aspathtree/htdocs/trash
X@dirrm var/aspathtree/htdocs
X@dirrm var/aspathtree/history/bbtree
X@dirrm var/aspathtree/history/completetree
X@dirrm var/aspathtree/history/othertree
X@dirrm var/aspathtree/history/other
X@dirrm var/aspathtree/history/ptlas
X@dirrm var/aspathtree/history
X@dirrm var/aspathtree/data
X@dirrm var/aspathtree/log
X@dirrm var/aspathtree
X@dirrm libexec/aspathtree
X%%PORTDOCS%%@dirrm share/doc/aspathtree/
END-of-aspathtree/pkg-plist
echo x - aspathtree/pkg-descr
sed 's/^X//' >aspathtree/pkg-descr << 'END-of-aspathtree/pkg-descr'
XASpath-tree program
X============================
X
XASpath-tree is a tool designed to be used by an IPv6 site involved
Xin the experimentation of the BGP4+ protocol inside the 6Bone network.
XIt generates summary of:
X
X    * the number of route entries (valid/total/suppressed/damped/history)
X    * the number of AS in table (total, originating only, originating/transit,
X      transit only, private and reserved)
X    * the number of active AS paths
X    * the number of active BGP neighbours (i.e. announcing routing information)
X    * an analysis of the network size, in terms of AS distances
X    * the number of circulating prefixes (total, 6Bone pTLAs, sTLAs, 6to4,
X      others)
X
XThe current version supports:
X    * 6Bone pTLAs
X    * RIR's assigned sTLAs
X    * Juniper/Cisco/Zebra routers
X
XWWW: http://carmen.ipv6.cselt.it/ipv6/tools/ASpath-tree/index.html
X
Xjanos.mohacsi@bsd.hu
END-of-aspathtree/pkg-descr
echo x - aspathtree/distinfo
sed 's/^X//' >aspathtree/distinfo << 'END-of-aspathtree/distinfo'
XMD5 (ASpath-tree-v4.1.tar.gz) = 1c5d7f84c00b6b30da2705bd1feedd27
END-of-aspathtree/distinfo
echo x - aspathtree/Makefile
sed 's/^X//' >aspathtree/Makefile << 'END-of-aspathtree/Makefile'
X# New ports collection makefile for:    aspathtree
X# Date created:         06.05.2002
X# Whom: Janos Mohacsi <janos.mohacsi@bsd.hu>
X#
X# $FreeBSD$
X
XPORTNAME=	aspathtree
XPORTVERSION=	4.1
XCATEGORIES=	net ipv6
XMASTER_SITES=	#http://carmen.ipv6.cselt.it/ipv6/tools/ASpath-tree/index.html
XDISTNAME=	ASpath-tree-v${PORTVERSION}
X
XMAINTAINER=	Janos.Mohacsi@bsd.hu
XCOMMENT=	Checks IPv6 routes' stability and correctness on IPv6 internet
X
XRUN_DEPENDS=	${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Net/Telnet.pm:${PORTSDIR}/net/p5-Net-Telnet \
X		ripewhois:${PORTSDIR}/net/ripetools
X
XWRKSRC=			${WRKDIR}/ASpath-tree-v${PORTVERSION}/
XRESTRICTED=		"not redistributable, license agreement required"
X
X.include <bsd.port.pre.mk>
X
X.if !exists(${DISTDIR}/${DISTNAME}${EXTRACT_SUFX})
XIGNORE=		"You need to read the license and disclaimer on http://carmen.ipv6.tilab.com/cgi-bin/download.pl?pkg=ASpath-tree and download ${DISTFILES} into ${DISTDIR}"
X.endif
X
XNO_BUILD=	yes
XUSE_PERL5=	yes
XUSE_REINPLACE=	yes
XSCRIPTS_ENV+=	PERL5=${PERL5}
XPKGMESSAGE=	${WRKDIR}/pkg-message
XCONFIG_FILES=	ASpath-tree.config
XICON_FILES=	bnew.gif bold.gif e.gif h.gif l.gif p.gif t.gif v.gif
XLIB_FILES=	bgp-tree-changes.pl bgp-tree.pl create-homepage.pl elaborate-aspaths.pl getbgptable.pl history.pl ipv6prefix.pl odd-as.pl odd-routes.pl route-stability.pl utility.pl ASmain.pl
XDATA_FILES=	6bone.db force.as.name rirs.db
XDOC_FILES=	DISCLAIMER readme.txt changes.txt
X
Xpre-configure:
X	@${REINPLACE_CMD} -e 's#%%PATHPERLBIN%%#${PERL5}#; \
X		s#%%PREFIX%%#${PREFIX}#' ${WRKSRC}/update-rtree \
X			${WRKSRC}/etc/ASpath-tree.config
X
Xdo-install:
X#installing main script
X	${INSTALL_SCRIPT} ${WRKSRC}/update-rtree ${PREFIX}/bin
X#installing lib files
X	${MKDIR} ${PREFIX}/libexec/aspathtree/
X.for file in ${LIB_FILES}
X	${INSTALL_DATA} ${WRKSRC}/lib/${file} ${PREFIX}/libexec/aspathtree
X.endfor
X#installing htdocs files
X	${MKDIR} ${PREFIX}/var/aspathtree/htdocs/icons/
X.for file in ${ICON_FILES}
X	${INSTALL_DATA} ${WRKSRC}/htdocs/icons/${file} ${PREFIX}/var/aspathtree/htdocs/icons/
X.endfor
X#installing data files
X	${MKDIR} ${PREFIX}/var/aspathtree/data
X.for file in ${DATA_FILES}
X	${INSTALL_DATA} ${WRKSRC}/data/${file} ${PREFIX}/var/aspathtree/data/
X.endfor
X#installing log directory
X	${MKDIR} ${PREFIX}/var/aspathtree/log
X#installing config files
X.for file in ${CONFIG_FILES}
X	${INSTALL_DATA} ${WRKSRC}/etc/${file} ${PREFIX}/etc/${file}.dist
X.endfor
X#installing docs
X.ifndef(NOPORTDOCS)
X	${MKDIR} ${DOCSDIR}
X.for file in ${DOC_FILES}
X	${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
X.endfor
X.endif
X
Xpost-install:
X	@${SED} -e "s:%%PREFIX%%:${PREFIX}:g" ${.CURDIR}/pkg-message >${PKGMESSAGE}
X.if !defined(BATCH)
X	@${ECHO}
X	@${CAT} ${PKGMESSAGE}
X	@${ECHO}
X.endif
X
X.include <bsd.port.post.mk>
END-of-aspathtree/Makefile
echo c - aspathtree/files
mkdir -p aspathtree/files > /dev/null 2>&1
echo x - aspathtree/files/patch-update-rtree
sed 's/^X//' >aspathtree/files/patch-update-rtree << 'END-of-aspathtree/files/patch-update-rtree'
X--- update-rtree.orig	Tue Dec 10 10:02:25 2002
X+++ update-rtree	Sat Mar  8 21:51:42 2003
X@@ -1,13 +1,13 @@
X-#!/usr/local/bin/perl
X+#!%%PATHPERLBIN%%
X #### ASpath-tree v.4.1 - Released on Tue DEC 10 2002, h.10:02:25
X #### File: update-rtree Last modified on Mon DEC 9 2002, h.22:42:19
X
X # Main ASpath-tree script
X # Configuration File
X-my $CONFIGFILE = "/etc/ASpath-tree.config";
X+my $CONFIGFILE = "%%PREFIX%%/etc/ASpath-tree.config";
X
X # Global variables
X-use vars qw ($HOMEDIR $RSHDIR $ROUTER $LOCAL $ROUTERADDR $ROUTERUSER $CONTACTNAME $CONTACTMAIL $SITENAME $SITEPICTURE $HTMLDIR
X+use vars qw ($HOMEDIR $RSHDIR $ROUTER $LOCAL $ROUTERADDR $ROUTERUSER $ROUTERUSERPASS $CONTACTNAME $CONTACTMAIL $SITENAME $SITEPICTURE $HTMLDIR
X              $WHOISLINK $QUIET $DEBUG $FILTEROUT $RIPEWHOISCLIENT);
X use vars qw ($DATADIR $ROOTPICTURE $LIB $ICONS $WARNINGTIME $HISTORYPERIOD $FLAG_COLLECT $LONGDATE $CURRENTTIME $LASTRUN);
X use vars qw ($SIXBONEDB $IPV6PREFIXTABLE $PTLA_FILE $HISTORYFILE $LASTRUNFILE $OLDASPATHSFILE $OLDDATEFILE $OLDBBASPATHSFILE
X@@ -95,6 +95,7 @@
X 		if ($line =~ /^\s*LOCAL\s*=\s*(.*)/)         {$LOCAL = $1}
X 		if ($line =~ /^\s*ROUTERADDR\s*=\s*(.*)/)    {$ROUTERADDR = $1}
X 		if ($line =~ /^\s*ROUTERUSER\s*=\s*(.*)/)    {$ROUTERUSER = $1}
X+		if ($line =~ /^\s*ROUTERUSERPASS\s*=\s*(.*)/)    {$ROUTERUSERPASS = $1}
X 		if ($line =~ /^\s*CONTACTNAME\s*=\s*(.*)/)   {$CONTACTNAME = $1}
X 		if ($line =~ /^\s*CONTACTMAIL\s*=\s*(.*)/)   {$CONTACTMAIL = $1}
X 		if ($line =~ /^\s*SITENAME\s*=\s*(.*)/)      {$SITENAME = $1}
X@@ -108,10 +109,10 @@
X
X ## DEFAULT values setting...(if not explicitely declared) and ERROR checking ...
X 	die "ERROR in configuration file: parameter HOMEDIR not set!\n"    unless ($HOMEDIR);
X-	die "ERROR in configuration file: parameter HOMEDIR not correct!\n"    unless (-e "$HOMEDIR/update-rtree");
X+	die "ERROR in configuration file: parameter HOMEDIR not correct!\n"    unless (-d "$HOMEDIR");
X 	# enabling log to file if required
X 	$LOGDIR = "$HOMEDIR/log";
X-	unless (-e "$LOGDIR") {mkdir("$LOGDIR", 0777)};
X+	unless (-e "$LOGDIR") {mkdir("$LOGDIR", 0775)};
X 	if ($DEBUG) {
X 		open(LOGFILE,"> $LOGDIR/runlog.txt");
X 		print LOGFILE "ASpath-tree DEBUG log file\n\n";
X@@ -130,7 +131,7 @@
X 	}
X 	unless ($WHOISLINK)     {$WHOISLINK = "http://whois.6bone.net/cgi-bin/whois"}
X 	unless ($DATADIR)       {$DATADIR = "$HOMEDIR/data"}
X-	unless ($LIB)           {$LIB = "$HOMEDIR/lib"}
X+	unless ($LIB)           {$LIB = "%%PREFIX%%/libexec/aspathtree"}
X 	unless ($WARNINGTIME)   {$WARNINGTIME = 5}
X 	unless ($ICONS)         {$ICONS = "./icons"}
X 	unless ($HISTORYPERIOD) {$HISTORYPERIOD = 24}
X@@ -229,28 +230,28 @@
X
X # Creating directories if required...
X
X-	unless (-e "$PTLASHISTORYDIR") {mkdir("$PTLASHISTORYDIR", 0777); &log_it("$PTLASHISTORYDIR created.")};
X-	unless (-e "$OTHERHISTORYDIR") {mkdir("$OTHERHISTORYDIR", 0777); &log_it("$OTHERHISTORYDIR created.")};
X-	unless (-e "$HOMEDIR/history/bbtree") {mkdir("$HOMEDIR/history/bbtree", 0777); &log_it("$HOMEDIR/history/bbtree created.")};
X-	unless (-e "$HOMEDIR/history/completetree") {mkdir("$HOMEDIR/history/completetree", 0777); &log_it("$HOMEDIR/history/completetree created.")};
X-	unless (-e "$HOMEDIR/history/othertree") {mkdir("$HOMEDIR/history/othertree", 0777); &log_it("$HOMEDIR/history/othertree created.")};
X-	unless (-e "$DETAILDIR") {mkdir("$DETAILDIR", 0777); &log_it("$DETAILDIR created.")};
X-	unless (-e "$DETAILDIRCO") {mkdir("$DETAILDIRCO", 0777); &log_it("$DETAILDIRCO created.")};
X-	unless (-e "$DETAILDIRBB") {mkdir("$DETAILDIRBB", 0777); &log_it("$DETAILDIRBB created.")};
X-	unless (-e "$DETAILDIRIANA") {mkdir("$DETAILDIRIANA", 0777); &log_it("$DETAILDIRIANA created.")};
X-	unless (-e "$HISTORYHTMLDIR") {mkdir("$HISTORYHTMLDIR", 0777); &log_it("$HISTORYHTMLDIR created.")};
X-	unless (-e "$CHANGESDIR") {mkdir("$CHANGESDIR", 0777); &log_it("$CHANGESDIR created.")}
X-	unless (-e "$HTMLDIR_LOCAL/trash") {mkdir("$HTMLDIR_LOCAL/trash", 0777); &log_it("$HTMLDIR_LOCAL/trash created.")}
X+	unless (-e "$PTLASHISTORYDIR") {mkdir("$PTLASHISTORYDIR", 0775); &log_it("$PTLASHISTORYDIR created.")};
X+	unless (-e "$OTHERHISTORYDIR") {mkdir("$OTHERHISTORYDIR", 0775); &log_it("$OTHERHISTORYDIR created.")};
X+	unless (-e "$HOMEDIR/history/bbtree") {mkdir("$HOMEDIR/history/bbtree", 0775); &log_it("$HOMEDIR/history/bbtree created.")};
X+	unless (-e "$HOMEDIR/history/completetree") {mkdir("$HOMEDIR/history/completetree", 0775); &log_it("$HOMEDIR/history/completetree created.")};
X+	unless (-e "$HOMEDIR/history/othertree") {mkdir("$HOMEDIR/history/othertree", 0775); &log_it("$HOMEDIR/history/othertree created.")};
X+	unless (-e "$DETAILDIR") {mkdir("$DETAILDIR", 0775); &log_it("$DETAILDIR created.")};
X+	unless (-e "$DETAILDIRCO") {mkdir("$DETAILDIRCO", 0775); &log_it("$DETAILDIRCO created.")};
X+	unless (-e "$DETAILDIRBB") {mkdir("$DETAILDIRBB", 0775); &log_it("$DETAILDIRBB created.")};
X+	unless (-e "$DETAILDIRIANA") {mkdir("$DETAILDIRIANA", 0775); &log_it("$DETAILDIRIANA created.")};
X+	unless (-e "$HISTORYHTMLDIR") {mkdir("$HISTORYHTMLDIR", 0775); &log_it("$HISTORYHTMLDIR created.")};
X+	unless (-e "$CHANGESDIR") {mkdir("$CHANGESDIR", 0775); &log_it("$CHANGESDIR created.")}
X+	unless (-e "$HTMLDIR_LOCAL/trash") {mkdir("$HTMLDIR_LOCAL/trash", 0775); &log_it("$HTMLDIR_LOCAL/trash created.")}
X 	else {system "rm -rf $HTMLDIR_LOCAL/trash/*"; &log_it("Trash empty")}
X 	if (-d $HTMLDIR) {
X-		unless (-e "$HTMLDIR/details") {mkdir("$HTMLDIR/details", 0777); &log_it("$HTMLDIR/details created.")}
X-		unless (-e "$HTMLDIR/details/complete") {mkdir("$HTMLDIR/details/complete", 0777); &log_it("$HTMLDIR/details/complete created.")}
X-		unless (-e "$HTMLDIR/details/backbone") {mkdir("$HTMLDIR/details/backbone", 0777); &log_it("$HTMLDIR/details/backbone created.")}
X-		unless (-e "$HTMLDIR/details/otherIANA") {mkdir("$HTMLDIR/details/otherIANA", 0777); &log_it("$HTMLDIR/details/otherIANA created.")}
X-		unless (-e "$HTMLDIR/24h_history") {mkdir("$HTMLDIR/24h_history", 0777); &log_it("$HTMLDIR/24h_history created.")}
X-		unless (-e "$HTMLDIR/changes") {mkdir("$HTMLDIR/changes", 0777); &log_it("$HTMLDIR/changes created.")}
X+		unless (-e "$HTMLDIR/details") {mkdir("$HTMLDIR/details", 0775); &log_it("$HTMLDIR/details created.")}
X+		unless (-e "$HTMLDIR/details/complete") {mkdir("$HTMLDIR/details/complete", 0775); &log_it("$HTMLDIR/details/complete created.")}
X+		unless (-e "$HTMLDIR/details/backbone") {mkdir("$HTMLDIR/details/backbone", 0775); &log_it("$HTMLDIR/details/backbone created.")}
X+		unless (-e "$HTMLDIR/details/otherIANA") {mkdir("$HTMLDIR/details/otherIANA", 0775); &log_it("$HTMLDIR/details/otherIANA created.")}
X+		unless (-e "$HTMLDIR/24h_history") {mkdir("$HTMLDIR/24h_history", 0775); &log_it("$HTMLDIR/24h_history created.")}
X+		unless (-e "$HTMLDIR/changes") {mkdir("$HTMLDIR/changes", 0775); &log_it("$HTMLDIR/changes created.")}
X 		unless (-e "$HTMLDIR/icons") {
X-			mkdir("$HTMLDIR/icons", 0777);
X+			mkdir("$HTMLDIR/icons", 0775);
X 			system("cp $ICONSDIR/* $HTMLDIR/icons");
X 			&log_it("$HTMLDIR/icons created and template icons copied.");
X 		}
END-of-aspathtree/files/patch-update-rtree
echo x - aspathtree/files/patch-readme.txt
sed 's/^X//' >aspathtree/files/patch-readme.txt << 'END-of-aspathtree/files/patch-readme.txt'
X--- readme.txt.orig	Thu Feb  6 11:50:12 2003
X+++ readme.txt	Thu Feb  6 12:07:49 2003
X@@ -62,7 +62,7 @@
X (up to 8) and FreeBSD (up to 4.5) platforms and it should work
X without problems on any Unix platform (Linux, etc.) with
X Perl (version equal or greater than 5.0) installed.
X-BGP routes are collected using rsh commands. The current release
X+BGP routes are collected using rsh or telnet commands. The current release
X works with cisco routers, zebra routers and juniper routers running
X IPv6 capable software versions.
X
X@@ -114,8 +114,9 @@
X The main script is "update-rtree"; to be executed properly it must be
X customized by editing the text file
X            "etc/ASpath-tree.config"
X-and the target router must be configured to accept rsh commands from
X-the workstation which is running the ASpath-tree scripts.
X+and the target router must be configured to accept rsh commands or
X+telnet access from the workstation which is running the ASpath-tree
X+scripts.
X
X Configuring the target router
X -----------------------------
X@@ -125,6 +126,12 @@
X The administrator of the cisco router must perform the following
X configurations:
X
X+Option 1: rsh collection
X+------------------------
X+The router must be configured to accept rsh commands coming from the
X+remote workstation which is running the ASpath-tree scripts in the
X+following way:
X+
X   ip rcmd remote-host <router-username> <remote-ip-address> <remote-
X   username>
X   ip rcmd rsh-enable
X@@ -154,9 +161,28 @@
X scripts to collect the routing information available on the cisco
X router.
X
X+Option 2: telnet collection
X+---------------------------
X+The router must be configured to accept telnet commands coming from the
X+remote workstation which is running the ASpath-tree scripts.
X+
X+<router-username> is the name of the telnet user enabled to show the bgp
X+table on the cisco router.
X+
X+<router-username-password> is the corresponding password of the telnet user
X+enabled to show the bgp table on the cisco router.
X+
X+Consult the Cisco documentations, how to configure such a settings.
X+
X+If you configure ROUTERUSERPWD then the telnet option automatically selected.
X+
X+
X JUNIPER
X -------
X
X+Option 1: rsh collection
X+------------------------
X+
X With a juniper router, you have first to enable the rsh service
X on the router, then to set the permission to receive rsh commands
X from the ASpath-tree WS. Let's assume you have configured a user
X@@ -188,6 +214,13 @@
X This is exactly the rsh command used by the ASpath-tree scripts to
X collect the routing information available on the juniper router.
X
X+Option 2: telnet collection
X+---------------------------
X+
X+configure an user <router-username> with password <router-password on
X+the Juniper router with view permisssion. Consult your Juniper
X+documentation about that.
X+
X ZEBRA
X -----
X To use ASpath-tree with zebra routers, the "vtysh" CLI emulator must
X@@ -257,7 +290,12 @@
X              router have IPv6 capable rsh implementations.
X
X ROUTERUSER   is the username on the router that you have to use to
X-             run remote rsh commands.
X+             run remote rsh commands or telnet.
X+
X+ROUTERUSERPASS
X+             is an optional parameter to use for telnet collection. If you
X+             configure this parameter telnet mode will be used automatically.
X+             DO NOT SPECIFY this parameter if you use RSH collection.
X
X HTMLDIR      is the full path to the directory where the generated
X              html files have to be placed. If you do not specify this
X@@ -592,6 +630,9 @@
X         Raffaele D'Albenzio, Ivano Guardini and Paolo Fasano
X         <ipv6@tilab.com>
X         ----------------------------------------------------
X+	Telnet modul addition
X+        Janos Mohacsi <mohacsi@niif.hu> - 6NET project
X+	----------------------------------------------------
X
X #### ASpath-tree v.4.1 - Released on Tue DEC 10 2002, h.10:02:25
X #### File: readme.txt Last modified on Mon DEC 9 2002, h.22:46:11
END-of-aspathtree/files/patch-readme.txt
echo x - aspathtree/files/patch-etc::ASpath-tree.config
sed 's/^X//' >aspathtree/files/patch-etc::ASpath-tree.config << 'END-of-aspathtree/files/patch-etc::ASpath-tree.config'
X--- etc/ASpath-tree.config.orig	Tue Dec 10 10:02:25 2002
X+++ etc/ASpath-tree.config	Sat Mar  8 21:56:17 2003
X@@ -9,7 +9,7 @@
X # Full path to the directory where you have installed the ASpath-tree
X # scripts. It is the directory where the script create-bgp-pages is
X # located
X-HOMEDIR = /usr/local/ASpath-tree-v4.1
X+HOMEDIR = %%PREFIX%%/var/aspathree/
X
X # Router you are using. Currently supported platforms include Cisco, Juniper
X # and Zebra routers. Allowed values are "CISCO", "JUNIPER" , "ZEBRA" and
X@@ -37,8 +37,14 @@
X # command:
X #         ip rcmd remote-host
X #              <router-user> <client-ip-address>  <client-user>
X+# or the telnet user. See ROUTERUSERPASS also.
X ROUTERUSER = router
X
X+# The password of the telnet user which have been enabled on the cisco
X+# router to issue 'show bgp ipv6' command. Set up only if you want to
X+# use the telnet mode.
X+# ROUTERUSERPASS = router
X+
X # The full path to the directory where the generated html files have to be
X # placed. If you do not specify this option the html files are stored under
X # the htdocs/ directory which comes with the distribution
X@@ -46,15 +52,15 @@
X # HTMLDIR = /usr/local/httpd/htdocs/bgp
X
X # The contactname which is placed at the bottom of the generated html pages
X-CONTACTNAME = IPv6 group
X+CONTACTNAME = Your IPv6 group
X
X # e-mail address of the contact person. It is placed at the bottom of the
X # generated html pages together with the contactname
X- CONTACTMAIL = me@myhost.com
X+ CONTACTMAIL = your@ipv6.mail
X
X # The name of your IPv6 site. It is used as the root of the BGP4+ routing
X # tree displayed by the generated html pages
X-SITENAME = TILAB
X+SITENAME = Your IPv6 project
X
X # The name of the image file (for instance a graphical logo representing
X # your IPv6 site) to be placed at the beginning of the generated html
X@@ -71,7 +77,7 @@
X # WHOISLINK = http://whois.6bone.net/cgi-bin/whois
X
X # A flag to enable the display of the last changes on the tree. Set
X-# CHANGESFLAG = 1
X+CHANGESFLAG = 1
X # to see the display as html pages accessible from a link within the tree pages
X
X # A flag to control which routes are filtered out from the output of
X@@ -83,7 +89,7 @@
X # installed on the same WS that hosts ASpath-tree
X # This parameter is needed only if you want to update via ASpath-tree the
X # useful information available on whois DBs connected to the Internet
X-# RIPEWHOISCLIENT = /usr/local/bin/whois3
X+RIPEWHOISCLIENT = /usr/local/bin/ripewhois
X
X #### ASpath-tree v.4.1 - Released on Tue DEC 10 2002, h.10:02:25
X #### File: etc/ASpath-tree.config Last modified on Mon DEC 9 2002, h.15:52:30
END-of-aspathtree/files/patch-etc::ASpath-tree.config
echo x - aspathtree/files/patch-lib::getbgptable.pl
sed 's/^X//' >aspathtree/files/patch-lib::getbgptable.pl << 'END-of-aspathtree/files/patch-lib::getbgptable.pl'
X--- lib/getbgptable.pl.orig	Thu Feb  6 11:25:26 2003
X+++ lib/getbgptable.pl	Thu Feb  6 11:43:58 2003
X@@ -24,10 +24,55 @@
X #     ASs  (all the ASs in the router BGP table)
X # Finally this routine produces a text file containing the raw version of the router table
X # and if required log files of both the raw router table and the normalized table.
X+
X+
X sub get_bgp_table {
X 	my ($parser, $command, $line) = ('', '', '');
X 	my (@lines) = ();
X
X+	use Socket;
X+        use Net::Telnet;
X+
X+	if (defined($ROUTERUSERPASS)) {
X+
X+# TELNET module to get BGP4+ AS Path table
X+
X+	if ($ROUTER =~ /^JUNIPER$/i) {
X+		$parser = "juniper";
X+		$STATUSCODES = "*&gt; active";
X+        	my $telnet_session = new Net::Telnet(
X+	        prompt => '/[\w().-]*[\$#]\s*$/'
X+       		);
X+
X+	        $telnet_session->open($ROUTERADDR);
X+       		$telnet_session->login($ROUTERUSER, $ROUTERUSERPASS);
X+	        $telnet_session->cmd(String => "set cli screen-length 0", Timeout => 1800);
X+
X+       		 @lines = $telnet_session->cmd(String => "show route table inet6.0 all terse",
X+                                  Timeout => 1800);
X+	        $telnet_session->close;
X+	} else {
X+		$ROUTER = "CISCO";
X+		$parser = "cisco";
X+		$STATUSCODES = "s suppressed, d damped, h history, * valid, &gt; best, r RIB-failure";
X+       		my $telnet_session = new Net::Telnet(
X+	        prompt => '/[\w().-]*[\$#]\s*$/'
X+       		);
X+
X+	        $telnet_session->open($ROUTERADDR);
X+       		$telnet_session->login($ROUTERUSER, $ROUTERUSERPASS);
X+	        $telnet_session->cmd(String => "terminal length 0", Timeout => 1800);
X+
X+       		@lines = $telnet_session->cmd(String => "show bgp ipv6",
X+                                  Timeout => 1800);
X+	        $telnet_session->close;
X+	}
X+# end TELNET module
X+
X+        } else {
X+
X+# RSH module to get BGP4+ AS Path table
X+
X 	if ($ROUTER =~ /^JUNIPER$/i) {
X 		$parser = "juniper";
X 		$STATUSCODES = "*&gt; active";
X@@ -58,6 +103,7 @@
X 		push(@lines, $_);
X 	}
X 	close(OUTPUT);
X+	}
X 	chomp(@lines);
X # Write log and for web files (raw table)
X 	open(TXTFILE,"> $BGPTABLEFILE");
END-of-aspathtree/files/patch-lib::getbgptable.pl
echo x - aspathtree/pkg-message
sed 's/^X//' >aspathtree/pkg-message << 'END-of-aspathtree/pkg-message'
XFor to configuration information please look at
X%%PREFIX%%/share/doc/aspathtree/readme.txt.
X
XCopy %%PREFIX%%/etc/ASpath-tree.config.dist to
X%%PREFIX%%/etc/ASpath-tree.config
Xand modify accordingly to your environment.
END-of-aspathtree/pkg-message
exit
Comment 4 Munechika Sumikawa freebsd_committer freebsd_triage 2003-04-27 02:36:25 UTC
State Changed
From-To: open->closed

I've upgraded it to 4.2 and commited thanks. 
Please review my work for upgrading just in case.