aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/esp4.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 13:32:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 13:32:36 -0400
commit13199a0845729492fc51d1ba87938cdfe341b141 (patch)
tree544267bc4076fff6b2eaae119372b13f23aa8932 /net/ipv4/esp4.c
parentaf56e0aa35f3ae2a4c1a6d1000702df1dd78cb76 (diff)
parent2e1d4a065a77d076a679df22a4eddbc7e33cad98 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking changes from David S. Miller: 1) Fix IPSEC header length calculation for transport mode in ESP. The issue is whether to do the calculation before or after alignment. Fix from Benjamin Poirier. 2) Fix regression in IPV6 IPSEC fragment length calculations, from Gao Feng. This is another transport vs tunnel mode issue. 3) Handle AF_UNSPEC connect()s properly in L2TP to avoid OOPSes. Fix from James Chapman. 4) Fix USB ASIX driver's reception of full sized VLAN packets, from Eric Dumazet. 5) Allow drop monitor (and, more generically, all generic netlink protocols) to be automatically loaded as a module. From Neil Horman. Fix up trivial conflict in Documentation/feature-removal-schedule.txt due to new entries added next to each other at the end. As usual. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (38 commits) net/smsc911x: Repair broken failure paths virtio-net: remove useless disable on freeze netdevice: Update netif_dbg for CONFIG_DYNAMIC_DEBUG drop_monitor: Add module alias to enable automatic module loading genetlink: Build a generic netlink family module alias net: add MODULE_ALIAS_NET_PF_PROTO_NAME r6040: Do a Proper deinit at errorpath and also when driver unloads (calling r6040_remove_one) r6040: disable pci device if the subsequent calls (after pci_enable_device) fails skb: avoid unnecessary reallocations in __skb_cow net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens asix: allow full size 8021Q frames to be received rds_rdma: don't assume infiniband device is PCI l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case mac80211: fix ADDBA declined after suspend with wowlan wlcore: fix undefined symbols when CONFIG_PM is not defined mac80211: fix flag check for QoS NOACK frames ath9k_hw: apply internal regulator settings on AR933x ath9k_hw: update AR933x initvals to fix issues with high power devices ath9k: fix a use-after-free-bug when ath_tx_setup_buffer() fails ath9k: stop rx dma before stopping tx ...
Diffstat (limited to 'net/ipv4/esp4.c')
-rw-r--r--net/ipv4/esp4.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 89a47b35905d..cb982a61536f 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -459,28 +459,22 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
459 struct esp_data *esp = x->data; 459 struct esp_data *esp = x->data;
460 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); 460 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
461 u32 align = max_t(u32, blksize, esp->padlen); 461 u32 align = max_t(u32, blksize, esp->padlen);
462 u32 rem; 462 unsigned int net_adj;
463
464 mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
465 rem = mtu & (align - 1);
466 mtu &= ~(align - 1);
467 463
468 switch (x->props.mode) { 464 switch (x->props.mode) {
469 case XFRM_MODE_TUNNEL:
470 break;
471 default:
472 case XFRM_MODE_TRANSPORT: 465 case XFRM_MODE_TRANSPORT:
473 /* The worst case */
474 mtu -= blksize - 4;
475 mtu += min_t(u32, blksize - 4, rem);
476 break;
477 case XFRM_MODE_BEET: 466 case XFRM_MODE_BEET:
478 /* The worst case. */ 467 net_adj = sizeof(struct iphdr);
479 mtu += min_t(u32, IPV4_BEET_PHMAXLEN, rem);
480 break; 468 break;
469 case XFRM_MODE_TUNNEL:
470 net_adj = 0;
471 break;
472 default:
473 BUG();
481 } 474 }
482 475
483 return mtu - 2; 476 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
477 net_adj) & ~(align - 1)) + (net_adj - 2);
484} 478}
485 479
486static void esp4_err(struct sk_buff *skb, u32 info) 480static void esp4_err(struct sk_buff *skb, u32 info)