Index: /tools/conf2inc.pl
===================================================================
--- /tools/conf2inc.pl	(revision 1978)
+++ /tools/conf2inc.pl	(revision 1978)
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+# use strict;
+use Data::Dumper;
+
+$|++;
+
+my $DIR='../nodes';
+my @nodes=();
+
+opendir(DIR,$DIR) or die $!;
+
+my $nodes = \();
+
+foreach(readdir(DIR)) {
+	next unless m/[CH]Node[\w+]/;
+	# print STDERR "Working on: $_\n";
+	my $n = $_;
+	my $f = $DIR.'/'.$n.'/wleiden.conf';
+	next unless -r $f;
+	eval qq|
+		package $n;
+		require "$f";
+		\$\::nodes->{$n} = \{
+			'location' => \$location,
+			'master_ip' => \$master_ip,
+			'nodename' => \$nodename,
+			'X' => \$X,
+			'Y' => \$Y,
+			'config' => \{ %config },
+		};
+		1;
+	|;
+	die "Parse error: $@" if $@;
+	push @nodes, $_;
+};
+
+foreach my $n (@nodes) {
+	$c = $::nodes->{$n}->{config};
+	foreach my $if (keys %$c ) {
+		foreach(split(m/\n/,$c->{$if})) {
+			chomp;
+			s/#.*//;
+			next if m/^\s*$/;
+			die unless my ($k,$v) = split /=/;
+			# print "$n\t$if\t$k\t$v\n";
+			$::nodes->{$n}->{ifaces}->{$if}->{$k}=$v;
+		};
+	};
+	delete  $::nodes->{$n}->{config};
+}
+
+print Dumper($::nodes);
+
Index: /tools/inc2minimal.pl
===================================================================
--- /tools/inc2minimal.pl	(revision 1978)
+++ /tools/inc2minimal.pl	(revision 1978)
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+$|++;
+require "conf.inc"
+	or die "Did you run conf2inc.pl > conf.inc ??";
+
+# Make a reverse mapping..
+my %ips = ();
+
+foreach my $node (keys %$VAR1) {
+	foreach my $iface (keys %{ $VAR1->{$node}->{ifaces} }) {
+		my $v = $VAR1->{$node}->{ifaces}->{$iface};
+		next unless defined $v->{IP};
+		$ip = $v->{IP};
+		die "IP of $node:$iface malformed ($ip)"
+			unless $ip =~ m/([\d\.]+)\/(\d+)/;
+		$pip = $1;
+		$mask = $2;
+
+		my %info=();
+		if ($iface =~ m/([^:]+):(.*)/) {
+			my ($a,$b)=($1,$2);
+			%info = %{$VAR1->{$node}->{ifaces}->{$a}};
+		};
+		foreach my $k (keys(%{$v})) {
+			$info{ $k } = $v->{$k};
+		};
+		
+		$ips{ $pip } = \%info;
+		# print "$node	$iface	$pip	$info{ESSID}\n";
+	}
+}
+
+while (my ($node,$vals) = each %$VAR1) {
+	print qq|<node id="$node" ip="$vals->{master_ip}>
+	<location>$vals->{location}</location>
+|;
+	foreach my $iface (sort keys(%{$vals->{ifaces}})) {
+		my $v = $vals->{ifaces}->{$iface};
+		print qq|	<iface id="$iface"|;
+		
+		if ($v->{TYPE} =~ m/wireless/i) {
+			my $ssid = "ERROR!";
+			if ($v->{MODE} =~ m/master/i) {
+				print qq| channel="$v->{CHANNEL}"|;
+				$ssid = $v->{ESSID};
+				print " master";
+			} else {
+				# Channel vollows; ESSID is
+				# that of the peer.
+				my $pip = $v->{POINT_TO_POINT};
+				if (defined $ips{ $pip }) {
+					$ssid = $ips{$pip}->{ESSID};
+				} else {
+					$ssid = 'undefined ('.$pip.')';
+				}
+			};
+			print qq| ssid="$ssid"|;
+		}
+		if ($v->{DHCP} =~ m/(\d+)\-(\d+)/) {
+			my $x = $2 - $1;
+			print qq| dhcp="$x"|;
+		};
+		print ">\n";
+		print qq|	</iface>\n|;
+	}
+	print qq|</node>\n|;
+};
