From owner-freebsd-bugs Thu Apr 30 09:30:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA03680 for freebsd-bugs-outgoing; Thu, 30 Apr 1998 09:30:05 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA03633; Thu, 30 Apr 1998 09:30:03 -0700 (PDT) (envelope-from gnats) Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [194.93.177.113]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA02128 for ; Thu, 30 Apr 1998 09:20:40 -0700 (PDT) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.8.8/8.8.8) id TAA16249; Thu, 30 Apr 1998 19:20:29 +0300 (EEST) (envelope-from ru) Message-Id: <199804301620.TAA16249@relay.ucb.crimea.ua> Date: Thu, 30 Apr 1998 19:20:29 +0300 (EEST) From: Ruslan Ermilov Reply-To: ru@ucb.crimea.ua To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/6466: loopback interface has no SIOCSIFFLAGS handler, this causes bugs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 6466 >Category: kern >Synopsis: loopback interface has no SIOCSIFFLAGS handler, this causes bugs >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 30 09:30:01 PDT 1998 >Last-Modified: >Originator: Ruslan Ermilov >Organization: United Commercial Bank >Release: FreeBSD 2.2.6-STABLE i386 >Environment: -stable and (I guess) -current. >Description: Loopback network interface driver (net/if_loop.c) has no SIOCSIFFLAGS ioctl handler. This causes bugs. I noticed this after running tcpdump on lo0. Once set, IFF_PROMISC flag isn't cleared on lo0. Searching in the source code (net/if.c, net/if_loop.c, net/bpf.c) I found the problem: 1. The IFF_PROMISC flag is cleared in ifpromisc(ifp,0). 2. ifpromisc(ifp,0) is called from bpf_detach() only if (struct bpf_d).bd_promisc is set to non-zero. 3. bd_promisc is set to 1 in bpfioctl() while handling BIOCPROMISC. It is set to 1 only if ifpromisc(ifp,1) returns 0. 4. ifpromisc(ifp,1) fails on if_ioctl(lo0, SIOCSIFFLAGS) because if_loop.c has no handler for SIOCSIFFLAGS. >How-To-Repeat: 1. Run ``ifconfig lo0'': lo0: flags=8149 mtu 16384 inet 127.0.0.1 netmask 0xff000000 2. Run ``tcpdump -i lo0'' 3. Stop ``tcpdump -i lo0'' 4. Run ``ifconfig lo0'' again: lo0: flags=8149 mtu 16384 ^^^^^^^ inet 127.0.0.1 netmask 0xff000000 >Fix: This patch for RELENG_2_2: Index: if_loop.c =================================================================== RCS file: /usr/FreeBSD-CVS/src/sys/net/if_loop.c,v retrieving revision 1.22 diff -u -r1.22 if_loop.c --- if_loop.c 1996/06/19 16:24:10 1.22 +++ if_loop.c 1998/04/30 16:09:16 @@ -293,6 +293,9 @@ ifp->if_mtu = ifr->ifr_mtu; break; + case SIOCSIFFLAGS: + break; + default: error = EINVAL; } >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message