Bug 24780

Summary: FreeBSD 4.x + bridge + dummynet = crash
Product: Base System Reporter: aigars
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   

Description aigars 2001-02-01 13:40:01 UTC
kernel crashes when bridged packet goes through dummynet pipe.

ip_dummynet.c: transmit_event() looks for ethernet header in dn_pkt, 
               not in real packet mbuf.
bridge.c: bdg_forward() throws away ethernet header when passes packet
          to dummynet. May be this is correct, but ethernet header is
          is needed to forward the packet when it comes out from dummynet.
          My patch adds ethernet header back to packet before passing it
          to dummynet, and everything is working great.

Fix: 

======= Fix for sys/netinet/ip_dummynet.c:
404a405
>             struct mbuf *mpkt;
407,408c408,411
<           if (m->m_len < ETHER_HDR_LEN
<             && (m = m_pullup(m, ETHER_HDR_LEN)) == NULL) {
---
>             mpkt=m->m_next;
>           if (mpkt->m_len < ETHER_HDR_LEN
>             && (mpkt = m->m_next = m_pullup(mpkt, ETHER_HDR_LEN)) == NULL) {
>               m_freem(mpkt);
412,413c415,416
<           bcopy(mtod(m, struct ether_header *), &hdr, ETHER_HDR_LEN);
<           m_adj(m, ETHER_HDR_LEN);
---
>           bcopy(mtod(mpkt, struct ether_header *), &hdr, ETHER_HDR_LEN);
>           m_adj(mpkt, ETHER_HDR_LEN);

================================
======= Fix for sys/net/bridge.c:
755a756,759
>           M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT);
>           if (m == NULL)
>                   return ENOBUFS;
>           bcopy(eh, mtod(m, struct ether_header *), ETHER_HDR_LEN);
================================
How-To-Repeat: Compile kernel with bridge and dummynet support.

sysctl -w net.link.ether.bridge=1
sysctl -w net.link.ether.bridge_ipfw=1
ipfw pipe 1 config bw 512kbit/s
ipfw add 1 pipe 1 ip from any to any bridged

Wait for any bridged packet...
Comment 1 ru freebsd_committer freebsd_triage 2001-02-01 14:06:10 UTC
On Thu, Feb 01, 2001 at 05:36:20AM -0800, aigars@ugunssiena.lv wrote:
[...]
> 
> >Environment:
> FreeBSD test.us.lv 4.2-RELEASE FreeBSD 4.2-RELEASE #20: Thu Feb  1 13:33:50 EET 2001     root@test.us.lv:/data/src/sys/compile/KERN1  i386
> 
> 
> >Description:
> kernel crashes when bridged packet goes through dummynet pipe.
> 
Please upgrade to 4.2-STABLE (a dozen of fixes has been committed
recently that should fix the panic you observe), and follow up on
this PR again.


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 2 Luigi Rizzo freebsd_committer freebsd_triage 2001-02-11 23:14:11 UTC
State Changed
From-To: open->closed

PR not relevant anymore, the code has been upgraded and this particular 
issue fixed.