goto abort_transaction;
}
+ /* We can cope with transmit checksum offload packets
+ in which the TCP and IP headers are in separate
+ fragments. */
+ err = xenbus_printf(xbt, dev->nodename,
+ "feature-tx-csum-split-header", "%d", 1);
+ if (err) {
+ message = "writing feature-tx-csum-split-header";
+ goto abort_transaction;
+ }
+
/*
* We don't support rx-flip path (except old guests who don't
* grok this feature flag).
}
#ifdef CONFIG_XEN
+static int skb_pull_up_to(struct sk_buff *skb, void *ptr)
+{
+ if (ptr < (void *)skb->tail)
+ return 1;
+ if (__pskb_pull_tail(skb,
+ ptr - (void *)skb->data - skb_headlen(skb))) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
inline int skb_checksum_setup(struct sk_buff *skb)
{
if (skb->proto_csum_blank) {
if (skb->protocol != htons(ETH_P_IP))
goto out;
- skb->h.raw = (unsigned char *)skb->nh.iph + 4*skb->nh.iph->ihl;
- if (skb->h.raw >= skb->tail)
+ if (!skb_pull_up_to(skb, skb->nh.iph + 1))
goto out;
+ skb->h.raw = (unsigned char *)skb->nh.iph + 4*skb->nh.iph->ihl;
switch (skb->nh.iph->protocol) {
case IPPROTO_TCP:
skb->csum = offsetof(struct tcphdr, check);
" %d packet", skb->nh.iph->protocol);
goto out;
}
- if ((skb->h.raw + skb->csum + 2) > skb->tail)
+ if (!skb_pull_up_to(skb, skb->h.raw + skb->csum + 2))
goto out;
skb->ip_summed = CHECKSUM_HW;
skb->proto_csum_blank = 0;