bsp: wr841: make dynamic network functions available for all

Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
This commit is contained in:
Tim Niemeyer 2014-04-11 22:39:34 +02:00
parent c8ef1aa724
commit 055232d13b
6 changed files with 61 additions and 126 deletions

View File

@ -0,0 +1,49 @@
if ! uci get network.$SWITCHDEV.ifname; then
uci set network.$SWITCHDEV=switch
uci set network.$SWITCHDEV.enable=1
uci set network.$SWITCHDEV.reset=1
uci set network.$SWITCHDEV.enable_vlan=1
uci set network.${SWITCHDEV}_1=switch_vlan
uci set network.${SWITCHDEV}_1.device=$SWITCHDEV
uci set network.${SWITCHDEV}_1.vlan=1
uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
echo "# Allow IPv6 RAs on WAN Port" >> /etc/sysctl.conf
if [[ "$WANDEV" = "$SWITCHDEV" ]]; then
uci set network.${SWITCHDEV}_2=switch_vlan
uci set network.${SWITCHDEV}_2.device=$SWITCHDEV
uci set network.${SWITCHDEV}_2.vlan=2
uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
echo "net.ipv6.conf.$WANDEV.2.accept_ra_defrtr = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.2.accept_ra_pinfo = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.2.autoconf = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.2.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
else
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
fi
uci set network.${SWITCHDEV}_3=switch_vlan
uci set network.${SWITCHDEV}_3.device=$SWITCHDEV
uci set network.${SWITCHDEV}_3.vlan=3
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
uci set network.mesh.ifname="$SWITCHDEV.1 bat0"
uci set network.ethmesh.ifname="$SWITCHDEV.3"
if [[ "$WANDEV" = "$SWITCHDEV" ]]; then
uci set network.wan.ifname=$WANDEV.2
else
uci set network.wan.ifname=$WANDEV
fi
uci commit
/etc/init.d/network reload
fi

View File

@ -5,6 +5,11 @@ BOARD=$(cat /var/sysinfo/board_name)
if ! uci get board.model.name; then
uci set board.model.name=BOARD
fi
. /etc/network.$BOARD
. /etc/network.sh
. /etc/rc.local.$BOARD
# collect environment info and write to dot-script

View File

@ -71,12 +71,3 @@ net.ipv6.conf.default.max_addresses = 0
net.ipv6.conf.all.max_addresses = 0
# Allow IPv6 RAs on WAN Port
net.ipv6.conf.eth0.2.accept_ra_defrtr = 1
net.ipv6.conf.eth0.2.accept_ra_pinfo = 1
net.ipv6.conf.eth0.2.autoconf = 1
net.ipv6.conf.eth0.2.accept_ra_rtr_pref = 1
net.ipv6.conf.eth1.accept_ra_defrtr = 1
net.ipv6.conf.eth1.accept_ra_pinfo = 1
net.ipv6.conf.eth1.autoconf = 1
net.ipv6.conf.eth1.accept_ra_rtr_pref = 1

View File

@ -0,0 +1,7 @@
WANDEV=eth1
# WANDEV=eth0
SWITCHDEV=eth0
CLIENT_PORTS="1 2 0t"
WAN_PORTS=
BATMAN_PORTS="3 4 0t"

View File

@ -6,45 +6,6 @@ if ! uci get nodewatcher.@network[0].client_interfaces; then
uci commit
fi
WANDEV=eth1
SWITCHDEV=eth0
CLIENT_PORTS="1 2 0t"
WAN_PORTS=
BATMAN_PORTS="3 4 0t"
if ! uci get network.$SWITCHDEV.ifname; then
uci set network.$SWITCHDEV=switch
uci set network.$SWITCHDEV.enable=1
uci set network.$SWITCHDEV.reset=1
uci set network.$SWITCHDEV.enable_vlan=1
uci set network.${SWITCHDEV}_1=switch_vlan
uci set network.${SWITCHDEV}_1.device=$SWITCHDEV
uci set network.${SWITCHDEV}_1.vlan=1
uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
if [[ "$WANDEV" = "$SWITCHDEV" ]]; then
uci set network.${SWITCHDEV}_2=switch_vlan
uci set network.${SWITCHDEV}_2.device=$SWITCHDEV
uci set network.${SWITCHDEV}_2.vlan=2
uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
fi
uci set network.${SWITCHDEV}_3=switch_vlan
uci set network.${SWITCHDEV}_3.device=$SWITCHDEV
uci set network.${SWITCHDEV}_3.vlan=3
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
uci set network.mesh.ifname="$SWITCHDEV.1 bat0"
uci set network.ethmesh.ifname="$SWITCHDEV.3"
uci set network.wan.ifname=$WANDEV
uci commit
/etc/init.d/network reload
fi
if uci get network.ethmesh.macaddr
then
echo "MAC for ethmesh is set already"

View File

@ -1,78 +0,0 @@
kernel.panic=3
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.all.forwarding=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.tcp_ecn=0
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=0
net.ipv4.netfilter.ip_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_max=16384
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
net.ipv4.netfilter.ip_conntrack_udp_timeout=60
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
net.core.netdev_max_backlog=30
net.netfilter.nf_conntrack_checksum=0
#Controls source route verification
net.ipv4.conf.default.rp_filter=1
#Do not accept source routing
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.ip_forward=0
# net.ipv6.conf.all.forwarding=1
# disable bridge firewalling by default
net.bridge.bridge-nf-call-arptables=0
net.bridge.bridge-nf-call-ip6tables=0
net.bridge.bridge-nf-call-iptables=0
net.ipv6.conf.default.accept_dad=0
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.default.accept_redirects=0
net.ipv6.conf.all.accept_dad=0
net.ipv6.conf.all.accept_ra=1
net.ipv6.conf.all.accept_redirects=0
# Number of Router Solicitations to send until assuming no routers are present.
# This is host and not router
net.ipv6.conf.default.router_solicitations = 0
net.ipv6.conf.all.router_solicitations = 0
# Accept Router Preference in RA?
net.ipv6.conf.default.accept_ra_rtr_pref = 0
net.ipv6.conf.all.accept_ra_rtr_pref = 1
# Learn Prefix Information in Router Advertisement
net.ipv6.conf.default.accept_ra_pinfo = 0
net.ipv6.conf.all.accept_ra_pinfo = 1
# Setting controls whether the system will accept Hop Limit settings from a router advertisement
net.ipv6.conf.default.accept_ra_defrtr = 0
net.ipv6.conf.all.accept_ra_defrtr = 1
#router advertisements can cause the system to assign a global unicast address to an interface
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.all.autoconf = 1
#how many neighbor solicitations to send out per address?
net.ipv6.conf.default.dad_transmits = 3
net.ipv6.conf.all.dad_transmits = 3
# How many global unicast IPv6 addresses can be assigned to each interface?
net.ipv6.conf.default.max_addresses = 0
net.ipv6.conf.all.max_addresses = 0
# Allow IPv6 RAs on WAN Port
net.ipv6.conf.eth0.accept_ra_defrtr = 1
net.ipv6.conf.eth0.accept_ra_pinfo = 1
net.ipv6.conf.eth0.autoconf = 1
net.ipv6.conf.eth0.accept_ra_rtr_pref = 1