[PATCH 4/4] add an assertion in rtnl_tc_set_link()

Cong Wang xiyou.wangcong at gmail.com
Tue Dec 3 23:16:11 EST 2013


So that we can catch the bug easily.

Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
---
 lib/route/tc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/route/tc.c b/lib/route/tc.c
index fbc5c7e..0886e8e 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -300,6 +300,8 @@ void rtnl_tc_set_link(struct rtnl_tc *tc, struct rtnl_link *link)
 
 	if (!link)
 		return;
+	if (!link->l_index)
+		BUG();
 
 	nl_object_get(OBJ_CAST(link));
 	tc->tc_link = link;
-- 
1.8.1.4




More information about the libnl mailing list