diff options
author | jim-p <jimp@pfsense.org> | 2012-08-29 13:28:22 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-08-29 13:30:30 -0400 |
commit | 0649859138161c1cf49032348114cd683e212fbe (patch) | |
tree | 69ad99a15f87350758b07349a1afb55ae7beae22 /sbin/dhclient-script | |
parent | 56178d9a78bcf4fd44b13d6ed6f54fa4afb68841 (diff) | |
download | pfsense-0649859138161c1cf49032348114cd683e212fbe.zip pfsense-0649859138161c1cf49032348114cd683e212fbe.tar.gz |
Try to remove old states when a DHCP IP changes, might be related to ticket #1629 and also "unable to allocate llinfo" messages from states through an old gateway.
Diffstat (limited to 'sbin/dhclient-script')
-rwxr-xr-x | sbin/dhclient-script | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sbin/dhclient-script b/sbin/dhclient-script index 8bb18ab..5af4aa1 100755 --- a/sbin/dhclient-script +++ b/sbin/dhclient-script @@ -58,6 +58,27 @@ arp_flush() { /bin/sh >/dev/null 2>&1 } +delete_old_states() { + # If the IP changed, remove states from the old one + if [ -f /var/db/${interface}_ip ]; then + $OLD_IP = `cat /var/db/${interface}_ip` + if [ "${OLD_IP}" != "${new_ip_address}" ]; then + echo "Removing states from old IP '${OLD_IP}' (new IP '${new_ip_address}')" | logger -t dhclient + /sbin/pfctl -k 0.0.0.0/0 -k ${OLD_IP}/32 + /sbin/pfctl -k ${OLD_IP}/32 + pfctl -K ${OLD_IP}/32 + fi + fi + # Delete states through old gateway if it's not the same + if [ -f /tmp/${interface}_router ]; then + $OLD_ROUTER = `cat /tmp/${interface}_router` + if [ "${OLD_ROUTER}" != "${new_routers}" ]; then + echo "Removing states through old gateway '${OLD_ROUTER}' (new gateway '${new_routers}')" | logger -t dhclient + /sbin/pfctl -b 0.0.0.0/32 -b ${OLD_ROUTER}/32 + fi + fi +} + delete_old_address() { /bin/rm -f /var/db/${interface}_ip $IFCONFIG $interface inet -alias $old_ip_address $medium @@ -307,6 +328,7 @@ BOUND|RENEW|REBIND|REBOOT) fi if [ "$old_ip_address" != "$new_ip_address" ]; then delete_old_address + delete_old_states delete_old_routes changes="yes" fi @@ -334,6 +356,7 @@ EXPIRE|FAIL) delete_old_alias if [ -n "$old_ip_address" ]; then delete_old_address + delete_old_states delete_old_routes fi ;; @@ -356,6 +379,7 @@ TIMEOUT) fi fi $IFCONFIG $interface inet -alias $new_ip_address $medium + delete_old_states delete_old_routes ;; esac |