build: support for Linux 2.6.31-rc1

This commit is contained in:
Jan Engelhardt
2009-07-02 01:51:40 +02:00
parent 6b2ca78af7
commit fdf42a3a50
5 changed files with 35 additions and 16 deletions

View File

@@ -1,5 +1,8 @@
- build: support for Linux 2.6.31-rc1
Xtables-addons 1.17 (June 16 2009) Xtables-addons 1.17 (June 16 2009)
================================== ==================================
- IPMARK: print missing --shift parameter - IPMARK: print missing --shift parameter

View File

@@ -4,6 +4,23 @@
struct tcphdr; struct tcphdr;
struct udphdr; 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) #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19)
# define skb_ifindex(skb) \ # define skb_ifindex(skb) \
(((skb)->input_dev != NULL) ? (skb)->input_dev->ifindex : 0) (((skb)->input_dev != NULL) ? (skb)->input_dev->ifindex : 0)

View File

@@ -119,19 +119,18 @@ static void delude_send_reset(struct sk_buff *oldskb, unsigned int hook)
addr_type = RTN_LOCAL; addr_type = RTN_LOCAL;
/* ip_route_me_harder expects skb->dst to be set */ /* ip_route_me_harder expects skb->dst to be set */
dst_hold(oldskb->dst); skb_dst_set(nskb, dst_clone(skb_dst(oldskb)));
nskb->dst = oldskb->dst;
if (ip_route_me_harder(&nskb, addr_type)) if (ip_route_me_harder(&nskb, addr_type))
goto free_nskb; goto free_nskb;
else else
niph = ip_hdr(nskb); 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; nskb->ip_summed = CHECKSUM_NONE;
/* "Never happens" */ /* "Never happens" */
if (nskb->len > dst_mtu(nskb->dst)) if (nskb->len > dst_mtu(skb_dst(nskb)))
goto free_nskb; goto free_nskb;
nf_ct_attach(nskb, oldskb); nf_ct_attach(nskb, oldskb);

View File

@@ -167,20 +167,20 @@ static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook)
nskb->ip_summed = CHECKSUM_NONE; nskb->ip_summed = CHECKSUM_NONE;
/* Adjust IP TTL */ /* Adjust IP TTL */
niph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT); niph->ttl = dst_metric(skb_dst(nskb), RTAX_HOPLIMIT);
/* Adjust IP checksum */ /* Adjust IP checksum */
niph->check = 0; niph->check = 0;
niph->check = ip_fast_csum(skb_network_header(nskb), niph->ihl); niph->check = ip_fast_csum(skb_network_header(nskb), niph->ihl);
/* "Never happens" */ /* "Never happens" */
if (nskb->len > dst_mtu(nskb->dst)) if (nskb->len > dst_mtu(skb_dst(nskb)))
goto free_nskb; goto free_nskb;
nf_ct_attach(nskb, oldskb); nf_ct_attach(nskb, oldskb);
NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb, NULL, nskb->dst->dev, NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb, NULL,
dst_output); skb_dst(nskb)->dev, dst_output);
return; return;
free_nskb: 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 sk_buff *skb = *pskb;
const struct iphdr *iph = ip_hdr(skb); 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.) */ /* Do we have an input route cache entry? (Not in PREROUTING.) */
if (rt == NULL) if (rt == NULL)

View File

@@ -79,9 +79,9 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)
return false; return false;
} }
dst_release(skb->dst); dst_release(skb_dst(skb));
skb->dst = &rt->u.dst; skb_dst_set(skb, &rt->u.dst);
skb->dev = skb->dst->dev; skb->dev = rt->u.dst.dev;
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
return true; 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) 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; const struct net_device *dev = dst->dev;
unsigned int hh_len = LL_RESERVED_SPACE(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; return false;
} }
dst_release(skb->dst); dst_release(skb_dst(skb));
skb->dst = dst; skb_dst_set(skb, dst);
skb->dev = skb->dst->dev; skb->dev = dst->dev;
skb->protocol = htons(ETH_P_IPV6); skb->protocol = htons(ETH_P_IPV6);
return true; return true;
} }