[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Emulation filters not working



I've been having a few issues with the ns emulation.  I can get it to record 
live network packets in my nam output file, but it doesn't work when I filter 
the packets.  If I just accept every incoming packet, I get the expected 
result of "going backwards in time."  However, any attempts to filter the 
incoming packets results in zero output.

I have tested my filters with tcpdump before putting them through nse, but 
nse doesn't pick up any of the packets.  For example, I'm trying to pull 
packets received on port 6665 of the localhost using the filter "dst port 
6665 and dst localhost."  tcpdump finds lots of packets, but nse finds none.  
Even if tcpdump is finding packets that I don't want it to, I would still 
like to see nse filters returning the same results.

Anyone else having similar difficulties?  Is this a RedHat 7.1 problem?

Just for completeness, here is the script I'm attempting to run:

------------------------------
set dotrace 1
set stoptime 120.0

set me "localhost"
set ns [new Simulator]

if { $dotrace } {
	set allchan [open jkd.tr w]
	$ns trace-all $allchan
	set namchan [open jkd.nam w]
	$ns namtrace-all $namchan
}

puts "Listening on $me"

$ns use-scheduler RealTime

set bpf0 [new Network/Pcap/Live]
set bpf1 [new Network/Pcap/Live]
$bpf0 set promisc_ true
$bpf1 set promisc_ true

set ipnet [new Network/IP]

set nd0 [$bpf0 open readonly eth0]
set nd1 [$bpf1 open readonly eth0]
$ipnet open writeonly

puts "bpf0($bpf0) on dev $nd0, bpf1($bpf1) on dev $nd1, ipnet is $ipnet"

set f0len [$bpf0 filter "dst port 6665 and dst host $me"]
set f1len [$bpf1 filter "src $me"]

puts "filter lengths: $f0len (bpf0), $f1len (bpf1)"
puts "dev $nd0 has address [$bpf0 linkaddr]"
puts "dev $nd1 has address [$bpf1 linkaddr]"

set a0 [new Agent/Tap]
set a1 [new Agent/Tap]
set a2 [new Agent/Tap]
puts "install nets into taps..."
$a0 network $bpf0
$a1 network $bpf1
$a2 network $ipnet

set node0 [$ns node]
set node1 [$ns node]
set node2 [$ns node]

puts "node0 id:[$node0 id], node1 id:[$node1 id], node2 id: [$node2 id]"

$ns simplex-link $node0 $node2 8Mb 100ms DropTail
$ns simplex-link $node1 $node2 8Mb 100ms DropTail

$ns attach-agent $node0 $a0
$ns attach-agent $node1 $a1
$ns attach-agent $node2 $a2

$ns connect $a0 $a2
$ns connect $a1 $a2

puts "scheduling termination at t=$stoptime"
$ns at $stoptime "exit 0"

puts "let's rock"
$ns run
----------------------------

Thanks,
Jason