xfrm6_output.c (2fe5de9ce7d57498abc14b375cad2fcf8c3ee6cc) | xfrm6_output.c (60ff746739bf805a912484643c720b6124826140) |
---|---|
1/* 2 * xfrm6_output.c - Common IPsec encapsulation code for IPv6. 3 * Copyright (C) 2002 USAGI/WIDE Project 4 * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 64 unchanged lines hidden (view full) --- 73{ 74 int mtu, ret = 0; 75 struct dst_entry *dst = skb_dst(skb); 76 77 mtu = dst_mtu(dst); 78 if (mtu < IPV6_MIN_MTU) 79 mtu = IPV6_MIN_MTU; 80 | 1/* 2 * xfrm6_output.c - Common IPsec encapsulation code for IPv6. 3 * Copyright (C) 2002 USAGI/WIDE Project 4 * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 64 unchanged lines hidden (view full) --- 73{ 74 int mtu, ret = 0; 75 struct dst_entry *dst = skb_dst(skb); 76 77 mtu = dst_mtu(dst); 78 if (mtu < IPV6_MIN_MTU) 79 mtu = IPV6_MIN_MTU; 80 |
81 if (!skb->local_df && skb->len > mtu) { | 81 if (!skb->ignore_df && skb->len > mtu) { |
82 skb->dev = dst->dev; 83 84 if (xfrm6_local_dontfrag(skb)) 85 xfrm6_local_rxpmtu(skb, mtu); 86 else if (skb->sk) 87 xfrm_local_error(skb, mtu); 88 else 89 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); --- 25 unchanged lines hidden (view full) --- 115 return err; 116 117 memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); 118#ifdef CONFIG_NETFILTER 119 IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; 120#endif 121 122 skb->protocol = htons(ETH_P_IPV6); | 82 skb->dev = dst->dev; 83 84 if (xfrm6_local_dontfrag(skb)) 85 xfrm6_local_rxpmtu(skb, mtu); 86 else if (skb->sk) 87 xfrm_local_error(skb, mtu); 88 else 89 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); --- 25 unchanged lines hidden (view full) --- 115 return err; 116 117 memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); 118#ifdef CONFIG_NETFILTER 119 IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; 120#endif 121 122 skb->protocol = htons(ETH_P_IPV6); |
123 skb->local_df = 1; | 123 skb->ignore_df = 1; |
124 125 return x->outer_mode->output2(x, skb); 126} 127EXPORT_SYMBOL(xfrm6_prepare_output); 128 129int xfrm6_output_finish(struct sk_buff *skb) 130{ 131#ifdef CONFIG_NETFILTER --- 13 unchanged lines hidden (view full) --- 145 if (skb->protocol == htons(ETH_P_IPV6)) 146 mtu = ip6_skb_dst_mtu(skb); 147 else 148 mtu = dst_mtu(skb_dst(skb)); 149 150 if (skb->len > mtu && xfrm6_local_dontfrag(skb)) { 151 xfrm6_local_rxpmtu(skb, mtu); 152 return -EMSGSIZE; | 124 125 return x->outer_mode->output2(x, skb); 126} 127EXPORT_SYMBOL(xfrm6_prepare_output); 128 129int xfrm6_output_finish(struct sk_buff *skb) 130{ 131#ifdef CONFIG_NETFILTER --- 13 unchanged lines hidden (view full) --- 145 if (skb->protocol == htons(ETH_P_IPV6)) 146 mtu = ip6_skb_dst_mtu(skb); 147 else 148 mtu = dst_mtu(skb_dst(skb)); 149 150 if (skb->len > mtu && xfrm6_local_dontfrag(skb)) { 151 xfrm6_local_rxpmtu(skb, mtu); 152 return -EMSGSIZE; |
153 } else if (!skb->local_df && skb->len > mtu && skb->sk) { | 153 } else if (!skb->ignore_df && skb->len > mtu && skb->sk) { |
154 xfrm_local_error(skb, mtu); 155 return -EMSGSIZE; 156 } 157 158 if (x->props.mode == XFRM_MODE_TUNNEL && 159 ((skb->len > mtu && !skb_is_gso(skb)) || 160 dst_allfrag(skb_dst(skb)))) { 161 return ip6_fragment(skb, x->outer_mode->afinfo->output_finish); 162 } 163 return x->outer_mode->afinfo->output_finish(skb); 164} 165 166int xfrm6_output(struct sock *sk, struct sk_buff *skb) 167{ 168 return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, 169 skb_dst(skb)->dev, __xfrm6_output); 170} | 154 xfrm_local_error(skb, mtu); 155 return -EMSGSIZE; 156 } 157 158 if (x->props.mode == XFRM_MODE_TUNNEL && 159 ((skb->len > mtu && !skb_is_gso(skb)) || 160 dst_allfrag(skb_dst(skb)))) { 161 return ip6_fragment(skb, x->outer_mode->afinfo->output_finish); 162 } 163 return x->outer_mode->afinfo->output_finish(skb); 164} 165 166int xfrm6_output(struct sock *sk, struct sk_buff *skb) 167{ 168 return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, 169 skb_dst(skb)->dev, __xfrm6_output); 170} |