Bug 193888 - ipfw list will show previous enable rule when current one is disabled.
Summary: ipfw list will show previous enable rule when current one is disabled.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Andrey V. Elsukov
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-09-24 12:13 UTC by bycn82
Modified: 2016-03-09 14:47 UTC (History)
2 users (show)

See Also:


Attachments
set the header of the buffer to 0 (257 bytes, patch)
2014-09-24 12:13 UTC, bycn82
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bycn82 2014-09-24 12:13:49 UTC
Created attachment 147635 [details]
set the header of the buffer to 0

bp_flush() doesnt clean the buffer, it resets the pointers only.
the "ipfw list" will do below

loop rules and do
   1.if current rule is disabled
        continue
     otherwise
         write rule into the buffer,
   2.printf(buffer)
   3.bp_flush(buffer).
done

so it will print the previous enable rule when current one is disabled.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-03-09 14:47:27 UTC
A commit references this bug:

Author: ae
Date: Wed Mar  9 14:47:05 UTC 2016
New revision: 296566
URL: https://svnweb.freebsd.org/changeset/base/296566

Log:
  Set buffer to empty string to prevent duplicated output in some cases.

  PR:		193888

Changes:
  head/sbin/ipfw/ipfw2.c