Page MenuHomeFreeBSD

Fixes on arp output and parameters validation
ClosedPublic

Authored by garga on Feb 9 2017, 9:01 AM.
Tags
None
Referenced Files
F106681317: D9504.diff
Fri, Jan 3, 7:10 PM
Unknown Object (File)
Nov 29 2024, 7:29 AM
Unknown Object (File)
Nov 13 2024, 6:26 AM
Unknown Object (File)
Oct 5 2024, 1:40 AM
Unknown Object (File)
Oct 2 2024, 8:28 PM
Unknown Object (File)
Oct 2 2024, 5:41 AM
Unknown Object (File)
Sep 30 2024, 2:24 AM
Unknown Object (File)
Sep 22 2024, 9:49 AM
Subscribers

Details

Summary
  • 'blackhole' and 'reject' are mutually exclusive, replace printf() by errx() when both are selected.
  • 'trail' option is no longer supported since first import of arp from BSD 4.4. XXX message was added 13 years ago in r128192. I believe it's time to remove it.
  • Use warnx() to print some informative messages instead of printf()
  • Replace strncmp() by strcmp() when validating parameters and exit when invalid parameter is found

Sponsored by: Rubicon Communications (Netgate)
MFC after: 1 week

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7322
Build 7490: arc lint + arc unit

Event Timeline

garga retitled this revision from to Fixes on arp output and parameters validation.
garga updated this object.
garga edited the test plan for this revision. (Show Details)
garga added a reviewer: allanjude.
cem edited edge metadata.
This revision is now accepted and ready to land.Feb 9 2017, 5:11 PM
vangyzen edited edge metadata.
vangyzen added inline comments.
usr.sbin/arp/arp.c
322

By using strncmp, this code accepts parameters like "temperature", "template", and "tempestuous", and treats them like "temp". Likewise for the other cases below. This seems wrong. You didn't break it, obviously, but while you're here...

344

I wonder if blackhole and reject still work after the L2/L3 separation in FreeBSD 8.0. (I think it was 8.0.) Since you're apparently in a cleanup mood... :-)

365

warnx appends a newline.

401

warnx appends a newline.

872–873

warnx appends a newline.

However, this seems like an informative message on the successful path, not a warning, so I think printf is more appropriate.

In any case, combining the two printf calls into one makes sense.

garga edited edge metadata.
  • Removed \n from warnx() calls
  • Back success informative message to printf, but kept a single call
  • Replace strncmp() by strcmp() on parameters check and exit if wrong parameter is used
This revision now requires review to proceed.Feb 9 2017, 5:44 PM
usr.sbin/arp/arp.c
322

Replaced by strcmp() and added else condition to exit for unknown parameters

344

I can check it after and submit a new review. Sounds good?

365

Fixed

401

Fixed

872–873

You are right, back to printf(), but a single one

vangyzen edited edge metadata.
vangyzen added inline comments.
usr.sbin/arp/arp.c
344

Sure. It's a logically separate change, so it should be a separate commit.

489

Here's another extra newline that I missed the first time.

This revision is now accepted and ready to land.Feb 9 2017, 6:06 PM
garga edited edge metadata.

Remove \n from warnx message

This revision now requires review to proceed.Feb 9 2017, 6:46 PM
usr.sbin/arp/arp.c
489

fixed as well, thanks!

vangyzen edited edge metadata.
This revision is now accepted and ready to land.Feb 9 2017, 6:48 PM
garga edited edge metadata.
allanjude edited edge metadata.

Approved for commit

This revision was automatically updated to reflect the committed changes.