gnunet: update defaults, integrate with netifd and fw3

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle
2016-04-19 02:11:06 +02:00
parent 4dc6595bb7
commit 72a164f63b
5 changed files with 215 additions and 26 deletions
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
ip link show gnunet-dns 1>/dev/null 2>/dev/null || exit 0
iptables -t mangle -I OUTPUT 1 -p udp -m owner --gid-owner gnunetdns --dport 53 -j ACCEPT
iptables -t mangle -I OUTPUT 2 -p udp --dport 53 -j MARK --set-mark 136708149
+51
View File
@@ -0,0 +1,51 @@
#!/bin/sh
# gnunet.sh - GNUnet proto for netifd
# Copyright (c) 2016 OpenWrt.org
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. /lib/functions/network.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_gnunet_setup() {
local cfg="$1"
local iface="$2"
local ipv4_addr ipv6_addr prefix ipaddr ip6addr
local configfile="/var/run/gnunet/gnunet.conf"
local gnunet_iftype
for gnit in dns exit vpn; do
local i1="$(gnunet-config -c $configfile -s $gnit -o IFNAME 2>/dev/null)"
local i2="$(gnunet-config -c $configfile -s $gnit -o TUN_IFNAME 2>/dev/null)"
[ "$i1" = "$iface" -o "$i2" = "$iface" ] && gnunet_iftype="$gnit"
done
if [ -z "$iface" -o -z "$gnunet_iftype" ]; then
proto_setup_failed "$cfg"
return
fi
proto_init_update "$iface" 1
ipaddr="$(gnunet-config -c $configfile -s $gnunet_iftype -o IPV4ADDR 2>/dev/null)"
ipmask="$(gnunet-config -c $configfile -s $gnunet_iftype -o IPV4MASK 2>/dev/null)"
ip6addr="$(gnunet-config -c $configfile -s $gnunet_iftype -o IPV6ADDR 2>/dev/null)"
ip6prefix="$(gnunet-config -c $configfile -s $gnunet_iftype -o IPV6PREFIX 2>/dev/null)"
[ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "$ipmask"
[ -n "$ip6addr" ] && proto_add_ipv6_address "$ip6addr" "$ip6prefix"
proto_send_update "$cfg"
}
proto_gnunet_teardown() {
return
}
[ -n "$INCLUDE_ONLY" ] || {
add_protocol gnunet
}
+23 -23
View File
@@ -4,33 +4,33 @@
touch /etc/config/gnunet
uci set gnunet.datastore=gnunet-config
uci set gnunet.datastore.DATABASE=heap
uci set gnunet.datastore.QUOTA="4 MB"
uci batch <<EOF
set gnunet.datastore=gnunet-config
set gnunet.datastore.DATABASE=heap
set gnunet.datastore.QUOTA="4 MB"
uci set gnunet.fs=gnunet-config
uci set gnunet.fs.CONTENT_PUSHING=NO
uci set gnunet.fs.CONTENT_CACHING=NO
set gnunet.fs=gnunet-config
set gnunet.fs.CONTENT_PUSHING=NO
set gnunet.fs.CONTENT_CACHING=NO
# limit dhtcache memory usage to 4 MB
uci set gnunet.dhtcache=gnunet-config
uci set gnunet.dhtcache.QUOTA="4 MB"
set gnunet.dhtcache=gnunet-config
set gnunet.dhtcache.QUOTA="4 MB"
# enable dns2gns
uci set gnunet.dns2gns=gnunet-config
uci set gnunet.dns2gns.AUTOSTART=YES
uci set gnunet.dns2gns.FORCESTART=YES
set gnunet.dns2gns=gnunet-config
set gnunet.dns2gns.AUTOSTART=YES
set gnunet.dns2gns.FORCESTART=YES
# enable v4/v6 protocol translation for EXIT/VPN
uci set gnunet.pt=gnunet-config
uci set gnunet.pt.FORCESTART=YES
set gnunet.pt=gnunet-config
set gnunet.pt.FORCESTART=YES
uci set gnunet.exit=gnunet-config
uci set gnunet.exit.AUTOSTART=YES
uci set gnunet.exit.FORCESTART=YES
set gnunet.exit=gnunet-config
set gnunet.exit.AUTOSTART=YES
set gnunet.exit.FORCESTART=YES
# increase WORKDELAY to something more sane on small CPUs
uci set gnunet.nse=gnunet-config
uci set gnunet.nse.WORKDELAY='500 ms'
set gnunet.nse=gnunet-config
set gnunet.nse.WORKDELAY='500 ms'
commit gnunet
EOF
uci commit gnunet
Regular → Executable
View File