CURVNET_RESTORE expands to multiple expressions. So enclose it in curly brackets when used in an if statement.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
Are they broken? I guess you can change them for CURVNET_RESTORE, but not for CURVNET_SET. So I guess they are done this way for consistency... But I don't know for sure, since I did not invent them...
The man page explicitly state that
if (condition) CURVNET_SET(vnet);
will not work, but it does not say anything regarding CURVNET_RESTORE.
Comment Actions
The need to guard their use with { } is most definitely a bug and will keep tripping people over.
Looking at the code I have to say I don't see a fix which does not induce churn. If the set/restore macros took an argument we would be set, but it's definitely not something I'm going to spend time on nor will demand someone else does.