14 _cip_prefix
="${_cip_base%.*}"
15 _cip_suffix
="${_cip_base##*.}"
17 for _i
in $
(seq 1 "$_count"); do
18 _cip_last
=$
((_cip_suffix
+ _i
))
19 _cip
="${_cip_prefix}.${_cip_last}"
20 _cport
=$
((_cport_base
+ _i
))
21 echo "${_sip}:${_sport} ${_cip}:${_cport}"
25 setup_tcp_connections
()
27 _t
="${FAKE_NETWORK_STATE}/tcp-established"
28 export FAKE_NETSTAT_TCP_ESTABLISHED_FILE
="$_t"
29 _tcp_connections
"$@" >"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE"
32 setup_tcp_connections_unkillable
()
34 # These connections are listed by the "ss" stub but are not
35 # killed by the "ctdb killtcp" stub. So killing these
36 # connections will never succeed... and will look like a time
38 _t
=$
(_tcp_connections
"$@" |
sed -e 's/ /|/g')
39 export FAKE_NETSTAT_TCP_ESTABLISHED
="$_t"
42 # Setup some fake /proc/net/bonding files with just enough info for
45 # arg1 is interface name, arg2 is currently active slave (use "None"
46 # if none), arg3 is MII status ("up" or "down").
50 _slave
="${2:-${_iface}_sl_0}"
52 _mii_subs
="${4:-${_mii_s:-up}}"
55 Setting $_iface to be a bond with active slave $_slave and MII status $_mii_s
58 _t
="${FAKE_NETWORK_STATE}/proc-net-bonding"
59 export FAKE_PROC_NET_BONDING
="$_t"
60 mkdir
-p "$FAKE_PROC_NET_BONDING"
62 cat >"${FAKE_PROC_NET_BONDING}/$_iface" <<EOF
63 Bonding Mode: IEEE 802.3ad Dynamic link aggregation
64 Currently Active Slave: $_slave
67 # Status of 1st pretend adapter
68 MII Status: $_mii_subs
69 # Status of 2nd pretend adapter
70 MII Status: $_mii_subs