mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-06 20:10:11 +02:00
hotfix(pmtud/tcp): block kernel from racing to send RST packets
- this makes PMTUD TCP reliable - this only works on kernels with the mark module - on kernels without the mark module, the icmp pmtud mtu found is used
This commit is contained in:
@@ -10,12 +10,18 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/pmtud/ip"
|
||||
)
|
||||
|
||||
func startRawSocket(family int) (fd fileDescriptor, stop func(), err error) {
|
||||
func startRawSocket(family, excludeMark int) (fd fileDescriptor, stop func(), err error) {
|
||||
fdPlatform, err := socket(family, constants.SOCK_RAW, constants.IPPROTO_TCP)
|
||||
if err != nil {
|
||||
return 0, nil, fmt.Errorf("creating raw socket: %w", err)
|
||||
}
|
||||
|
||||
err = setMark(fdPlatform, excludeMark)
|
||||
if err != nil {
|
||||
_ = closeSocket(fdPlatform)
|
||||
return 0, nil, fmt.Errorf("setting mark option on raw socket: %w", err)
|
||||
}
|
||||
|
||||
if family == constants.AF_INET {
|
||||
err = ip.SetIPv4HeaderIncluded(fdPlatform)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user