Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 1998 19:20:29 +0300 (EEST)
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/6466: loopback interface has no SIOCSIFFLAGS handler, this causes bugs
Message-ID:  <199804301620.TAA16249@relay.ucb.crimea.ua>

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

>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<UP,LOOPBACK,RUNNING,MULTICAST> 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<UP,LOOPBACK,RUNNING,PROMISC,MULTICAST> 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



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