From owner-freebsd-doc Wed Mar 22 9:40: 5 2000 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id AC9BC37BFC3 for ; Wed, 22 Mar 2000 09:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id JAA45407; Wed, 22 Mar 2000 09:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from ada.eu.org (marvin.enst.fr [137.194.161.2]) by hub.freebsd.org (Postfix) with ESMTP id 80F5B37B99A for ; Wed, 22 Mar 2000 09:35:38 -0800 (PST) (envelope-from sam@infres.enst.fr) Received: from antinea.enst.fr (antinea.enst.fr [137.194.160.145]) by ada.eu.org (Postfix) with ESMTP id AC0C71907E for ; Wed, 22 Mar 2000 18:35:33 +0100 (CET) Received: by antinea.enst.fr (Postfix, from userid 1000) id 6FE491E3; Wed, 22 Mar 2000 18:13:51 +0100 (CET) Message-Id: <20000322171351.6FE491E3@antinea.enst.fr> Date: Wed, 22 Mar 2000 18:13:51 +0100 (CET) From: sam@enst.fr Reply-To: sam@enst.fr To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: docs/17552: Documentation error in divert(4) Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 17552 >Category: docs >Synopsis: Documentation error in divert(4) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Wed Mar 22 09:40:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Samuel Tardieu >Release: FreeBSD 5.0-CURRENT i386 >Organization: TELECOM Paris >Environment: >Description: When developing an toy application using divert(4), I was surprised to see that it was working only if the PF_INET/SOCK_RAW/IPPROTO_DIVERT socket, at bind() time, has a *valid* interface address (such as INADDR_ANY). divert(4) manpage says: The IP ad- dress in the bind is ignored; only the port number is significant. A di- vert socket bound to a divert port will receive all packets diverted to that port by some (here unspecified) kernel mechanism(s). This is false, as the bind() operation for a divert socket will call in_pcbbind() which makes use of the interface address. >How-To-Repeat: Build a PF_INET/SOCK_RAW/IPPROTO_DIVERT socket, bind it with a sockaddr_in structure which has an invalid sin_addr field. Diverted packets will not be available on the socket and will be silently dropped by the kernel as if no diverted socket was listening. >Fix: Two possible immediate fixes: (1) Doc fix: change divert(4) manpage (2) Code fix: when entering div_bind, change the nam->sin_addr field if nam->sin_family is AF_INET so that it contains INADDR_ANY. It may break things that would depend on the fact that a diverted socket can be bound to a particular interface though (natd does use INADDR_ANY explicitely). >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message