ipv6: allow IPV6_PMTUDISC_INTERFACE generate fragments if packet size is larger than interface mtu
Subsystems (3)
PATCH 2/2 ipv6: allow IPV6_PMTUDISC_INTERFACE generate fragments if packet size is larger than interface mtu
Following the changes of the IPv4 IP_PMTUDISC_INTERFACE logic, this patch relax this option to allow generation of fragments if the packet size exceeds only the interface mtu.
Fixes 93b36cf3425b9b ("ipv6: support IPV6_PMTU_INTERFACE on sockets")
Cc Florian Weimer <[email protected]>
Signed-off-by Hannes Frederic Sowa <[email protected]>
--- include/net/ip6_route.h | 8 ++++++++ net/ipv6/ip6_output.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-)
include/net/ip6_route.h +8 -0
@@ -174,6 +174,14 @@ static inline bool ip6_sk_accept_pmtu(const struct sock *sk)return inet6_sk (sk)->pmtudisc !=IPV6_PMTUDISC_INTERFACE ; } +static inline bool ip6_sk_allow_local_frag (const struct sock *sk) +{ +struct ipv6_pinfo *np =inet6_sk (sk); + +return np->pmtudisc !=IPV6_PMTUDISC_DO && + np->pmtudisc !=IPV6_PMTUDISC_PROBE ; +} +static inline struct in6_addr *rt6_nexthop (struct rt6_info *rt) {return &rt->rt6i_gateway;
net/ipv6/ip6_output.c +5 -4
@@ -1231,8 +1231,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, sizeof(struct frag_hdr) : 0) + rt->rt6i_nfheader_len; - maxnonfragsize = (np->pmtudisc >=IPV6_PMTUDISC_DO ) ? - mtu :sizeof (struct ipv6hdr ) +IPV6_MAXPLEN ; +if (ip6_sk_allow_local_frag (sk)) + maxnonfragsize =sizeof (struct ipv6hdr ) +IPV6_MAXPLEN ; +else + maxnonfragsize = mtu;/* dontfrag active */ if ((cork->length + length > mtu - headersize) && dontfrag &&
@@ -1540,8 +1542,7 @@ int ip6_push_pending_frames(struct sock *sk) }/* Allow local fragmentation. */ -if (np->pmtudisc <IPV6_PMTUDISC_DO ) - skb->local_df =1 ; + skb->local_df =ip6_sk_allow_local_frag (sk); *final_dst = fl6->daddr;__skb_pull (skb,skb_network_header_len (skb));
Signature · 1 line
1.8.5.3