freifunkh / ansible

Here we store all Ansible roles and configs used for Freifunk Hannover.
MIT License
7 stars 3 forks source link

dns_zonenodes: support meshviewer format v2 #22

Closed lemoer closed 6 years ago

lemoer commented 7 years ago

I currently have a setup, where meshviewer v2 format is used. Maybe this patch could be useful somewhen in future...

--- knoten_compile.pl   2017-02-25 02:34:58.274837705 +0000
+++ knoten_compile.pl.bak   2017-02-25 02:36:36.749872556 +0000
@@ -66,15 +66,15 @@

     # Get hostname and IPv6 address from nodes.json
     # normalize hostname
-    foreach my $node ( @{ $data->{nodes} } ) {
+    foreach my $node_id ( keys %{ $data->{nodes} } ) {
         my $ip;
         my $names;
-        foreach my $node_ip ( @{ $node->{nodeinfo}->{network}->{addresses} } ) {
+        foreach my $node_ip ( @{ $data->{nodes}->{$node_id}->{nodeinfo}->{network}->{addresses} } ) {
             next if $node_ip !~ m/^2a06/;
             $ip = $node_ip; 
         }
         next unless $ip;
-        my $hostname = normalize_nodename( $node->{nodeinfo}->{hostname} );
+        my $hostname = normalize_nodename( $data->{nodes}->{$node_id}->{nodeinfo}->{hostname} );

         if ($mode eq "forward")
         {
lemoer commented 7 years ago

Filter out next node adresses:

(Not sure whether this could happen in batman-adv branch.)

1977er commented 7 years ago

What kind of prefix is 2a06:/112?

lemoer commented 7 years ago

Am 25. Februar 2017 11:58:58 MEZ schrieb "Oliver Krüger" notifications@github.com:

What kind of prefix is 2a06:/112?

This is just an example for a next-node address.

I'm currently using the script also for the babelnetz.ffh.zone. zone in the gluon babel branch. The IPs are actually from freifunk frankfurt, because I'm testing with their firmware.

You could take a look at http://lemoers-testbox.babelnetz.ffh.zone/ :wink:

lemoer commented 6 years ago

Think it's done.