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)
Tue, Nov 26, 12:11 PM
Unknown Object (File)
Tue, Nov 26, 12:11 PM
Unknown Object (File)
Tue, Nov 26, 12:11 PM
Unknown Object (File)
Tue, Nov 26, 12:11 PM
Unknown Object (File)
Tue, Nov 26, 12:11 PM
Unknown Object (File)
Tue, Nov 26, 11:53 AM
Unknown Object (File)
Fri, Nov 8, 6:50 AM
Unknown Object (File)
Oct 17 2024, 8:21 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 Skipped
Unit
Tests Skipped

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.