aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f3496e995302..73e255788fae 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1130,6 +1130,7 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs,
1130{ 1130{
1131 struct vxlanhdr *vxh; 1131 struct vxlanhdr *vxh;
1132 struct udphdr *uh; 1132 struct udphdr *uh;
1133 int min_headroom;
1133 int err; 1134 int err;
1134 1135
1135 if (!skb->encapsulation) { 1136 if (!skb->encapsulation) {
@@ -1137,6 +1138,14 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs,
1137 skb->encapsulation = 1; 1138 skb->encapsulation = 1;
1138 } 1139 }
1139 1140
1141 min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
1142 + VXLAN_HLEN + sizeof(struct iphdr);
1143
1144 /* Need space for new headers (invalidates iph ptr) */
1145 err = skb_cow_head(skb, min_headroom);
1146 if (unlikely(err))
1147 return err;
1148
1140 vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh)); 1149 vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
1141 vxh->vx_flags = htonl(VXLAN_FLAGS); 1150 vxh->vx_flags = htonl(VXLAN_FLAGS);
1142 vxh->vx_vni = vni; 1151 vxh->vx_vni = vni;
@@ -1220,10 +1229,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
1220 goto drop; 1229 goto drop;
1221 } 1230 }
1222 1231
1223 /* Need space for new headers (invalidates iph ptr) */
1224 if (skb_cow_head(skb, VXLAN_HEADROOM))
1225 goto drop;
1226
1227 old_iph = ip_hdr(skb); 1232 old_iph = ip_hdr(skb);
1228 1233
1229 ttl = vxlan->ttl; 1234 ttl = vxlan->ttl;