Page MenuHomeFreeBSD

dummymbuf: Validate syntax upon write to net.dummymbuf.rules sysctl
ClosedPublic

Authored by igoro on Aug 31 2024, 11:00 AM.
Tags
None
Referenced Files
F102891808: D46496.diff
Mon, Nov 18, 9:37 AM
Unknown Object (File)
Mon, Nov 11, 10:38 AM
Unknown Object (File)
Tue, Nov 5, 1:32 PM
Unknown Object (File)
Sat, Oct 26, 10:46 AM
Unknown Object (File)
Sat, Oct 26, 10:46 AM
Unknown Object (File)
Sat, Oct 26, 10:46 AM
Unknown Object (File)
Sat, Oct 26, 10:46 AM
Unknown Object (File)
Sat, Oct 26, 10:46 AM

Details

Summary

For now, opargs are not validated due to their runtime nature.
While here, improve parser a little and fix comment style.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59275
Build 56162: arc lint + arc unit

Event Timeline

Fix style as reported by checkstyle9.pl

I usually prefer having whitespace/comment cleanup work be a separate commit. That makes reviewing things that much easier.
There's no need to separate it out now, but it's something to keep in mind for future commits.

sys/net/dummymbuf.c
226

We also set this in line 232. I don't see any obvious reason to set it here and then again later, so one of them should go away.

igoro marked an inline comment as done.Sep 2 2024, 1:03 PM
igoro added inline comments.
sys/net/dummymbuf.c
226

Currently implemented parser error reporting tries to report only the rule it stopped at. During the recent testing I found a case when ; is missing, then nothing is printed back due to syntax_len=0. There is a little cons (probably it seems so only for me) if it prints everything from the cursor till the end -- it might form a feeling like the whole rule set is printed, while it's not.

What do you think? I'm open for any direction.

Approved.

sys/net/dummymbuf.c
226

Ah, I think I see.
Essentially rule->syntax_len is part of the error feedback for read_rule(), so we want it set to something meaningful in case we return in the delim == NULL case.

This revision is now accepted and ready to land.Sep 2 2024, 2:20 PM
igoro marked an inline comment as done.Sep 3 2024, 8:47 AM
In D46496#1060114, @kp wrote:

I usually prefer having whitespace/comment cleanup work be a separate commit. That makes reviewing things that much easier.
There's no need to separate it out now, but it's something to keep in mind for future commits.

Thanks for reminding. My feeling of little style updates probably has gone too far. I would like to separate it for the sake of good history/example.

Deflate the diff to the functional change only

This revision now requires review to proceed.Sep 3 2024, 9:29 AM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 5 2024, 9:52 AM
This revision was automatically updated to reflect the committed changes.