Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Spoofmac on VLANs don't work in 2.2.4

    Scheduled Pinned Locked Moved General pfSense Questions
    21 Posts 6 Posters 2.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      David_W
      last edited by

      It's probably worth posting a link to your findings in Redmine #2859.

      The code in question is in the interface_configure() function of /etc/inc.interfaces.inc (around line 2907):

              $mac = get_interface_mac($realhwif);
              /*
               * Don't try to reapply the spoofed MAC if it's already applied.
               * When ifconfig link is used, it cycles the interface down/up, which triggers
               * the interface config again, which attempts to spoof the MAC again,
               * which cycles the link again...
               */
              if ($wancfg['spoofmac'] && ($wancfg['spoofmac'] != $mac)) {
                      mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) .
                              " link " . escapeshellarg($wancfg['spoofmac']));
              }  else {
      
                      if ($mac == "ff:ff:ff:ff:ff:ff") {
                              /*   this is not a valid mac address.  generate a
                               *   temporary mac address so the machine can get online.
                               */
                              echo gettext("Generating new MAC address.");
                              $random_mac = generate_random_mac_address();
                              mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) .
                                      " link " . escapeshellarg($random_mac));
                              $wancfg['spoofmac'] = $random_mac;
                              write_config();
                              file_notice("MAC Address altered", sprintf(gettext('The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s'), $realif, $random_mac), "Interfaces");
                      }
              }
      
      

      The thought occurs that replacing $realhwif (and the one seemingly incorrect occurrence of $realif) with $interface_to_check throughout that block of code might make the behaviour more correct - act on the interface itself except in the case of PPPoE, where you need to be acting on the parent interface.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.