diff --git a/doc/changelog.txt b/doc/changelog.txt index bf3275d..6c40b7c 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,5 +1,8 @@ +- build: support for Linux 2.6.31-rc1 + + Xtables-addons 1.17 (June 16 2009) ================================== - IPMARK: print missing --shift parameter diff --git a/extensions/compat_skbuff.h b/extensions/compat_skbuff.h index 976e101..2778fb4 100644 --- a/extensions/compat_skbuff.h +++ b/extensions/compat_skbuff.h @@ -4,6 +4,23 @@ struct tcphdr; struct udphdr; +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30) +static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) +{ + skb->dst = dst; +} + +static inline struct dst_entry *skb_dst(const struct sk_buff *skb) +{ + return skb->dst; +} + +static inline struct rtable *skb_rtable(const struct sk_buff *skb) +{ + return (void *)skb->dst; +} +#endif + #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19) # define skb_ifindex(skb) \ (((skb)->input_dev != NULL) ? (skb)->input_dev->ifindex : 0) diff --git a/extensions/xt_DELUDE.c b/extensions/xt_DELUDE.c index 6bcb77c..43df0d2 100644 --- a/extensions/xt_DELUDE.c +++ b/extensions/xt_DELUDE.c @@ -119,19 +119,18 @@ static void delude_send_reset(struct sk_buff *oldskb, unsigned int hook) addr_type = RTN_LOCAL; /* ip_route_me_harder expects skb->dst to be set */ - dst_hold(oldskb->dst); - nskb->dst = oldskb->dst; + skb_dst_set(nskb, dst_clone(skb_dst(oldskb))); if (ip_route_me_harder(&nskb, addr_type)) goto free_nskb; else niph = ip_hdr(nskb); - niph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT); + niph->ttl = dst_metric(skb_dst(nskb), RTAX_HOPLIMIT); nskb->ip_summed = CHECKSUM_NONE; /* "Never happens" */ - if (nskb->len > dst_mtu(nskb->dst)) + if (nskb->len > dst_mtu(skb_dst(nskb))) goto free_nskb; nf_ct_attach(nskb, oldskb); diff --git a/extensions/xt_TARPIT.c b/extensions/xt_TARPIT.c index 4100ab5..ed052e4 100644 --- a/extensions/xt_TARPIT.c +++ b/extensions/xt_TARPIT.c @@ -167,20 +167,20 @@ static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook) nskb->ip_summed = CHECKSUM_NONE; /* Adjust IP TTL */ - niph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT); + niph->ttl = dst_metric(skb_dst(nskb), RTAX_HOPLIMIT); /* Adjust IP checksum */ niph->check = 0; niph->check = ip_fast_csum(skb_network_header(nskb), niph->ihl); /* "Never happens" */ - if (nskb->len > dst_mtu(nskb->dst)) + if (nskb->len > dst_mtu(skb_dst(nskb))) goto free_nskb; nf_ct_attach(nskb, oldskb); - NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb, NULL, nskb->dst->dev, - dst_output); + NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb, NULL, + skb_dst(nskb)->dev, dst_output); return; free_nskb: @@ -192,7 +192,7 @@ tarpit_tg(struct sk_buff **pskb, const struct xt_target_param *par) { const struct sk_buff *skb = *pskb; const struct iphdr *iph = ip_hdr(skb); - const struct rtable *rt = (const void *)skb->dst; + const struct rtable *rt = skb_rtable(skb); /* Do we have an input route cache entry? (Not in PREROUTING.) */ if (rt == NULL) diff --git a/extensions/xt_TEE.c b/extensions/xt_TEE.c index 5fdfe3b..dea135c 100644 --- a/extensions/xt_TEE.c +++ b/extensions/xt_TEE.c @@ -79,9 +79,9 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info) return false; } - dst_release(skb->dst); - skb->dst = &rt->u.dst; - skb->dev = skb->dst->dev; + dst_release(skb_dst(skb)); + skb_dst_set(skb, &rt->u.dst); + skb->dev = rt->u.dst.dev; skb->protocol = htons(ETH_P_IP); return true; } @@ -104,7 +104,7 @@ static inline bool dev_hh_avail(const struct net_device *dev) */ static void tee_tg_send(struct sk_buff *skb) { - const struct dst_entry *dst = skb->dst; + const struct dst_entry *dst = skb_dst(skb); const struct net_device *dev = dst->dev; unsigned int hh_len = LL_RESERVED_SPACE(dev); @@ -251,9 +251,9 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info) return false; } - dst_release(skb->dst); - skb->dst = dst; - skb->dev = skb->dst->dev; + dst_release(skb_dst(skb)); + skb_dst_set(skb, dst); + skb->dev = dst->dev; skb->protocol = htons(ETH_P_IPV6); return true; }