From owner-freebsd-net@freebsd.org Sun Apr 10 17:56:47 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 7E5DAB0BEB4 for ; Sun, 10 Apr 2016 17:56:47 +0000 (UTC) (envelope-from kristof@sigsegv.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464B61195 for ; Sun, 10 Apr 2016 17:56:46 +0000 (UTC) (envelope-from kristof@sigsegv.be) Received: from [IPv6:2a02:1811:2419:4e02:b962:9614:3775:ea1] (unknown [IPv6:2a02:1811:2419:4e02:b962:9614:3775:ea1]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id A8FA2733C; Sun, 10 Apr 2016 19:56:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigsegv.be; s=mail; t=1460311003; bh=lo5Fee1qBRyOmMjlOQA2i2iDyAG0UjRhyUUg/dvMuas=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=R/AxqB+NuurnZuw4XJFRQQ19qYsDE6aiUqximr7hl/GYwp71rIi57kt4jkRMhzy6H HXe62xSwaPYFDAm6jZdHUML61ZFCjP3PGYskPMvM0iP4KeOjUiDss9j2Gb7H/tpV3W stPTPLAqnNPJSCYlLESqlm5HCX6a0T7sVTplnihA= Subject: Re: Create socket to send and receive arp packets - Freebsd Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=utf-8 From: Kristof Provost X-Checked-By-Nsa: Probably In-Reply-To: Date: Sun, 10 Apr 2016 19:56:45 +0200 Cc: "freebsd-net@freebsd.org" , Meny Yossefi , Yuval Bason Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Wafa Hamzah X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2016 17:56:47 -0000 > On 10 Apr 2016, at 10:00, Wafa Hamzah wrote: >=20 > Hi, >=20 > We are trying to send arp requests from user space using a RAW socket. > Our Linux reference suggest the following flags when creating the = socket: s =3D socket (PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP))). > For FreeBSD support, we replaced PF_PACKET with PF_ARP , SOCK_PACKET = with SOCK_RAW and htons(ETH_P_ARP) with ETHERTYPE_ARP Which resulted in = a failure to create the socket (the return code was -1). >=20 > Please advise, I=E2=80=99d start by looking at =E2=80=98errno=E2=80=99, because = that=E2=80=99ll tell you a little more. It should give you a better indication of why the call fails. It might also be useful to reduce the code to the bare minimum required to reproduce your problem. Not only will that often help you to find the = problem it also makes it easier to post the code, which is the next step in = helping you. Regards, Kristof=