summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-12-04 07:48:43 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-12-04 07:48:43 +0000
commitd6ee4ccf4499351c791792e910927255fa030be4 (patch)
tree12c5ae5811a96c51ab003450c207ae82cbba2277 /sbin
parent3031ccc11fb74ca931f45018a65c2013d51ed6ae (diff)
downloadpfsense-d6ee4ccf4499351c791792e910927255fa030be4.zip
pfsense-d6ee4ccf4499351c791792e910927255fa030be4.tar.gz
When adding nameservers to the system, add a route to the ip through the interface in question. This ensures that domain name server lookups to the nameserver goes out the correct wan address. Also before adding new entries route delete the old nameserver routes that are on file to ensure that a long uptime doesn't result in stale routes.
Diffstat (limited to 'sbin')
-rwxr-xr-xsbin/dhclient-script20
1 files changed, 18 insertions, 2 deletions
diff --git a/sbin/dhclient-script b/sbin/dhclient-script
index 2ec748c..6910024 100755
--- a/sbin/dhclient-script
+++ b/sbin/dhclient-script
@@ -63,6 +63,10 @@ delete_old_address() {
}
add_new_address() {
+
+ # Kill off old pftpx process.
+ kill `ps awux | grep "pftpx -b" | grep -v grep | grep $old_ip_address | cut -d" " -f5`
+
$IFCONFIG $interface \
inet $new_ip_address \
netmask $new_subnet_mask \
@@ -161,12 +165,24 @@ add_new_routes() {
}
add_new_resolv_conf() {
-
/bin/rm -f /var/etc/nameservers.conf
-
+ if [ ! -f "/var/etc/nameserver_$interface" ]; then
+ # Make sure file exists to avoid errors
+ touch /var/etc/nameserver_$interface
+ fi
if [ -n "$new_domain_name_servers" ]; then
+ # Remove old entries
+ for nameserver in `cat /var/etc/nameserver_$interface`; do
+ route delete $nameserver
+ done
+ rm -f /var/etc/nameserver_$interface
for nameserver in $new_domain_name_servers; do
echo $nameserver >>/var/etc/nameservers.conf
+ # Add a route to the nameserver out the correct interface
+ # so that mulitple wans work correctly with multiple dns
+ # also backup the nameserver for later route removal
+ echo $nameserver >>/var/etc/nameserver_$interface
+ route add $nameserver -if $interface
done
echo $new_domain_name >/var/etc/defaultdomain.conf
fi
OpenPOWER on IntegriCloud