HomeFreeBSD

Fix deadlock in IPv6 PCB code.

Description

Fix deadlock in IPv6 PCB code.

When several threads are trying to send datagram to the same destination,
but fragmentation is disabled and datagram size exceeds link MTU,
ip6_output() calls pfctlinput2(PRC_MSGSIZE). It does notify all
sockets wanted to know MTU to this destination. And since all threads
hold PCB lock while sending, taking the lock for each PCB in the
in6_pcbnotify() leads to deadlock.

RFC 3542 p.11.3 suggests notify all application wanted to receive
IPV6_PATHMTU ancillary data for each ICMPv6 packet too big message.
But it doesn't require this, when we don't receive ICMPv6 message.

Change ip6_notify_pmtu() function to be able use it directly from
ip6_output() to notify only one socket, and to notify all sockets
when ICMPv6 packet too big message received.

PR: 197059
Differential Revision: https://reviews.freebsd.org/D1949
Reviewed by: no objection from network
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

Details

Provenance
aeAuthored on
Reviewer
network
Differential Revision
D1949: Fix deadlock in IPv6 PCB code.
Parents
rS279587: Define PTR_ALIGN() macro which will be needed coming Mellanox driver
Branches
Unknown
Tags
Unknown

Event Timeline