From owner-freebsd-net@freebsd.org Thu Aug 18 21:43:11 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC16DBBFC9D for ; Thu, 18 Aug 2016 21:43:11 +0000 (UTC) (envelope-from paul@prt.org) Received: from smtp3.mail.clearhost.co.uk (smtp3.mail.clearhost.co.uk [IPv6:2001:1420::25:103]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.mail.clearhost.co.uk", Issuer "RapidSSL CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BB8891911 for ; Thu, 18 Aug 2016 21:43:11 +0000 (UTC) (envelope-from paul@prt.org) Received: from [2001:1420:a:105:c62c:3ff:fe2f:bf] (port=50867 helo=parsnip.heronsbrook.org.uk) by smtp3.mail.clearhost.co.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.76 (FreeBSD)) (envelope-from ) id 1baV5g-000MGl-Vd for freebsd-net@freebsd.org; Thu, 18 Aug 2016 21:43:09 +0000 Subject: Re: How can I send packets to 255.255.255.255 from the command line? To: freebsd-net@freebsd.org References: <20160818204822.GB18759@workvm.myhome> From: Paul Thornton Message-ID: <6bc1bbb9-c530-92bc-8e26-6d4ca7e4ecb9@prt.org> Date: Thu, 18 Aug 2016 22:43:36 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 21:43:12 -0000 On 18/08/2016 21:55, Ryan Stone wrote: > On Thu, Aug 18, 2016 at 4:48 PM, Paul A. Procacci > wrote: > >> You should be able to ping the local subnet. >> Alternatively you can use net/arping. >> >> ~Paul >> > > I'm specifically looking to test the handling of 255.255.255.255, so a > local broadcast address is out. Unfortunately, arping doesn't seem to do > the right thing on FreeBSD. It manages to get the kernel to try arp'ing > for 255.255.255.255. This very likely comes under the heading of "horrible bodges" but when I needed to do this, after much experimenting I added a static route to 255.255.255.0/24 pointing to the local LAN broadcast address. For example, on a machine with address 192.168.10.10/24 the "fix" would be: route add 255.255.255.0/24 192.168.10.255 My code could then happily send UDP to 255.255.255.255 without issue, and the packets make it out onto the wire with a broadcast destination MAC address. This was under 10.1-RELEASE; things may have changed that make it no longer work. I did warn you that it came under the heading of "horrible bodges" :) Paul.