From owner-freebsd-hackers Tue Dec 18 6:34:47 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp2.port.ru (mx2.port.ru [194.67.57.12]) by hub.freebsd.org (Postfix) with ESMTP id AEF5037B41A for ; Tue, 18 Dec 2001 06:34:39 -0800 (PST) Received: from [62.5.162.135] (helo=ad0503-01) by smtp2.port.ru with esmtp (Exim 3.14 #1) id 16GLKI-0004A7-00 for freebsd-hackers@freebsd.org; Tue, 18 Dec 2001 17:34:38 +0300 Date: Tue, 18 Dec 2001 17:33:34 +0300 From: aka50 X-Mailer: The Bat! (v1.45) Personal Reply-To: aka50 X-Priority: 3 (Normal) Message-ID: <997578317.20011218173334@mail.ru> To: freebsd-hackers@freebsd.org Subject: NATD libalias bug or feature? Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello freebsd-hackers, FreeBSD 4.3 RELEASE. I tried to use natd transparent proxing ability with encode_ip_hdr type. I found strange behaviour in function TcpAliasOut() (/usr/src/lib/libalias/alias.c). When packet modified by ProxyModify() (/usr/src/lib/libalias/alias_proxy.c), code doesn't recompute pointer to TCP header by calling tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); /usr/src/lib/libalias/alias.c line 1024 ---------------begins here------------------------------------ /* Save original destination address, if this is a proxy packet. Also modify packet to include destination encoding. */ if (proxy_type != 0) { SetProxyPort(link, dest_port); SetProxyAddress(link, dest_address); ProxyModify(link, pip, maxpacketsize, proxy_type); } /* Get alias address and port */ alias_port = GetAliasPort(link); alias_address = GetAliasAddress(link); -----------------ends here------------------------------------- should be ---------------begins here------------------------------------ /* Save original destination address, if this is a proxy packet. Also modify packet to include destination encoding. */ if (proxy_type != 0) { SetProxyPort(link, dest_port); SetProxyAddress(link, dest_address); ProxyModify(link, pip, maxpacketsize, proxy_type); /* Modify pointer to TCP Header, because it can be shifted by ProxyModify() */ tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); } /* Get alias address and port */ alias_port = GetAliasPort(link); alias_address = GetAliasAddress(link); -----------------ends here------------------------------------- Is it a bug or feature? :) -- Best regards, Stepachev Andrey mailto:aka50@mail.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message