Last change
on this file since 10603 was 10598, checked in by rick, 13 years ago |
Put it into logical brain ordering...
|
-
Property svn:executable
set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[10586] | 1 | #!/bin/sh -
|
---|
| 2 | #
|
---|
| 3 | # An normal proxy should not have an defaultrouter configured, as all calls to
|
---|
| 4 | # the outside world are handled via PF redirects.
|
---|
| 5 | #
|
---|
| 6 | # Rick van der Zwet <rick@wirelessleiden.nl>
|
---|
| 7 |
|
---|
[10594] | 8 | # Little hack to load the available functions in case we are running this as an
|
---|
| 9 | # standalone script (for testing mostly).
|
---|
| 10 | if [ -z "$exit_status" ]; then
|
---|
| 11 | grep -v 'exit $exit_status' /sbin/dhclient-script | eval
|
---|
| 12 | fi
|
---|
| 13 |
|
---|
[10586] | 14 | . /etc/rc.subr
|
---|
| 15 |
|
---|
[10590] | 16 | : ${service_proxy_normal="NO"}
|
---|
[10594] | 17 | : ${service_proxy_ileiden="NO"}
|
---|
[10590] | 18 | : ${service_accesspoint="NO"}
|
---|
[10586] | 19 |
|
---|
| 20 | load_rc_config 'ileiden'
|
---|
| 21 |
|
---|
[10594] | 22 | update_pf_conf() {
|
---|
[10598] | 23 | if is_default_interface; then
|
---|
| 24 | new_ext_if_gw=`route -n get default | awk '/gateway/ {print $2}'`
|
---|
| 25 | if [ -n "$new_ext_if_gw" ]; then
|
---|
| 26 | if [ -a "$new_ext_if_gw" != "$ext_if_gw" ]; then
|
---|
| 27 | info "Reloading PF firewall to load new ext_if_gw=$ext_if_gw"
|
---|
| 28 | { grep -v '^ext_if_gw=' $rc_conf_running; echo "ext_if_gw=$new_ext_if_gw"; } > $rc_conf_running
|
---|
| 29 | /etc/rc.d/pf reload
|
---|
| 30 | fi
|
---|
| 31 | fi
|
---|
| 32 | fi
|
---|
| 33 |
|
---|
[10594] | 34 | # Make sure not to nuke the default route on an ileiden proxy,
|
---|
| 35 | # as it will rendering it usefull
|
---|
[10595] | 36 | checkyesno "service_proxy_ileiden" && return
|
---|
[10590] | 37 |
|
---|
| 38 | if checkyesno "service_proxy_normal" && checkyesno "service_accesspoint"; then
|
---|
[10598] | 39 | warn "Removing default route as machine is marked as service_proxy AND service_accesspoint"
|
---|
| 40 | route -q del default
|
---|
[10590] | 41 | fi
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[10594] | 44 | reason=${reason:-$FORCE}
|
---|
| 45 |
|
---|
[10590] | 46 | case $reason in
|
---|
| 47 | BOUND|RENEW|REBIND|REBOOT)
|
---|
| 48 | update_pf_conf
|
---|
| 49 | ;;
|
---|
| 50 | TIMEOUT)
|
---|
| 51 | update_pf_conf
|
---|
| 52 | ;;
|
---|
| 53 | esac
|
---|
| 54 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.