diff options
author | David S. Miller <davem@davemloft.net> | 2013-12-10 22:10:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-10 22:10:21 -0500 |
commit | bbd37626e6be9500e74aa244a3be1a69b6645ea0 (patch) | |
tree | e1979b61467a70f0c58e47d3a3f14d99602db526 /drivers/net/tun.c | |
parent | 730054da3868c35809fd31a4018044ab10b0e215 (diff) |
net: Revert macvtap/tun truncation signalling changes.
Jason Wang and Michael S. Tsirkin are still discussing how
to properly fix this.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index dd1bd7aedc3c..e26cbea1ce68 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1183,11 +1183,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1183 | const struct iovec *iv, int len) | 1183 | const struct iovec *iv, int len) |
1184 | { | 1184 | { |
1185 | struct tun_pi pi = { 0, skb->protocol }; | 1185 | struct tun_pi pi = { 0, skb->protocol }; |
1186 | struct { | 1186 | ssize_t total = 0; |
1187 | __be16 h_vlan_proto; | ||
1188 | __be16 h_vlan_TCI; | ||
1189 | } veth; | ||
1190 | ssize_t total = 0, off = 0; | ||
1191 | int vlan_offset = 0; | 1187 | int vlan_offset = 0; |
1192 | 1188 | ||
1193 | if (!(tun->flags & TUN_NO_PI)) { | 1189 | if (!(tun->flags & TUN_NO_PI)) { |
@@ -1252,11 +1248,14 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1252 | total += tun->vnet_hdr_sz; | 1248 | total += tun->vnet_hdr_sz; |
1253 | } | 1249 | } |
1254 | 1250 | ||
1255 | off = total; | ||
1256 | if (!vlan_tx_tag_present(skb)) { | 1251 | if (!vlan_tx_tag_present(skb)) { |
1257 | len = min_t(int, skb->len, len); | 1252 | len = min_t(int, skb->len, len); |
1258 | } else { | 1253 | } else { |
1259 | int copy, ret; | 1254 | int copy, ret; |
1255 | struct { | ||
1256 | __be16 h_vlan_proto; | ||
1257 | __be16 h_vlan_TCI; | ||
1258 | } veth; | ||
1260 | 1259 | ||
1261 | veth.h_vlan_proto = skb->vlan_proto; | 1260 | veth.h_vlan_proto = skb->vlan_proto; |
1262 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); | 1261 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); |
@@ -1265,22 +1264,22 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1265 | len = min_t(int, skb->len + VLAN_HLEN, len); | 1264 | len = min_t(int, skb->len + VLAN_HLEN, len); |
1266 | 1265 | ||
1267 | copy = min_t(int, vlan_offset, len); | 1266 | copy = min_t(int, vlan_offset, len); |
1268 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, off, copy); | 1267 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, total, copy); |
1269 | len -= copy; | 1268 | len -= copy; |
1270 | off += copy; | 1269 | total += copy; |
1271 | if (ret || !len) | 1270 | if (ret || !len) |
1272 | goto done; | 1271 | goto done; |
1273 | 1272 | ||
1274 | copy = min_t(int, sizeof(veth), len); | 1273 | copy = min_t(int, sizeof(veth), len); |
1275 | ret = memcpy_toiovecend(iv, (void *)&veth, off, copy); | 1274 | ret = memcpy_toiovecend(iv, (void *)&veth, total, copy); |
1276 | len -= copy; | 1275 | len -= copy; |
1277 | off += copy; | 1276 | total += copy; |
1278 | if (ret || !len) | 1277 | if (ret || !len) |
1279 | goto done; | 1278 | goto done; |
1280 | } | 1279 | } |
1281 | 1280 | ||
1282 | skb_copy_datagram_const_iovec(skb, vlan_offset, iv, off, len); | 1281 | skb_copy_datagram_const_iovec(skb, vlan_offset, iv, total, len); |
1283 | total += skb->len + (vlan_offset ? sizeof(veth) : 0); | 1282 | total += len; |
1284 | 1283 | ||
1285 | done: | 1284 | done: |
1286 | tun->dev->stats.tx_packets++; | 1285 | tun->dev->stats.tx_packets++; |