aboutsummaryrefslogtreecommitdiffstats
path: root/tools/v6-netlist-from-v4.pl
diff options
context:
space:
mode:
authorroot <root@riffraff.tg14.gathering.org>2014-04-20 02:58:05 +0200
committerroot <root@riffraff.tg14.gathering.org>2014-04-20 02:58:05 +0200
commit8f4ae8e5833f0d26be5fad5160ae6ee0479b0712 (patch)
treeda5089e91fbe52fd7da57a1c431c9af64f6ac8af /tools/v6-netlist-from-v4.pl
parent37a3b5d6ed97367989aecc875f1db1e9eb0458df (diff)
parent19cd0064816a577b72577b9f21a5a946eb746f64 (diff)
Merge branch 'master' of https://github.com/tech-server/tgmanage
Diffstat (limited to 'tools/v6-netlist-from-v4.pl')
-rw-r--r--tools/v6-netlist-from-v4.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/v6-netlist-from-v4.pl b/tools/v6-netlist-from-v4.pl
new file mode 100644
index 0000000..ea79268
--- /dev/null
+++ b/tools/v6-netlist-from-v4.pl
@@ -0,0 +1,33 @@
+#! /usr/bin/perl
+use strict;
+use warnings;
+
+while (<>) {
+ chomp;
+ /^#/ and next;
+ /^(151\.216\.(\d+)\.(\d+)) (\d+) (\S+)$/ or die;
+ my $z;
+ my ($ip, $third, $fourth, $len, $name) = ($1, $2, $3, $4, $5);
+ if ($len == 24) {
+ $z = '2a02:ed02:' . $third . '::/64';
+ } elsif ($len == 25) {
+ if ($fourth == 0) {
+ $z = '2a02:ed02:' . $third . 'a::/64';
+ } else {
+ $z = '2a02:ed02:' . $third . 'b::/64';
+ }
+ } elsif ($len == 26) {
+ if ($fourth == 0) {
+ $z = '2a02:ed02:' . $third . 'a::/64';
+ } elsif ($fourth == 64) {
+ $z = '2a02:ed02:' . $third . 'b::/64';
+ } elsif ($fourth == 128) {
+ $z = '2a02:ed02:' . $third . 'c::/64';
+ } else {
+ $z = '2a02:ed02:' . $third . 'd::/64';
+ }
+ } else {
+ warn "Unknown len $ip/$len";
+ }
+ print "$z $name\n" if (defined($z));
+}