rc.d/routing: Silence errors for loopback routes
_loopback entry in `static_routes` ensures a loopback route exists in all routing tables. However, loopback routes may already be added by the kernel. Therefore, re-adding them triggers an `EEXIST` error on every boot. This change suppresses those harmless errors. PR: 259553 MFC after: 1 week Reviewed by: glebius, jlduran, markj Differential Revision: https://reviews.freebsd.org/D57470
This commit is contained in:
+16
-3
@@ -190,7 +190,13 @@ static_inet()
|
|||||||
if [ $_skip = 0 ]; then
|
if [ $_skip = 0 ]; then
|
||||||
route_args=`get_if_var ${i%:*} route_IF`
|
route_args=`get_if_var ${i%:*} route_IF`
|
||||||
if [ -n "$route_args" ]; then
|
if [ -n "$route_args" ]; then
|
||||||
${ROUTE_CMD} ${_action} ${route_args}
|
# Loopback routes may already be added by the kernel; ignore EEXIST.
|
||||||
|
if [ "${i%:*}" = "_loopback" ]; then
|
||||||
|
${ROUTE_CMD} ${_action} ${route_args} 2>&1 >/dev/null |
|
||||||
|
sed -e '/route: message indicates error: File exists/d' >&2
|
||||||
|
else
|
||||||
|
${ROUTE_CMD} ${_action} ${route_args}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
warn "route_${i%:*} not found."
|
warn "route_${i%:*} not found."
|
||||||
fi
|
fi
|
||||||
@@ -267,8 +273,15 @@ static_inet6()
|
|||||||
if [ $_skip = 0 ]; then
|
if [ $_skip = 0 ]; then
|
||||||
ipv6_route_args=`get_if_var ${i%:*} ipv6_route_IF`
|
ipv6_route_args=`get_if_var ${i%:*} ipv6_route_IF`
|
||||||
if [ -n "$ipv6_route_args" ]; then
|
if [ -n "$ipv6_route_args" ]; then
|
||||||
${ROUTE_CMD} ${_action} \
|
# Loopback routes may already be added by the kernel; ignore EEXIST.
|
||||||
-inet6 ${ipv6_route_args}
|
if [ "${i%:*}" = "_loopback" ]; then
|
||||||
|
${ROUTE_CMD} ${_action} -inet6 \
|
||||||
|
${ipv6_route_args} 2>&1 >/dev/null |
|
||||||
|
sed -e '/route: message indicates error: File exists/d' >&2
|
||||||
|
else
|
||||||
|
${ROUTE_CMD} ${_action} \
|
||||||
|
-inet6 ${ipv6_route_args}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
warn "route_${i%:*} not found"
|
warn "route_${i%:*} not found"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user