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

View File

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

View File

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

View File

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