diff options
author | Bill Sommerfeld <wsommerfeld@google.com> | 2011-07-19 11:22:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-22 00:31:41 -0400 |
commit | d9be4f7a6f5a8da3133b832eca41c3591420b1ca (patch) | |
tree | 438012f22c81f3d109849a12a14acfbcf5bb9837 /net/ipv4/ip_output.c | |
parent | 2e66f55b3afa290337a47e6ea134ac071c5dd9a7 (diff) |
ipv4: Constrain UFO fragment sizes to multiples of 8 bytes
Because the ip fragment offset field counts 8-byte chunks, ip
fragments other than the last must contain a multiple of 8 bytes of
payload. ip_ufo_append_data wasn't respecting this constraint and,
depending on the MTU and ip option sizes, could create malformed
non-final fragments.
Google-Bug-Id: 5009328
Signed-off-by: Bill Sommerfeld <wsommerfeld@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index be27e609a98b..ccaaa851ab42 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -734,7 +734,7 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
734 | int getfrag(void *from, char *to, int offset, int len, | 734 | int getfrag(void *from, char *to, int offset, int len, |
735 | int odd, struct sk_buff *skb), | 735 | int odd, struct sk_buff *skb), |
736 | void *from, int length, int hh_len, int fragheaderlen, | 736 | void *from, int length, int hh_len, int fragheaderlen, |
737 | int transhdrlen, int mtu, unsigned int flags) | 737 | int transhdrlen, int maxfraglen, unsigned int flags) |
738 | { | 738 | { |
739 | struct sk_buff *skb; | 739 | struct sk_buff *skb; |
740 | int err; | 740 | int err; |
@@ -767,7 +767,7 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
767 | skb->csum = 0; | 767 | skb->csum = 0; |
768 | 768 | ||
769 | /* specify the length of each IP datagram fragment */ | 769 | /* specify the length of each IP datagram fragment */ |
770 | skb_shinfo(skb)->gso_size = mtu - fragheaderlen; | 770 | skb_shinfo(skb)->gso_size = maxfraglen - fragheaderlen; |
771 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 771 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
772 | __skb_queue_tail(queue, skb); | 772 | __skb_queue_tail(queue, skb); |
773 | } | 773 | } |
@@ -831,7 +831,7 @@ static int __ip_append_data(struct sock *sk, | |||
831 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { | 831 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { |
832 | err = ip_ufo_append_data(sk, queue, getfrag, from, length, | 832 | err = ip_ufo_append_data(sk, queue, getfrag, from, length, |
833 | hh_len, fragheaderlen, transhdrlen, | 833 | hh_len, fragheaderlen, transhdrlen, |
834 | mtu, flags); | 834 | maxfraglen, flags); |
835 | if (err) | 835 | if (err) |
836 | goto error; | 836 | goto error; |
837 | return 0; | 837 | return 0; |