initial commit of file from CVS for smeserver-bridge-interface on Sat Sep 7 20:11:17 AEST 2024
This commit is contained in:
@@ -0,0 +1 @@
|
||||
br0
|
1
root/etc/e-smith/db/configuration/defaults/bridge/status
Normal file
1
root/etc/e-smith/db/configuration/defaults/bridge/status
Normal file
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
tap0
|
1
root/etc/e-smith/db/configuration/defaults/bridge/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/bridge/type
Normal file
@@ -0,0 +1 @@
|
||||
service
|
21
root/etc/e-smith/db/configuration/migrate/50bridge-interface
Normal file
21
root/etc/e-smith/db/configuration/migrate/50bridge-interface
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
my $bridge = $DB->get('bridge') || $DB->new_record('bridge', {type => 'service'});
|
||||
my $brStatus = $bridge->prop('status') || 'enabled';
|
||||
|
||||
# Return nothing if bridge is disabled
|
||||
return "" if ($brStatus eq 'disabled');
|
||||
|
||||
my $br = $bridge->prop('bridgeInterface') || 'br0';
|
||||
my $IntIfConf = $DB->get('InternalInterface');
|
||||
my $IntIfName = $IntIfConf->prop('Name');
|
||||
|
||||
# If the InternalInterface Name is the same as the bridge, there's nothing to do
|
||||
return "" if ($IntIfName eq $br);
|
||||
|
||||
# else, we store the old InternalInterface Name in ethernetInterface
|
||||
# and we set the InternalInterface to be the bridge
|
||||
|
||||
$bridge->set_prop('ethernetInterface',$IntIfName);
|
||||
$IntIfConf->set_prop('Name',$br);
|
||||
}
|
||||
|
35
root/etc/e-smith/events/actions/bridge-disable
Normal file
35
root/etc/e-smith/events/actions/bridge-disable
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/perl -w
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2011 Firewall-Services
|
||||
# daniel@firewall-services.com
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $c = esmith::ConfigDB->open() || die "Error opening the ConfigDB\n";
|
||||
my $bridge = $c->get('bridge') || $c->new_record('bridge', {type => 'service'});
|
||||
my $status = $bridge->prop('status') || 'enabled';
|
||||
my $internal = $bridge->prop('ethernetInterface') || 'eth0';
|
||||
|
||||
if ($status eq 'enabled'){
|
||||
$c->set_prop('bridge', 'OldStatus', 'enabled');
|
||||
$c->set_prop('bridge', 'status', 'disabled');
|
||||
$c->set_prop('InternalInterface', 'Name', "$internal");
|
||||
}
|
||||
|
||||
exit (0);
|
38
root/etc/e-smith/events/actions/bridge-enable
Normal file
38
root/etc/e-smith/events/actions/bridge-enable
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/perl -w
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2011 Firewall-Services
|
||||
# daniel@firewall-services.com
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $c = esmith::ConfigDB->open() || die "Error opening the ConfigDB\n";
|
||||
my $bridge = $c->get('bridge') || $c->new_record('bridge', {type => 'service'});
|
||||
my $status = $bridge->prop('status') || 'enabled';
|
||||
my $internal = $bridge->prop('bridgeInterface') || 'br0';
|
||||
|
||||
if ($status eq 'disabled'){
|
||||
my $oldstatus = $bridge->prop('OldStatus') || 'disabled';
|
||||
if ($oldstatus eq 'enabled'){
|
||||
$c->set_prop('bridge', 'status', 'enabled');
|
||||
$c->set_prop('InternalInterface', 'Name', "$internal");
|
||||
$c->get_prop_and_delete('bridge','OldStatus');
|
||||
}
|
||||
}
|
||||
|
||||
exit (0);
|
@@ -0,0 +1,20 @@
|
||||
{
|
||||
$interface=$InternalInterface{'Name'}||"hum";
|
||||
$bridgeif=(defined $bridge{bridgeInterface} )? $bridge{bridgeInterface}: "";
|
||||
#$bridgedif=(defined $bridge{ethernetInterface} ) ? $bridge{ethernetInterface} : undef;
|
||||
#$interface=(defined $bridgedif && $bridgedif eq $interface && defined $bridgeif) ? $bridgeif : $interface;
|
||||
# extra code if we want to hide the ethernet interface, howecer with only a little noise in dhcp log, we can keep the two intefaces
|
||||
$interface=( "$interface" ne "$bridgeif" && defined $bridgeif ) ? "$interface $bridgeif" : $interface;
|
||||
|
||||
$configfile='/etc/dhcpd.conf';
|
||||
$leasefile='/var/lib/dhcpd/dhcpd.leases';
|
||||
$OUT .="";
|
||||
}
|
||||
|
||||
[Service]
|
||||
# added for bridge interface
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/sh -c 'exec /usr/sbin/dhcpd -f -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases -user dhcpd -group dhcpd --no-pid {$bridgeif} >>/var/log/dhcpd/current 2>>/var/log/dhcpd/current'
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
Reference in New Issue
Block a user