Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2002 00:44:27 +0400 (MSD)
From:      Dmitry Morozovsky <marck@rinet.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/44357: net/ehnt: non-ASN update (0.3 -> 0.3_1)
Message-ID:  <200210212044.g9LKiRke030559@woozle.rinet.ru>

next in thread | raw e-mail | index | archive | help

>Number:         44357
>Category:       ports
>Synopsis:       net/ehnt: non-ASN update (0.3 -> 0.3_1)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 21 13:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Morozovsky
>Release:        FreeBSD 4-STABLE i386
>Organization:
Cronyx Plus LLC (RiNet ISP)
>Environment:
System: FreeBSD 4-STABLE 


>Description:

Distributed with ehnt data file contains a bit outdated ASN list.  Also, RIPE
NCC had totally switched their database to RPSL, so new preparation logic
should take place.

Moreover, large part of traffic accounters don't need it ASN list all.

So, provide a knob for ASN data download (still defaulted to yes), and
patch for ASN list generation script.

>How-To-Repeat:

>Fix:


Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net/ehnt/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- Makefile	5 Oct 2001 20:34:49 -0000	1.3
+++ Makefile	21 Oct 2002 20:36:00 -0000
@@ -7,16 +7,24 @@
 
 PORTNAME=	ehnt
 PORTVERSION=	0.3
+PORTREVISION=	1
 CATEGORIES=	net
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
-DISTFILES=	${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX} \
-		${PORTNAME}_data-${PORTVERSION}${EXTRACT_SUFX}
+DISTFILES=	${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
+.if !defined(NO_ASN_DATA)
+DISTFILES+=	${PORTNAME}_data-${PORTVERSION}${EXTRACT_SUFX}
+.endif
 
 MAINTAINER=	marck@rinet.ru
 
 MAN1=		ehnt.1
 MAN8=		ehntserv.8
+
+.if defined(NO_ASN_DATA)
+post-extract:
+	${TOUCH} ${WRKSRC}/asnc.txt
+.endif
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/ehnt ${PREFIX}/bin/
--- /dev/null	Tue Oct 22 00:35:36 2002
+++ files/patch-ProcessASN.pl	Tue Oct 22 00:22:21 2002
@@ -0,0 +1,128 @@
+
+$FreeBSD$
+
+--- ProcessASN.pl.orig	Tue Oct 22 00:21:49 2002
++++ ProcessASN.pl	Tue Oct 22 00:21:53 2002
+@@ -4,7 +4,7 @@
+ 
+ #ftp://ftp.arin.net/netinfo/asn.txt
+ #ftp://ftp.apnic.net/pub/apnic/dbase/data/apnic.an.gz
+-#ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.an.gz
++#ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.aut-num.gz
+ 
+ #and put them all in another file in a dumb format so they can
+ #be processed by my dumb C program.
+@@ -51,28 +51,28 @@
+ 	}
+ }
+ 
+-if (! -f "ripe.db.an" ) { 
+-	if (-f "ripe.db.an.gz") {
+-		system "$gzip -d ripe.db.an.gz";
++if (! -f "ripe.db.aut-num" ) { 
++	if (-f "ripe.db.aut-num.gz") {
++		system "$gzip -d ripe.db.aut-num.gz";
+ 		$r=$?;
+ 		if ($r > 0) {
+-			print "---> Retrieved ripe.db.an.gz, but could not run $gzip!\n";
++			print "---> Retrieved ripe.db.aut-num.gz, but could not run $gzip!\n";
+ 			print "---> Please get $gzip and try again\n";
+ 			exit(1);
+ 		}
+ 	} else { 
+-		if ( RetrieveFile("ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.an.gz","ripe.db.an.gz")) {
+-			system "$gzip -d ripe.db.an.gz";
++		if ( RetrieveFile("ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.aut-num.gz","ripe.db.aut-num.gz")) {
++			system "$gzip -d ripe.db.aut-num.gz";
+ 			$r=$?;
+ 			if ($r > 0) {
+-				print "---> Retrieved ripe.db.an.gz, but could not run $gzip!\n";
++				print "---> Retrieved ripe.db.aut-num.gz, but could not run $gzip!\n";
+ 				print "---> Please get $gzip and try again\n";
+ 				exit(1);
+ 			}
+ 		} else {
+-			print "---> Cannot retrieve ripe.db.an.gz\n";
++			print "---> Cannot retrieve ripe.db.aut-num.gz\n";
+ 			print "---> Please download it from\n";
+-			print "---> ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.an.gz\n";
++			print "---> ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.aut-num.gz\n";
+ 			$MissingFile=1;
+ 		}
+ 	}
+@@ -109,7 +109,7 @@
+ print "Processed $c ASes from asn.txt\n";
+ 
+ ProcessRipeDB("apnic.an");
+-ProcessRipeDB("ripe.db.an");
++ProcessRipeDB("ripe.db.aut-num");
+ 
+ $c=0;
+ open OUTPUT,">asnc.txt";
+@@ -124,7 +124,7 @@
+   $c=0;
+   open APNIC,"<$file";
+   while (<APNIC>) {
+-	if (/^\*an: AS(..*)/) {
++	if (/^(\*an|aut-num):\s+AS(..*)/) {
+ 		if ($an) {
+ 			if ($aa) { $ASNs{$an}=$aa; $c++; }
+ 			elsif ($mb) { $ASNs{$an}=$mb; $c++; }
+@@ -133,25 +133,25 @@
+ 			
+ 			undef $an; undef $aa; undef $mb; undef $de;
+ 		}
+-		$an=$1;
++		$an=$2;
+ 	}
+-	if (/^\*aa: (..*)/) {
++	if (/^(\*aa|as-name):\s+(..*)/) {
+ 		if (! $aa) {
+-			$aa=$1;
++			$aa=$2;
+ 			$aa=~ s/ /_/g;
+ 			if ($aa eq 'UNSPECIFIED') {
+ 			    $aa="AS$an"; # 'an:' is always defined here
+ 			}
+ 		}
+ 	} 
+-	if (/^\*mb: MAINT\-(..*)/) {
++	if (/^(\*mb|mnt-by):\s+MAINT\-(..*)/) {
+ 		if (! $mb) {
+-			$mb=$1;
++			$mb=$2;
+ 			$mb=~ s/ /_/g;
+ 		}
+-	} elsif (/^\*mb: (..*)/) {
++	} elsif (/^(\*mb|mnt-by):\s+(..*)/) {
+ 		if (! $mb) {
+-			$mb=$1;
++			$mb=$2;
+ 			$mb=~ s/ /_/g;
+ 		}
+ 	} 
+@@ -176,20 +176,12 @@
+ 
+   print "RetrieveFile: getting $location\n";
+ 
+-  $wget="wget";
+-  $ncftp="ncftp";
+-  $curl="curl";
+-  system "$wget -q $location";
+-  $r=$?;
+-  if ($r==0) { print "Got file with $wget.\n"; return 1; }
++  $fetch="fetch";
+ 
+-  system "$ncftp $location";
++  system "$fetch $location";
+   $r=$?;
+-  if ($r==0) { print "Got file with $ncftp.\n"; return 1; }
++  if ($r==0) { print "Got file with $fetch.\n"; return 1; }
+ 
+-  system "$curl -o $filename $location";
+-  $r=$?;
+-  if ($r==0) { print "Got file with $curl\n"; return 1; }
+-  if ($r > 0) { print "Could not get $filename with $curl, $wget or $ncftp.\n"; }
++  if ($r > 0) { print "Could not get $filename with $fetch, $curl, $wget or $ncftp.\n"; }
+   return 0;
+ }
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210212044.g9LKiRke030559>