Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/etc/rc.d wait until our local address is available before co...
details: https://anonhg.NetBSD.org/src/rev/182053f9919f
branches: trunk
changeset: 789909:182053f9919f
user: christos <christos%NetBSD.org@localhost>
date: Thu Sep 12 19:52:50 2013 +0000
description:
wait until our local address is available before configuring.
diffstat:
etc/rc.d/ipsec | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diffs (48 lines):
diff -r 9ea4d6c303dd -r 182053f9919f etc/rc.d/ipsec
--- a/etc/rc.d/ipsec Thu Sep 12 19:51:09 2013 +0000
+++ b/etc/rc.d/ipsec Thu Sep 12 19:52:50 2013 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: ipsec,v 1.12 2013/06/14 16:37:55 christos Exp $
+# $NetBSD: ipsec,v 1.13 2013/09/12 19:52:50 christos Exp $
#
# PROVIDE: ipsec
@@ -37,14 +37,33 @@
done
}
+ipsec_load() {
+ if [ -z "$1" ]; then
+ /sbin/setkey -f /etc/ipsec.conf
+ else
+ sed -e "s/@LOCAL_ADDR@/$1/" < /etc/ipsec.conf | \
+ /sbin/setkey -f -
+ fi
+}
+
+ipsec_configure() {
+ while true; do
+ local addr="$(ipsec_getip "$ipsec_flags")"
+ case "$addr" in
+ '') sleep 1;;
+ "0.0.0.0") sleep 1;;
+ *) ipsec_load "$addr"; return;;
+ esac
+ done &
+}
+
ipsec_start()
{
echo "Installing ipsec manual keys/policies."
if [ -n "$ipsec_flags" ]; then
- sed -e "s/@LOCAL_ADDR@/$(ipsec_getip "$ipsec_flags")/" \
- < /etc/ipsec.conf | /sbin/setkey -f -
+ ipsec_configure
else
- /sbin/setkey -f /etc/ipsec.conf
+ ipsec_load
fi
}
Home |
Main Index |
Thread Index |
Old Index