From owner-p4-projects@FreeBSD.ORG Mon Jan 7 14:19:00 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 74E4F16A46C; Mon, 7 Jan 2008 14:19:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A60816A468 for ; Mon, 7 Jan 2008 14:19:00 +0000 (UTC) (envelope-from adrian@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C678413C45D for ; Mon, 7 Jan 2008 14:18:58 +0000 (UTC) (envelope-from adrian@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m07EIwJm036149 for ; Mon, 7 Jan 2008 14:18:58 GMT (envelope-from adrian@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m07EIwNn036146 for perforce@freebsd.org; Mon, 7 Jan 2008 14:18:58 GMT (envelope-from adrian@freebsd.org) Date: Mon, 7 Jan 2008 14:18:58 GMT Message-Id: <200801071418.m07EIwNn036146@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to adrian@freebsd.org using -f From: Adrian Chadd To: Perforce Change Reviews Cc: Subject: PERFORCE change 132710 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 14:19:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=132710 Change 132710 by adrian@wendy on 2008/01/07 14:18:50 Bring over more of Julians' initial work. Affected files ... .. //depot/projects/adrian_spoof_clientip/src/share/man/man4/ip.4#2 edit Differences ... ==== //depot/projects/adrian_spoof_clientip/src/share/man/man4/ip.4#2 (text+ko) ==== @@ -292,6 +292,29 @@ cmsg_type = IP_RECVIF .Ed .Pp +If the +.Dv IP_NONLOCALOK +options is set then the checking of local bind addresses against addresses +assigned to local interfaces is disabled. +The kernel must have been compiled with the +.Dv IP_NONLOCALBIND option, and the sysctl +.Va net.inet.ip.nonlocalok +should be set to 1. +The option needs to be set on the socket before the +.Xr bind 2 +system call is used on it. +.Bd -literal +u_char spoofing = 1; /* 0 = disable (default), 1 = enable */ + +setsockopt(s, IPPROTO_IP, IP_NONLOCALOK, &spoofing, sizeof(spoofing)); +ret = bind (...); +.Ed +.Pp +This behaviour is not for general use and is +included for use in servers that are implementing fully +transparent proxies. Use of this option on general purpose +systems is strongly discouraged. +.Pp .Dv IP_PORTRANGE may be used to set the port range used for selecting a local port number on a socket with an unspecified (zero) port number.