I've got the same problem, and using this code does not solve the problem for all cases (in my particular simulation)
Instead, I'm using this with great success: In C++, at the top of ARPTable::arpresolve , insert this code that requires #include "utils_ns.h" (see http://tagus.inesc-id.pt/~pestrela/ns2/contributed_code.html#_Toc147652229) --- cut here --- TCL_EVALFr("ARP_find_mobile_iaddr2mac %d", dst); LL *ll = (LL *)TclObject::lookup(Tcl::instance().result()); if(!ll){ dprintf("Error: LL empty\n"); exit(-1); } int mac = ll->mac_->addr(); mac_->hdr_dst((char*) HDR_MAC(p), mac); return 0; --- cut here --- then, add this tcl code to your script or /tcl/lib/ns-lib.tcl. I'm not sure, but this code MIGHT require the NOAH extension because that for {set i 0} { $i < [Node set nn_] loop. --- cut here --- # Given the node handle, return the haddr, iaddr or ID proc NOAH_handle2iaddr { handle } { if { $handle == "-1" } { return "-1" } set iaddr [$handle address?] return $iaddr } # # Given the node's address in haddr, iaddr or ID, search and return the handle # (TODO:) create an array at creation to store these pairs for faster lookup # proc NOAH_iaddr2handle { node_iaddr } { if { $node_iaddr == "-1" } { return "-1" } set ns_ [Simulator instance] for {set i 0} { $i < [Node set nn_]} {incr i} { set node_handle [$ns_ set Node_($i)] if {[string compare [NOAH_handle2iaddr $node_handle] $node_iaddr] == 0} { return $node_handle } } return "-1" } ## ## PROC: returns the handle of a given NODE, by its iaddress ## ## FIXME: assume itf(0), codigo C++ devolve mac dessa interface ## ## this code is used by the disabled ARP (option 2) proc ARP_find_mobile_iaddr2mac { iaddr } { set ns_ [Simulator instance] set MH_node_handle [NOAH_iaddr2handle $iaddr] set ll [$MH_node_handle set ll_(0)] #puts "found: $MH_node_handle $ll" return $ll } --- cut here --- --------- Re: [ns] Disable ARP Ahmad Khayyat Wed, 28 Feb 2007 02:27:15 -0800 Never mind. The two lines work perfectly. They just happened to trigger another problem, which is taken care of now :) On Tue, 27 Feb 2007 18:27:37 -0500 Ahmad Khayyat <[EMAIL PROTECTED]> wrote: > What is the easiest way to disable the use of the ARP protocol? > I guess the IP address corresponds to the MAC address in ns-2, doesn't > it? So how do I make the LL/ARP modules use it immediately without > using ARP? > > I tried adding the following two lines at the top of > ARPTable::arpresolve(nsaddr_t dst, Packet *p, LL *ll) > > mac_->hdr_dst((char*) HDR_MAC(p), dst); > return 0; > > but that caused strange behaviour on rare occasions, where a packet > suddenly would appear in another far node. Playing with ARP doesn't > explain the problem for me, but somehow removing those two lines > gets rid of the strange behaviour. So, what is a proper way of > disabling ARP? > > Thanks.. > Ahmad