gluon-client-bridge, gluon-mesh-batman-adv-core: nicer indentation of uci:section calls

Also simplify the local_node.peerdns setting.
This commit is contained in:
Matthias Schiffer 2017-02-10 08:16:27 +01:00
parent f9a52fd54f
commit eb350aba34
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
4 changed files with 76 additions and 106 deletions

View File

@ -18,15 +18,13 @@ if site.next_node.ip6 then
ip6 = site.next_node.ip6 .. '/128'
end
uci:section('network', 'interface', 'client',
{
type = 'bridge',
proto = 'static',
macaddr = site.next_node.mac,
ipaddr = ip4,
ip6addr = ip6,
}
)
uci:section('network', 'interface', 'client', {
type = 'bridge',
proto = 'static',
macaddr = site.next_node.mac,
ipaddr = ip4,
ip6addr = ip6,
})
uci:delete('network', 'client', 'reqprefix')
uci:delete('network', 'client', 'peerdns')
@ -61,11 +59,9 @@ uci:set('dhcp', dnsmasq, 'localise_queries', false)
uci:set('dhcp', dnsmasq, 'rebind_protection', false)
uci:delete('dhcp', 'client')
uci:section('dhcp', 'dhcp', 'client',
{
interface = 'client',
ignore = true,
}
)
uci:section('dhcp', 'dhcp', 'client', {
interface = 'client',
ignore = true,
})
uci:save('dhcp')

View File

@ -13,27 +13,23 @@ if site.mesh and site.mesh.batman_adv then
end
uci:delete('batman-adv', 'bat0')
uci:section('batman-adv', 'mesh', 'bat0',
{
orig_interval = 5000,
gw_mode = 'client',
gw_sel_class = gw_sel_class,
hop_penalty = 15,
multicast_mode = false,
}
)
uci:section('batman-adv', 'mesh', 'bat0', {
orig_interval = 5000,
gw_mode = 'client',
gw_sel_class = gw_sel_class,
hop_penalty = 15,
multicast_mode = false,
})
uci:save('batman-adv')
uci:delete('network', 'bat0')
uci:section('network', 'interface', 'bat0',
{
ifname = 'bat0',
proto = 'none',
macaddr = sysconfig.primary_mac,
multicast_router = 2,
learning = false,
}
)
uci:section('network', 'interface', 'bat0', {
ifname = 'bat0',
proto = 'none',
macaddr = sysconfig.primary_mac,
multicast_router = 2,
learning = false,
})
local interfaces = uci:get_list('network', 'client', 'ifname')
util.add_to_set(interfaces, 'bat0')

View File

@ -5,22 +5,18 @@ local sysctl = require 'gluon.sysctl'
local uci = require('simple-uci').cursor()
uci:section('network', 'interface', 'client',
{
robustness = 3,
query_interval = 2000,
query_response_interval = 500,
}
)
uci:section('network', 'interface', 'client', {
robustness = 3,
query_interval = 2000,
query_response_interval = 500,
})
uci:delete('network', 'client', 'igmp_snooping')
uci:delete('network', 'client_lan')
if sysconfig.lan_ifname then
uci:section('network', 'interface', 'client_lan',
{
unicast_flood = false,
}
)
uci:section('network', 'interface', 'client_lan', {
unicast_flood = false,
})
uci:set('network', 'client_lan', 'ifname', sysconfig.lan_ifname)
end
@ -28,15 +24,13 @@ uci:save('network')
uci:delete('firewall', 'client')
uci:section('firewall', 'zone', 'client',
{
name = 'client',
network = {'client'},
input = 'ACCEPT',
output = 'ACCEPT',
forward = 'REJECT',
}
)
uci:section('firewall', 'zone', 'client', {
name = 'client',
network = {'client'},
input = 'ACCEPT',
output = 'ACCEPT',
forward = 'REJECT',
})
uci:delete('firewall', 'client_dns')

View File

@ -8,73 +8,57 @@ local uci = require('simple-uci').cursor()
uci:delete('network', 'local_node_dev')
uci:section('network', 'device', 'local_node_dev',
{
name = 'local-node',
ifname = 'br-client',
type = 'macvlan',
macaddr = sysconfig.primary_mac,
}
)
uci:section('network', 'device', 'local_node_dev', {
name = 'local-node',
ifname = 'br-client',
type = 'macvlan',
macaddr = sysconfig.primary_mac,
})
uci:delete('network', 'local_node')
uci:section('network', 'interface', 'local_node',
{
ifname = 'local-node',
proto = 'dhcpv6',
reqprefix = 'no',
peerdns = true,
sourcefilter = false,
keep_ra_dnslifetime = true,
}
)
if site.dns and site.dns.servers then
uci:set('network', 'local-node', 'peerdns','0')
end
uci:section('network', 'interface', 'local_node', {
ifname = 'local-node',
proto = 'dhcpv6',
reqprefix = 'no',
peerdns = not (site.dns and site.dns.servers),
sourcefilter = false,
keep_ra_dnslifetime = true,
})
uci:delete('network', 'local_node_route6')
uci:section('network', 'route6', 'local_node_route6',
{
interface = 'local-node',
target = site.prefix6,
gateway = '::',
}
)
uci:section('network', 'route6', 'local_node_route6', {
interface = 'local-node',
target = site.prefix6,
gateway = '::',
})
uci:save('network')
uci:delete('firewall', 'local_node')
uci:section('firewall', 'zone', 'local_node',
{
name = 'local_node',
network = {'local_node'},
input = 'ACCEPT',
output = 'ACCEPT',
forward = 'REJECT',
}
)
uci:section('firewall', 'zone', 'local_node', {
name = 'local_node',
network = {'local_node'},
input = 'ACCEPT',
output = 'ACCEPT',
forward = 'REJECT',
})
uci:section('firewall', 'rule', 'local_node_dns',
{
name = 'local_node_dns',
src = 'local_node',
dest_port = '53',
target = 'REJECT',
}
)
uci:section('firewall', 'rule', 'local_node_dns', {
name = 'local_node_dns',
src = 'local_node',
dest_port = '53',
target = 'REJECT',
})
uci:save('firewall')
uci:delete('dhcp', 'local_node')
uci:section('dhcp', 'dhcp', 'local_node',
{
interface = 'local_node',
ignore = true,
}
)
uci:section('dhcp', 'dhcp', 'local_node', {
interface = 'local_node',
ignore = true,
})
uci:save('dhcp')