[mirrorbrain-commits] [mod_asn] r92 - /trunk/asn_import.py

From: <poeml_at_mirrorbrain.org>
Date: Mon, 16 Apr 2012 22:46:31 -0000
Author: poeml
Date: Tue Apr 17 00:46:30 2012
New Revision: 92

URL: http://svn.mirrorbrain.org/viewvc/mod_asn?rev=92&view=rev
Log:
asn_get_routeviews script: 
- don't fail when the BGP routing data snapshot contains bogus AS numbers. (issue #93)
  Patch courtesy of agy.

Modified:
    trunk/asn_import.py

Modified: trunk/asn_import.py
URL: http://svn.mirrorbrain.org/viewvc/mod_asn/trunk/asn_import.py?rev=92&r1=91&r2=92&view=diff
==============================================================================
--- trunk/asn_import.py	(original)
+++ trunk/asn_import.py	Tue Apr 17 00:46:30 2012
_at_@ -10,6 +10,8 @@
 tablename = 'pfx2asn'
 # not needed when a MirrorBrain setup exists
 conffile = '/etc/asn_import.conf'
+
+MAX_ASN_INT = 65535
 
 # is there a MirrorBrain config file? If yes, use that.
 try:
_at_@ -61,6 +63,8 @@
     inserted = 0
     for line in fileinput.input():
         pfx, asnb, asn = line.split()
+        if int(asn) > MAX_ASN_INT:
+            continue
         try:
             cursor.execute("INSERT INTO %s VALUES ( %%s, %%s )" % tablename, [pfx, asn])
             inserted += 1




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Mon Apr 16 2012 - 22:46:31 GMT

This archive was generated by hypermail 2.3.0 : Mon Apr 16 2012 - 22:47:03 GMT