may be IPv4 or IPv6 addresses. If the interface has only an IPv4
address then IPv6 routes will be ignored, and
.IR "vice versa" .
+.RS
+.PP
+If any configuration commands fail, a warning
+.IP
+.B USER tripe-ifup command-failed
+.BI rc= rc
+.I command
+.PP
+is issued.
+.RE
.hP 4.
Configure the interface MTU and bring it up. The
interface MTU is configured based on the path MTU to the peer's external
.IP
.B USER tripe-ifup configured
.I peer
+.RB [ failed ]
.PP
-is issued.
+is issued: the
+.B failed
+token is included if any of the configuration commands failed.
.RE
.
.\"--------------------------------------------------------------------------
## Determine whether we have IPv6 support.
if [ -d /proc/sys/net/ipv6 ]; then have6=t; else have6=nil; fi
+###--------------------------------------------------------------------------
+### Error handling.
+
+win=t
+try () {
+ if "$@"; then :; else
+ rc=$?
+ tripectl warn tripe-ifup command-failed rc=$rc "$*"
+ win=nil
+ fi
+}
+
###--------------------------------------------------------------------------
### Collect arguments.
case "${P_IFNAME+set}" in
set)
- ip link set "$ifname" name "$P_IFNAME"
+ try ip link set "$ifname" name "$P_IFNAME"
ifname=$P_IFNAME
$tripectl setifname "$peer" "$ifname"
;;
set -- $l4addr
case $#,${r4addr+set} in
[1-9]*,set)
- ip addr add "$1" peer "$r4addr" dev "$ifname"
+ try ip addr add "$1" peer "$r4addr" dev "$ifname"
haveaddr4=t
shift
;;
esac
for a in "$@"; do
- ip addr add "$a" dev "$ifname"
+ try ip addr add "$a" dev "$ifname"
haveaddr4=t
done
case $have6,$# in
t,[1-9]*)
for a in "$@"; do
- ip addr add "$a" dev "$ifname"
+ try ip addr add "$a" dev "$ifname"
haveaddr6=t
done
case ${r6addr+set} in
- set) ip route add $r6addr proto static dev "$ifname" ;;
+ set) try ip route add $r6addr proto static dev "$ifname" ;;
esac
;;
esac
mtu=$(expr "$pathmtu" - 29 - $A_BULK_OVERHEAD)
;;
esac
- ip link set dev "$ifname" up mtu "$mtu"
+ try ip link set dev "$ifname" up mtu "$mtu"
;;
esac
case $haveaddr4,$# in
t,[1-9]*)
for p in "$@"; do
- ip route add $p proto static via "$r4addr"
+ try ip route add $p proto static via "$r4addr"
done
;;
esac
case $haveaddr6,$# in
t,[1-9]*)
for p in "$@"; do
- ip route add $p proto static via "${r6addr%/*}"
+ try ip route add $p proto static via "${r6addr%/*}"
done
;;
esac
###--------------------------------------------------------------------------
### Issue a notification that we've won.
-$tripectl notify tripe-ifup configured "$peer"
+case $win in
+ t) $tripectl notify tripe-ifup configured "$peer" ;;
+ nil) $tripectl notify tripe-ifup configured "$peer" failed ;;
+esac
###----- That's all, folks --------------------------------------------------