Follow-ups to #22587 and #23269#23712
Closed
topimiettinen wants to merge 1 commit intosystemd:mainfrom
Closed
Conversation
Add links to documentation to NetLabel, LSM, Netlabel Fallback Peer Labeling and NFT. Use a positive boolean function nft_identifier_good() to help grok the checks more easily than nft_identifier_bad(). Escape logged invalid items. Add an ASSERT_PTR() for 'data' in config_parse_netlabel(). Use a different debug message when NFT operation fails. Align nfproto_table strings. Remove NFT_SET_MSGS, it's only used once.
This was referenced Jun 11, 2022
Merged
Contributor
Author
|
focal-amd64 fails with Probably not related since other focals and everything else pass the tests. |
yuwata
requested changes
Jun 14, 2022
Member
yuwata
left a comment
There was a problem hiding this comment.
Please do not squash changes. At least, please split the changes into two: for NFT and for NetLabel.
|
|
||
| if (nft_identifier_bad(table)) | ||
| if (!nft_identifier_good(table)) | ||
| return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT table name %s.", table); |
Member
There was a problem hiding this comment.
Please also escape the string in error message.
|
|
||
| if (nft_identifier_bad(set)) | ||
| if (!nft_identifier_good(set)) | ||
| return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT set name %s.", set); |
|
|
||
| if (nft_identifier_bad(table)) | ||
| if (!nft_identifier_good(table)) | ||
| return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT table name %s.", table); |
|
|
||
| if (nft_identifier_bad(set)) | ||
| if (!nft_identifier_good(set)) | ||
| return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT set name %s.", set); |
| const char *rvalue, | ||
| void *data, | ||
| void *userdata) { | ||
| Set **set = ASSERT_PTR(data); |
Member
There was a problem hiding this comment.
Please insert a empty line between the function prototype and variable declaration.
Also, you can drop assert(set); below.
| _cleanup_free_ char *esc = NULL; | ||
|
|
||
| esc = cescape(table); | ||
| return log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid table name %s, ignoring", esc); |
Member
There was a problem hiding this comment.
cescape() may fail. Please wrap esc with strna().
| _cleanup_free_ char *esc = NULL; | ||
|
|
||
| esc = cescape(set); | ||
| return log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid set name %s, ignoring", esc); |
| esc = cescape(w); | ||
| log_syntax(unit, LOG_WARNING, filename, line, 0, | ||
| "Bad NetLabel label, ignoring: %s", w); | ||
| "Bad NetLabel label, ignoring: %s", esc); |
| if (nft_identifier_bad(set)) | ||
| return log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid set name %s, ignoring", set); | ||
| esc = cescape(table); | ||
| return log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid table name %s, ignoring", esc); |
| _cleanup_free_ char *esc = NULL; | ||
|
|
||
| esc = cescape(set); | ||
| return log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid set name %s, ignoring", esc); |
Member
|
Now I am preparing a PR based on this. Please wait for a while. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add links to documentation to NetLabel, LSM, Netlabel Fallback Peer Labeling
and NFT.
Use a positive boolean function nft_identifier_good() to help grok the checks
more easily than nft_identifier_bad().
Escape logged invalid items.
Add an ASSERT_PTR() for 'data' in config_parse_netlabel().
Use a different debug message when NFT operation fails.
Align nfproto_table strings.
Remove NFT_SET_MSGS, it's only used once.