fix broken Throughput Widget and Wireshark for node numbers above 10

this also fixes the Throughput Widget results when multiple sessions are running
This commit is contained in:
Jeff Ahrenholz 2017-03-31 09:55:26 -07:00
parent de923091b3
commit 724534e3ac
2 changed files with 9 additions and 10 deletions

View file

@ -1483,10 +1483,11 @@ proc addInterfaceCommand { node parentmenu txt cmd state isnodecmd } {
if { $isnodecmd } { ;# run command in a node
set icmd "spawnShell $node \"$cmd $ifc\""
} else { ;# exec a command directly
set nodenum [string range $node 1 end]
set node_num [string range $node 1 end]
set hex [format "%x" $node_num]
set ifnum [string range $ifc 3 end]
set localifc veth$nodenum.$ifnum.$ssid
set icmd "exec $cmd $localifc &"
set ifname "veth$hex\\.$ifnum\\.$ssid"
set icmd "exec $cmd $ifname &"
}
$childmenu add command -label "$ifc$addr" -state $state -command $icmd
}

View file

@ -919,6 +919,7 @@ proc getstats_bytes_netgraph { raw_input } {
}
proc getstats_link_ifname { link } {
global g_current_session
set lnode1 [lindex [linkPeers $link] 0]
set lnode2 [lindex [linkPeers $link] 1]
@ -932,13 +933,10 @@ proc getstats_link_ifname { link } {
set ifname [ifcByPeer $lnode2 $lnode1]
}
if { $node_num < 0 } { return "" }
set node_num [format %x $node_num]
# TODO: need to determine session number used by daemon
# instead this uses a '*' character for a regexp match against
# the interfaces in /proc/net/dev
set ssid [shortSessionID $g_current_session]
set hex [format "%x" $node_num]
set ifname "veth$hex\\.[string range $ifname 3 end]\\.*"
set ifnum [string range $ifname 3 end]
set ifname "veth$hex.$ifnum.$ssid"
return $ifname
}