]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
TEE: reenable header_ops check
authorJan Engelhardt <jengelh@computergmbh.de>
Mon, 7 Apr 2008 06:38:46 +0000 (08:38 +0200)
committerJan Engelhardt <jengelh@computergmbh.de>
Mon, 7 Apr 2008 06:44:25 +0000 (08:44 +0200)
extensions/xt_TEE.c

index c006913e56f1157708a7084a1d66c86c1e2f2140..fa4305b04c80e23baeacaf8591465a0b0067defc 100644 (file)
@@ -85,6 +85,15 @@ static bool tee_routing(struct sk_buff *skb,
        return true;
 }
 
+static bool dev_hh_avail(const struct net_device *dev)
+{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
+       return dev->hard_header != NULL;
+#else
+       return dev->header_ops != NULL;
+#endif
+}
+
 /*
  * Stolen from ip_finish_output2
  * PRE : skb->dev is set to the device we are leaving by
@@ -99,8 +108,7 @@ static void tee_ip_direct_send(struct sk_buff *skb)
        unsigned int hh_len = LL_RESERVED_SPACE(dev);
 
        /* Be paranoid, rather than too clever. */
-       if (unlikely(skb_headroom(skb) < hh_len)) {
-       /* if (dev->header_ops != NULL) */
+       if (unlikely(skb_headroom(skb) < hh_len) && dev_hh_avail(dev)) {
                struct sk_buff *skb2;
 
                skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));