Okay, I think I found it.  The problem is with services_dhcp.php - 
 
  if($_POST['staticarp'] == "yes")
   $config['dhcpd'][$if]['staticarp'] = true;
  else
   unset($config['dhcpd'][$if]['staticarp']);
  write_config();
  /* static arp configuration */
                if (isset($config['dhcpd'][$if]['staticarp']))
                    interfaces_staticarp_configure($if);
The if statement in bold will always be false if staticarp is off (not checked), in otherwords unset via 'unset($config['dhcpd'][$if]['staticarp']);".  So this means that 'interfaces_staticarp_configure($if);' is never executed when you turn off static arp, so the function
interfaces_staticarp_configure($if) is never called, so it's else statement is never executed.
 
So I would think the fix to be applied is either this
1. 
  /* static arp configuration */
                /* if (isset($config['dhcpd'][$if]['staticarp'])) */
   interfaces_staticarp_configure($if);
 
or this
2. 
  /* static arp configuration */
                if (isset($config['dhcpd'][$if]['staticarp']))
                      interfaces_staticarp_configure($if);
                else
                      interfaces_staticarp_configure($if);
 
I am hoping this will be corrected.  Thanks.
 
Let me know if I am posting this bug / resolution in the wrong place.

From: Wesley K. Joyce [mailto:[EMAIL PROTECTED]
Sent: Fri 2/24/2006 11:53 PM
To: [email protected]
Subject: [pfSense Support] BUG : DHCP - Static ARP

When I turn on the static arp feature, it executes the code in red.  When I turn off the feature, it does not execute the code in blue.  This appears to be why turning this off is broken, so my question is why?  I don't know how to debug php, but the if statement looks logical.
 
TESTING-SNAPSHOT-02-19-06
 
/etc/inc/services.inc
 
function interfaces_staticarp_configure($if) {
 global $config, $g;
 if(isset($config['system']['developerspew'])) {
  $mt = microtime();
  echo "interfaces_staticarp_configure($if) being called $mt\n";
 }
       
        $ifcfg = $config['interfaces'][$if];
        /* Enable staticarp, if enabled */
        if(isset($config['dhcpd'][$if]['staticarp'])) {
                mwexec("/sbin/ifconfig " . escapeshellarg($ifcfg['if']) . " staticarp " );
                mwexec("/usr/sbin/arp -ad > /dev/null 2>&1 ");

                if (is_array($config['dhcpd'][$if]['staticmap'])) {
                        foreach ($config['dhcpd'][$if]['staticmap'] as $arpent) {
                                mwexec("/usr/sbin/arp -s " . escapeshellarg($arpent['ipaddr']) . " " . escapeshellarg($arpent['mac']));
                        }
                       
                }
        } else {
                mwexec("/sbin/ifconfig " . escapeshellarg($ifcfg['if']) . " -staticarp " );
                mwexec("/usr/sbin/arp -ad > /dev/null 2>&1 ");

        }
        return 0;
}

Reply via email to