From 9ae141c3aee52edbe07fa2b5652d13c57bf8d21e Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Sun, 13 Feb 2011 18:35:31 -0800 Subject: [PATCH] see #2074 on FreeBSD ifconfig does not understand parameter carpdev --- doc/ChangeLog | 3 +++ src/pflib/OSConfigurator_freebsd.cpp | 10 ++++++---- src/res/configlets/freebsd/carp_interface | 19 +++++++++++++++++++ .../configlets/freebsd/rc_conf_carp_interface | 4 +++- 4 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 src/res/configlets/freebsd/carp_interface diff --git a/doc/ChangeLog b/doc/ChangeLog index 9d5cbb359..c93934794 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,8 @@ 2011-02-13 vadim + * configlets/freebsd/carp_interface: see #2074 On FreeBSD ifconfig + does not understand parameter carpdev + * PolicyCompiler_pf.cpp (checkForShadowingPlatformSpecific): see #1867 "PF: rule with non-terminating action Tag shadows other rules below it". Since action Tag is non-terminating, rules with diff --git a/src/pflib/OSConfigurator_freebsd.cpp b/src/pflib/OSConfigurator_freebsd.cpp index f65a976da..08cff9177 100644 --- a/src/pflib/OSConfigurator_freebsd.cpp +++ b/src/pflib/OSConfigurator_freebsd.cpp @@ -397,12 +397,14 @@ void OSConfigurator_freebsd::interfaceConfigLineCARP(Interface *iface, FWObject *failover_group) { FWOptions* options = fw->getOptionsObject(); + QString configlet_name = "carp_interface"; if (options->getBool("generate_rc_conf_file")) { - Configlet configlet(fw, "freebsd", "rc_conf_carp_interface"); - interfaceConfigLineCARPInternal(iface, failover_group, &configlet); - } else - OSConfigurator_bsd::interfaceConfigLineCARP(iface, failover_group); + configlet_name = "rc_conf_carp_interface"; + } + + Configlet configlet(fw, "freebsd", configlet_name); + interfaceConfigLineCARPInternal(iface, failover_group, &configlet); } void OSConfigurator_freebsd::summaryConfigLinePfsync(bool have_pfsync) diff --git a/src/res/configlets/freebsd/carp_interface b/src/res/configlets/freebsd/carp_interface new file mode 100644 index 000000000..049164d86 --- /dev/null +++ b/src/res/configlets/freebsd/carp_interface @@ -0,0 +1,19 @@ +## -*- mode: shell-script; -*- +## +## Lines that start with "##" will be removed before this code is +## added to the generated script. Regular shell comments can be added +## using single "#", these will appear in the script. +## +## +## CARP +## ifconfig carp-interface [advbase n] [advskew n] [carpdev iface] +## [pass passphrase] [state state] [vhid host-id] +## +## for pfsync and CARP see http://www.kernel-panic.it/openbsd/carp/ +## "Redundant firewalls with OpenBSD, CARP and pfsync" +## +## Unlike in OpenBSD, in FreeBSD ifconfig does not understand carpdev parameter + +$IFCONFIG {{$carp_interface}} vhid {{$vhid}} pass {{$carp_password}} {{if have_advbase}} advbase {{$advbase}}{{endif}} {{if have_advskew}} advskew {{$advskew}}{{endif}} + + diff --git a/src/res/configlets/freebsd/rc_conf_carp_interface b/src/res/configlets/freebsd/rc_conf_carp_interface index 13f9f0f13..c17f76cc9 100644 --- a/src/res/configlets/freebsd/rc_conf_carp_interface +++ b/src/res/configlets/freebsd/rc_conf_carp_interface @@ -15,8 +15,10 @@ ## here is how to configure CARP interfaces in rc.conf ## ## http://blas.phemo.us/articles/2007/04/04/setting-up-and-configuring-carp-interfaces-on-freebsd +## +## Unlike in OpenBSD, in FreeBSD ifconfig does not understand carpdev parameter -ifconfig_{{$carp_interface}}="vhid {{$vhid}} pass {{$carp_password}} {{if have_advbase}} advbase {{$advbase}}{{endif}} {{if have_advskew}} advskew {{$advskew}}{{endif}} {{if have_base_inetrface}} carpdev {{$base_inetrface}}{{endif}}" +ifconfig_{{$carp_interface}}="vhid {{$vhid}} pass {{$carp_password}} {{if have_advbase}} advbase {{$advbase}}{{endif}} {{if have_advskew}} advskew {{$advskew}}{{endif}}"