--- kamikaze_7.09.orig/package/madwifi/files/lib/wifi/madwifi.sh	2008-09-11 13:29:21.000000000 +0200
+++ kamikaze_7.09/package/madwifi/files/lib/wifi/madwifi.sh	2008-09-11 13:29:58.000000000 +0200
@@ -1,6 +1,29 @@
 #!/bin/sh
 append DRIVERS "atheros"
 
+delroute() {
+# This script removes each entry for $device in the routing table,
+# to be used for avoiding confusion in the routing table.
+#  - by Dongsu Park <dpark1978@gmail.com>
+
+	local device="$1"
+	local rt_entries=$(route -n |grep $device)
+	local target netmask
+
+	if [ "x$rt_entries" = "x" ]; then
+		exit 0
+	fi
+
+	echo "$rt_entries" | 
+	while read line; do
+		target=$(echo $line | awk '{print $1}')
+		netmask=$(echo $line | awk '{print $3}')
+
+		echo "Removing target $target(netmask $netmask) from the routing table..."
+		route del -net $target netmask $netmask dev $device
+	done
+}
+
 scan_atheros() {
 	local device="$1"
 	local wds
@@ -250,6 +273,11 @@
 		esac
 		first=0
 	done
+	
+	# Now each routing table entry of wifi device(e.g. wifi0) should be
+	# removed, because it only causes routing to be confused.
+	# Added by Dongsu Park <dpark1978@gmail.com>
+	delroute "$device"
 }
 
 

