Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Medium: IPsrcaddr: exit with the right code when not properly configured
- Loading branch information
1 parent
aa2b080
commit 2db67fa
Showing
2 changed files
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,7 +247,7 @@ CheckIP() { | |
then | ||
if [ $1 -eq 127 ]; then | ||
ocf_log err "IP address [$ip] is a loopback address, thus can not be preferred source address" | ||
exit $OCF_ERR_ARGS | ||
exit $OCF_ERR_CONFIGURED | ||
fi | ||
else | ||
true | ||
|
@@ -385,7 +385,7 @@ ip_status() { | |
case $IF in | ||
lo*) | ||
ocf_log err "IP address [$BASEIP] is served by loopback, thus can not be preferred source address" | ||
exit $OCF_ERR_ARGS | ||
exit $OCF_ERR_CONFIGURED | ||
;; | ||
*)return $OCF_SUCCESS;; | ||
esac | ||
|
@@ -412,15 +412,15 @@ srca_validate_all() { | |
: | ||
else | ||
ocf_log err "Invalid IP address [$ipaddress]" | ||
exit $OCF_ERR_ARGS | ||
exit $OCF_ERR_CONFIGURED | ||
fi | ||
|
||
# We should serve this IP address of course | ||
if ip_status "$ipaddress"; then | ||
: | ||
else | ||
ocf_log err "We are not serving [$ipaddress], hence can not make it a preferred source address" | ||
exit $OCF_ERR_ARGS | ||
exit $OCF_ERR_INSTALLED | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dmuhamedagic
Author
Contributor
|
||
fi | ||
} | ||
|
||
|
@@ -448,12 +448,15 @@ if | |
then | ||
# usage | ||
ocf_log err "Please set OCF_RESKEY_ipaddress to the preferred source IP address!" | ||
exit $OCF_ERR_ARGS | ||
exit $OCF_ERR_CONFIGURED | ||
fi | ||
|
||
ipaddress="$OCF_RESKEY_ipaddress" | ||
|
||
INTERFACE=`$FINDIF -C |grep -o "^[^[:space:]]*"` | ||
findif_out=`$FINDIF -C` | ||
rc=$? | ||
[ $rc -ne 0 ] && exit $rc | ||
INTERFACE=`echo $findif_out | awk '{print $1}'` | ||
NETWORK=`ip route list dev $INTERFACE scope link|grep -o '^[^ ]*'` | ||
|
||
case $1 in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dmuhamedagic Oops, wrong spot previously.
This is the change that looks wrong (both the old and the new).
Combined with srca_validate_all(), this will result in fencing when stopping an inactive instance (as would happen for a misconfigured resource)