How to solve MAC_802_11: accessing MAC cache_ array out of range

63 views
Skip to first unread message

Wong Wei Lok

unread,
Oct 27, 2023, 2:01:34 AM10/27/23
to Network Simulator 2 (NS2)
I trying to simulate MIPv6 and faced problem MAC_802_11: accessing MAC cache_  array out of range.

I am using ns-2.35 and fhmip_ns235.patch. After Installation, according to the fhmip_simula.tcl file provided in ns2.35/tcl/ex/fhmip, i block the code and start simulation.
From the output text found out error:
 MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
How to solve the problem?
_________________________________________________________________________________________
Output text after simulation:
num_nodes is set 1
INITIALIZE THE LIST xListHead
Simulation started...
0.000340 BS send ADS 1.0.0
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 129.2
SORTING LISTS ...DONE!
0.004777 MH 1.0.1 received ADS with coa 1.0.0
0.004777 MH 1.0.1 sends request (packet 1) to 1.0.0
0.004777 MH agent list [COA 511.2047.2047]: 1.0.0-(0/0 0)
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
0.009664 HA 1.0.0 updated, MH back home, packet 1
0.011924 MH 1.0.1 received reply from BS 1.0.0 [COA: 511.2047.2047], packet 1
Executing L2 handoff
0.014205 BS send ADS 3.1.0
0.031924 MH 1.0.1 has new coa (1.0.0) and new map (511.2047.2047)
0.031924 Complete L2 handoff
0.088123 BS send ADS 4.1.0
1.000340 BS send ADS 1.0.0
1.005155 MH 1.0.1 received ADS with coa 1.0.0
1.005155 MH 1.0.1 sends request (packet 5) to 1.0.0
1.005155 MH agent list [COA 1.0.0]: [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
1.007211 HA 1.0.0 updated, MH back home, packet 5
1.009891 MH 1.0.1 received reply from BS 1.0.0 [COA: 1.0.0], packet 5
1.014205 BS send ADS 3.1.0
1.088123 BS send ADS 4.1.0
2.000340 BS send ADS 1.0.0
2.010577 MH 1.0.1 received ADS with coa 1.0.0
2.010577 MH 1.0.1 sends request (packet 9) to 1.0.0
2.010577 MH agent list [COA 1.0.0]: [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
2.012593 HA 1.0.0 updated, MH back home, packet 9
2.014205 BS send ADS 3.1.0
2.014873 MH 1.0.1 received reply from BS 1.0.0 [COA: 1.0.0], packet 9
2.088123 BS send ADS 4.1.0
3.000340 BS send ADS 1.0.0
3.005084 MH 1.0.1 received ADS with coa 1.0.0
3.005084 MH 1.0.1 sends request (packet 13) to 1.0.0
3.005084 MH agent list [COA 1.0.0]: [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
3.007180 HA 1.0.0 updated, MH back home, packet 13
3.009900 MH 1.0.1 received reply from BS 1.0.0 [COA: 1.0.0], packet 13
3.014205 BS send ADS 3.1.0
3.088123 BS send ADS 4.1.0
4.000340 BS send ADS 1.0.0
4.009597 MH 1.0.1 received ADS with coa 1.0.0
4.009597 MH 1.0.1 sends request (packet 17) to 1.0.0
4.009597 MH agent list [COA 1.0.0]: [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
4.011433 HA 1.0.0 updated, MH back home, packet 17
4.013893 MH 1.0.1 received reply from BS 1.0.0 [COA: 1.0.0], packet 17
4.014205 BS send ADS 3.1.0
4.088123 BS send ADS 4.1.0
5.000340 BS send ADS 1.0.0
daddr = [1.0.1] saddr = [0.0.0] last_hop = [0.0.0] varify_ = [1.0.0], packet 20
5.005646 Varifier drop! ( packet 20 )
5.008998 MH 1.0.1 received ADS with coa 1.0.0
5.008998 MH 1.0.1 sends request (packet 22) to 1.0.0
5.008998 MH agent list [COA 1.0.0]: [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
5.011154 HA 1.0.0 updated, MH back home, packet 22
5.013994 MH 1.0.1 received reply from BS 1.0.0 [COA: 1.0.0], packet 22
5.014205 BS send ADS 3.1.0
5.088123 BS send ADS 4.1.0
6.000340 BS send ADS 1.0.0
6.003247 MH 1.0.1 received ADS with coa 1.0.0
6.003247 MH 1.0.1 sends request (packet 26) to 1.0.0
6.003247 MH agent list [COA 1.0.0]: [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 0, size 1)!
6.005103 HA 1.0.0 updated, MH back home, packet 26
6.007603 MH 1.0.1 received reply from BS 1.0.0 [COA: 1.0.0], packet 26
6.014205 BS send ADS 3.1.0
6.088123 BS send ADS 4.1.0
7.000340 BS send ADS 1.0.0
7.014205 BS send ADS 3.1.0
7.088123 BS send ADS 4.1.0
8.000340 BS send ADS 1.0.0
8.014205 BS send ADS 3.1.0
8.019705 MH 1.0.1 received ADS with coa 3.1.0
dst of request 2.0.0 (MAP), packet 35
8.019705 MH 1.0.1 sends request to 3.1.0
8.019705 MH agent list [COA 1.0.0]: 3.1.0-(0/0 0) [1.0.0-(0/0 0)]
MAC_802_11: accessing MAC cache_ array out of range (src 2, dst 1, size 1)!
MAC_802_11: accessing MAC cache_ array out of range (src 1, dst 2, size 1)!
8.024292 BS 3.1.0 forwarding map-reg-request from 1.0.1 to MAP 2.0.0, packet 35
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o35: no target for slot 0
_o35 type: Classifier/Port/Reserve
content dump:
classifier _o35
0 offset
0 shift
2147483647 mask
1 slots
slot 1: _o36 (Classifier/Addr/MIPDecapsulator)
---------- Finished standard no-slot{} default handler ----------

_________________________________________________________________________________________
fhmip_simula.tcl:
#
# This script was written for the sole purpose of showing the fhmip ns-2 extnesion.
#
# July 2003 - Robert Hsieh
#
#
# Simulation Instructions:
#
#
# To simulate Mobile IP:
# classic handoff mechanism (miss 2 advertisement msg).
# Procedures: mip-reg.cc => block out MAP_MODE, FAST_HANDOVER, MAP_FAST_HANDOVER
#             simula.tcl => block out 'priority' associated with all nodes,
#                                 block out 'attach-mapagent'
#
# To simulate Mobile IP with priority handoff:
# Using priority handoff. Mobile node switch to nodes with higher priority (shown inside adv msg). Prioirty handoff
#         is included in the J. Widmer's ns-extnesion package.
# Procedures: mip-reg.cc => block out MAP_MODE, FAST_HANDOVER, MAP_FAST_HANDOVER
#             simula.tcl => make sure priority is set for nodes
#                                 block out 'attach-mapagent'
#                                  
# To simualte Hierarchical Mobile IP:
# Using priority handoff.
# Procedures: mip-reg.cc => unblock MAP_MODE
#             simula.tcl => make sure priority is set for nodes
#                                 unblock 'attach-mapagent'
#
# To simulate (Flat Mobile IP with Fast-handover):
# Using priority handoff.
# Procedures: mip-reg.cc => unblock FAST_HANDOVER (block both MAP_MODE and FAST_MAP_HANDOVER)
#             simula.tcl => make sure priority is set for nodes
#                                 block out 'attach-mapagent'
#
# To simulate (Hierarchical Mobile IP with Fast-handover):
# Using priority handoff.
# Procedures: mip-reg.cc => unblock MAD_MODE, FAST_HANDOVER, FAST_MAP_HANDOVER
#             simula.tcl => make sure priority is set
#                                 unblock 'attach-mapagent'
#
#


# upgraded to NS2.31 by Pedro Vale Estrela (IST/TULisbon), March 2007  (FHMIP+NOAH)

set ns_ [new Simulator]
$ns_ node-config -addressType hierarchical

AddrParams set domain_num_ 5
 lappend cluster_num 2 1 1 2 2
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 2 1 1 1 1 1
AddrParams set nodes_num_ $eilastlevel


# to show ack number, header flags, header length
# Note: only useful though if using tcpfull
#Trace set show_tcphdr_ 1



set tracefd [open traffic.tr w]
$ns_ use-newtrace
$ns_ trace-all $tracefd


set namtracefd [open traffic.nam w]
$ns_ namtrace-all $namtracefd


set topo [new Topography]
$topo load_flatgrid 1000 1000
set god_ [create-god 1]


##############
# NODE SETUP #
##############

# Wired nodes => CH, MAP, N1, N2, N3
#

#CH - 0
set CN [$ns_ node 0.0.0]

#MAP - 1
set MAP [$ns_ node 2.0.0]

#N1 - 2
set N1 [$ns_ node 0.1.0]

#N2 - 3
set N2 [$ns_ node 3.0.0]

#N3 - 4
set N3 [$ns_ node 4.0.0]

# NOAH nodes (wireless+wired) => HA, PAR, NAR
# MN is a special node (i.e. a NOAH node with wiredrouting turned off)

set chan_ [new Channel/WirelessChannel]
$ns_ node-config -mobileIP ON \
                  -adhocRouting NOAH \
                  -llType LL \
                  -macType Mac/802_11 \
                  -ifqType Queue/DropTail/PriQueue \
                  -ifqLen 50 \
                  -antType Antenna/OmniAntenna \
                  -propType Propagation/TwoRayGround \
                  -phyType Phy/WirelessPhy \
                  -channel $chan_ \
    -topoInstance $topo \
                  -wiredRouting ON \
  -agentTrace ON \
                  -routerTrace OFF \
                  -macTrace ON


#HA - 5
set HA [$ns_ node 1.0.0]
#@[$HA set regagent_] priority 3

#MN - 6
$ns_ node-config -wiredRouting OFF
set MN [$ns_ node 1.0.1]
[$MN set regagent_] set home_agent_ [AddrParams addr2id [$HA node-addr]]
$ns_ node-config -wiredRouting ON

#PAR - 7
set PAR [$ns_ node 3.1.0 2.0.0]
#@[$PAR set regagent_] priority 3

#NAR - 8
set NAR [$ns_ node 4.1.0 2.0.0]
#@[$NAR set regagent_] priority 4



#####################
# PLACEMENT of NODE #
#####################

$CN set X_ 80.0
$CN set Y_ 5.0

$N1 set X_ 120.0
$N1 set Y_ 10.0

$HA set X_ 160.0
$HA set Y_ 5.0

$MN set X_ 160.0
$MN set Y_ 5.1

$MAP set X_ 120.0
$MAP set Y_ 15.0

$N2 set X_ 85.0
$N2 set Y_ 60.0

$N3 set X_ 155.0
$N3 set Y_ 60.0

$PAR set X_ 85.0
$PAR set Y_ 135.0

$NAR set X_ 155.0
$NAR set Y_ 135.0


##############
# LINK SETUP #
##############

# droptail = (FIFO), RED = Random Early Detection
$ns_ duplex-link $CN $N1 100Mb 2ms RED         ;# Since consitiute a domain, so we simplify it by just use 100M and keep the delay of 2ms constant
$ns_ duplex-link $HA $N1 100Mb 2ms RED         ;# same as above
$ns_ duplex-link $MAP $N1 100Mb 50ms RED       ;# We increase the dealy to 50ms to show the advantange of MAP
$ns_ duplex-link $N2 $MAP 10Mb 2ms RED         ;# All nodes below MAP belongs to a single domain, therefore we keep the delay at constant 2ms and vary the
$ns_ duplex-link $N3 $MAP 10Mb 2ms RED         ;#  bandwidth in a decreasing order, i.e. from 100M to 10M to 1M.
$ns_ duplex-link $PAR $N2 1000Kb 2ms DropTail
$ns_ duplex-link $NAR $N3 1000Kb 2ms DropTail




#####################
# APPLICATION SETUP #
#####################

# RCH Attaching the MAP agent.
#@$ns_ attach-mapagent $MAP       ;# Need to enable MAP_MODE in mip-reg.cc

set tcp_(1) [$ns_ create-connection TCP $CN TCPSink $MN 1]
$tcp_(1) set window_ 32
$tcp_(1) set packetSize_ 512

# RCH  Setting connection monitor - to compensate the non existance of frequency jumping in 802.11.
$ns_ connection-monitor 1 $MN


#trace all congestion window (cwnd) value for this TCP connection
set cwndtrace [open all.cwnd w]
$tcp_(1) trace cwnd_
$tcp_(1) attach $cwndtrace

set ftp_(1) [new Application/FTP]
$ftp_(1) attach-agent $tcp_(1)
$ns_ at 5.0 "$ftp_(1) start"
$ns_ at 80.0 "$ftp_(1) stop"



############
# SCENARIO #
############

#$ns_ at 6.0 "$MN set X_ 85.0"
#$ns_ at 6.0 "$MN set Y_ 135.1"

$ns_ at 6.0 "$MN setdest 85.0 135.1 100" ;# pmsrve: move MN to PAR at a really high speed

#
# http://www.tkn.tu-berlin.de/publications/papers/Handover_Blackout_Duration_of_L3_Mobility_Management_Schemes1.pdf
#
# We had to change the script to do this with the setdest command instead of just changing the
# position of the node since ns-2.28 was not #updating the topological lists properly if the
# node was moved this way.
#
#
# $mobilenode setdest X Y s
#
# This command is used to setup a destination for the mobilenode.
# The mobile node starts moving towards destination given by <X> and <Y> at a speed of <s> m/s.
#


$ns_ at 10.0 "$MN setdest 155.0 135.1 1"


for {set t 10} {$t < 80} {incr t 10} {
    $ns_ at $t "puts stderr \"completed through $t/80 secs...\""
}

$ns_ at 0.0 "puts stderr \"Simulation started...\""


set opt(stop) 80


$ns_ at [expr $opt(stop) + 0.0001] "puts stderr \"Simulation finished\""
$ns_ at [expr $opt(stop) + 0.0002] "close $tracefd"
$ns_ at [expr $opt(stop) + 0.0002] "close $namtracefd"
$ns_ at [expr $opt(stop) + 0.0003] "$ns_ halt"

$ns_ run

knudfl

unread,
Oct 27, 2023, 4:47:18 AM10/27/23
to Network Simulator 2 (NS2)
ns-[fhmip]  your-modified__fhmip_simula.tcl : No chance
__________________
$ diff -dbBwaur orig__fhmip_simula.tcl modified__fhmip_simula.tcl
@@ -189,7 +189,7 @@
#####################
 
# RCH Attaching the MAP agent.
-$ns_ attach-mapagent $MAP       ;# Need to enable MAP_MODE in mip-reg.cc
+#@$ns_ attach-mapagent $MAP       ;# Need to enable MAP_MODE in mip-reg.cc
________________________

.......... i.e. you have an incompatible modification in line 192.
I.e. i.e.  this must be included :        $ns_ attach-mapagent $MAP

cd FHMIP/ex-fhmip__noah/fhmip/
ns-fhmip fhmip_simula.tcl    : No issues.

Wong Wei Lok

unread,
Oct 27, 2023, 6:08:44 AM10/27/23
to Network Simulator 2 (NS2)
First of all, thanks for your reply sir.
There is no problem when simulate fhmipv6 using the patch.
From fhmip_simula.tcl, i found out that it able to simulate MIPv6,FMIPv6 by blocking certain part of code in specific file.
Error only occur when i try to simulate MIPv6 and FMIPv6.
The simulation instruction are at line7 to line39 in fhmip_simula.tcl and line79 to line88 in mip-reg.cc

line7 to line39 fhmip_simula.tcl:
line79 to line 88 mip-reg.cc:
/* RCH

   Operation Procedures!!! Read this first!!

   To perform Mobile IP: block everything
   To perform Hierarchical Mobile IP: unblock MAP_MODE
   To perform (Flat) Mobile IP with Fast-handover: unblock FAST_HANDOVER only, block everything else
   To perform Hierarchical Mobile IP with Fast-handover: unblock MAP_MODE, FAST_HANDOVER, FAST_MAP_HANDOVER

*/

knudfl

unread,
Oct 27, 2023, 8:51:46 AM10/27/23
to Network Simulator 2 (NS2)
Well, it's a tricky one ........ seemingly because of code age : Originally 2011 ?
I can run your file with ns-2.31 in PCLinuxOS 2023.
"Segmentation fault" happens a bit before the trace files have reached full size, but usable.
Other random tests: 
CentOS 6.10 - 32bit, no luck.  Ubuntu 16.04 - amd64, no luck, both are showing "-- Classfier::no-slot{} default handler"
..... So it all depends which Linux OS's you have access to.

cd ns-allinone-2.31/
export CC=gcc41 CXX=g++41 && ./install
cd ns-2.31/
cp ns ns231-fhmip
sudo cp ns231-fhmip /usr/local/bin/
--------- Simulation ...... wherever your file is ------
$ ns231-fhmip modified__fhmip_simula.tcl
... traffic.nam = 32kB, traffic.tr = 36kb

knudfl

unread,
Oct 27, 2023, 9:07:15 AM10/27/23
to Network Simulator 2 (NS2)
Correction : The above result is poor, i.e. the original fhmip_simula.tcl shows :
traffic.nam 47.2MB,  traffic.tr 32.8MB

Wong Wei Lok

unread,
Oct 28, 2023, 3:51:55 AM10/28/23
to Network Simulator 2 (NS2)
sir, could explain why the result is not good based on the size of both .nam and .tr file.

knudfl

unread,
Oct 28, 2023, 4:52:15 AM10/28/23
to Network Simulator 2 (NS2)
The fhmip code is ancient, there was fhmip for ns-2.28 also.

Other example: The widely used "nistmob + pmipv6" can be built with Ubuntu 8.04, no later Ubuntu !!
Luckily also with a modern 2011 OS : CentOS 6.10
And actually we don't have to build anything: Binary packages are available →
nist-pmip6-6LoWPAN-2.29-1.el6.i686.rpm  nist-pmip6_ns229-2-1.i386.rpm
nist-pmip6-6lowpan-ns_2.29-ubuntu12_i386.deb  nist-pmip6-ns_229-1-ubuntu12_i386.deb
..... all usable in later OS versions, like Ubuntu 18.04 .

Conclusion : There may be a way to build fhmip with some old OS ... I don't know.
Not much info on the net any more. ns2 was developed in the nineties, last century, and left unsupported many years ago. So the remains of ns2 info is getting less every year : Deleted.

Wong Wei Lok

unread,
Nov 1, 2023, 6:34:15 AM11/1/23
to Network Simulator 2 (NS2)
Sir, how u simulate fhmip using ns2.31? Are you using the file that u share in the google drive?
Cuz i try install 2.31 in ubuntu 22.04 with the setting of http://dk.archive.ubuntu.com/ubuntu/ bionic main universe in etc/apt/source.list.
Could you show what the requirement for installing ns2.31 and ns2.28 as well.

knudfl

unread,
Nov 1, 2023, 8:36:57 AM11/1/23
to Network Simulator 2 (NS2)
About "bionic main universe" : is meant for installing g++-4.8 only.
ns2 requirements are the same for all ns2 versions :
sudo apt install g++ g++-4.8 autoconf libtool libxmu-dev
And gcc41-c++_4.1.2-16_amd64.deb, please see the above post, Oct 27, 2023.
sudo apt install Downloads/gcc41-c++_4.1.2-16_amd64.deb
No reason really to use ns-2.31 : A very poor result with FHMIP.

About ns-2.28 : No fhmip code anymore that I know.
..... with tcl - tk 8.4.18
Building ns-2.28: cd ns-allinone-2.28/ && export CC=gcc41 CXX=g++41 && ./install
........ probably need an oldish OS like CentOS 6.10 .
I.e. not all ns2 will work in late Ubuntu's .....
Reply all
Reply to author
Forward
0 new messages