Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2001 05:36:20 -0800 (PST)
From:      aigars@ugunssiena.lv
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/24780: FreeBSD 4.x + bridge + dummynet = crash
Message-ID:  <200102011336.f11DaKt70170@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         24780
>Category:       kern
>Synopsis:       FreeBSD 4.x + bridge + dummynet = crash
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 01 05:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Aigars Zaube
>Release:        4.2-RELEASE
>Organization:
SIA Ugunssiena
>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.

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.


>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...


>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);
================================


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102011336.f11DaKt70170>