source: hybrid/branches/releng-10/nanobsd/files/etc/dhclient-exit-hooks@ 13375

Last change on this file since 13375 was 10841, checked in by rick, 13 years ago

Op het moment dat je inlogt met SSH op een normale proxy is je FIB=1, omdat
SSH op FIB=1 draait. Draai je dan handmatig dhclient vr0 zal dit je default
route op FIB=1 weer wissen, en dat is nu juist _niet_ de bedoeling.

Hard-coded de wis actie naar FIB=0 om zo altijd de goede te wissen.

Fixes nodefactory:ticket:172

  • Property svn:executable set to *
File size: 1.7 KB
Line 
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
8. /etc/rc.subr
9
10: ${service_proxy_normal="NO"}
11: ${service_proxy_ileiden="NO"}
12: ${service_accesspoint="NO"}
13
14load_rc_config 'ileiden'
15
16update_pf_conf() {
17 $LOGGER "reason: $reason"
18 if is_default_interface 2>/dev/null; then
19 $LOGGER "is_default_interface: TRUE"
20 $LOGGER "`sysctl net.my_fib`"
21 new_ext_if_gw=`route -n get default 2>/dev/null | awk '/gateway/ {print $2}'`
22 $LOGGER "prev default gateway: $ext_if_gw"
23 $LOGGER "curr default gateway: $new_ext_if_gw"
24 if [ -n "$new_ext_if_gw" -a "$new_ext_if_gw" != "$ext_if_gw" ]; then
25 $LOGGER "Syncing new default route ($new_ext_if_gw) to routing table 1"
26 { grep -v '^ext_if_gw=' $rc_conf_running; echo "ext_if_gw=$new_ext_if_gw"; } > $rc_conf_running
27 $LOGGER "`setfib 1 route -q del default 2>&1`"
28 $LOGGER "`setfib 1 route -q add default $new_ext_if_gw 2>&1`"
29 fi
30 else
31 $LOGGER "is_default_interface: FALSE"
32 fi
33
34 # Make sure not to nuke the default route on an ileiden proxy,
35 # as it will rendering it usefull
36 checkyesno "service_proxy_ileiden" && return
37
38 if [ -n "$new_ext_if_gw" ] && checkyesno "service_proxy_normal" && checkyesno "service_accesspoint"; then
39 $LOGGER "Removing default route from routing table 0 as machine is marked as service_proxy AND service_accesspoint"
40 $LOGGER "`setfib 0 route -q del default 2>&1`"
41 fi
42}
43
44reason=${reason:-${REASON:-"BOUND"}}
45case $reason in
46 BOUND|RENEW|REBIND|REBOOT)
47 update_pf_conf
48 ;;
49 TIMEOUT)
50 update_pf_conf
51 ;;
52esac
53
Note: See TracBrowser for help on using the repository browser.