meaningless retry when EMSGSIZE error happens in dtls1_do_write
#27,905 创建于 2025年6月26日
仓库指标
- 星标
- (30,157 个星标)
- PR 合并指标
- (30 天内没有已合并 PR)
描述
According to the man, when EMSGSIZE error occurs, path MTU can be retrieved conveniently using the IP_MTU socket option
When PMTU discovery is enabled, the kernel automatically keeps track of the path MTU per destination host. When it is connected to a specific peer with connect(2), the currently known path MTU can be retrieved conveniently using the IP_MTU socket option (e.g., after an EMSGSIZE error occurred). The path MTU may change over time. For connectionless sockets with many destinations, the new MTU for a given destination can also be accessed using the error queue (see IP_RECVERR). A new error will be queued for every incoming MTU update.
However, in the function dtls1_do_write, when the EMSGSIZE error occurs, it use function dtls1_query_mtu to query the path mtu from socket and take a retry to send message. But in function dtls1_query_mtu , if the current mtu(s->d1->mtu) is larger than dtls1_min_mtu(256 -28 for ipv4), the current mtu will not be updated, even if the queried mtu from socket is smaller than the current mtu. So the retry will be meaningless. https://github.com/openssl/openssl/blob/5876f3f52a9d722613b244ee2e91dd32755d921e/ssl/d1_lib.c#L888-L918