$(IPKG_OLSRD):
install -d -m0755 $(IDIR_OLSRD)/etc
- $(CP) $(PKG_INSTALL_DIR)/etc/olsrd.conf $(IDIR_OLSRD)/etc/
+ $(CP) ./files/olsrd.conf $(IDIR_OLSRD)/etc/
install -d -m0755 $(IDIR_OLSRD)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/olsrd $(IDIR_OLSRD)/usr/sbin/
install -d -m0755 $(IDIR_OLSRD)/etc/init.d
--- /dev/null
+DebugLevel 0
+IpVersion 4
+AllowNoInt yes
+Pollrate 0.1
+TcRedundancy 2
+MprCoverage 7
+LinkQualityFishEye 1
+LinkQualityWinSize 100
+LinkQualityDijkstraLimit 0 5.0
+
+Hna4 {
+ @@HNA_IP@@ @@HNA_MASK@@
+}
+
+LoadPlugin "olsrd_dyn_gw.so.0.4"
+{
+}
+
+LoadPlugin "olsrd_httpinfo.so.0.1"
+{
+ PlParam "port" "8080"
+ PlParam "Host" "127.0.0.1"
+ PlParam "Net" "192.168.1.0 255.255.255.0"
+}
+IpcConnect
+{
+ MaxConnections 1
+ Host 127.0.0.1
+ Net 192.168.1.0 255.255.255.0
+}
+LinkQualityLevel 2
+UseHysteresis no
+Interface @@INTERFACE@@
+{
+ HelloInterval 5.0
+ HelloValidityTime 90.0
+ TcInterval 2.0
+ TcValidityTime 270.0
+ MidInterval 15.0
+ MidValidityTime 90.0
+ HnaInterval 15.0
+ HnaValidityTime 90.0
+}
+
#!/bin/sh
DEFAULT=/etc/default/olsrd
+OPTIONS="-f /tmp/olsrd.conf"
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
- start)
- olsrd $OPTIONS
+ start)
+ lanip="$(nvram get lan_ipaddr)"
+ case "${lanip%\.*}" in
+ 192.168.1|192.168.0)
+ HNA_IP=
+ HNA_MASK=
+ ;;
+ *)
+ HNA_IP="$lanip"
+ HNA_MASK="$(nvram get lan_netmask)"
+ ;;
+ esac
+ wifi_ifname="$(nvram get wifi_ifname)"
+ [ -z "$wifi_ifname" ] && grep '@INTERFACE@' /etc/olsrd.conf && {
+ echo No interface...
+ exit 1
+ }
+ (
+ cat <<EOF
+@define HNA_IP $HNA_IP
+@define HNA_MASK $HNA_MASK
+@define INTERFACE "$wifi_ifname"
+EOF
+ cat /etc/olsrd.conf
+ ) | awk -f /usr/lib/parse-config.awk > /tmp/olsrd.conf
+ iptables -D input_rule -i "$wifi_ifname" -o "$wifi_ifname" -j ACCEPT 2>/dev/null >/dev/null # no duplicates please
+ iptables -A input_rule -i "$wifi_ifname" -o "$wifi_ifname" -j ACCEPT
+ olsrd $OPTIONS
;;
*)
echo "usage: $0 (start)"