backport drbd main ipv6: Fix interface indices larger than 255

drbd services occasionally fail at rapid successive swact
Netlink device number exceeding 255 (max number
that can be represented with two characters in hex ,
"ff") fail to parse by drbdadm during fast successive swacts,
the Netlink device number (second string in lines of
/proc/net/if_inet6]) gets very large exceeding 255 decimal and
cannot be represented as two hex characters (ff), like this:
fe80000000000000eceeeefffeeeeeee 14e 40 20 80 cali19a19189318

Closes-bug: 1877907

Change-Id: I035eb81830f3c5e5a129c20766348ff842bc05c8
Signed-off-by: Paul Vaduva <Paul.Vaduva@windriver.com>
This commit is contained in:
paul 2020-06-24 14:33:42 +00:00 committed by Paul Vaduva
parent 5bb777d372
commit 4cad553856
2 changed files with 41 additions and 0 deletions

View File

@ -44,6 +44,7 @@ Patch0006: 0006-avoid-kernel-userspace-version-check.patch
Patch0007: 0007-Update-OCF-to-attempt-connect-in-certain-states.patch
Patch0008: 0008-Increase-short-cmd-timeout-to-15-secs.patch
Patch0009: 0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
Patch0010: 0010-backport-drbd-main-ipv6-Fix-interface-indices-larger.patch
License: GPLv2+
ExclusiveOS: linux
@ -273,6 +274,7 @@ management utility.
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%build
%configure \

View File

@ -0,0 +1,39 @@
From 393137563853cde5561845aeb8498d831d6368aa Mon Sep 17 00:00:00 2001
From: paul <paul@starlingx.com>
Date: Mon, 29 Jun 2020 16:48:39 +0000
Subject: [PATCH] backport: drbd main ipv6: Fix interface indices larger than
255
fscanf line probably copied from kernel printf, but printf specifies the
minimal field width and scanf the maximal field width.
The bug was triggered on Xen servers that create and assign new,
incremented interface IDs for new machines.
ifindex is of type int anyways: struct net_device as defined in
include/linux/netdevice.h. We should not rely on the assumption that
the values are small enough to fit in one byte.
Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
Signed-off-by: paul <paul@starlingx.com>
---
user/drbdadm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/user/drbdadm_main.c b/user/drbdadm_main.c
index 19c5a44..d516d6f 100644
--- a/user/drbdadm_main.c
+++ b/user/drbdadm_main.c
@@ -3091,7 +3091,7 @@ int have_ip_ipv6(const char *ip)
while (fscanf
(if_inet6,
- X32(08) X32(08) X32(08) X32(08) " %*02x %*02x %*02x %*02x %s",
+ X32(08) X32(08) X32(08) X32(08) " %*x %*x %*x %*x %s",
b, b + 1, b + 2, b + 3, name) > 0) {
for (i = 0; i < 4; i++)
addr6.s6_addr32[i] = cpu_to_be32(b[i]);
--
1.8.3.1