Page MenuHomeFreeBSD

ipfw(8): Fix most warnings with the default WARNS level.
ClosedPublic

Authored by markj on Jun 25 2020, 7:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 9:21 AM
Unknown Object (File)
Wed, Apr 17, 8:28 AM
Unknown Object (File)
Mar 12 2024, 12:14 AM
Unknown Object (File)
Mar 12 2024, 12:14 AM
Unknown Object (File)
Mar 12 2024, 12:14 AM
Unknown Object (File)
Mar 8 2024, 4:06 AM
Unknown Object (File)
Jan 6 2024, 4:20 AM
Unknown Object (File)
Jan 6 2024, 4:20 AM
Subscribers

Details

Summary

Most of these fall into one of several patterns.


- Missing const qualifiers. All but one of these were benign (i.e.,
adding "const" fixes the warning). The exception was in print_ip(),
where we write

cmd->addr.s_addr = htonl(cmd->addr.s_addr);
<print statement>
cmd->addr.s_addr = htonl(cmd->addr.s_addr);


so this can easily be fixed with a temporary variable.

- A global variable `co` shadowing local declarations. In ipfw2.c, some
code gets `co` through a function parameter for some reason. I
renamed the global `co` to `g_co`. I think this will help a bit if
anyone ever tries to convert this code to a libipfw.

- Using a signed int as an index variable where the loop bound is
unsigned. I just converted the variable to have the same type as the
bound.

- Missing static qualifiers on some functions.

- I left the -Wcast-align warnings alone. They are more involved to
fix. It might be sufficient to just add an __aligned qualifier to the
corresponding kernel types.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jun 25 2020, 7:25 PM
markj created this revision.
markj edited the summary of this revision. (Show Details)
markj added a subscriber: nc.

Any objections to committing this?

This revision is now accepted and ready to land.Jul 13 2020, 7:07 AM

Thanks for fixing this!