From 724534e3acb691221b9bc0b89327533731497a60 Mon Sep 17 00:00:00 2001 From: Jeff Ahrenholz Date: Fri, 31 Mar 2017 09:55:26 -0700 Subject: [PATCH] fix broken Throughput Widget and Wireshark for node numbers above 10 this also fixes the Throughput Widget results when multiple sessions are running --- gui/editor.tcl | 9 +++++---- gui/widget.tcl | 10 ++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gui/editor.tcl b/gui/editor.tcl index c451c1e7..a69ec4f8 100644 --- a/gui/editor.tcl +++ b/gui/editor.tcl @@ -1475,7 +1475,7 @@ proc addInterfaceCommand { node parentmenu txt cmd state isnodecmd } { $parentmenu add cascade -label $txt -menu $childmenu -state $state if { ! $isnodecmd } { if { $g_current_session == 0 } { set state disabled } - set ssid [shortSessionID $g_current_session] + set ssid [shortSessionID $g_current_session] } foreach ifc [ifcList $node] { set addr [lindex [getIfcIPv4addr $node $ifc] 0] @@ -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 } diff --git a/gui/widget.tcl b/gui/widget.tcl index 19fe6d0b..12c40499 100644 --- a/gui/widget.tcl +++ b/gui/widget.tcl @@ -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 }