diff options
Diffstat (limited to 'root/etc/init.d')
-rwxr-xr-x | root/etc/init.d/S10boot | 21 | ||||
-rwxr-xr-x | root/etc/init.d/S40network | 10 | ||||
-rwxr-xr-x | root/etc/init.d/S45firewall | 22 | ||||
-rwxr-xr-x | root/etc/init.d/S50services | 5 | ||||
-rwxr-xr-x | root/etc/init.d/S99done | 3 | ||||
-rwxr-xr-x | root/etc/init.d/rcS | 25 |
6 files changed, 86 insertions, 0 deletions
diff --git a/root/etc/init.d/S10boot b/root/etc/init.d/S10boot new file mode 100755 index 000000000..6a8cc6c56 --- /dev/null +++ b/root/etc/init.d/S10boot @@ -0,0 +1,21 @@ +#!/bin/sh +sysctl -p + +insmod diag +echo "0x01" > /proc/sys/diag + +# networking stub +insmod et +insmod wl + +ifconfig lo 127.0.0.1 up +ifconfig eth0 promisc + +HOSTNAME=$(nvram get wan_hostname) +DOMAINNAME=${HOSTNAME##*.} +HOSTNAME=${HOSTNAME%%.*} + +echo ${HOSTNAME:=OpenWrt} > /proc/sys/kernel/hostname +echo ${DOMAINNAME:=lan} > /proc/sys/kernel/domainname + +vconfig set_name_type VLAN_PLUS_VID_NO_PAD diff --git a/root/etc/init.d/S40network b/root/etc/init.d/S40network new file mode 100755 index 000000000..4264705dc --- /dev/null +++ b/root/etc/init.d/S40network @@ -0,0 +1,10 @@ +#!/bin/sh +. /etc/functions.sh +case "$1" in + start|restart) + ifup lan + ifup wan + ifup wifi + wifi up + ;; +esac diff --git a/root/etc/init.d/S45firewall b/root/etc/init.d/S45firewall new file mode 100755 index 000000000..40ac81a49 --- /dev/null +++ b/root/etc/init.d/S45firewall @@ -0,0 +1,22 @@ +#!/bin/sh +. /etc/functions.sh + +WAN=$(nvram_get wan_ifname) + +IPT=/usr/sbin/iptables + +for T in filter nat mangle ; do + $IPT -t $T -F + $IPT -t $T -X +done + +$IPT -t filter -A INPUT -m state --state INVALID -j DROP +$IPT -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +$IPT -t filter -A INPUT -p icmp -j ACCEPT +$IPT -t filter -A INPUT -i $WAN -p tcp -j REJECT --reject-with tcp-reset +$IPT -t filter -A INPUT -i $WAN -j REJECT --reject-with icmp-port-unreachable +$IPT -t filter -A FORWARD -m state --state INVALID -j DROP +$IPT -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT +$IPT -t filter -A FORWARD -i $WAN -m state --state NEW,INVALID -j DROP + +$IPT -t nat -A POSTROUTING -o $WAN -j MASQUERADE diff --git a/root/etc/init.d/S50services b/root/etc/init.d/S50services new file mode 100755 index 000000000..949bee635 --- /dev/null +++ b/root/etc/init.d/S50services @@ -0,0 +1,5 @@ +#!/bin/sh +/usr/sbin/telnetd -l /bin/login +/usr/sbin/httpd -p 80 -h /www -r WRT54G Router +/usr/sbin/udhcpd /etc/udhcpd.conf +#udhcpd started from /etc/inittab diff --git a/root/etc/init.d/S99done b/root/etc/init.d/S99done new file mode 100755 index 000000000..c5211813f --- /dev/null +++ b/root/etc/init.d/S99done @@ -0,0 +1,3 @@ +#!/bin/sh +# turn off DMZ led +echo "0x00" > /proc/sys/diag diff --git a/root/etc/init.d/rcS b/root/etc/init.d/rcS new file mode 100755 index 000000000..9510e941a --- /dev/null +++ b/root/etc/init.d/rcS @@ -0,0 +1,25 @@ +#!/bin/sh + +# Start all init scripts in /etc/init.d +# executing them in numerical order. +# +for i in /etc/init.d/S??* ;do + + # Ignore dangling symlinks (if any). + [ ! -f "$i" ] && continue + + case "$i" in + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + set start + . $i + ) + ;; + *) + # No sh extension, so fork subprocess. + $i start + ;; + esac +done |