From owner-freebsd-bugs Mon Jan 4 05:30:11 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA13421 for freebsd-bugs-outgoing; Mon, 4 Jan 1999 05:30:11 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA13404 for ; Mon, 4 Jan 1999 05:30:08 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id FAA29486; Mon, 4 Jan 1999 05:30:01 -0800 (PST) Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [194.93.177.113]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA12676 for ; Mon, 4 Jan 1999 05:21:13 -0800 (PST) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.8.8/8.8.8) id PAA05806; Mon, 4 Jan 1999 15:20:13 +0200 (EET) (envelope-from ru) Message-Id: <199901041320.PAA05806@relay.ucb.crimea.ua> Date: Mon, 4 Jan 1999 15:20:13 +0200 (EET) From: Ruslan Ermilov Reply-To: ru@ucb.crimea.ua To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/9309: [PATCH] ip_divert.c bug Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 9309 >Category: kern >Synopsis: [PATCH] ip_divert.c bug >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Jan 4 05:30:01 PST 1999 >Closed-Date: >Last-Modified: >Originator: Ruslan Ermilov >Release: FreeBSD 2.2.8-STABLE i386 >Organization: United Commercial Bank >Environment: Kernel built with divert(4) support. >Description: Attempt to write the packet as incoming to the divert socket, with sin_port set to the rule number and interface supplied in sin_addr, rather than in sin_zero[], causes EADDRNOTAVAIL error. The problem first appeared in revision 1.1.2.12, when the following line of code was deleted (by Julian Elischer): sin->sin_port = 0; The removal of this line causes ifa_ifwithaddr() to fail when sin_port is set to any non-zero value. >How-To-Repeat: I have a small program, which can be used to implement IP over UDP tunneling (http://www.ucb.crimea.ua/~ru/FreeBSD/). It worked fine until 2.2.7. It uses old logic, i.e. sin_port is used to avoid firewall checker loops. Now it fails with ``Can't assing requested address'' when trying to write an incoming packet to the divert socket. Thanks to: kseel , who pointed out the problem. >Fix: Try the following patch (both RELENG_2_2 and HEAD): Index: ip_divert.c =================================================================== RCS file: /usr/FreeBSD-CVS/src/sys/netinet/ip_divert.c,v retrieving revision 1.1.2.12 diff -u -r1.1.2.12 ip_divert.c --- ip_divert.c 1998/07/06 08:48:38 1.1.2.12 +++ ip_divert.c 1999/01/04 12:48:00 @@ -317,6 +317,7 @@ struct ifaddr *ifa; /* If no luck with the name above, check by IP address. */ + sin->sin_port = 0; if (m->m_pkthdr.rcvif == NULL) { if (!(ifa = ifa_ifwithaddr((struct sockaddr *) sin))) { error = EADDRNOTAVAIL; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message