Skip to content

Commit

Permalink
ipv4: use ip_skb_dst_mtu to determine mtu in ip_fragment
Browse files Browse the repository at this point in the history
ip_skb_dst_mtu mostly falls back to ip_dst_mtu_maybe_forward if no socket
is attached to the skb (in case of forwarding) or determines the mtu like
we do in ip_finish_output, which actually checks if we should branch to
ip_fragment. Thus use the same function to determine the mtu here, too.

This is important for the introduction of IP_PMTUDISC_OMIT, where we
want the packets getting cut in pieces of the size of the outgoing
interface mtu. IPv6 already does this correctly.

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hannes Frederic Sowa authored and David S. Miller committed Feb 26, 2014
1 parent a960ff8 commit 69647ce
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
__be16 not_last_frag;
struct rtable *rt = skb_rtable(skb);
int err = 0;
bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;

dev = rt->dst.dev;

Expand All @@ -459,7 +458,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))

iph = ip_hdr(skb);

mtu = ip_dst_mtu_maybe_forward(&rt->dst, forwarding);
mtu = ip_skb_dst_mtu(skb);
if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->local_df) ||
(IPCB(skb)->frag_max_size &&
IPCB(skb)->frag_max_size > mtu))) {
Expand Down

0 comments on commit 69647ce

Please sign in to comment.