From e11a07b230f932cc7c62bd04d74b7c866680c66f Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sat, 7 Mar 2009 02:58:36 +0100 Subject: [PATCH] build: fix compile issues with <= 2.6.19 Resolve compile breakage from commits 36f80be2f7d496469690045d7dc754cfd0e02cb0 and 7b9ca945d4be0d6a12511a434ab329f3ad2b218d. --- extensions/compat_skbuff.h | 3 +++ extensions/xt_LOGMARK.c | 2 +- extensions/xt_TEE.c | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/extensions/compat_skbuff.h b/extensions/compat_skbuff.h index b32bbf5..976e101 100644 --- a/extensions/compat_skbuff.h +++ b/extensions/compat_skbuff.h @@ -5,8 +5,11 @@ struct tcphdr; struct udphdr; #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19) +# define skb_ifindex(skb) \ + (((skb)->input_dev != NULL) ? (skb)->input_dev->ifindex : 0) # define skb_nfmark(skb) (((struct sk_buff *)(skb))->nfmark) #else +# define skb_ifindex(skb) (skb)->iif # define skb_nfmark(skb) (((struct sk_buff *)(skb))->mark) #endif diff --git a/extensions/xt_LOGMARK.c b/extensions/xt_LOGMARK.c index 43c5fd1..604ecb6 100644 --- a/extensions/xt_LOGMARK.c +++ b/extensions/xt_LOGMARK.c @@ -41,7 +41,7 @@ logmark_tg(struct sk_buff **pskb, const struct xt_target_param *par) printk("<%u>%.*s""iif=%d hook=%s nfmark=0x%x " "secmark=0x%x classify=0x%x", info->level, (unsigned int)sizeof(info->prefix), info->prefix, - skb->iif, hook_names[par->hooknum], + skb_ifindex(skb), hook_names[par->hooknum], skb_nfmark(skb), skb_secmark(skb), skb->priority); ct = nf_ct_get(skb, &ctinfo); diff --git a/extensions/xt_TEE.c b/extensions/xt_TEE.c index f24785d..5fdfe3b 100644 --- a/extensions/xt_TEE.c +++ b/extensions/xt_TEE.c @@ -60,8 +60,12 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info) struct flowi fl; memset(&fl, 0, sizeof(fl)); - fl.iif = skb->iif; - fl.mark = skb->mark; + fl.iif = skb_ifindex(skb); +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19) + fl.nl_u.ip4_u.fwmark = skb_nfmark(skb); +#else + fl.mark = skb_nfmark(skb); +#endif fl.nl_u.ip4_u.daddr = info->gw.ip; fl.nl_u.ip4_u.tos = RT_TOS(iph->tos); fl.nl_u.ip4_u.scope = RT_SCOPE_UNIVERSE; @@ -226,8 +230,12 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info) struct flowi fl; memset(&fl, 0, sizeof(fl)); - fl.iif = skb->iif; - fl.mark = skb->mark; + fl.iif = skb_ifindex(skb); +#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 19) + fl.nl_u.ip6_u.fwmark = skb_nfmark(skb); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) + fl.mark = skb_nfmark(skb); +#endif fl.nl_u.ip6_u.daddr = info->gw.in6; fl.nl_u.ip6_u.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) | (iph->flow_lbl[1] << 8) | iph->flow_lbl[2];