1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 18:23:09 +02:00

[package] base-files: ensure that ipv6 is loaded if interfaces have an ip6addr defined, clean trailing whitespace, bump pkg revision (#5356)

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17118 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2009-08-04 00:06:47 +00:00
parent b788e04612
commit ef1435675c
2 changed files with 22 additions and 13 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=base-files PKG_NAME:=base-files
PKG_RELEASE:=24 PKG_RELEASE:=25
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/

View File

@ -57,7 +57,7 @@ scan_interfaces() {
add_vlan() { add_vlan() {
local vif="${1%\.*}" local vif="${1%\.*}"
[ "$1" = "$vif" ] || ifconfig "$1" >/dev/null 2>/dev/null || { [ "$1" = "$vif" ] || ifconfig "$1" >/dev/null 2>/dev/null || {
ifconfig "$vif" up 2>/dev/null >/dev/null || add_vlan "$vif" ifconfig "$vif" up 2>/dev/null >/dev/null || add_vlan "$vif"
$DEBUG vconfig add "$vif" "${1##*\.}" $DEBUG vconfig add "$vif" "${1##*\.}"
@ -90,7 +90,7 @@ prepare_interface() {
# to create any interfaces here. The scripts have already done that, otherwise # to create any interfaces here. The scripts have already done that, otherwise
# the bridge interface wouldn't exist. # the bridge interface wouldn't exist.
[ "br-$config" = "$iface" -o -e "$iface" ] && return 0; [ "br-$config" = "$iface" -o -e "$iface" ] && return 0;
ifconfig "$iface" 2>/dev/null >/dev/null && { ifconfig "$iface" 2>/dev/null >/dev/null && {
config_get proto "$config" proto config_get proto "$config" proto
@ -165,12 +165,12 @@ setup_interface_static() {
config_get netmask "$config" netmask config_get netmask "$config" netmask
config_get ip6addr "$config" ip6addr config_get ip6addr "$config" ip6addr
[ -z "$ipaddr" -o -z "$netmask" ] && [ -z "$ip6addr" ] && return 1 [ -z "$ipaddr" -o -z "$netmask" ] && [ -z "$ip6addr" ] && return 1
config_get gateway "$config" gateway config_get gateway "$config" gateway
config_get ip6gw "$config" ip6gw config_get ip6gw "$config" ip6gw
config_get dns "$config" dns config_get dns "$config" dns
config_get bcast "$config" broadcast config_get bcast "$config" broadcast
[ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" broadcast "${bcast:-+}" [ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" broadcast "${bcast:-+}"
[ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr" [ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr"
[ -z "$gateway" ] || $DEBUG route add default gw "$gateway" dev "$iface" [ -z "$gateway" ] || $DEBUG route add default gw "$gateway" dev "$iface"
@ -183,7 +183,7 @@ setup_interface_static() {
done done
} }
config_get type "$config" TYPE config_get type "$config" TYPE
[ "$type" = "alias" ] && return 0 [ "$type" = "alias" ] && return 0
env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug-call "iface" & env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug-call "iface" &
@ -213,7 +213,7 @@ setup_interface_alias() {
static) static)
setup_interface_static "$iface:$ctr" "$config" setup_interface_static "$iface:$ctr" "$config"
;; ;;
*) *)
echo "Unsupported type '$proto' for alias config '$config'" echo "Unsupported type '$proto' for alias config '$config'"
return 1 return 1
;; ;;
@ -226,23 +226,32 @@ setup_interface() {
local vifmac="$4" local vifmac="$4"
local proto local proto
local macaddr local macaddr
local hasipv6
[ -n "$config" ] || { [ -n "$config" ] || {
config=$(find_config "$iface") config=$(find_config "$iface")
[ "$?" = 0 ] || return 1 [ "$?" = 0 ] || return 1
} }
proto="${3:-$(config_get "$config" proto)}" proto="${3:-$(config_get "$config" proto)}"
prepare_interface "$iface" "$config" "$vifmac" || return 0 prepare_interface "$iface" "$config" "$vifmac" || return 0
[ "$iface" = "br-$config" ] && { [ "$iface" = "br-$config" ] && {
# need to bring up the bridge and wait a second for # need to bring up the bridge and wait a second for
# it to switch to the 'forwarding' state, otherwise # it to switch to the 'forwarding' state, otherwise
# it will lose its routes... # it will lose its routes...
ifconfig "$iface" up ifconfig "$iface" up
sleep 1 sleep 1
} }
# Check whether this interface has an IPv6 address
# defined and ensure that the kmod is loaded since
# ifup could be triggered before modules are loaded.
config_get hasipv6 "$config" ip6addr
[ -n "$hasipv6" ] && [ ! -d /proc/sys/net/ipv6 ] && {
grep -q '^ipv6' /etc/modules.d/* && insmod ipv6
}
# Interface settings # Interface settings
config_get mtu "$config" mtu config_get mtu "$config" mtu
config_get macaddr "$config" macaddr config_get macaddr "$config" macaddr
@ -285,7 +294,7 @@ setup_interface() {
;; ;;
*) *)
if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then
eval "setup_interface_$proto '$iface' '$config' '$proto'" eval "setup_interface_$proto '$iface' '$config' '$proto'"
else else
echo "Interface type $proto not supported." echo "Interface type $proto not supported."
return 1 return 1
@ -307,7 +316,7 @@ setup_interface() {
unbridge() { unbridge() {
local dev="$1" local dev="$1"
local brdev local brdev
[ -x /usr/sbin/brctl ] || return 0 [ -x /usr/sbin/brctl ] || return 0
brctl show | grep "$dev" >/dev/null && { brctl show | grep "$dev" >/dev/null && {
# interface is still part of a bridge, correct that # interface is still part of a bridge, correct that