320-gluon-mesh-batman-adv-client-bridge 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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'
  5. local sysconfig = require 'gluon.sysconfig'
  6. local sysctl = require 'gluon.sysctl'
  7. local util = require 'gluon.util'
  8. local uci = require('simple-uci').cursor()
  9. uci:section('network', 'interface', 'client', {
  10. ipv6 = true,
  11. proto = 'dhcpv6',
  12. reqprefix = 'no',
  13. peerdns = not site.dns.servers(),
  14. sourcefilter = false,
  15. keep_ra_dnslifetime = true,
  16. robustness = 3,
  17. query_interval = 2000,
  18. query_response_interval = 500,
  19. })
  20. uci:delete('network', 'client_lan')
  21. uci:delete('network', 'local_node_route')
  22. uci:section('network', 'route', 'local_node_route', {
  23. interface = 'client',
  24. target = site.prefix4(),
  25. })
  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. local networks = uci:get_list('firewall', 'mesh', 'network')
  34. util.add_to_set(networks, 'client')
  35. uci:set_list('firewall', 'mesh', 'network', networks)
  36. local networks = uci:get_list('firewall', 'drop', 'network')
  37. util.remove_from_set(networks, 'client')
  38. uci:set_list('firewall', 'drop', 'network', networks)
  39. uci:delete('firewall', 'local_node_dns')
  40. uci:save('firewall')
  41. sysctl.set('net.ipv6.conf.local-node.forwarding', 0)