Broken "vnstat info" tab on pfSense 2.2.6 and vnstat 1.12



  • Hi everyone,

    I had issues with the "vnstat info" tab that would not display anything but a gray box when I selected an interface.

    Looking into the code of "/usr/local/www/diag_vnstat2.php" I discovered this block of code

    
    if ($_REQUEST['getactivity']) {
            if ($_REQUEST['sorttype']) {
                    $sorttype = escapeshellarg($_REQUEST['sorttype']);
            } else {
                    $sorttype = gettext("-h");
                    $text = shell_exec("/usr/local/bin/vnstat -i {$aaaa} {$sorttype}");
                    echo $text;
            }
            exit;
    }
    
    

    By moving the "$text" and the following echo line outside of the if statement, it worked.

    Like this:

    
    if ($_REQUEST['getactivity']) {
            if ($_REQUEST['sorttype']) {
                    $sorttype = escapeshellarg($_REQUEST['sorttype']);
            } else {
                    $sorttype = gettext("-h");
            }
            $text = shell_exec("/usr/local/bin/vnstat -i {$aaaa} {$sorttype}");
            echo $text;
            exit;
    }
    
    

    I hope this can help someone else with that issue