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
Unknown Object (File)
Sun, Dec 8, 4:45 AM
Unknown Object (File)
Fri, Dec 6, 8:41 AM
Unknown Object (File)
Fri, Dec 6, 8:41 AM
Unknown Object (File)
Fri, Dec 6, 8:41 AM
Unknown Object (File)
Fri, Dec 6, 8:41 AM
Unknown Object (File)
Fri, Dec 6, 8:41 AM
Unknown Object (File)
Wed, Dec 4, 10:23 AM
Unknown Object (File)
Tue, Dec 3, 10:38 PM

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 59274
Build 56161: 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.