320-gluon-mesh-batman-adv-core-client-bridge 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/lua
  2. -- This script must be ordered after 300-gluon-client-bridge-network, as
  3. -- it overrides parts of network.client
  4. local site = require 'gluon.site_config'
  5. local sysconfig = require 'gluon.sysconfig'
  6. local sysctl = require 'gluon.sysctl'
  7. local uci = require('simple-uci').cursor()
  8. uci:section('network', 'interface', 'client', {
  9. ipv6 = true,
  10. proto = 'dhcpv6',
  11. reqprefix = 'no',
  12. peerdns = not (site.dns and site.dns.servers),
  13. sourcefilter = false,
  14. keep_ra_dnslifetime = true,
  15. robustness = 3,
  16. query_interval = 2000,
  17. query_response_interval = 500,
  18. })
  19. uci:delete('network', 'client_lan')
  20. if sysconfig.lan_ifname then
  21. uci:section('network', 'interface', 'client_lan', {
  22. unicast_flood = false,
  23. ifname = sysconfig.lan_ifname,
  24. })
  25. end
  26. uci:delete('network', 'local_node_route6')
  27. uci:section('network', 'route6', 'local_node_route6', {
  28. interface = 'client',
  29. target = site.prefix6,
  30. gateway = '::',
  31. })
  32. uci:save('network')
  33. uci:section('firewall', 'zone', 'client', {
  34. input = 'ACCEPT',
  35. output = 'ACCEPT',
  36. forward = 'REJECT',
  37. })
  38. uci:section('firewall', 'rule', 'client_dns', {
  39. name = 'client_dns',
  40. src = 'client',
  41. dest_port = '53',
  42. target = 'REJECT',
  43. })
  44. uci:delete('firewall', 'local_node')
  45. uci:section('firewall', 'zone', 'local_node', {
  46. name = 'local_node',
  47. network = {'local_node'},
  48. input = 'ACCEPT',
  49. output = 'ACCEPT',
  50. forward = 'REJECT',
  51. })
  52. uci:delete('firewall', 'local_node_dns')
  53. uci:save('firewall')
  54. sysctl.set('net.ipv6.conf.local-node.forwarding', 0)