From owner-freebsd-net@freebsd.org Wed Mar 21 01:03:08 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6994F5C29C for ; Wed, 21 Mar 2018 01:03:08 +0000 (UTC) (envelope-from michael.tuexen@lurchi.franken.de) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F094736D1 for ; Wed, 21 Mar 2018 01:03:08 +0000 (UTC) (envelope-from michael.tuexen@lurchi.franken.de) Received: from dhcp-9621.meeting.ietf.org (dhcp-9621.meeting.ietf.org [31.133.150.33]) (Authenticated sender: lurchi) by mail-n.franken.de (Postfix) with ESMTPSA id 913EB721E281A; Wed, 21 Mar 2018 02:03:04 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: Raw Sockets: Two Questions From: Michael Tuexen In-Reply-To: <5AB1A9C5.9050707@grosbein.net> Date: Wed, 21 Mar 2018 01:03:02 +0000 Cc: "Ronald F. Guilmette" , freebsd-net@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <98551.1521576540@segfault.tristatelogic.com> <5AB1A9C5.9050707@grosbein.net> To: Eugene Grosbein X-Mailer: Apple Mail (2.3445.5.20) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 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, 21 Mar 2018 01:03:09 -0000 > On 21. Mar 2018, at 00:39, Eugene Grosbein wrote: >=20 > 21.03.2018 3:09, Ronald F. Guilmette wrote: >=20 >> I'm going to be doing some stuff with raw sockets pretty soon, and >> while scrounging around, looking for some nice coding examples, I >> found the following very curious comment on one particular message >> board: >>=20 >> = https://stackoverflow.com/questions/7048448/raw-sockets-on-bsd-operating-s= ystems >>=20 >> "Using raw sockets isn't hard but it's not entirely portable. = For >> instance, both in BSD and in Linux you can send whatever you = want, >> but in BSD you can't receive anything that has a handler (like = TCP >> and UDP)." >>=20 >> So, first question: Is the above comment actually true & accurate? >=20 > Not for FreeBSD. Are you saying that I can receive on a raw socket SCTP, TCP and UDP = packets? Best regards Michael >=20 >> Second question: If the above assertion is actually true, then how = can >> nmap manage to work so well on FreeBSD, despite what would appear to = be >> this insurmountable stumbling block (of not being able to receive = replies)? >=20 > nmap uses libdnet that provides some portability layer, including RAW = socket operations. > It uses bundled stripped-down version but we have "normal" one as = net/libdnet port/package. > You should consider using it too as convenience layer. >=20 >=20 >=20 > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"