aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r--net/ipv4/ip_output.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index df184616493f..73c6b63bba74 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -422,9 +422,6 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
422 to->tc_index = from->tc_index; 422 to->tc_index = from->tc_index;
423#endif 423#endif
424 nf_copy(to, from); 424 nf_copy(to, from);
425#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)
426 to->nf_trace = from->nf_trace;
427#endif
428#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) 425#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
429 to->ipvs_property = from->ipvs_property; 426 to->ipvs_property = from->ipvs_property;
430#endif 427#endif
@@ -449,6 +446,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
449 __be16 not_last_frag; 446 __be16 not_last_frag;
450 struct rtable *rt = skb_rtable(skb); 447 struct rtable *rt = skb_rtable(skb);
451 int err = 0; 448 int err = 0;
449 bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
452 450
453 dev = rt->dst.dev; 451 dev = rt->dst.dev;
454 452
@@ -458,12 +456,13 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
458 456
459 iph = ip_hdr(skb); 457 iph = ip_hdr(skb);
460 458
459 mtu = ip_dst_mtu_maybe_forward(&rt->dst, forwarding);
461 if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->local_df) || 460 if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->local_df) ||
462 (IPCB(skb)->frag_max_size && 461 (IPCB(skb)->frag_max_size &&
463 IPCB(skb)->frag_max_size > dst_mtu(&rt->dst)))) { 462 IPCB(skb)->frag_max_size > mtu))) {
464 IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); 463 IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
465 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 464 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
466 htonl(ip_skb_dst_mtu(skb))); 465 htonl(mtu));
467 kfree_skb(skb); 466 kfree_skb(skb);
468 return -EMSGSIZE; 467 return -EMSGSIZE;
469 } 468 }
@@ -473,7 +472,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
473 */ 472 */
474 473
475 hlen = iph->ihl * 4; 474 hlen = iph->ihl * 4;
476 mtu = dst_mtu(&rt->dst) - hlen; /* Size of data space */ 475 mtu = mtu - hlen; /* Size of data space */
477#ifdef CONFIG_BRIDGE_NETFILTER 476#ifdef CONFIG_BRIDGE_NETFILTER
478 if (skb->nf_bridge) 477 if (skb->nf_bridge)
479 mtu -= nf_bridge_mtu_reduction(skb); 478 mtu -= nf_bridge_mtu_reduction(skb);
@@ -1551,7 +1550,7 @@ void __init ip_init(void)
1551 ip_rt_init(); 1550 ip_rt_init();
1552 inet_initpeers(); 1551 inet_initpeers();
1553 1552
1554#if defined(CONFIG_IP_MULTICAST) && defined(CONFIG_PROC_FS) 1553#if defined(CONFIG_IP_MULTICAST)
1555 igmp_mc_proc_init(); 1554 igmp_mc_init();
1556#endif 1555#endif
1557} 1556}