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