Hi Johannes,
I attach the script that I am using to load mac80211_hwsim. What you need to do is:
1) Execute the script to load two mesh interfaces mesh0 and mesh1.
2) Load wmediumd (the version in GitHub: https://github.com/cozybit/wmediumd), and use as config file the file that I am attaching.
3) Ping from mesh0 to mesh1: ping -I mesh0 192.168.77.11
You will see in syslog a kernel crash, followed by mac80211_hwsim deregistering the netlink socket. Then the ping proceeds normally because wmediumd is dettached.
Thanks for your help!
Cheers
Daniel
El Jueves 5 de diciembre de 2013 17:25, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> escribió:
On Thu, 2013-12-05 at 16:14 +0000, Dani Camps wrote:
> I am only loading mac80211_hwsim with the parameter "radios=2". I am
> not specifying anything about "channels", which looking at the code
> should be 1.
Ok. What's the easiest way to reproduce this? Do I need
hostapd/wpa_supplicant and wmediumd, or something else?
johannes
############### #
# Configuration #
#################
NUM_RADIOS=2
sudo modprobe mac80211
sudo modprobe mac80211_hwsim channels=1 radios=$NUM_RADIOS
echo "-> Modules loaded"
sleep 2
# Prepare ip rules for send-to-self
ip rule flush
ip rule del pref 0 lookup local
ip rule add pref 5000 lookup local
ip rule add pref 32766 lookup main
ip rule add pref 32767 lookup default
#Configure the mesh interfaces
PHYS=`find /sys/kernel/debug/ieee80211 -name hwsim | cut -d/ -f 6 | sort`
i=0
for phy in ${PHYS}; do
#Configure the mesh interface
iw phy ${phy} interface add mesh$i type mp mesh_id bazooka
ip address add 192.168.77.1$i/24 dev mesh$i
ip link set mesh$i up
i=$(($i+1))
done
#Configure the IP rules required to implement send-to-self
for i in $(seq 0 $(($NUM_RADIOS - 1))); do
#rule for incoming packets on each interface --> go to local table
ip rule add pref $(($i+10)) iif mesh$i lookup local
#create a rule for each pair i->j to point to table i->j where the default device is mesh$j. This ensures t$
for j in $(seq 0 $(($NUM_RADIOS - 1))); do
if [ "$j" -ne "$i" ]; then
#table_idx=$(($j+($i+1)*100))
table_idx=$(($j+100))
#table_prio=$table_idx
table_prio=$(($j+($i+1)*100))
ip rule add pref $table_prio from 192.168.77.1$j to 192.168.77.1$i lookup $table_idx
ip route flush table $table_idx
ip route add default dev mesh$j table $table_idx
fi
done
echo 1 >/proc/sys/net/ipv4/conf/mesh$i/accept_local
done
# Bringing up hwsim0, otherwise the packets do not flow through mac80211_hwsim
ifconfig hwsim0 up
ifaces :
{
count = 2;
ids = ["42:00:00:00:00:00", "42:00:00:00:01:00" ];
};
prob :
{
rates = 12;
matrix_list = (
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ],
[ -1.000, 0.500, 0.500, -1.000 ]
);
};