Page MenuHomeFreeBSD

tcp: improve mbuf handling when processing SYN
ClosedPublic

Authored by tuexen on Sat, Sep 28, 8:38 PM.
Tags
None
Referenced Files
F97908956: D46839.diff
Tue, Oct 1, 5:09 PM
F97730470: D46839.id143875.diff
Tue, Oct 1, 12:29 AM
Unknown Object (File)
Mon, Sep 30, 10:37 PM
Unknown Object (File)
Mon, Sep 30, 6:04 PM
Unknown Object (File)
Sun, Sep 29, 11:04 PM

Details

Summary

When the sysctl-variable net.inet.ip.accept_sourceroute is non-zero, an mbuf would be leaked when processing a SYN-segment containing an IPv4 strict or loose source routing option, when
the on-stack syncache entry is used or there is an error related to processing TCP MD5 options.

Fix this by freeing the mbuf whenever an error occurred or the on-stack syncache entry is used.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
sys/netinet/tcp_syncache.c
1585

Mostly unrelated, but this if-statement can be indented such that it applies only to the uma_zalloc() case. It's a minor thing but the control flow in this function is so complicated. :(

1777
This revision is now accepted and ready to land.Mon, Sep 30, 10:34 AM
tuexen added inline comments.
sys/netinet/tcp_syncache.c
1585

I agree. Had the same observation, but did not want to intermix a the fix with a code cleanup with no functional change. Will do this as a follow-up.

1777

Will change it. But this is used multiple time this way in this file. Maybe this should be cleaned up first.