#!/bin/sh

uci -q batch <<EOF
del network.gnunetdns
set network.gnunetdns=interface
set network.gnunetdns.ifname='gnunet-dns'
set network.gnunetdns.proto='gnunet'

del network.gndnsrtt
set network.gndnsrtt=route
set network.gndnsrtt.interface='gnunetdns'
set network.gndnsrtt.table='53'
set network.gndnsrtt.target='0.0.0.0/0'

del network.gndnsrl
set network.gndnsrl=rule
set network.gndnsrl.mark='0x8260035'
set network.gndnsrl.lookup='53'
set network.gndnsrk.priority='0'

commit network

del firewall.gnunetdns
set firewall.gnunetdns=zone
set firewall.gnunetdns.name='gnunetdns'
set firewall.gnunetdns.network='gnunetdns'
set firewall.gnunetdns.input='ACCEPT'
set firewall.gnunetdns.output='ACCEPT'
set firewall.gnunetdns.forward='ACCEPT'

del firewall.gndnsrl
set firewall.gndnsrl=rule
set firewall.gndnsrl.name='Mark-local-DNS-for-GNUnet'
set firewall.gndnsrl.proto='udp'
set firewall.gndnsrl.dest_port='53'
set firewall.gndnsrl.extra='-m owner ! --gid-owner 452-453'
set firewall.gndnsrl.target='MARK'
set firewall.gndnsrl.set_mark='136708149'

del firewall.gndnsrl2
set firewall.gndnsrl2=rule
set firewall.gndnsrl2.name='Mark-forwarded-DNS-for-GNUnet'
set firewall.gndnsrl2.enabled='0'
set firewall.gndnsrl2.src='*'
set firewall.gndnsrl2.proto='udp'
set firewall.gndnsrl2.dest_port='53'
set firewall.gndnsrl2.target='MARK'
set firewall.gndnsrl2.set_mark='136708149'

commit firewall
EOF
