[CUWiN-Dev] default route disappearance

David Young dyoung at pobox.com
Thu Sep 7 20:33:34 CDT 2006


Dan,

This should help with the problems at the library, and at every other
node, too.

Dave

On Thu, Sep 07, 2006 at 08:28:06PM -0500, dyoung at cuw.ojctech.com wrote:
> Author: dyoung
> Date: 2006-09-07 20:28:05 -0500 (Thu, 07 Sep 2006)
> New Revision: 4160
> 
> Modified:
>    cuw/trunk/src/boot-image/extras/sbin/dhcpselect
> Log:
> Fix a bug in dhcpselect where it would rule that we had a default
> route on some arbitrary wire interface, such as sip0, when we really
> we got a ping reply from google.com over the wireless, because
> hslsd had installed a default.  Now, we rule that an interface is
> net-connected if it is the default interface, and if we can ping
> Google on the interface.
> 
> This patch should help on the library's node, and on all other
> non-gateway nodes, too!
> 
> 
> 
> Modified: cuw/trunk/src/boot-image/extras/sbin/dhcpselect
> ===================================================================
> --- cuw/trunk/src/boot-image/extras/sbin/dhcpselect	2006-09-07 19:27:10 UTC (rev 4159)
> +++ cuw/trunk/src/boot-image/extras/sbin/dhcpselect	2006-09-08 01:28:05 UTC (rev 4160)
> @@ -784,8 +784,10 @@
>  	rv=$is_dhclient
>  }
>  
> -# Given an interface, test for a net connection on that interface.  If we find
> -# one, call net-connect to prepare for a routing change.
> +# Given an interface, test for a net connection on that interface.  Rule
> +# that an interface is net-connected if it is the default interface, and
> +# if we can ping Google on the interface.  If we find a net connection,
> +# call net-connect to prepare for a routing change.
>  test-for-net-connection ()
>  {
>  	iface="$1"
> @@ -796,11 +798,13 @@
>  		grep -v alias)
>  	ip=$2
>  
> +	default_iface=$(route -n get default | \
> +			awk '/^[[:space:]]*interface:/ { print $2; }')
> +
>  	# Ping Google with 4 packets using the interface.
>  	print "test-for-net-connection: $iface: testing for a net connection.."
> -	ping -c 4 -I $ip google.com \
> -		>/dev/null 2>/dev/null
> -	if [ $? = 0 ]; then
> +	if [ "$default_iface" = "$iface" ] && \
> +	   ping -c 4 -I $ip google.com >/dev/null 2>/dev/null; then
>  		print "test-for-net-connection: $iface: found a net connection"
>  
>  		# We are now net-connected.  Run net-connect to queue a routing
> 
> _______________________________________________
> CU-Wireless-Commits mailing list
> CU-Wireless-Commits at cuwireless.net
> http://lists.chambana.net/cgi-bin/listinfo/cu-wireless-commits


-- 
David Young             OJC Technologies
dyoung at ojctech.com      Urbana, IL * (217) 278-3933


More information about the CU-Wireless-Dev mailing list