Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFSense 24.11 breaks smart compatibility #186

Open
stevo11811 opened this issue Nov 27, 2024 · 1 comment
Open

PFSense 24.11 breaks smart compatibility #186

stevo11811 opened this issue Nov 27, 2024 · 1 comment

Comments

@stevo11811
Copy link

stevo11811 commented Nov 27, 2024

Hello,

PFSense 24.11 removes the PHP smart code. This is a copied code snip from 23.09 util.php i believe, i have manually added it to my file but this will require some sort of fix for the new versions.

This code below is a terrible workaround that checks for a duplicate function if used on 23.09 and seems to work on my 24.11, sorry my ability is limited.

/* Locate disks that can be queried for S.M.A.R.T. data. */
if (!function_exists('get_smart_drive_list')) {
    function get_smart_drive_list() {
        /* SMART supports some disks directly, and some controllers directly,
         * See https://redmine.pfsense.org/issues/9042 */
        $supported_disk_types = array("ad", "da", "ada");
        $supported_controller_types = array("nvme");
        $disk_list = explode(" ", get_single_sysctl("kern.disks"));
        
        foreach ($disk_list as $id => $disk) {
            // We only want certain kinds of disks for S.M.A.R.T.
            // 1 is a match, 0 is no match, False is any problem processing the regex
            if (preg_match("/^(" . implode("|", $supported_disk_types) . ").*[0-9]{1,2}$/", $disk) !== 1) {
                unset($disk_list[$id]);
                continue;
            }
        }
        
        foreach ($supported_controller_types as $controller) {
            $devices = glob("/dev/{$controller}*");
            if (!is_array($devices)) {
                continue;
            }
            foreach ($devices as $device) {
                $disk_list[] = basename($device);
            }
        }
        
        sort($disk_list);
        return $disk_list;
    }
}
@rbicelli
Copy link
Owner

rbicelli commented Dec 4, 2024

Indeed is correct, will include it in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants