Skip to content

Commit 0600be8

Browse files
ordexNipaLocal
authored and
NipaLocal
committed
ovpn: set skb->ignore_df = 1 before sending IPv6 packets out
IPv6 user packets (sent over the tunnel) may be larger than the outgoing interface MTU after encapsulation. When this happens ovpn should allow the kernel to fragment them because they are "locally generated". To achieve the above, we must set skb->ignore_df = 1 so that ip6_fragment() can be made aware of this decision. Failing to do so will result in ip6_fragment() dropping the packet thinking it was "routed". No change is required in the IPv4 path, because when calling udp_tunnel_xmit_skb() we already pass the 'df' argument set to 0, therefore the resulting datagram is allowed to be fragmented if need be. Fixes: 08857b5 ("ovpn: implement basic TX path (UDP)") Reported-by: Gert Doering <[email protected]> Closes: OpenVPN#3 Tested-by: Gert Doering <[email protected]> Acked-by: Gert Doering <[email protected]> # as primary user Link: https://mail-archive.com/[email protected]/msg31577.html Signed-off-by: Antonio Quartulli <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 7564adb commit 0600be8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/net/ovpn/udp.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind,
262262
dst_cache_set_ip6(cache, dst, &fl.saddr);
263263

264264
transmit:
265+
/* user IPv6 packets may be larger than the transport interface
266+
* MTU (after encapsulation), however, since they are locally
267+
* generated we should ensure they get fragmented.
268+
* Setting the ignore_df flag to 1 will instruct ip6_fragment() to
269+
* fragment packets if needed.
270+
*
271+
* NOTE: this is not needed for IPv4 because we pass df=0 to
272+
* udp_tunnel_xmit_skb()
273+
*/
274+
skb->ignore_df = 1;
265275
udp_tunnel6_xmit_skb(dst, sk, skb, skb->dev, &fl.saddr, &fl.daddr, 0,
266276
ip6_dst_hoplimit(dst), 0, fl.fl6_sport,
267277
fl.fl6_dport, udp_get_no_check6_tx(sk));

0 commit comments

Comments
 (0)