MAC filtering error



  • I'm getting the following error after applying a MAC filter under DHCP, however the entry is save and functional

    line 239 Warning: in_array() expects parameter 2 to be array, null given in /etc/inc/unbound.inc on
    line 239 Warning: in_array() expects parameter 2 to be array, null given in /etc/inc/unbound.inc on
    line 239 Warning: in_array() expects parameter 2 to be array, null given in /etc/inc/unbound.inc on
    line 239 Warning: in_array() expects parameter 2 to be array, null given in /etc/inc/unbound.inc on


  • Moderator

    That unbound error is related to DNS Servers .. Line 239 in Red.

    // Set up forwarding if it is configured
            if (isset($config['unbound']['forwarding'])) {
                    $dnsservers = array();
                    if (isset($config['system']['dnsallowoverride'])) {
                            $ns = array_unique(get_nameservers());
                            foreach($ns as $nameserver) {
                                    if ($nameserver)
                                            $dnsservers[] = $nameserver;
                            }
                    }
                    $sys_dnsservers = array_unique(get_dns_servers());
                    foreach ($sys_dnsservers as $sys_dnsserver) {
                            if ($sys_dnsserver && (!in_array($sys_dnsserver, $ns))) {
                                    $dnsservers[] = $sys_dnsserver;
                            }
                    }



  • thank you for the reply, how to fix/prevent the error ?


  • Moderator

    @samham:

    thank you for the reply, how to fix/prevent the error ?

    You can post a bug report in Redmine.

    It seems you enabled "Forwarding mode" in Unbound, and its trying to read your DNS servers but they are probably not defined. So when it runs the code and hits line 239, the foreach fails because the $sys_dnsservers array is empty.. You could try manually editing that code (at your own risk )  :)    Adding the lines in Red below..

    // Set up forwarding if it is configured
            if (isset($config['unbound']['forwarding'])) {
                    $dnsservers = array();
                    if (isset($config['system']['dnsallowoverride'])) {
                            $ns = array_unique(get_nameservers());
                            foreach ($ns as $nameserver) {
                                    if ($nameserver)
                                            $dnsservers[] = $nameserver;
                            }
                    }
                    $sys_dnsservers = array_unique(get_dns_servers());
                  if (!empty($sys_dnsservers)) {
                            foreach ($sys_dnsservers as $sys_dnsserver) {
                                    if ($sys_dnsserver && (!in_array($sys_dnsserver, $ns))) {
                                            $dnsservers[] = $sys_dnsserver;
                                    }
                            }
                    }

    if (!empty($dnsservers)) {
                            $forward_conf .=<<


  • Banned

    @BBcan177:

    @samham:

    thank you for the reply, how to fix/prevent the error ?

    You can post a bug report in Redmine.

    Nooooo. This been fixed about 1 month ago.



  • I'm already running 2.2.2 are you saying it was fixed in version 2.2.2 or will it be included post 2.2.2?


  • Banned

    No, it has not been fixed in 2.2.2. Either use a 2.2.3 snapshot or apply the patch manually.

    https://redmine.pfsense.org/projects/pfsense/repository/revisions/98615a3156d86aed1a560f109087d7e1ad4bf990