mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
gnunet: update defaults, integrate with netifd and fw3
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Executable
+7
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user