{
    #----------------------------------------------------------------------
    # This template defines both:
    #    - our local network/netmask ($primaryLocalNet)
    #    - a list of all our local networks from the networks database.
    #----------------------------------------------------------------------
    $OUT = "";

    # We won't use "my" for @locals, so that we can use it in other fragments
    @locals = ();

    use esmith::util;

    my ($network, $broadcast) =
	esmith::util::computeNetworkAndBroadcast ($LocalIP, $LocalNetmask);

    $primaryLocalNet = "$network/$LocalNetmask";
    push @locals, $primaryLocalNet;

    use esmith::NetworksDB;
    my $nets = esmith::NetworksDB->open;

    foreach my $network ($nets->get_all_by_prop(type => 'network'))
    {
	my $key = $network->key;
	my $mask = $network->prop('Mask');
	push @locals, "$key/$mask";
    }
    # Remove duplicates.
    my %count = ();
    foreach my $net (@locals)
    {
  	$count{$net}++;
    }
    @locals = keys %count;
}
