datapath: Factor out common code from *_build_header() to ovs_tnl_send().
[sliver-openvswitch.git] / datapath / tunnel.c
index 87f212a..8d5a6d4 100644 (file)
@@ -221,7 +221,6 @@ u16 ovs_tnl_get_src_port(struct sk_buff *skb)
 int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
 {
        struct tnl_vport *tnl_vport = tnl_vport_priv(vport);
-       enum vport_err_type err = VPORT_E_TX_ERROR;
        struct rtable *rt;
        __be32 saddr;
        int sent_len = 0;
@@ -261,6 +260,7 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
                struct sk_buff *next_skb = skb->next;
                struct iphdr *iph;
                int frag_len;
+               int err;
 
                skb->next = NULL;
 
@@ -280,6 +280,15 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
                /* Push Tunnel header. */
                tnl_vport->tnl_ops->build_header(vport, skb, tunnel_hlen);
 
+               /*
+                * Allow our local IP stack to fragment the outer packet even
+                * if the DF bit is set as a last resort.  We also need to
+                * force selection of an IP ID here because Linux will
+                * otherwise leave it at 0 if the packet originally had DF set.
+                */
+               skb->local_df = 1;
+               __ip_select_ident(ip_hdr(skb), skb_dst(skb), 0);
+
                /* Push IP header. */
                iph = ip_hdr(skb);
                iph->version    = 4;
@@ -314,7 +323,7 @@ err_free_rt:
        ip_rt_put(rt);
 error_free:
        kfree_skb(skb);
-       ovs_vport_record_error(vport, err);
+       ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
        return sent_len;
 }