Blame SOURCES/0015-utils-return-default-family-when-rtm_family-is-not-R.patch

be97f7
From 420957e4c56f65703c6f2f24da0ea35c6b7bbcda Mon Sep 17 00:00:00 2001
be97f7
From: Stefano Brivio <sbrivio@redhat.com>
be97f7
Date: Thu, 27 Jul 2017 21:52:30 +0200
be97f7
Subject: [PATCH] utils: return default family when rtm_family is not
be97f7
 RTNL_FAMILY_IPMR/IP6MR
be97f7
be97f7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1475762
be97f7
Upstream Status: iproute2.git commit 5ce897a03bfd
be97f7
be97f7
commit 5ce897a03bfda76dc66dc1acfa014fc0e3d3022a
be97f7
Author: Hangbin Liu <liuhangbin@gmail.com>
be97f7
Date:   Thu Jul 27 17:44:15 2017 +0800
be97f7
be97f7
    utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR
be97f7
be97f7
    When we get a multicast route, the rtm_type is RTN_MULTICAST, but the
be97f7
    rtm_family may be AF_INET. If we only check the type with RTNL_FAMILY_IPMR,
be97f7
    we will get malformed address. e.g.
be97f7
be97f7
    + ip -4 route add multicast 172.111.1.1 dev em1 table main
be97f7
be97f7
    Before fix:
be97f7
    + ip route list type multicast table main
be97f7
    multicast ac6f:101:800:400:400:0:3c00:0 dev em1 scope link
be97f7
be97f7
    After fix:
be97f7
    + ip route list type multicast table main
be97f7
    multicast 172.111.1.1 dev em1 scope link
be97f7
be97f7
    Fixes: 56e3eb4c3400 ("ip: route: fix multicast route dumps")
be97f7
    Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
be97f7
    Acked-by: Phil Sutter <phil@nwl.cc>
be97f7
be97f7
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
be97f7
---
be97f7
 lib/utils.c | 8 +++++++-
be97f7
 1 file changed, 7 insertions(+), 1 deletion(-)
be97f7
be97f7
diff --git a/lib/utils.c b/lib/utils.c
be97f7
index 7d6ee53..9f55391 100644
be97f7
--- a/lib/utils.c
be97f7
+++ b/lib/utils.c
be97f7
@@ -1219,5 +1219,11 @@ int get_real_family(int rtm_type, int rtm_family)
be97f7
 	if (rtm_type != RTN_MULTICAST)
be97f7
 		return rtm_family;
be97f7
 
be97f7
-	return rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6;
be97f7
+	if (rtm_family == RTNL_FAMILY_IPMR)
be97f7
+		return AF_INET;
be97f7
+
be97f7
+	if (rtm_family == RTNL_FAMILY_IP6MR)
be97f7
+		return AF_INET6;
be97f7
+
be97f7
+	return rtm_family;
be97f7
 }
be97f7
-- 
be97f7
1.8.3.1
be97f7