Bug 216265

Summary: [patch] [mppc] invalid KASSERT prevent building kernel with NETGRAPH_MPPC_COMPRESSION and INVARIANTS
Product: Base System Reporter: Eugene Grosbein <ports>
Component: kernAssignee: Pedro F. Giffuni <pfg>
Status: Closed FIXED    
Severity: Affects Some People CC: mav, pfg
Priority: --- Keywords: patch
Version: 11.0-STABLEFlags: pfg: mfc-stable11+
pfg: mfc-stable10+
Hardware: Any   
OS: Any   
Attachments:
Description Flags
unbreak debugging kernel build
none
add missing chunk none

Description Eugene Grosbein 2017-01-19 19:22:35 UTC
Created attachment 179079 [details]
unbreak debugging kernel build

Since 11.0-RELEASE, FreeBSD includes implementation of MMPC.

Build of kernel configuration containing both of NETGRAPH_MPPC_COMPRESSION and INVARIANTS fails:

--- ng_mppc.o ---
/home/src/sys/netgraph/ng_mppc.c:546:18: error: use of undeclared identifier 'MPPC_INVALID'
                KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__));

According to http://media.digikey.com/pdf/Data%20Sheets/EXAR%20PDFs/MPPC-C.pdf return value MPPC_INVALID (zero) for "rtn" variable was supposed to denote invalid values for arguments srcCnt, dstCnt or flags passed to function MPPC_Compress(). Our implementation in sys/net/mppcc.c does not perform such validity checks and never returns zero value, so this KASSERT should be removed.

Also, /* XXX NETGRAPH_MPPC_COMPRESSION isn't functional yet */ comment in the same file and some others are not valid anymore. This includes sys/conf/NOTES and sys/conf/options.

Attached patch fixes this.
Comment 1 Eugene Grosbein 2017-01-19 19:40:30 UTC
Created attachment 179081 [details]
add missing chunk
Comment 2 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-01-19 20:02:25 UTC
Looks good, let me give it a spin.
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-01-20 00:02:29 UTC
A commit references this bug:

Author: pfg
Date: Fri Jan 20 00:02:12 UTC 2017
New revision: 312443
URL: https://svnweb.freebsd.org/changeset/base/312443

Log:
  mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION.

  There were several places where reference to compression were left
  unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID
  which is not defined in the tree and therefore were sure to break with
  INVARIANTS: comment them out.

  Reported by:	Eugene Grosbein
  PR:		216265
  MFC after:	3 days

Changes:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/netgraph/ng_mppc.c
Comment 4 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-01-20 00:09:24 UTC
(In reply to Pedro F. Giffuni from comment #2)

I am now wondering what was I thinking when I did the original commit, 
it did look too easy but it was probably the hurry of getting it in before the release ... yikes. Thanks!
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-01-23 01:22:01 UTC
A commit references this bug:

Author: pfg
Date: Mon Jan 23 01:20:58 UTC 2017
New revision: 312656
URL: https://svnweb.freebsd.org/changeset/base/312656

Log:
  MFC r312443:
  mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION.

  There were several places where reference to compression were left
  unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID
  which is not defined in the tree and therefore were sure to break with
  INVARIANTS: comment them out.

  Reported by:	Eugene Grosbein
  PR:		216265

Changes:
_U  stable/11/
  stable/11/sys/conf/NOTES
  stable/11/sys/conf/options
  stable/11/sys/netgraph/ng_mppc.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2017-01-23 01:22:05 UTC
A commit references this bug:

Author: pfg
Date: Mon Jan 23 01:21:39 UTC 2017
New revision: 312657
URL: https://svnweb.freebsd.org/changeset/base/312657

Log:
  MFC r312443:
  mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION.

  There were several places where reference to compression were left
  unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID
  which is not defined in the tree and therefore were sure to break with
  INVARIANTS: comment them out.

  Reported by:	Eugene Grosbein
  PR:		216265

Changes:
_U  stable/10/
  stable/10/sys/conf/NOTES
  stable/10/sys/conf/options
  stable/10/sys/netgraph/ng_mppc.c
Comment 7 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-01-23 01:23:48 UTC
Committed up to 10-stable.
Thanks!