From nobody@FreeBSD.org  Fri Feb  4 23:20:01 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CA13F16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  4 Feb 2005 23:20:01 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B463243D2D
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  4 Feb 2005 23:20:01 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j14NK1IO084524
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 4 Feb 2005 23:20:01 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j14NK1CC084523;
	Fri, 4 Feb 2005 23:20:01 GMT
	(envelope-from nobody)
Message-Id: <200502042320.j14NK1CC084523@www.freebsd.org>
Date: Fri, 4 Feb 2005 23:20:01 GMT
From: Andrew Korovin <freeside@inbox.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: After pppd establishes connection, if "options MAC" is enabled in the kernel, kernel panic happens.
X-Send-Pr-Version: www-2.3

>Number:         77111
>Category:       kern
>Synopsis:       After pppd establishes connection, if "options MAC" is enabled in the kernel, kernel panic happens.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 04 23:20:17 GMT 2005
>Closed-Date:    Wed Aug 10 14:00:02 GMT 2005
>Last-Modified:  Wed Aug 10 14:00:02 GMT 2005
>Originator:     Andrew Korovin
>Release:        5.3 RELEASE p5
>Organization:
FreeSide`s Softwarem inc.
>Environment:
FreeBSD freeside.pp.ru 5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #0: Fri Feb  4 04:28:14 MSK 2005     root@freeside.pp.ru:/usr/obj/usr/src/sys/FreeSide  i386

>Description:
After pppd establishes connection, if "options MAC" is enabled in the kernel, kernel panic happens.
>How-To-Repeat:
To repeat the problem, you'll have to Enable "options MAC" in kernel and call your ISP with pppd.
>Fix:
Unknown.
>Release-Note:
>Audit-Trail:

From: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/77111: After pppd establishes connection, if "options MAC" is enabled in the kernel, kernel panic happens.
Date: Tue, 15 Feb 2005 00:32:24 +0000

 --mYCpIKhGyMATD0i+
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hello,
 I'm not able to test it in working environment right now, but attached patch
 should correct this problem. Needs testing. The problem is that
 mac_check_ifnet_transmit() needs to have packet header in passed mbuf. This
 function is called from: pppwrite() -- pppoutput() --
 mac_check_ifnet_transmit(). Attached patch should correct this problem.
 
 -- 
 * Wojciech A. Koszek && dunstan@FreeBSD.czest.pl
 
 --mYCpIKhGyMATD0i+
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="diff.0.ppp_tty.c"
 
 Patch against FreeBSD 5.3-STABLE, kern.osreldate: 503102.
 
 diff -upr /usr/src/sys/net/ppp_tty.c src/sys/net/ppp_tty.c
 --- /usr/src/sys/net/ppp_tty.c	Sat Feb 12 09:36:38 2005
 +++ src/sys/net/ppp_tty.c	Tue Feb 15 00:29:38 2005
 @@ -396,6 +396,16 @@ pppwrite(tp, uio, flag)
  	    splx(s);
  	    return (ENOBUFS);
  	}
 +	/* 
 +	 * mbuf has to hold packet header in order to pass tests made by
 +	 * mac_check_ifnet_transmit() in pppoutput(), when MAC is present in
 +	 * the kernel.
 +	 */
 +	if (!(m->m_flags & M_PKTHDR)) {
 +		m_free(m0);
 +		splx(s);
 +		return (EIO);
 +	}
  	m->m_len = 0;
  	if (uio->uio_resid >= MCLBYTES / 2)
  	    MCLGET(m, M_DONTWAIT);
 
 --mYCpIKhGyMATD0i+--
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Fri Jul 1 20:15:01 GMT 2005 
State-Changed-Why:  
The problem is fixed in HEAD. 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Fri Jul 1 20:15:01 GMT 2005 
Responsible-Changed-Why:  
My colleague has rediscovered this problem. I've made a fix, and 
was pointed to this PR later. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77111 
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Wed Aug 10 13:59:14 GMT 2005 
State-Changed-Why:  
Merged. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77111 
>Unformatted:
