diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-08-02 20:17:12 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-08-02 20:17:12 +0000 |
commit | a4d9f914534696d684d913a79a73643db81c652a (patch) | |
tree | 60e2a32c34e4e502dad0247c511e8c9291fea2d5 /etc/inc/interfaces.inc | |
parent | f0dcff6fa875d8d02fca6b72817e503dca8fee9f (diff) | |
download | pfsense-a4d9f914534696d684d913a79a73643db81c652a.zip pfsense-a4d9f914534696d684d913a79a73643db81c652a.tar.gz |
Add LAN bridging option
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 3c00050..de4a915 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -111,6 +111,24 @@ function interfaces_lan_configure() { file_notice("MAC Address altered", "The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface {$lancfg['if']} has been automatically replaced with {$random_mac}", "Interfaces"); } } + + /* bridged? */ + if ($optcfg['bridge']) { + mwexec("/sbin/ifconfig " . escapeshellarg($optcfg['if']) . " delete up"); + /* use open/netBSD style bridge */ + mwexec("/sbin/ifconfig bridge{$bridges_total} create"); + mwexec("/sbin/ifconfig bridge{$bridges_total} addm {$optcfg['if']} addm {$config['interfaces'][$optcfg['bridge']]['if']} up"); + mwexec("/sbin/ifconfig bridge{$bridges_total} stp {$optcfg['if']} add {$config['interfaces'][$optcfg['bridge']]['if']}"); + + $fd = fopen("{$g['tmp_path']}/bridge_config_{$optcfg['if']}", "w"); + fwrite($fd, "/sbin/ifconfig bridge{$bridges_total} create\n"); + fwrite($fd, "/sbin/ifconfig bridge{$bridges_total} addm {$optcfg['if']} addm {$config['interfaces'][$optcfg['bridge']]['if']} up\n"); + fwrite($fd, "/sbin/ifconfig bridge{$bridges_total} stp {$optcfg['if']} add {$config['interfaces'][$optcfg['bridge']]['if']}\n"); + fclose($fd); + + /* lets keep track of the amount of bridges initialized */ + $bridges_total++; + } /* media */ if ($lancfg['media'] || $lancfg['mediaopt']) { |