Page MenuHomeFreeBSD

tcp: limit namespace for tcp_[gs]et_flags
ClosedPublic

Authored by tuexen on Dec 30 2023, 3:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 17, 8:21 AM
Unknown Object (File)
Oct 5 2024, 6:14 PM
Unknown Object (File)
Oct 5 2024, 6:14 PM
Unknown Object (File)
Oct 5 2024, 12:52 PM
Unknown Object (File)
Oct 2 2024, 6:10 PM
Unknown Object (File)
Oct 2 2024, 5:12 PM
Unknown Object (File)
Sep 30 2024, 12:10 PM
Unknown Object (File)
Sep 24 2024, 7:09 AM

Details

Summary

This limits the namespace of tcp_[gs]et_flags as suggested by karels and kib in D43231.

Diff Detail

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

Event Timeline

There is another namespace issue in tcp.h. There have been several additions near the end of the file, after the #endif at line 458. The #endif closes the #ifdef _BSD_VISIBLE at line 181. The #endif should be moved to line 544, just before the closing #endif, as the additions are not in POSIX, and the #endif should be commented as /* _BSD_VISIBLE */ so people are less likely to add things after it. If you don't want to combine the namespace fixes, I can do it later.

sys/netinet/tcp.h
96

I.e. using function-like macro is more to the point there, at least checking the number of args for substitution.

Address comments made by kib and karels.

There is another namespace issue in tcp.h. There have been several additions near the end of the file, after the #endif at line 458. The #endif closes the #ifdef _BSD_VISIBLE at line 181. The #endif should be moved to line 544, just before the closing #endif, as the additions are not in POSIX, and the #endif should be commented as /* _BSD_VISIBLE */ so people are less likely to add things after it. If you don't want to combine the namespace fixes, I can do it later.

Done in the latest diff.

sys/netinet/tcp.h
96

Done in the latest diff.

Q: Are Userspace Applications then supposed use the __tcp_[gs]et_flags directly, or #define their tcp_[gs]et_flags locally?

Q: Are Userspace Applications then supposed use the __tcp_[gs]et_flags directly, or #define their tcp_[gs]et_flags locally?

It is up to the app itself, we cannot mandate it. In both cases the code uses __tcp_set_flags(), further style issues are outside the scope of the OS compilation environment.

sys/netinet/tcp.h
91–92

since you are fixing the style issue with tab.

Address whitespace issue mentioned by kib.

tuexen added inline comments.
sys/netinet/tcp.h
91–92

Addressed with the latest patch.

This revision is now accepted and ready to land.Dec 31 2023, 1:46 PM

Thanks for moving the #endif!

Moving the #endif might be worth mentioning in the description too; only TCP_NODELAY should be visible without __BSD_VISIBLE

This revision was automatically updated to reflect the committed changes.