ovs-vsctl: Free memory on fatal error.
[openvswitch] / datapath / linux-2.6 / compat-2.6 / ip_gre.c
index 246e864e08bab258f91043786910c64a5ee12c19..05c6055b5b524683bd1eca4b29a04e39fa19c942 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <linux/capability.h>
+#include <linux/ethtool.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -678,13 +679,6 @@ static int ipgre_rcv(struct sk_buff *skb)
                skb_reset_network_header(skb);
                ipgre_ecn_decapsulate(iph, skb);
 
-#ifdef CHECKSUM_HW
-               /* XXX: Temporary workaround to avoid a panic when doing
-                * bridging due to multiple meanings of CHECKSUM_HW. */
-               if (skb->ip_summed == CHECKSUM_HW)
-                       skb->ip_summed = CHECKSUM_NONE;
-#endif
-
                netif_rx(skb);
                read_unlock(&ipgre_lock);
                return(0);
@@ -815,6 +809,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
        if (skb_dst(skb))
                skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu);
 
+       /* XXX: Temporarily allow fragmentation since DF doesn't
+        * do the right thing with bridging. */
+/*
        if (skb->protocol == htons(ETH_P_IP)) {
                df |= (old_iph->frag_off&htons(IP_DF));
 
@@ -845,7 +842,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
                }
        }
 #endif
-
+*/
        if (tunnel->err_count > 0) {
                if (time_before(jiffies,
                                tunnel->err_time + IPTUNNEL_ERR_TIMEO)) {
@@ -1008,6 +1005,10 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
        if (mtu < 68)
                mtu = 68;
 
+       /* XXX: Set MTU to the maximum possible value.  If we are bridged to a
+       * device with a larger MTU then packets will be dropped. */
+       mtu = 65482;
+
        return mtu;
 }
 
@@ -1292,6 +1293,18 @@ static int ipgre_close(struct net_device *dev)
 
 #endif
 
+static void ethtool_getinfo(struct net_device *dev,
+                           struct ethtool_drvinfo *info)
+{
+       strcpy(info->driver, "ip_gre");
+       strcpy(info->version, "Open vSwitch "VERSION BUILDNR);
+       strcpy(info->bus_info, dev->type == ARPHRD_ETHER ? "gretap" : "gre");
+}
+
+static struct ethtool_ops ethtool_ops = {
+       .get_drvinfo = ethtool_getinfo,
+};
+
 #ifdef HAVE_NET_DEVICE_OPS
 static const struct net_device_ops ipgre_netdev_ops = {
        .ndo_init               = ipgre_tunnel_init,
@@ -1334,6 +1347,8 @@ static void ipgre_tunnel_setup(struct net_device *dev)
        dev->addr_len           = 4;
        dev->features           |= NETIF_F_NETNS_LOCAL;
        dev->priv_flags         &= ~IFF_XMIT_DST_RELEASE;
+
+       SET_ETHTOOL_OPS(dev, &ethtool_ops);
 }
 
 static int ipgre_tunnel_init(struct net_device *dev)
@@ -1540,6 +1555,8 @@ static void ipgre_tap_setup(struct net_device *dev)
 
        dev->iflink             = 0;
        dev->features           |= NETIF_F_NETNS_LOCAL;
+
+       SET_ETHTOOL_OPS(dev, &ethtool_ops);
 }
 
 #ifndef GRE_IOCTL_ONLY