}
$settings{"FREIFUNK_HOSTNAME"} = $hostname;
+ # Save adhoc network settings
+ my $adhocs = $network->{'adhoc'};
+
+ # Clear everything
+ $settings{"FREIFUNK_ADHOC_BSSID"} = "";
+ $settings{"FREIFUNK_ADHOC_SSID"} = "";
+ $settings{"FREIFUNK_ADHOC_FREQ"} = "";
+
+ foreach my $adhoc (@$adhocs) {
+ # We will only care about mesh networks
+ # in the 2.4 GHz band
+ next if ($adhoc->{"channel"} > 13);
+
+ $settings{"FREIFUNK_ADHOC_BSSID"} = $adhoc->{"bssid"};
+ $settings{"FREIFUNK_ADHOC_SSID"} = $adhoc->{"ssid"};
+ $settings{"FREIFUNK_ADHOC_FREQ"} = $adhoc->{"channel"} * 5 + 2407;
+
+ # Do not process any more entries
+ last;
+ }
+
&General::writehash("${General::swroot}/freifunk/settings", \%settings);
# Write configuration bits...