diff options
| -rwxr-xr-x | src/bbfw.in | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/src/bbfw.in b/src/bbfw.in index 40fdcb8..e6f28d1 100755 --- a/src/bbfw.in +++ b/src/bbfw.in | |||
| @@ -144,6 +144,30 @@ config_option() | |||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | 146 | ||
| 147 | conftest() | ||
| 148 | { | ||
| 149 | # quiet option | ||
| 150 | if test "x${FW_QUIET}" == "xno";then | ||
| 151 | unset FW_QUIET | ||
| 152 | elif test "x${FW_QUIET}" != "xyes";then | ||
| 153 | echo "invalid value for option 'quiet'" |$LOGGER | ||
| 154 | return 1 | ||
| 155 | fi | ||
| 156 | |||
| 157 | # verbose option | ||
| 158 | if test "x${FW_VERBOSE}" == "xno";then | ||
| 159 | unset FW_VERBOSE | ||
| 160 | elif test "x${FW_VERBOSE}" != "xyes";then | ||
| 161 | echo "invalid value for verbose 'quiet'" |$LOGGER | ||
| 162 | return 1 | ||
| 163 | else | ||
| 164 | FW_VERBOSE=-v | ||
| 165 | fi | ||
| 166 | |||
| 167 | return 0 | ||
| 168 | } | ||
| 169 | |||
| 170 | |||
| 147 | dump() | 171 | dump() |
| 148 | { | 172 | { |
| 149 | ipset list |sed -e "s/^/ipset: /g" | 173 | ipset list |sed -e "s/^/ipset: /g" |
| @@ -458,23 +482,6 @@ FW_ORDER_IPTABLES="$( config_option order_iptables "${FW_ORDER_IPTABLES}" A-Z | |||
| 458 | FW_ORDER_IPSETS="$( config_option order_ipsets "${FW_ORDER_IPSETS}" A-Z a-z )" | 482 | FW_ORDER_IPSETS="$( config_option order_ipsets "${FW_ORDER_IPSETS}" A-Z a-z )" |
| 459 | 483 | ||
| 460 | 484 | ||
| 461 | # checks and normalizes options | ||
| 462 | if test "x${FW_QUIET}" == "xno";then | ||
| 463 | unset FW_QUIET | ||
| 464 | elif test "x${FW_QUIET}" != "xyes";then | ||
| 465 | echo "${PROGRAM_NAME}: invalid value for option 'quiet'" 1>&2 | ||
| 466 | exit 1 | ||
| 467 | fi | ||
| 468 | if test "x${FW_VERBOSE}" == "xno";then | ||
| 469 | unset FW_VERBOSE | ||
| 470 | elif test "x${FW_VERBOSE}" != "xyes";then | ||
| 471 | echo "${PROGRAM_NAME}: invalid value for verbose 'quiet'" 1>&2 | ||
| 472 | exit 1 | ||
| 473 | else | ||
| 474 | FW_VERBOSE=-v | ||
| 475 | fi | ||
| 476 | |||
| 477 | |||
| 478 | case "$1" in | 485 | case "$1" in |
| 479 | -h|--help) | 486 | -h|--help) |
| 480 | echo "Usage: ${PROGRAM_NAME} [ start | stop | restart | dump ]" | 487 | echo "Usage: ${PROGRAM_NAME} [ start | stop | restart | dump ]" |
| @@ -493,16 +500,19 @@ case "$1" in | |||
| 493 | 500 | ||
| 494 | 'start') # "start" brings up all configured interfaces: | 501 | 'start') # "start" brings up all configured interfaces: |
| 495 | echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER | 502 | echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER |
| 503 | conftest || exit 1 | ||
| 496 | start 2>&1 | $LOGGER | 504 | start 2>&1 | $LOGGER |
| 497 | ;; | 505 | ;; |
| 498 | 506 | ||
| 499 | 'stop') # "stop" takes down all configured interfaces: | 507 | 'stop') # "stop" takes down all configured interfaces: |
| 500 | echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER | 508 | echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER |
| 509 | conftest || exit 1 | ||
| 501 | stop 2>&1 | $LOGGER | 510 | stop 2>&1 | $LOGGER |
| 502 | ;; | 511 | ;; |
| 503 | 512 | ||
| 504 | 'restart') # "restart" restarts the network: | 513 | 'restart') # "restart" restarts the network: |
| 505 | echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER | 514 | echo "${PACKAGE_NAME} ${PACKAGE_VERSION}" | $LOGGER |
| 515 | conftest || exit 1 | ||
| 506 | stop 2>&1 | $LOGGER | 516 | stop 2>&1 | $LOGGER |
| 507 | start 2>&1 | $LOGGER | 517 | start 2>&1 | $LOGGER |
| 508 | ;; | 518 | ;; |
