#!/bin/sh

# Wait until --listen succeeds, and then look for trap route
# caused by "packetdefault"
# This will delay until pluto is started

count=20
until [ $count -eq 0 ] || ipsec whack --listen >/dev/null 2>&1
do
	count=`expr $count - 1`
	sleep 2
done 

until [ $count -eq 0 ] || (ipsec eroute | grep 0.0.0.0/0 > /dev/null)
do
    count=`expr $count - 1`
    sleep 1
done


