From owner-freebsd-net@FreeBSD.ORG Wed Oct 11 12:35:44 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F84516A4F1 for ; Wed, 11 Oct 2006 12:35:44 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 96F2043D72 for ; Wed, 11 Oct 2006 12:34:31 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id k9BCY4qV048384 for ; Wed, 11 Oct 2006 16:34:04 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id k9BCY4L3048379 for freebsd-net@freebsd.org; Wed, 11 Oct 2006 16:34:04 +0400 (MSD) (envelope-from yar) Date: Wed, 11 Oct 2006 16:34:04 +0400 From: Yar Tikhiy To: freebsd-net@freebsd.org Message-ID: <20061011123403.GC47124@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i Subject: A way to disable reception of broadcast UDP? 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: Wed, 11 Oct 2006 12:35:44 -0000 Hi all, Is there a well-known way for a UDP application to tell to the system that it doesn't want to receive broadcast datagrams? E.g., it would be very good for TFTP as required by RFC 1123. In general, accepting broadcast UDP is a security flaw unless the higher proto was specifically designed to work with broadcast. SO_BROADCAST affects sending only, and not reception. Dropping broadcast datagrams in the application is not an option because they can't be told without bogus system-dependent hacks. I found that our network stack would stop passing broadcast datagrams to the application as soon as it bound the socket to a particular address, but the status of this feature is unclear to me. By the way, it's the reason for a funny problem: Samba's nmbd won't work if started from inetd bound to a single IP. I can remember that, when T/TCP was there, the respective option must have been enabled on a socket for reception and transmission, for security reasons. (IIRC there was even a security incident related to that.) Perhaps SO_BROADCAST should be given similar semantics? It could improve security of many UDP applications. Any ideas? Thanks! -- Yar