From owner-freebsd-bugs Mon Mar 12 17:20: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2330F37B719 for ; Mon, 12 Mar 2001 17:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2D1K1H47620; Mon, 12 Mar 2001 17:20:01 -0800 (PST) (envelope-from gnats) Received: from Unicorn.Forest.Od.UA (Forest-2M-EuroPort.Forest.Od.UA [195.138.69.214]) by hub.freebsd.org (Postfix) with ESMTP id DA6E837B718 for ; Mon, 12 Mar 2001 17:18:47 -0800 (PST) (envelope-from unicorn@Unicorn.Forest.Od.UA) Received: (from unicorn@localhost) by Unicorn.Forest.Od.UA (8.11.3/8.11.3) id f2D1Imi00439 for FreeBSD-gnats-submit@freebsd.org; Tue, 13 Mar 2001 03:18:48 +0200 (EET) (envelope-from unicorn) Message-Id: <200103130118.f2D1Imi00439@Unicorn.Forest.Od.UA> Date: Tue, 13 Mar 2001 03:18:48 +0200 (EET) From: unicorn@Forest.Od.UA Reply-To: unicorn@Forest.Od.UA To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/25756: Patch against crash caused by use of uninitialized variable in ip_output. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25756 >Category: kern >Synopsis: Patch against crash caused by use of uninitialized variable in ip_output. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Mar 12 17:20:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Winged Unicorn >Release: FreeBSD 5.0-CURRENT i386 >Organization: Valhala >Environment: System: FreeBSD Unicorn.Forest.Od.UA 5.0-CURRENT FreeBSD 5.0-CURRENT #6: Tue Mar 13 02:38:01 EET 2001 root@Unicorn.Forest.Od.UA:/usr/src/sys/compile/FOREST i386 DUMMYNET. >Description: When ip_output called within dummynet guts it takes cooked mbuf ready to be sent. In ip_output() local variable `struct in_ifaddr *ia' is used to evaluate outgoing i-face counters, but left uninitialized. (see compiller worning) In previous snaps this bug don't crash system. But dummynet hangs sometimes for the same reason.. I guess. >How-To-Repeat: Send packet matches pipe rule. >Fix: Index: ip_output.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_output.c,v retrieving revision 1.122 diff -u -r1.122 ip_output.c --- ip_output.c 2001/02/26 20:05:32 1.122 +++ ip_output.c 2001/03/13 00:47:03 @@ -91,6 +91,9 @@ (ntohl(a.s_addr))&0xFF); #endif +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) + u_short ip_id; static struct mbuf *ip_insertoptions __P((struct mbuf *, struct mbuf *, int *)); @@ -168,6 +171,7 @@ rule = (struct ip_fw_chain *)(m->m_data) ; opt = NULL ; ro = & ( ((struct dn_pkt *)m)->ro ) ; + ia = ifatoia(ro->ro_rt->rt_ifa); imo = NULL ; dst = ((struct dn_pkt *)m)->dn_dst ; ifp = ((struct dn_pkt *)m)->ifp ; @@ -233,8 +237,6 @@ * If routing to interface only, * short circuit routing lookup. */ -#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) if (flags & IP_ROUTETOIF) { if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 && (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message