Blame SOURCES/bz1751700-IPaddr2-1-sanitize-IPv6-IPs.patch

734564
From 8ecfa95fff384ed047fd804016abdbbdcdd96d27 Mon Sep 17 00:00:00 2001
734564
From: Keisuke MORI <kskmori@intellilink.co.jp>
734564
Date: Wed, 11 Sep 2019 15:33:37 +0900
734564
Subject: [PATCH] Low: IPaddr2: fix to work properly with unsanitized IPv6
734564
 addresses
734564
734564
`ip route get` shows the sanitized address at $1 or $2 depending on
734564
the address is already assigned to the node or not.
734564
```
734564
[root@centos73-1 ~]# /sbin/ip route get 2001:db8:101::0001
734564
2001:db8:101::1 dev eth1  proto ra  src 2001:db8:101:0:XXXX:XXXX:XXXX:XXXX  metric 100
734564
[root@centos73-1 ~]# /sbin/ip addr add 2001:db8:101::0001/64 dev eth1
734564
[root@centos73-1 ~]# /sbin/ip route get 2001:db8:101::0001
734564
local 2001:db8:101::1 dev lo  table local  proto none  src 2001:db8:101::1  metric 0
734564
```
734564
734564
It can not be sanitized if the address is unreachable and on the recent distributions
734564
(probably depending on the iproute package version)
734564
```
734564
[root@centos73-1 ~]# /sbin/ip route get 2001:db8:201::0001
734564
unreachable 2001:db8:201::1 dev lo  table unspec  proto kernel  src 2001:db8:101:0:XXXX:XXXX:XXXX:XXXX  metric 429496
734564
```
734564
```
734564
[root@rhel80-1 ~]# /sbin/ip route get 200:db8:201::0001
734564
RTNETLINK answers: Network is unreachable
734564
```
734564
---
734564
 heartbeat/IPaddr2 | 6 ++++++
734564
 1 file changed, 6 insertions(+)
734564
734564
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
734564
index 041ace3a2..4f28ddab6 100755
734564
--- a/heartbeat/IPaddr2
734564
+++ b/heartbeat/IPaddr2
734564
@@ -477,6 +477,12 @@ ip_init() {
734564
 		fi
734564
 	else
734564
 		FAMILY=inet6
734564
+		# address sanitization defined in RFC5952
734564
+		SANITIZED_IP=$($IP2UTIL route get $OCF_RESKEY_ip | awk '$1~/:/ {print $1}  $2~/:/ {print $2}')
734564
+                if [ -n "$SANITIZED_IP" ]; then
734564
+                    OCF_RESKEY_ip="$SANITIZED_IP"
734564
+                fi
734564
+
734564
 		if ocf_is_true $OCF_RESKEY_lvs_support ;then
734564
 			ocf_exit_reason "The IPv6 does not support lvs_support"
734564
 			exit $OCF_ERR_CONFIGURED