From owner-freebsd-net@FreeBSD.ORG Mon Jan 14 16:08:20 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16E4D16A41B for ; Mon, 14 Jan 2008 16:08:20 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com [66.111.4.27]) by mx1.freebsd.org (Postfix) with ESMTP id CFA8413C46A for ; Mon, 14 Jan 2008 16:08:19 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 01B8A88896; Mon, 14 Jan 2008 11:08:19 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 14 Jan 2008 11:08:19 -0500 X-Sasl-enc: 1GFCpBEXJqjmTE6am+aJJILAvekd+J30Ta9+EJUHYkuQ 1200326895 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTP id 709132A06C; Mon, 14 Jan 2008 11:08:15 -0500 (EST) Message-ID: <478B88EE.7090307@FreeBSD.org> Date: Mon, 14 Jan 2008 16:08:14 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.6 (X11/20070928) MIME-Version: 1.0 To: Tom Judge References: <478B7AB7.5010208@tomjudge.com> In-Reply-To: <478B7AB7.5010208@tomjudge.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: Programming interface MAC filter without enabling PROMISC on an interface from user space. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jan 2008 16:08:20 -0000 Tom Judge wrote: > Hi, > > I have just started experimenting with OpenLLDP and come across a > little bit of a nasty. When it opens the interface, it puts it into > PROMISC mode, which I don't really want to happen. Is there any way > to add the LLDP MAC address (01-80-C2-00-00-0E) to the interface mac > filter from user space, so that the interface does not have to be set > to PROMISC? There *is* an API for this but it's not integrated into pcap or bpf; see SIOCADDMULTI and SIOCDELMULTI. There are some issues with doing that portably, Windows and Linux do things somewhat differently in this space. Really we could do with a KPI for this so that the references are properly refcounted. If you have other link layer multicast listeners it's not guaranteed that the stack will correctly restore the hash filters at the driver level if it has to enable ALLMULTI mode. You almost certainly don't want to set PROMISC if you are ever going to do any kind of IP forwarding, although I believe I fixed that historic bug whereby the IP layer kept seeing its own packets about a year ago. later BMS