Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 17:33:34 +0300
From:      aka50 <aka50@mail.ru>
To:        freebsd-hackers@freebsd.org
Subject:   NATD libalias bug or feature?
Message-ID:  <997578317.20011218173334@mail.ru>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?997578317.20011218173334>