From 1c47903b03c678470cf81c3a7d5c3ad95420d569 Mon Sep 17 00:00:00 2001 From: "David J. Wilder" Date: Mon, 20 Jul 2009 16:08:42 -0700 Subject: Fixes for 2.6.31. There are some changes in sk_buff structure those cause failures of compiling ipmib.stp and tcpmib.stp, rtable and dst fields are deleted. --- tapset/tcpmib.stp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'tapset/tcpmib.stp') diff --git a/tapset/tcpmib.stp b/tapset/tcpmib.stp index e3e76900..8b443309 100644 --- a/tapset/tcpmib.stp +++ b/tapset/tcpmib.stp @@ -250,12 +250,36 @@ function _is_reset:long (skb:long) %} function _tcpmib_input_route_type:long (skb:long) +{ +%( kernel_v < "2.6.31" %? + return __tcpmib_input_route_type_old(skb) +%: + return __tcpmib_input_route_type_new(skb) +%) +} + +function __tcpmib_input_route_type_old:long (skb:long) %{ /* pure */ - struct rtable *rt; - struct sk_buff *skb = (struct sk_buff *)(long)THIS->skb; - rt = (struct rtable *)kread(&(skb->rtable)); - THIS->__retvalue = kread(&(rt->rt_type)); - CATCH_DEREF_FAULT(); + struct rtable *rt; + struct sk_buff *skb = (struct sk_buff *)(long)THIS->skb; + rt = (struct rtable *)kread(&(skb->rtable)); + if ( rt ) + THIS->__retvalue = kread(&(rt->rt_type)); + else + THIS->__retvalue = RTN_UNSPEC; + CATCH_DEREF_FAULT(); +%} + +function __tcpmib_input_route_type_new:long (skb:long) +%{ /* pure */ + struct rtable *rt; + struct sk_buff *skb = (struct sk_buff *)(long)THIS->skb; + rt = (struct rtable *)kread(&(skb->_skb_dst)); + if ( rt ) + THIS->__retvalue = kread(&(rt->rt_type)); + else + THIS->__retvalue = RTN_UNSPEC; + CATCH_DEREF_FAULT(); %} /* -- cgit