]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/ppp/ip-up
Corrected dhcp.cgi sorting issue
[people/teissler/ipfire-2.x.git] / src / ppp / ip-up
index 0f32820c08c390140423e95ec49672d2ea877a75..80fb49f49e1c2a5176860545535f03db5cd403af 100644 (file)
@@ -44,9 +44,17 @@ echo -n "$1" > /var/ipfire/red/iface
 echo -n "$4" > /var/ipfire/red/local-ipaddress
 echo -n "$5" > /var/ipfire/red/remote-ipaddress
 grep -v "gateway" /etc/hosts > /tmp/hosts
 echo -n "$4" > /var/ipfire/red/local-ipaddress
 echo -n "$5" > /var/ipfire/red/remote-ipaddress
 grep -v "gateway" /etc/hosts > /tmp/hosts
-echo "$5 gateway"  >> /tmp/hosts
-mv /tmp/hosts /etc/hosts
 
 
+TEST=`ping -c 2 $5 2>/dev/null | tail -2 | head -1 | cut -d"," -f2`;
+
+if [ "$TEST" == " 2 packets received" ]; then
+       echo "$5 gateway" >> /tmp/hosts
+else
+       FIRE=`nslookup ping.ipfire.org | tail -2  | head -1 | cut -d" " -f2`;
+       echo "$FIRE gateway" >> /tmp/hosts
+fi
+
+mv /tmp/hosts /etc/hosts
 touch /var/ipfire/red/active
 
 run_subdir ${rc_base}/init.d/networking/red.up/
 touch /var/ipfire/red/active
 
 run_subdir ${rc_base}/init.d/networking/red.up/