Changeset 10608 in hybrid for branches


Ignore:
Timestamp:
Apr 29, 2012, 12:02:36 PM (13 years ago)
Author:
rick
Message:

The conditional statements and variables where not set correctly at all (last
commit properly done too late).

While here:

  • Cleanup logging format to logger, as all but the PREINIT hooks get called in privileged [priv] (forked) environment, where stdout goes to nothing.
  • Print more details to yield more logic to the user.

Related-To: nodefactory#129

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-9.0/nanobsd/files/etc/dhclient-exit-hooks

    r10598 r10608  
    2121
    2222update_pf_conf() {
    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
     23  $LOGGER "reason: $reason"
     24  if is_default_interface 2>/dev/null; then
     25    $LOGGER "is_default_interface: TRUE"
     26    new_ext_if_gw=`route -n get default 2>/dev/null | awk '/gateway/ {print $2}'`
     27    $LOGGER "prev default gateway: $ext_if_gw"
     28    $LOGGER "curr default gateway: $new_ext_if_gw"
     29    if [ -n "$new_ext_if_gw" -a "$new_ext_if_gw" != "$ext_if_gw" ];  then
     30      $LOGGER "Reloading PF firewall to load new ext_if_gw=$new_ext_if_gw"
     31      { grep -v '^ext_if_gw=' $rc_conf_running; echo "ext_if_gw=$new_ext_if_gw"; } > $rc_conf_running
     32      $LOGGER "`/etc/rc.d/pf reload 2>&1`"
    3133    fi
     34  else
     35    $LOGGER "is_default_interface: FALSE"
    3236  fi
    3337
     
    3640  checkyesno "service_proxy_ileiden" && return
    3741
    38   if checkyesno "service_proxy_normal" && checkyesno "service_accesspoint"; then
    39     warn "Removing default route as machine is marked as service_proxy AND service_accesspoint"
    40     route -q del default
     42  if [ -n "$new_ext_if_gw" ] && checkyesno "service_proxy_normal" && checkyesno "service_accesspoint"; then
     43    $LOGGER "Removing default route as machine is marked as service_proxy AND service_accesspoint"
     44    $LOGGER "`route -q del default 2>&1`"
    4145  fi
    4246}
    4347
    44 reason=${reason:-$FORCE}
    45 
     48reason=${reason:-${REASON:-"BOUND"}}
    4649case $reason in
    4750  BOUND|RENEW|REBIND|REBOOT)
    48     update_pf_conf 
     51    update_pf_conf
    4952    ;;
    5053  TIMEOUT)
Note: See TracChangeset for help on using the changeset viewer.