1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 20:27:22 +01:00

* configlets/bsd/update_vlans: see #2105: generated script now

supports vlan interfaces with names that do not match vlan IDs
(OpenBSD, FreeBSD, shell script format).
This commit is contained in:
Vadim Kurland 2011-02-16 15:22:47 -08:00
parent f4858bfc83
commit 1f8363c84e
71 changed files with 375 additions and 347 deletions

View File

@ -1,5 +1,9 @@
2011-02-16 vadim <vadim@netcitadel.com>
* configlets/bsd/update_vlans: see #2105: generated script now
supports vlan interfaces with names that do not match vlan IDs
(OpenBSD, FreeBSD, shell script format).
* OSConfigurator_bsd_interfaces.cpp (sort_interface_names): see
#1807, #2104: arrange interface configuration commands in the
generated scritpt in such order that bridge and carp interfaces

View File

@ -462,7 +462,11 @@ void OSConfigurator_bsd::interfaceConfigLineVlan(
QStringList vlan_names;
list<Interface*>::const_iterator it;
for (it=vlan_subinterfaces.begin(); it!=vlan_subinterfaces.end(); ++it)
vlan_names << (*it)->getName().c_str();
{
QString vlan_intf_name = (*it)->getName().c_str();
int vlan_id = (*it)->getOptionsObject()->getInt("vlan_id");
vlan_names << QString("%1:%2").arg(vlan_intf_name).arg(vlan_id);
}
interface_configuration_lines[iface->getName().c_str()] <<
QString("update_vlans_of_interface \"%1 %2\"")

View File

@ -13,25 +13,30 @@
##
############ VLAN ##############################################
## arguments:
##
## $1: vlan_name:vlan_id@<parent_name> e.g. vlan8101:101@em1
## $2: command, can be "add" or "rem"
##
missing_vlan() {
vlan=$1
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -39,23 +44,24 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG {{if openbsd}}-A{{endif}} | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG {{if openbsd}}-A{{endif}} | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
@ -68,12 +74,12 @@ parse_current_vlans() {
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:12 2011 PST by vadim
# Generated Wed Feb 16 15:16:50 2011 PST by vadim
#
# files: * firewall-base-rulesets.fw /etc/fw/firewall-base-rulesets.fw
# files: firewall-base-rulesets.conf /etc/fw/firewall-base-rulesets.conf
@ -163,7 +163,7 @@ configure_interfaces() {
update_addresses_of_interface "en2 192.168.100.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:12 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:50 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:12 2011 PST by vadim
# Generated Wed Feb 16 15:16:50 2011 PST by vadim
#
# files: * firewall-ipv6-1.fw pf-ipv6.fw
# files: firewall-ipv6-1.conf /etc/fw/pf-ipv6.conf
@ -175,7 +175,7 @@ configure_interfaces() {
update_addresses_of_interface "lo ::1/128 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:12 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:50 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:51 2011 PST by vadim
#
# files: * firewall-ipv6-2.fw pf.fw
# files: firewall-ipv6-2.conf pf.conf
@ -179,7 +179,7 @@ configure_interfaces() {
update_addresses_of_interface "lo ::1/128 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:51 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:13 2011 PST by vadim
# Generated Wed Feb 16 15:16:51 2011 PST by vadim
#
# files: * firewall-ipv6-3.fw /etc/firewall-ipv6-3.fw
# files: firewall-ipv6-3.conf /etc/firewall-ipv6-3.conf

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:38 2011 PST by vadim
# Generated Wed Feb 16 15:16:16 2011 PST by vadim
#
# files: * firewall.fw /etc/pf.fw
# files: firewall.conf /etc/pf.conf
@ -167,7 +167,7 @@ configure_interfaces() {
update_addresses_of_interface "lo 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:38 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:16 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:39 2011 PST by vadim
# Generated Wed Feb 16 15:16:16 2011 PST by vadim
#
# files: * firewall1.fw /etc/fw/firewall1.fw
# files: firewall1.conf /etc/fw/firewall1.conf
@ -76,7 +76,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:39 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:16 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:41 2011 PST by vadim
# Generated Wed Feb 16 15:16:18 2011 PST by vadim
#
# files: * firewall10-1.fw /etc/fw/firewall10-1.fw
# files: firewall10-1.conf /etc/fw/firewall10-1.conf
@ -74,7 +74,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:41 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:18 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:42 2011 PST by vadim
# Generated Wed Feb 16 15:16:19 2011 PST by vadim
#
# files: * firewall10-2.fw /etc/fw/firewall10-2.fw
# files: firewall10-2.conf /etc/fw/firewall10-2.conf
@ -74,7 +74,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:42 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:19 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:43 2011 PST by vadim
# Generated Wed Feb 16 15:16:20 2011 PST by vadim
#
# files: * firewall10-3.fw /etc/fw/firewall10-3.fw
# files: firewall10-3.conf /etc/fw/firewall10-3.conf
@ -76,7 +76,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:43 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:20 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:45 2011 PST by vadim
# Generated Wed Feb 16 15:16:23 2011 PST by vadim
#
# files: * firewall10-4.fw /etc/fw/firewall10-4.fw
# files: firewall10-4.conf /etc/fw/firewall10-4.conf
@ -76,7 +76,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:45 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:23 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:47 2011 PST by vadim
# Generated Wed Feb 16 15:16:24 2011 PST by vadim
#
# files: * firewall10-5.fw /etc/fw/firewall10-5.fw
# files: firewall10-5.conf /etc/fw/firewall10-5.conf
@ -77,7 +77,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:47 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:24 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:48 2011 PST by vadim
# Generated Wed Feb 16 15:16:26 2011 PST by vadim
#
# files: * firewall10-6.fw /etc/fw/firewall10-6.fw
# files: firewall10-6.conf /etc/fw/firewall10-6.conf
@ -77,7 +77,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:48 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:26 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:40 2011 PST by vadim
# Generated Wed Feb 16 15:16:17 2011 PST by vadim
#
# files: * firewall100.fw /etc/fw/pf.fw
# files: firewall100.conf /etc/fw/path\ with\ space/pf.conf
@ -161,7 +161,7 @@ configure_interfaces() {
update_addresses_of_interface "em1 10.1.1.81/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:40 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:17 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:40 2011 PST by vadim
# Generated Wed Feb 16 15:16:18 2011 PST by vadim
#
# files: * firewall101.fw /etc/fw/pf.fw
# files: firewall101.conf /etc/fw/path\ with\ space/pf.conf
@ -164,7 +164,7 @@ configure_interfaces() {
update_addresses_of_interface "em1 10.1.1.81/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:40 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:18 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:41 2011 PST by vadim
# Generated Wed Feb 16 15:16:19 2011 PST by vadim
#
# files: * firewall102.fw /etc/fw/pf.fw
# files: firewall102.conf /etc/fw/path\ with\ space/pf.conf

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:43 2011 PST by vadim
# Generated Wed Feb 16 15:16:21 2011 PST by vadim
#
# files: * firewall103-1.fw /etc/fw/pf.fw
# files: firewall103-1.conf /etc/fw/path\ with\ space/pf.conf
@ -132,20 +132,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -153,35 +153,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -387,7 +388,7 @@ configure_interfaces() {
update_addresses_of_interface "bridge0 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:43 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:21 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:44 2011 PST by vadim
# Generated Wed Feb 16 15:16:21 2011 PST by vadim
#
# files: * firewall103-2.fw /etc/fw/pf.fw
# files: firewall103-2.conf /etc/fw/path\ with\ space/pf.conf
@ -132,20 +132,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -153,35 +153,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -387,7 +388,7 @@ configure_interfaces() {
update_addresses_of_interface "bridge0 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:44 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:21 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:42 2011 PST by vadim
# Generated Wed Feb 16 15:16:20 2011 PST by vadim
#
# files: * firewall103.fw /etc/fw/pf.fw
# files: firewall103.conf /etc/fw/path\ with\ space/pf.conf
@ -135,20 +135,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -156,35 +156,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -390,7 +391,7 @@ configure_interfaces() {
update_addresses_of_interface "bridge0 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:42 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:20 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:46 2011 PST by vadim
# Generated Wed Feb 16 15:16:23 2011 PST by vadim
#
# files: * firewall104-1.fw /etc/fw/pf.fw
# files: firewall104-1.conf /etc/fw/path\ with\ space/pf.conf
@ -132,20 +132,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -153,35 +153,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -386,7 +387,7 @@ configure_interfaces() {
$IFCONFIG bridge0 -stp em3
}
log "Activating firewall script generated Wed Feb 16 14:45:46 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:23 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:45 2011 PST by vadim
# Generated Wed Feb 16 15:16:22 2011 PST by vadim
#
# files: * firewall104.fw /etc/fw/pf.fw
# files: firewall104.conf /etc/fw/path\ with\ space/pf.conf
@ -135,20 +135,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -156,35 +156,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -389,7 +390,7 @@ configure_interfaces() {
$IFCONFIG bridge0 stp em3
}
log "Activating firewall script generated Wed Feb 16 14:45:45 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:22 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:46 2011 PST by vadim
# Generated Wed Feb 16 15:16:24 2011 PST by vadim
#
# files: * firewall105.fw /etc/fw/pf.fw
# files: firewall105.conf /etc/fw/path\ with\ space/pf.conf

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:47 2011 PST by vadim
# Generated Wed Feb 16 15:16:25 2011 PST by vadim
#
# files: * firewall106.fw /etc/fw/pf.fw
# files: firewall106.conf /etc/fw/path\ with\ space/pf.conf

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:48 2011 PST by vadim
# Generated Wed Feb 16 15:16:26 2011 PST by vadim
#
# files: * firewall107.fw /etc/fw/pf.fw
# files: firewall107.conf /etc/fw/path\ with\ space/pf.conf
@ -135,20 +135,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -156,35 +156,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -382,13 +383,13 @@ configure_interfaces() {
sync_pfsync_interfaces
update_addresses_of_interface "em0 10.3.14.81/0xffffff00" ""
update_addresses_of_interface "em1 10.1.1.81/0xffffff00" ""
update_vlans_of_interface "em2 vlan101 vlan102"
update_vlans_of_interface "em2 vlan101:101 vlan102:102"
update_addresses_of_interface "em2" ""
update_addresses_of_interface "vlan101 192.168.101.1/0xffffff00" ""
update_addresses_of_interface "vlan102 192.168.102.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:48 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:26 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:49 2011 PST by vadim
# Generated Wed Feb 16 15:16:27 2011 PST by vadim
#
# files: * firewall108.fw /etc/fw/pf.fw
# files: firewall108.conf /etc/fw/path\ with\ space/pf.conf

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:50 2011 PST by vadim
# Generated Wed Feb 16 15:16:28 2011 PST by vadim
#
# files: * firewall109-1.fw /etc/fw/pf.fw
# files: firewall109-1.conf /etc/fw/path\ with\ space/pf.conf

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:51 2011 PST by vadim
# Generated Wed Feb 16 15:16:28 2011 PST by vadim
#
# files: * firewall109-2.fw /etc/fw/pf.fw
# files: firewall109-2.conf /etc/fw/path\ with\ space/pf.conf
@ -135,20 +135,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -156,35 +156,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -381,9 +382,9 @@ configure_interfaces() {
sync_carp_interfaces
sync_pfsync_interfaces
update_addresses_of_interface "em0 10.3.14.81/0xffffff00" ""
update_vlans_of_interface "em1 vlan9210"
update_vlans_of_interface "em1 vlan9210:210"
update_addresses_of_interface "em1" ""
update_vlans_of_interface "em2 vlan8210"
update_vlans_of_interface "em2 vlan8210:210"
update_addresses_of_interface "em2" ""
update_addresses_of_interface "vlan8210" ""
update_addresses_of_interface "vlan9210" ""
@ -393,7 +394,7 @@ configure_interfaces() {
update_addresses_of_interface "bridge0 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:51 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:28 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:52 2011 PST by vadim
# Generated Wed Feb 16 15:16:29 2011 PST by vadim
#
# files: * firewall109-3.fw /etc/fw/pf.fw
# files: firewall109-3.conf /etc/fw/path\ with\ space/pf.conf

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:50 2011 PST by vadim
# Generated Wed Feb 16 15:16:27 2011 PST by vadim
#
# files: * firewall109.fw /etc/fw/pf.fw
# files: firewall109.conf /etc/fw/path\ with\ space/pf.conf
@ -135,20 +135,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -156,35 +156,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -383,7 +384,7 @@ configure_interfaces() {
update_addresses_of_interface "em0 10.3.14.81/0xffffff00" ""
update_addresses_of_interface "em1" ""
$IFCONFIG em1 media 100baseTX mediaopt full-duplex up
update_vlans_of_interface "em2 vlan101 vlan102"
update_vlans_of_interface "em2 vlan101:101 vlan102:102"
update_addresses_of_interface "em2" ""
$IFCONFIG em2 media 100baseTX mediaopt full-duplex up
update_addresses_of_interface "vlan101 192.168.101.1/0xffffff00" ""
@ -394,7 +395,7 @@ configure_interfaces() {
update_addresses_of_interface "bridge0 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:50 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:27 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:52 2011 PST by vadim
# Generated Wed Feb 16 15:16:29 2011 PST by vadim
#
# files: * firewall11.fw /etc/firewall11.fw
# files: firewall11.conf /etc/firewall11.conf
@ -77,7 +77,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:52 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:29 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:53 2011 PST by vadim
# Generated Wed Feb 16 15:16:30 2011 PST by vadim
#
# files: * firewall110.fw /etc/fw/firewall110.fw
# files: firewall110.conf /etc/fw/firewall110.conf
@ -76,7 +76,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:53 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:30 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:53 2011 PST by vadim
# Generated Wed Feb 16 15:16:31 2011 PST by vadim
#
# files: * firewall12.fw /etc/fw/firewall12.fw
# files: firewall12.conf /etc/fw/firewall12.conf
@ -159,7 +159,7 @@ configure_interfaces() {
update_addresses_of_interface "lo0 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:53 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:31 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:54 2011 PST by vadim
# Generated Wed Feb 16 15:16:31 2011 PST by vadim
#
# files: * firewall13.fw /etc/fw/firewall13.fw
# files: firewall13.conf /etc/fw/firewall13.conf
@ -88,7 +88,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:54 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:31 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:55 2011 PST by vadim
# Generated Wed Feb 16 15:16:33 2011 PST by vadim
#
# files: * firewall14-1.fw /etc/firewall14-1.fw
# files: firewall14-1.conf /etc/firewall14-1.conf
@ -132,20 +132,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -153,35 +153,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -234,14 +235,14 @@ run_epilog_and_exit() {
configure_interfaces() {
:
sync_vlan_interfaces vlan101 vlan103
update_vlans_of_interface "em0 vlan101 vlan103"
update_vlans_of_interface "em0 vlan101:101 vlan103:103"
update_addresses_of_interface "em0 10.1.1.50/0xffffff00" ""
update_addresses_of_interface "pcn0 10.3.14.50/0xffffff00" ""
update_addresses_of_interface "vlan101 10.100.101.1/0xffffff00" ""
update_addresses_of_interface "vlan103 10.100.103.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:55 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:33 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:54 2011 PST by vadim
# Generated Wed Feb 16 15:16:32 2011 PST by vadim
#
# files: * firewall14.fw /etc/firewall14.fw
# files: firewall14.conf /etc/firewall14.conf
@ -132,20 +132,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -153,35 +153,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -234,14 +235,14 @@ run_epilog_and_exit() {
configure_interfaces() {
:
sync_vlan_interfaces vlan101 vlan103
update_vlans_of_interface "em0 vlan101 vlan103"
update_vlans_of_interface "em0 vlan101:101 vlan103:103"
update_addresses_of_interface "em0 10.1.1.50/0xffffff00" ""
update_addresses_of_interface "pcn0 10.3.14.50/0xffffff00" ""
update_addresses_of_interface "vlan101 10.100.101.1/0xffffff00" ""
update_addresses_of_interface "vlan103 10.100.103.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:54 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:32 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:57 2011 PST by vadim
# Generated Wed Feb 16 15:16:35 2011 PST by vadim
#
# files: * firewall2-1.fw /etc/fw/firewall2-1.fw
# files: firewall2-1.conf /etc/fw/firewall2-1.conf
@ -88,7 +88,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:57 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:35 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:55 2011 PST by vadim
# Generated Wed Feb 16 15:16:33 2011 PST by vadim
#
# files: * firewall2.fw /etc/fw/firewall2.fw
# files: firewall2.conf /etc/fw/firewall2.conf
@ -73,7 +73,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:55 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:33 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:56 2011 PST by vadim
# Generated Wed Feb 16 15:16:34 2011 PST by vadim
#
# files: * firewall20.fw /etc/fw/firewall20.fw
# files: firewall20.conf /etc/fw/firewall20.conf
@ -73,7 +73,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:56 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:34 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:56 2011 PST by vadim
# Generated Wed Feb 16 15:16:34 2011 PST by vadim
#
# files: * firewall21.fw /etc/fw/firewall21.fw
# files: firewall21.conf /etc/fw/firewall21.conf
@ -81,7 +81,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:56 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:34 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:58 2011 PST by vadim
# Generated Wed Feb 16 15:16:35 2011 PST by vadim
#
# files: * firewall22.fw /etc/fw/firewall22.fw
# files: firewall22.conf /etc/fw/firewall22.conf
@ -80,7 +80,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:45:58 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:35 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:58 2011 PST by vadim
# Generated Wed Feb 16 15:16:36 2011 PST by vadim
#
# files: * firewall3.fw /etc/firewall3.fw
# files: firewall3.conf /etc/firewall3.conf
@ -159,7 +159,7 @@ configure_interfaces() {
update_addresses_of_interface "lo 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:58 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:36 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:59 2011 PST by vadim
# Generated Wed Feb 16 15:16:37 2011 PST by vadim
#
# files: * firewall33.fw /etc/fw/firewall33.fw
# files: firewall33.conf /etc/fw/firewall33.conf
@ -162,7 +162,7 @@ configure_interfaces() {
update_addresses_of_interface "lo 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:59 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:37 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:45:59 2011 PST by vadim
# Generated Wed Feb 16 15:16:37 2011 PST by vadim
#
# files: * firewall34.fw /etc/fw/firewall34.fw
# files: firewall34.conf /etc/fw/firewall34.conf
@ -158,7 +158,7 @@ configure_interfaces() {
update_addresses_of_interface "lo 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:45:59 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:37 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:00 2011 PST by vadim
# Generated Wed Feb 16 15:16:38 2011 PST by vadim
#
# files: * firewall38.fw /etc/fw/firewall38.fw
# files: firewall38.conf /etc/fw/firewall38.conf
@ -76,7 +76,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:00 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:38 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:01 2011 PST by vadim
# Generated Wed Feb 16 15:16:38 2011 PST by vadim
#
# files: * firewall39.fw pf.fw
# files: firewall39.conf pf.conf
@ -79,7 +79,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:01 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:38 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:01 2011 PST by vadim
# Generated Wed Feb 16 15:16:39 2011 PST by vadim
#
# files: * firewall4.fw pf.fw
# files: firewall4.conf /etc/fw/pf.conf
@ -77,7 +77,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:01 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:39 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:02 2011 PST by vadim
# Generated Wed Feb 16 15:16:40 2011 PST by vadim
#
# files: * firewall40-1.fw /etc/firewall40-1.fw
# files: firewall40-1.conf /etc/firewall40-1.conf
@ -176,7 +176,7 @@ configure_interfaces() {
update_addresses_of_interface "lo0 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:02 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:40 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:02 2011 PST by vadim
# Generated Wed Feb 16 15:16:39 2011 PST by vadim
#
# files: * firewall40.fw /etc/firewall40.fw
# files: firewall40.conf /etc/firewall40.conf
@ -160,7 +160,7 @@ configure_interfaces() {
update_addresses_of_interface "lo0 127.0.0.1/0xff000000" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:02 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:39 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:03 2011 PST by vadim
# Generated Wed Feb 16 15:16:41 2011 PST by vadim
#
# files: * firewall41.fw /etc/firewall41.fw
# files: firewall41.conf /etc/firewall41.conf
@ -163,7 +163,7 @@ configure_interfaces() {
update_addresses_of_interface "eth1 2.2.2.2/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:03 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:41 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:04 2011 PST by vadim
# Generated Wed Feb 16 15:16:41 2011 PST by vadim
#
# files: * firewall5.fw /etc/fw/firewall5.fw
# files: firewall5.conf /etc/fw/firewall5.conf
@ -77,7 +77,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:04 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:41 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:04 2011 PST by vadim
# Generated Wed Feb 16 15:16:42 2011 PST by vadim
#
# files: * firewall51.fw /etc/fw/firewall51.fw
# files: firewall51.conf /etc/fw/firewall51.conf
@ -80,7 +80,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:04 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:42 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:05 2011 PST by vadim
# Generated Wed Feb 16 15:16:42 2011 PST by vadim
#
# files: * firewall6.fw /etc/fw/firewall6.fw
# files: firewall6.conf /etc/fw/firewall6.conf
@ -73,7 +73,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:05 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:42 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:06 2011 PST by vadim
# Generated Wed Feb 16 15:16:43 2011 PST by vadim
#
# files: * firewall62.fw /etc/firewall62.fw
# files: firewall62.conf /etc/firewall62.conf
@ -185,7 +185,7 @@ configure_interfaces() {
update_addresses_of_interface "en1 222.222.222.222/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:06 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:43 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:06 2011 PST by vadim
# Generated Wed Feb 16 15:16:43 2011 PST by vadim
#
# files: * firewall63.fw /etc/fw/firewall63.fw
# files: firewall63.conf /etc/fw/firewall63.conf
@ -77,7 +77,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:06 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:43 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:07 2011 PST by vadim
# Generated Wed Feb 16 15:16:44 2011 PST by vadim
#
# files: * firewall7.fw /etc/fw/firewall7.fw
# files: firewall7.conf /etc/fw/firewall7.conf
@ -73,7 +73,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:07 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:44 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:07 2011 PST by vadim
# Generated Wed Feb 16 15:16:45 2011 PST by vadim
#
# files: * firewall70.fw /etc/fw/firewall70.fw
# files: firewall70.conf /etc/fw/firewall70.conf
@ -82,7 +82,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:07 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:45 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:08 2011 PST by vadim
# Generated Wed Feb 16 15:16:46 2011 PST by vadim
#
# files: * firewall8.fw /etc/firewall8.fw
# files: firewall8.conf /etc/firewall8.conf
@ -72,7 +72,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:08 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:46 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:09 2011 PST by vadim
# Generated Wed Feb 16 15:16:47 2011 PST by vadim
#
# files: * firewall80-4.5.fw /etc/firewall80-4.5.fw
# files: firewall80-4.5.conf /etc/firewall80-4.5.conf
@ -73,7 +73,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:09 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:47 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:08 2011 PST by vadim
# Generated Wed Feb 16 15:16:46 2011 PST by vadim
#
# files: * firewall80.fw /etc/firewall80.fw
# files: firewall80.conf /etc/firewall80.conf
@ -73,7 +73,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:08 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:46 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:09 2011 PST by vadim
# Generated Wed Feb 16 15:16:47 2011 PST by vadim
#
# files: * firewall9.fw /etc/fw/firewall9.fw
# files: firewall9.conf /etc/fw/firewall9.conf
@ -76,7 +76,7 @@ configure_interfaces() {
}
log "Activating firewall script generated Wed Feb 16 14:46:09 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:47 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:10 2011 PST by vadim
# Generated Wed Feb 16 15:16:48 2011 PST by vadim
#
# files: * firewall91.fw /etc/fw/pf.fw
# files: firewall91.conf /etc/fw/pf.conf
@ -131,20 +131,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -152,35 +152,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -233,14 +234,14 @@ run_epilog_and_exit() {
configure_interfaces() {
:
sync_vlan_interfaces vlan101 vlan103
update_vlans_of_interface "em0 vlan101 vlan103"
update_vlans_of_interface "em0 vlan101:101 vlan103:103"
update_addresses_of_interface "em0 10.1.1.50/0xffffff00" ""
update_addresses_of_interface "pcn0 10.3.14.50/0xffffff00" ""
update_addresses_of_interface "vlan101 10.100.101.1/0xffffff00" ""
update_addresses_of_interface "vlan103 10.100.103.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:10 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:48 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:11 2011 PST by vadim
# Generated Wed Feb 16 15:16:48 2011 PST by vadim
#
# files: * firewall92.fw /etc/fw/pf.fw
# files: firewall92.conf /etc/fw/path\ with\ space/pf.conf
@ -160,7 +160,7 @@ configure_interfaces() {
update_addresses_of_interface "em1 10.1.1.81/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:11 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:48 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:51 2011 PST by vadim
#
# files: * pf_cluster_1_openbsd-1.fw /etc/pf_cluster_1_openbsd-1.fw
# files: pf_cluster_1_openbsd-1.conf /etc/pf_cluster_1_openbsd-1.conf
@ -131,20 +131,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -152,35 +152,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -292,7 +293,7 @@ configure_interfaces() {
update_addresses_of_interface "carp1 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:51 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:52 2011 PST by vadim
#
# files: * pf_cluster_1_openbsd-2.fw /etc/pf_cluster_1_openbsd-2.fw
# files: pf_cluster_1_openbsd-2.conf /etc/pf_cluster_1_openbsd-2.conf
@ -189,7 +189,7 @@ configure_interfaces() {
update_addresses_of_interface "carp1 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:52 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:52 2011 PST by vadim
#
# files: * pf_cluster_2_freebsd-1.fw /etc/pf_cluster_2_freebsd-1.fw
# files: pf_cluster_2_freebsd-1.conf /etc/pf_cluster_2_freebsd-1.conf
@ -134,20 +134,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -155,35 +155,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -294,7 +295,7 @@ configure_interfaces() {
update_addresses_of_interface "carp1 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:52 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:52 2011 PST by vadim
#
# files: * pf_cluster_2_freebsd-2.fw /etc/pf_cluster_2_freebsd-2.fw
# files: pf_cluster_2_freebsd-2.conf /etc/pf_cluster_2_freebsd-2.conf
@ -191,7 +191,7 @@ configure_interfaces() {
update_addresses_of_interface "carp1 192.168.1.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:52 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:52 2011 PST by vadim
#
# files: * pf_cluster_3_openbsd-3.fw /etc/pf_cluster_3_openbsd-3.fw
# files: pf_cluster_3_openbsd-3.conf /etc/pf_cluster_3_openbsd-3.conf
@ -131,20 +131,20 @@ missing_vlan() {
cmd=$2
oldIFS=$IFS
IFS="@"
IFS="@:"
set $vlan
subint=$1
parent=$2
vlan_id=$2
parent=$3
IFS=$oldIFS
vlan_id=$(echo $subint | sed 's/vlan//')
test "$cmd" = "add" && {
echo "# Adding VLAN interface $subint (parent: $parent)"
echo "# Adding VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id vlandev $parent || exit 1
$FWBDEBUG $IFCONFIG $subint up || exit 1
}
test "$cmd" = "rem" && {
echo "# Removing VLAN interface $subint (parent: $parent)"
echo "# Removing VLAN interface $subint (vlan id: $vlan_id parent: $parent)"
$FWBDEBUG $IFCONFIG $subint vlan $vlan_id -vlandev || exit 1
$FWBDEBUG $IFCONFIG $subint destroy || exit 1
}
@ -152,35 +152,36 @@ missing_vlan() {
parse_fwb_vlans() {
set $1
vlan_parent_interface=$1
vlan_parent=$1
shift
FWB_VLANS=$(
for subint in $*; do
echo "${subint}@$vlan_parent_interface"
echo "${subint}@$vlan_parent"
done | sort
)
echo $FWB_VLANS
}
parse_current_vlans() {
vlan_parent_interface=$1
$IFCONFIG -A | grep 'vlan: ' | sed 's/parent interface://' | \
while read x vlan_id parent
vlan_parent=$1
$IFCONFIG -A | grep -E 'vlan[^ ]*:' | paste - - | \
sed 's/flags=.*vlan://;s/://g;s/parent interface//' | \
while read vlan_subint vlan_id parent
do
test "$parent" = "$vlan_parent_interface" && echo "vlan$vlan_id@$parent"
test "$parent" = "$vlan_parent" && echo "$vlan_subint:$vlan_id@$parent"
done | sort
}
update_vlans_of_interface() {
args="$1"
set $1
vlan_parent_interface=$1
vlan_parent=$1
FWB_VLANS=$(parse_fwb_vlans "$args")
CURRENT_VLANS=$(parse_current_vlans $vlan_parent_interface)
CURRENT_VLANS=$(parse_current_vlans $vlan_parent)
$IFCONFIG $vlan_parent_interface up || exit 1
$IFCONFIG $vlan_parent up || exit 1
diff_intf missing_vlan "$FWB_VLANS" "$CURRENT_VLANS" add
diff_intf missing_vlan "$CURRENT_VLANS" "$FWB_VLANS" rem
}
@ -283,7 +284,7 @@ configure_interfaces() {
sync_pfsync_interfaces
update_addresses_of_interface "en0 172.24.0.2/0xffffff00" ""
update_addresses_of_interface "en1 192.168.1.2/0xffffff00" ""
update_vlans_of_interface "en2 vlan100"
update_vlans_of_interface "en2 vlan100:100"
update_addresses_of_interface "en2" ""
update_addresses_of_interface "lo0 127.0.0.1/0xff000000" ""
update_addresses_of_interface "vlan100 172.20.0.2/0xffffff00" ""
@ -295,7 +296,7 @@ configure_interfaces() {
update_addresses_of_interface "carp2 172.20.0.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:52 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -4,7 +4,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:52 2011 PST by vadim
#
# files: * pf_cluster_3_openbsd-4.fw /etc/pf_cluster_3_openbsd-4.fw
# files: pf_cluster_3_openbsd-4.conf /etc/pf_cluster_3_openbsd-4.conf
@ -193,7 +193,7 @@ configure_interfaces() {
update_addresses_of_interface "carp2 172.20.0.1/0xffffff00" ""
}
log "Activating firewall script generated Wed Feb 16 14:46:14 2011 by vadim"
log "Activating firewall script generated Wed Feb 16 15:16:52 2011 by vadim"
set_kernel_vars
configure_interfaces

View File

@ -3,7 +3,7 @@
#
# Firewall Builder fwb_pf v4.2.0.3479
#
# Generated Wed Feb 16 14:46:14 2011 PST by vadim
# Generated Wed Feb 16 15:16:52 2011 PST by vadim
#
# files: * pf_cluster_4_rc.conf.local /etc/pf_cluster_4_rc.conf.local
# files: pf_cluster_4_pf.conf /etc/pf_cluster_4_pf.conf