Debian Codegraph @

heartbeat/IPsrcaddr

raw
1 #!/bin/sh
2 #
3 # Description: IPsrcaddr - Preferred source(/dest) address modification
4 #
5 # Author: John Sutton <[email protected]>
6 # Support: [email protected]
7 # License: GNU General Public License (GPL)
8 # Copyright: SCL Internet
9 #
10 # Based on the IPaddr script.
11 #
12 # This script manages the preferred source address associated with
13 # packets which originate on the localhost and are routed through the
14 # matching route. By default, i.e. without the use of this script or
15 # similar, these packets will carry the IP of the primary i.e. the
16 # non-aliased interface. This can be a nuisance if you need to ensure
17 # that such packets carry the same IP irrespective of which host in
18 # a redundant cluster they actually originate from.
19 #
20 # It can add a preferred source address, or remove one.
21 #
22 # usage: IPsrcaddr {start|stop|status|monitor|validate-all|meta-data}
23 #
24 # The "start" arg adds a preferred source address.
25 #
26 # Surprisingly, the "stop" arg removes it. :-)
27 #
28 # NOTES:
29 #
30 # 1) There must be one and not more than 1 matching route! Mainly because
31 # I can't see why you should have more than one. And if there is more
32 # than one, we would have to box clever to find out which one is to be
33 # modified, or we would have to pass its identity as an argument.
34 #
35 # 2) The script depends on Alexey Kuznetsov's ip utility from the
36 # iproute aka iproute2 package.
37 #
38 # 3) No checking is done to see if the passed in IP address can
39 # reasonably be associated with the interface on which the default
40 # route exists. So unless you want to deliberately spoof your source IP,
41 # check it! Normally, I would expect that your haresources looks
42 # something like:
43 #
44 # nodename ip1 ip2 ... ipN IPsrcaddr::ipX
45 #
46 # where ipX is one of the ip1 to ipN.
47 #
48 # OCF parameters are as below:
49 # OCF_RESKEY_ipaddress
50
51 #######################################################################
52 # Initialization:
53 : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
54 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
55 . ${OCF_FUNCTIONS_DIR}/findif.sh
56
57 # Defaults
58 OCF_RESKEY_ipaddress_default=""
59 OCF_RESKEY_cidr_netmask_default=""
60 OCF_RESKEY_destination_default="0.0.0.0/0"
61 OCF_RESKEY_proto_default=""
62 OCF_RESKEY_metric_default=""
63 OCF_RESKEY_pref_default=""
64 OCF_RESKEY_table_default=""
65
66 : ${OCF_RESKEY_ipaddress=${OCF_RESKEY_ipaddress_default}}
67 : ${OCF_RESKEY_cidr_netmask=${OCF_RESKEY_cidr_netmask_default}}
68 : ${OCF_RESKEY_destination=${OCF_RESKEY_destination_default}}
69 : ${OCF_RESKEY_proto=${OCF_RESKEY_proto_default}}
70 : ${OCF_RESKEY_metric=${OCF_RESKEY_metric_default}}
71 : ${OCF_RESKEY_pref=${OCF_RESKEY_pref_default}}
72 : ${OCF_RESKEY_table=${OCF_RESKEY_table_default}}
73 #######################################################################
74
75 [ -z "$OCF_RESKEY_proto" ] && PROTO="" || PROTO="proto $OCF_RESKEY_proto"
76 [ -z "$OCF_RESKEY_table" ] && TABLE="" || TABLE="table $OCF_RESKEY_table"
77
78 USAGE="usage: $0 {start|stop|status|monitor|validate-all|meta-data}";
79
80 echo "$OCF_RESKEY_ipaddress" | grep -q ":" && FAMILY="inet6" || FAMILY="inet"
81 [ "$FAMILY" = "inet6" ] && [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] && OCF_RESKEY_destination="::/0"
82
83 CMDSHOW="$IP2UTIL -f $FAMILY route show $TABLE to exact $OCF_RESKEY_destination"
84 CMDCHANGE="$IP2UTIL -f $FAMILY route change to "
85
86 if [ "$OCF_RESKEY_destination" != "0.0.0.0/0" ] && [ "$OCF_RESKEY_destination" != "::/0" ]; then
87 CMDSHOW="$CMDSHOW src $OCF_RESKEY_ipaddress"
88 fi
89
90 if [ "$OCF_RESKEY_table" = "local" ]; then
91 TABLE="$TABLE local"
92 fi
93
94 SYSTYPE="`uname -s`"
95
96 usage() {
97 echo $USAGE >&2
98 }
99
100 meta_data() {
101 cat <<END
102 <?xml version="1.0"?>
103 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
104 <resource-agent name="IPsrcaddr" version="1.0">
105 <version>1.0</version>
106
107 <longdesc lang="en">
108 Resource script for IPsrcaddr. It manages the preferred source address
109 modification.
110
111 Note: DHCP should not be enabled for the interface serving the preferred
112 source address. Enabling DHCP may result in unexpected behavior, such as
113 the automatic addition of duplicate or conflicting routes. This may
114 cause the IPsrcaddr resource to fail, or it may produce undesired
115 behavior while the resource continues to run.
116 </longdesc>
117 <shortdesc lang="en">Manages the preferred source address for outgoing IP packets</shortdesc>
118
119 <parameters>
120 <parameter name="ipaddress" unique="0" required="1">
121 <longdesc lang="en">
122 The IP address.
123 </longdesc>
124 <shortdesc lang="en">IP address</shortdesc>
125 <content type="string" default="${OCF_RESKEY_ipaddress_default}" />
126 </parameter>
127
128 <parameter name="cidr_netmask">
129 <longdesc lang="en">
130 The netmask for the interface in CIDR format. (ie, 24), or in
131 dotted quad notation 255.255.255.0).
132 </longdesc>
133 <shortdesc lang="en">Netmask</shortdesc>
134 <content type="string" default="${OCF_RESKEY_cidr_netmask_default}"/>
135 </parameter>
136
137 <parameter name="destination">
138 <longdesc lang="en">
139 The destination IP/subnet for the route (default: $OCF_RESKEY_destination_default)
140 </longdesc>
141 <shortdesc lang="en">Destination IP/subnet</shortdesc>
142 <content type="string" default="${OCF_RESKEY_destination_default}" />
143 </parameter>
144
145 <parameter name="proto">
146 <longdesc lang="en">
147 Proto to match when finding network. E.g. "kernel".
148 </longdesc>
149 <shortdesc lang="en">Proto</shortdesc>
150 <content type="string" default="${OCF_RESKEY_proto_default}" />
151 </parameter>
152
153 <parameter name="metric">
154 <longdesc lang="en">
155 Metric. Only needed if incorrect metric value is used.
156 </longdesc>
157 <shortdesc lang="en">Metric</shortdesc>
158 <content type="string" default="${OCF_RESKEY_metric_default}" />
159 </parameter>
160
161 <parameter name="pref">
162 <longdesc lang="en">
163 IPv6 route preference (low, medium or high). Only needed if incorrect pref value is used.
164 </longdesc>
165 <shortdesc lang="en">IPv6 route preference.</shortdesc>
166 <content type="string" default="${OCF_RESKEY_pref_default}" />
167 </parameter>
168
169 <parameter name="table">
170 <longdesc lang="en">
171 Table to modify and use for interface lookup. E.g. "local".
172
173 The table has to have a route matching the "destination" parameter.
174
175 This can be used for policy based routing. See man ip-rule(8).
176 </longdesc>
177 <shortdesc lang="en">Table</shortdesc>
178 <content type="string" default="${OCF_RESKEY_table_default}" />
179 </parameter>
180
181 </parameters>
182
183 <actions>
184 <action name="start" timeout="20s" />
185 <action name="stop" timeout="20s" />
186 <action name="monitor" depth="0" timeout="20s" interval="10s" />
187 <action name="validate-all" timeout="5s" />
188 <action name="meta-data" timeout="5s" />
189 </actions>
190 </resource-agent>
191 END
192 }
193
194 errorexit() {
195 ocf_exit_reason "$*"
196 exit $OCF_ERR_GENERIC
197 }
198
199 #
200 # We can distinguish 3 cases: no preferred source address, a
201 # preferred source address exists which matches that specified, and one
202 # exists but doesn't match that specified. srca_read() returns 1,0,2
203 # respectively.
204 #
205 # The output of route show is something along the lines of:
206 #
207 # default via X.X.X.X dev eth1 src Y.Y.Y.Y
208 #
209 # where the src clause "src Y.Y.Y.Y" may or may not be present
210
211 WS="[[:blank:]]"
212 case "$FAMILY" in
213 inet)
214 GROUP="[0-9]\{1,3\}"
215 IPADDR="\($GROUP\.\)\{3\}$GROUP"
216 ;;
217 inet6)
218 GROUP="[0-9a-f]\{0,4\}"
219 IPADDR="\($GROUP\:\)\{0,\}$GROUP"
220 ;;
221 esac
222 SRCCLAUSE="src$WS$WS*\($IPADDR\)"
223 MATCHROUTE="\(.*${WS}\)proto [^ ]\+\(.*${WS}\)\($SRCCLAUSE\)\($WS.*\|$\)"
224 METRICCLAUSE=".*\(metric$WS[^ ]\+\).*"
225 PROTOCLAUSE=".*\(proto$WS[^ ]\+\).*"
226 PREFCLAUSE=".*\(pref$WS[^ ]\+\).*"
227 FINDIF=findif
228
229 # findif needs that to be set
230 export OCF_RESKEY_ip=$OCF_RESKEY_ipaddress
231
232 srca_read() {
233 # Capture matching route - doublequotes prevent word splitting...
234 ROUTE="`$CMDSHOW dev $INTERFACE 2> /dev/null`" || errorexit "command '$CMDSHOW' failed"
235
236 # ... so we can make sure there is only 1 matching route
237 [ 1 -eq `echo "$ROUTE" | wc -l` ] || \
238 errorexit "more than 1 matching route exists"
239
240 # But there might still be no matching route
241 ([ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] || [ "$OCF_RESKEY_destination" = "::/0" ]) && [ -z "$ROUTE" ] && \
242 ! ocf_is_probe && [ "$__OCF_ACTION" != stop ] && errorexit "no matching route exists"
243
244 # Sed out the source ip address if it exists
245 SRCIP=`echo $ROUTE | sed -n "s/$MATCHROUTE/\4/p"`
246
247 # and what remains after stripping out the source ip address clause
248 ROUTE_WO_SRC=`echo $ROUTE | sed "s/$MATCHROUTE/\1\2\6/"`
249
250 # using "src <ip>" only returns output if there's a match
251 if [ "$OCF_RESKEY_destination" != "0.0.0.0/0" ] && [ "$OCF_RESKEY_destination" != "::/0" ]; then
252 [ -z "$ROUTE" ] && return 1 || return 0
253 fi
254
255 [ -z "$SRCIP" ] && return 1
256 [ $SRCIP = $1 ] && return 0
257 [ "$__OCF_ACTION" = "monitor" ] || [ "$__OCF_ACTION" = "status" ] && [ "${ROUTE%% *}" = "default" ] && return 1
258 return 2
259 }
260
261 #
262 # Add (or change if it already exists) the preferred source address
263 # The exit code should conform to LSB exit codes.
264 #
265
266 srca_start() {
267 srca_read $1
268
269 rc=$?
270 if [ $rc = 0 ]; then
271 rc=$OCF_SUCCESS
272 ocf_log info "The ip route has been already set.($NETWORK, $INTERFACE, $ROUTE_WO_SRC)"
273 else
274 # NetworkManager manages routes with proto static/kernel
275 [ -z "$OCF_RESKEY_proto" ] && echo "$PROTO" | grep -q "proto \(kernel\|static\)" && PROTO="proto keepalived"
276
277 $IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE $PROTO src $1 $METRIC $PREF || \
278 errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $PROTO src $1 $METRIC $PREF' failed"
279
280 if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] || [ "$OCF_RESKEY_destination" = "::/0" ]; then
281 $CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE $PROTO src $1 || \
282 errorexit "command '$CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE $PROTO src $1' failed"
283 fi
284 rc=$?
285 fi
286
287 return $rc
288 }
289
290 #
291 # Remove (if it exists) the preferred source address.
292 # If one exists but it's not the same as the one specified, that's
293 # an error. Maybe that's the wrong behaviour because if this fails
294 # then when IPaddr releases the associated interface (if there is one)
295 # your matching route will also get dropped ;-(
296 # The exit code should conform to LSB exit codes.
297 #
298
299 srca_stop() {
300 srca_read $1
301 rc=$?
302
303 if [ $rc = 1 ]; then
304 # We do not have a preferred source address for now
305 ocf_log info "No preferred source address defined, nothing to stop"
306 exit $OCF_SUCCESS
307 fi
308
309 [ $rc = 2 ] && errorexit "The address you specified to stop does not match the preferred source address"
310
311 if [ -z "$TABLE" ] || [ "${TABLE#table }" = "main" ]; then
312 SCOPE="link"
313 else
314 SCOPE="host"
315 fi
316
317 PRIMARY_IP="$($IP2UTIL -4 -o addr show dev $INTERFACE primary | awk '{split($4,a,"/");print a[1]}')"
318 OPTS="proto kernel scope $SCOPE"
319 [ "$FAMILY" = "inet" ] && OPTS="$OPTS src $PRIMARY_IP"
320
321 $IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE $OPTS $METRIC $PREF || \
322 errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $OPTS $METRIC $PREF' failed"
323
324 if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] || [ "$OCF_RESKEY_destination" = "::/0" ]; then
325 $CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE proto static || \
326 errorexit "command '$CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE proto static' failed"
327 fi
328
329 return $?
330 }
331
332 srca_status() {
333 srca_read $1
334
335 case $? in
336 0) echo "OK"
337 return $OCF_SUCCESS;;
338
339 1) echo "No preferred source address defined"
340 return $OCF_NOT_RUNNING;;
341
342 2) echo "Preferred source address has incorrect value"
343 return $OCF_ERR_GENERIC;;
344 esac
345 }
346
347 # A not reliable IP address checking function, which only picks up those _obvious_ violations...
348 #
349 # It accepts IPv4 address in dotted quad notation, for example "192.168.1.1"
350 #
351 # 100% confidence whenever it reports "negative",
352 # but may get false "positive" answer.
353 #
354 CheckIP() {
355 ip="$1"
356 case $ip in
357 *[!0-9.]*) #got invalid char
358 false;;
359 .*|*.) #begin or end with ".", which is invalid
360 false;;
361 *..*) #consecutive ".", which is invalid
362 false;;
363 *.*.*.*.*) #four decimal dots, which is too many
364 false;;
365 *.*.*.*) #exactly three decimal dots, candidate, evaluate each field
366 local IFS=.
367 set -- $ip
368 if
369 ( [ $1 -le 254 ] && [ $2 -le 254 ] && [ $3 -le 254 ] && [ $4 -le 254 ] )
370 then
371 if [ $1 -eq 127 ]; then
372 ocf_exit_reason "IP address [$ip] is a loopback address, thus can not be preferred source address"
373 exit $OCF_ERR_CONFIGURED
374 fi
375 else
376 true
377 fi
378 ;;
379 *) #less than three decimal dots
380 false;;
381 esac
382 return $? # This return is unnecessary, this comment too :)
383 }
384
385 CheckIP6() {
386 ip="$1"
387 case $ip in
388 *[!0-9a-f:]*) #got invalid char
389 false;;
390 *:::*) # more than 2 consecutive ":", which is invalid
391 false;;
392 *::*::*) # more than 1 "::", which is invalid
393 false;;
394 esac
395 }
396
397 #
398 # Find out which interface or alias serves the given IP address
399 # The argument is an IP address, and its output
400 # is an (aliased) interface name (e.g., "eth0" and "eth0:0").
401 #
402 find_interface_solaris() {
403
404
405 $IFCONFIG $IFCONFIG_A_OPT | $AWK '{if ($0 ~ /.*: / && NR > 1) {print "\n"$0} else {print}}' |
406 while read ifname linkstuff
407 do
408 : ifname = $ifname
409 read inet addr junk
410 : inet = $inet addr = $addr
411 while
412 read line && [ "X$line" != "X" ]
413 do
414 : Nothing
415 done
416
417 # This doesn't look right for a box with multiple NICs.
418 # It looks like it always selects the first interface on
419 # a machine. Yet, we appear to use the results for this case too...
420 ifname=`echo "$ifname" | sed s'%:*$%%'`
421
422 case $addr in
423 addr:$BASEIP) echo $ifname; return $OCF_SUCCESS;;
424 $BASEIP) echo $ifname; return $OCF_SUCCESS;;
425 esac
426 done
427 return $OCF_ERR_GENERIC
428 }
429
430
431 #
432 # Find out which interface or alias serves the given IP address
433 # The argument is an IP address, and its output
434 # is an (aliased) interface name (e.g., "eth0" and "eth0:0").
435 #
436 find_interface_generic() {
437 local iface=`$IP2UTIL -o -f $FAMILY addr show | grep " $BASEIP" \
438 | cut -d ' ' -f2 | grep -v '^ipsec[0-9][0-9]*$'`
439 if [ -z "$iface" ]; then
440 return $OCF_ERR_GENERIC
441 else
442 echo $iface
443 return $OCF_SUCCESS
444 fi
445 }
446
447
448 #
449 # Find out which interface or alias serves the given IP address
450 # The argument is an IP address, and its output
451 # is an (aliased) interface name (e.g., "eth0" and "eth0:0").
452 #
453 find_interface() {
454 case "$SYSTYPE" in
455 SunOS)
456 IF=`find_interface_solaris $BASEIP`
457 ;;
458 *)
459 IF=`find_interface_generic $BASEIP`
460 ;;
461 esac
462
463 echo $IF
464 return $OCF_SUCCESS;
465 }
466
467
468 ip_status() {
469
470 BASEIP="$1"
471 case "$SYSTYPE" in
472 Darwin)
473 # Treat Darwin the same as the other BSD variants (matched as *BSD)
474 SYSTYPE="${SYSTYPE}BSD"
475 ;;
476 *)
477 ;;
478 esac
479
480
481 case "$SYSTYPE" in
482 *BSD)
483 $IFCONFIG $IFCONFIG_A_OPT | grep "inet.*[: ]$BASEIP " >/dev/null 2>&1
484 if [ $? = 0 ]; then
485 return $OCF_SUCCESS
486 else
487 return $OCF_NOT_RUNNING
488 fi;;
489
490 Linux|SunOS)
491 IF=`find_interface "$BASEIP"`
492 if [ -z "$IF" ]; then
493 return $OCF_NOT_RUNNING
494 fi
495
496 case $IF in
497 lo*)
498 ocf_exit_reason "IP address [$BASEIP] is served by loopback, thus can not be preferred source address"
499 exit $OCF_ERR_CONFIGURED
500 ;;
501 *)return $OCF_SUCCESS;;
502 esac
503 ;;
504
505 *)
506 if [ -z "$IF" ]; then
507 return $OCF_NOT_RUNNING
508 else
509 return $OCF_SUCCESS
510 fi;;
511 esac
512 }
513
514
515 srca_validate_all() {
516
517 if [ -z "$OCF_RESKEY_ipaddress" ]; then
518 # usage
519 ocf_exit_reason "Please set OCF_RESKEY_ipaddress to the preferred source IP address!"
520 return $OCF_ERR_CONFIGURED
521 fi
522
523 if ! echo "$OCF_RESKEY_destination" | grep -q "/"; then
524 return $OCF_ERR_CONFIGURED
525 fi
526
527
528 if ! [ "x$SYSTYPE" = "xLinux" ]; then
529 # checks after this point are only relevant for linux.
530 return $OCF_SUCCESS
531 fi
532
533 check_binary $AWK
534 case "$SYSTYPE" in
535 *BSD|SunOS)
536 check_binary $IFCONFIG
537 ;;
538 esac
539
540 # The IP address should be in good shape
541 if CheckIP "$ipaddress"; then
542 :
543 elif CheckIP6 "$ipaddress"; then
544 :
545 else
546 ocf_exit_reason "Invalid IP address [$ipaddress]"
547 return $OCF_ERR_CONFIGURED
548 fi
549
550 if ocf_is_probe; then
551 return $OCF_SUCCESS
552 fi
553
554 # We should serve this IP address of course
555 if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
556 if ip_status "$ipaddress"; then
557 :
558 else
559 ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
560 return $OCF_ERR_INSTALLED
561 fi
562 fi
563 return $OCF_SUCCESS
564 }
565
566 if
567 ( [ $# -ne 1 ] )
568 then
569 usage
570 exit $OCF_ERR_ARGS
571 fi
572
573 # These operations do not require the OCF instance parameters to be set
574 case $1 in
575 meta-data) meta_data
576 exit $OCF_SUCCESS
577 ;;
578 usage) usage
579 exit $OCF_SUCCESS
580 ;;
581 *)
582 ;;
583 esac
584
585 ipaddress="$OCF_RESKEY_ipaddress"
586
587 [ "$__OCF_ACTION" != "validate-all" ] && OCF_CHECK_LEVEL=10
588 srca_validate_all
589 rc=$?
590 if [ $rc -ne $OCF_SUCCESS ]; then
591 case $1 in
592 # if we can't validate the configuration during a stop, that
593 # means the resources isn't configured correctly. There's no way
594 # to actually stop the resource in this situation because there's
595 # no way it could have even started. Return success here
596 # to indicate that the resource is not running, otherwise the
597 # stop action will fail causing the node to be fenced just because
598 # of a mis configuration.
599 stop) exit $OCF_SUCCESS;;
600 *) exit $rc;;
601 esac
602 fi
603
604 findif_out=`$FINDIF`
605 rc=$?
606 [ $rc -ne 0 ] && {
607 ocf_exit_reason "[$FINDIF] failed"
608 exit $rc
609 }
610
611 INTERFACE=`echo $findif_out | awk '{print $1}'`
612 case "$FAMILY" in
613 inet)
614 LISTCMD="$IP2UTIL -f $FAMILY route list dev $INTERFACE scope link $PROTO match $ipaddress"
615 ;;
616 inet6)
617 LISTCMD="$IP2UTIL -f $FAMILY route list dev $INTERFACE $PROTO match $ipaddress"
618 ;;
619 esac
620 LISTROUTE=`$LISTCMD`
621
622 [ -z "$PROTO" ] && PROTO=`echo $LISTROUTE | sed -n "s/$PROTOCLAUSE/\1/p"`
623 if [ -n "$OCF_RESKEY_metric" ]; then
624 METRIC="metric $OCF_RESKEY_metric"
625 elif [ -z "$TABLE" ] || [ "${TABLE#table }" = "main" ] || [ "$FAMILY" = "inet6" ]; then
626 METRIC=`echo $LISTROUTE | sed -n "s/$METRICCLAUSE/\1/p"`
627 else
628 METRIC=""
629 fi
630 if [ "$FAMILY" = "inet6" ]; then
631 if [ -z "$OCF_RESKEY_pref" ]; then
632 PREF=`echo $LISTROUTE | sed -n "s/$PREFCLAUSE/\1/p"`
633 else
634 PREF="pref $OCF_RESKEY_pref"
635 fi
636 fi
637 if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] || [ "$OCF_RESKEY_destination" = "::/0" ] ;then
638 NETWORK=`echo $LISTROUTE | grep -m 1 -o '^[^ ]*'`
639
640 if [ -z "$NETWORK" ]; then
641 err_str="command '$LISTCMD' failed to find a matching route"
642
643 if [ "$__OCF_ACTION" = "start" ]; then
644 ocf_exit_reason "$err_str"
645 exit $OCF_ERR_ARGS
646 elif ! ocf_is_probe; then
647 ocf_log warn "$err_str"
648 else
649 ocf_log debug "$err_str"
650 fi
651 fi
652 else
653 NETWORK="$OCF_RESKEY_destination"
654 fi
655
656 case $1 in
657 start) srca_start $ipaddress
658 ;;
659 stop) srca_stop $ipaddress
660 ;;
661 status) srca_status $ipaddress
662 ;;
663 monitor) srca_status $ipaddress
664 ;;
665 validate-all) srca_validate_all
666 ;;
667 *) usage
668 exit $OCF_ERR_UNIMPLEMENTED
669 ;;
670 esac
671
672 exit $?
673
674 #
675 # Version 0.3 2002/11/04 17:00:00 John Sutton <[email protected]>
676 # Name changed from IPsrcroute to IPsrcaddr and now reports errors
677 # using ha_log rather than on stderr.
678 #
679 # Version 0.2 2002/11/02 17:00:00 John Sutton <[email protected]>
680 # Changed status output to "OK" to satisfy ResourceManager's
681 # we_own_resource() function.
682 #
683 # Version 0.1 2002/11/01 17:00:00 John Sutton <[email protected]>
684 # First effort but does the job?
685 #