diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-06-10 10:54:24 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-06-10 10:54:24 -0300 |
commit | 4cc2ae78d3027c349969437f08a88b1fb88c9de8 (patch) | |
tree | a99e75fcaec28802964e7fa8311fc6e5b45fdcc7 /sbin/dhclient-script | |
parent | e912bfae186b6b657daf52607f9d027f46be0478 (diff) | |
download | pfsense-4cc2ae78d3027c349969437f08a88b1fb88c9de8.zip pfsense-4cc2ae78d3027c349969437f08a88b1fb88c9de8.tar.gz |
Revert "Fix #3700 and other syntax issues:"
This reverts commit e912bfae186b6b657daf52607f9d027f46be0478.
Diffstat (limited to 'sbin/dhclient-script')
-rwxr-xr-x | sbin/dhclient-script | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sbin/dhclient-script b/sbin/dhclient-script index 0f393a7..8421bfd 100755 --- a/sbin/dhclient-script +++ b/sbin/dhclient-script @@ -27,14 +27,13 @@ ROUTE=/sbin/route SED=/usr/bin/sed ARP=/usr/sbin/arp IFCONFIG=/sbin/ifconfig -PFCTL=/sbin/pfctl LOCALHOST=127.0.0.1 if [ -x /usr/bin/logger ]; then LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" else - LOGGER="echo" + LOGGER=echo fi # @@ -43,8 +42,11 @@ fi check_hostname() { current_hostname=`$HOSTNAME` - if [ -z "$current_hostname" -o \ - "$current_hostname" != "$new_host_name" ]; then + if [ -z "$current_hostname" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + elif [ "$current_hostname" = "$old_host_name" -a \ + "$new_host_name" != "$old_host_name" ]; then $LOGGER "New Hostname ($interface): $new_host_name" $HOSTNAME $new_host_name fi @@ -58,30 +60,28 @@ arp_flush() { delete_old_states() { $LOGGER "Starting delete_old_states()" - _FLUSHED=0 # If the IP changed, remove states from the old one if [ -f /var/db/${interface}_ip ]; then - OLD_IP=`cat /var/db/${interface}_ip` + OLD_IP = `cat /var/db/${interface}_ip` $LOGGER "Comparing IPs: Old: ${OLD_IP} New: ${new_ip_address}" if [ -n "${OLD_IP}" ] && [ "${OLD_IP}" != "${new_ip_address}" ]; then $LOGGER "Removing states from old IP '${OLD_IP}' (new IP '${new_ip_address}')" - ${PFCTL} -i $interface -Fs - ${PFCTL} -K ${OLD_IP}/32 - _FLUSHED=1 + /sbin/pfctl -i $interface -Fs + pfctl -K ${OLD_IP}/32 fi fi # Delete states through old gateway if it's not the same - OLD_ROUTER="" if [ -n "${old_routers}" ]; then - OLD_ROUTER=$old_routers - elif [ -f /tmp/${interface}_router ]; then - OLD_ROUTER=`cat /tmp/${interface}_router` + OLD_ROUTER = $old_routers + fi + if [ -z "${OLD_ROUTER}" ] && [ -f /tmp/${interface}_router ]; then + OLD_ROUTER = `cat /tmp/${interface}_router` fi - if [ ${_FLUSHED} -eq 0 -a -n "${OLD_ROUTER}" ]; then + if [ -n "${OLD_ROUTER}" ]; then $LOGGER "Comparing Routers: Old: ${OLD_ROUTER} New: ${new_routers}" if [ "${OLD_ROUTER}" != "${new_routers}" ]; then $LOGGER "Removing states through old gateway '${OLD_ROUTER}' (new gateway '${new_routers}')" - ${PFCTL} -i $interface -Fs + /sbin/pfctl -i $interface -Fs -G ${OLD_ROUTER} fi fi } |