Bugfix backport: sysctl.conf vrouter namespace
[armband.git] / patches / fuel-library / 0015-Set-net.ipv4.ip_nonlocal_bind-1-for-vrouter-namespace.patch
1 From: Bartosz Kupidura <bkupidura@mirantis.com>
2 Date: Mon, 27 Jun 2016 13:12:29 +0200
3 Subject: [PATCH] Set net.ipv4.ip_nonlocal_bind=1 for vrouter namespace
4
5 Change-Id: I123af7e3b53f9a53fcd9d2818640c0bd4699e024
6 Closes-Bug: #1595957
7 (cherry picked from commit 244456a3b77074a6cd85fa9d33ebb03ac25decf8)
8 ---
9  files/fuel-ha-utils/ocf/ns_dns     | 3 ++-
10  files/fuel-ha-utils/ocf/ns_vrouter | 3 ++-
11  2 files changed, 4 insertions(+), 2 deletions(-)
12
13 diff --git a/files/fuel-ha-utils/ocf/ns_dns b/files/fuel-ha-utils/ocf/ns_dns
14 index cdd814c..49cbd17 100644
15 --- a/files/fuel-ha-utils/ocf/ns_dns
16 +++ b/files/fuel-ha-utils/ocf/ns_dns
17 @@ -140,7 +140,7 @@ exit $OCF_SUCCESS
18  
19  check_ns() {
20    local ns=`ip netns list | grep "$OCF_RESKEY_ns"`
21 -  [ $ns != $OCF_RESKEY_ns ] && return $OCF_ERR_GENERIC
22 +  [ "$ns" != $OCF_RESKEY_ns ] && return $OCF_ERR_GENERIC
23    return $OCF_SUCCESS
24  }
25  
26 @@ -150,6 +150,7 @@ get_ns() {
27  
28    ocf_run ip netns add $OCF_RESKEY_ns
29    rc=$?
30 +  ocf_run $RUN_IN_NS /sbin/sysctl -w net.ipv4.ip_nonlocal_bind=1
31    ocf_run $RUN_IN_NS ip link set up dev lo
32  
33    return $rc
34 diff --git a/files/fuel-ha-utils/ocf/ns_vrouter b/files/fuel-ha-utils/ocf/ns_vrouter
35 index a65e9cf..5cc6c98 100644
36 --- a/files/fuel-ha-utils/ocf/ns_vrouter
37 +++ b/files/fuel-ha-utils/ocf/ns_vrouter
38 @@ -186,7 +186,7 @@ check_ns() {
39    local LH="${LL} check_ns():"
40    local ns=`ip netns list | grep "$OCF_RESKEY_ns"`
41    ocf_log debug "${LH} recieved netns list: ${ns}"
42 -  [[ $ns != $OCF_RESKEY_ns ]] && return $OCF_ERR_GENERIC
43 +  [[ "$ns" != $OCF_RESKEY_ns ]] && return $OCF_ERR_GENERIC
44    return $OCF_SUCCESS
45  }
46  
47 @@ -197,6 +197,7 @@ get_ns() {
48  
49    ocf_run ip netns add $OCF_RESKEY_ns
50    rc=$?
51 +  ocf_run $RUN_IN_NS /sbin/sysctl -w net.ipv4.ip_nonlocal_bind=1
52    ocf_run $RUN_IN_NS ip link set up dev lo
53    ocf_log debug "${LH} added netns ${OCF_RESKEY_ns} and set up lo"
54