Re: PATCH: shared library support
Frédéric Raynal <[email protected]> Mon, 10 Jan 2005 09:08:41 +0100
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
Hello
wouldn't be possible to pas an argument to the ./configure to select
between static or dynamic building (or even both) ?
On Sun, Jan 09, 2005 at 02:11:43AM -0500, James Ralston wrote:
> qAttached is a patch for libnet 1.1.2.1 that adds support (via libtool)
> for building libnet as a shared library.
>
> - AC_DEFINE(HAVE_DLPI)
> + AC_DEFINE(HAVE_DLPI, 1, [I don't know what this does.])
DLPI = Data Link Provider Interface
It is a device used ton inject packets at link layer under HPUX for
instance.
> + AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [I don't know what this does.])
On some systems struct sockaddr does not have a sa_len field.
BTW, if someone has a pointer to an explanation on why it is prensent
on some system, and not on others, I'd like to have it.
> *solaris*)
> - AC_DEFINE(HAVE_SOLARIS)
> + AC_DEFINE(HAVE_SOLARIS, 1, [I don't know what this does.])
It is defined for some particular Solaris stuff:
- getipnodebynap() instead of gethostbyname2()
- getipnodebyaddr() instead of gethostbyaddr()
- some device specific binding (in DLPI)
> - AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir")
> + AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir", [I don't know what this does.])
AFAIK DLPI is reachable through a device, usually placed in /dev, but
it can be placed somewhere else. This is to define to path to the dlpi
device.
> case "`uname -r`" in
> 5.4)
> - AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
> + AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, [I don't know what this does.])
> ;;
> 5.5*)
> - AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
> + AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, [I don't know what this does.])
> ;;
> 5.8)
> - AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
> - AC_DEFINE(HAVE_SOLARIS_IPV6)
> + AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, [I don't know what this does.])
> + AC_DEFINE(HAVE_SOLARIS_IPV6, 1, [I don't know what this does.])
> ;;
> 5.9)
> - AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
> - AC_DEFINE(HAVE_SOLARIS_IPV6)
> + AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, [I don't know what this does.])
> + AC_DEFINE(HAVE_SOLARIS_IPV6, 1, [I don't know what this does.])
> ;;
>
> esac
STUPID_SOLARIS_CHECKSUM_BUG: on some old Solaris, TCP checksum are
poorly computed (see libnet_checksum.c):
#if (STUPID_SOLARIS_CHECKSUM_BUG)
tcph_p->th_sum = tcph_p->th_off << 2;
return (1);
#endif /* STUPID_SOLARIS_CHECKSUM_BUG */
There is something similar for HPUX11 too just below.
HAVE_SOLARIS_IPV6: IPv6 is not available on older Solaris, like 5.5 or
previous. This ensures that the solaris we are on do have IPv6.
> *hpux11*)
> - AC_DEFINE(HAVE_HPUX11)
> + AC_DEFINE(HAVE_HPUX11, 1, [I don't know what this does.])
Also a "stupid bug" (quoting Mike ;), see in libnet_checksum.c
#if (HAVE_HPUX11)
if (l->injection_type != LIBNET_LINK)
{
/*
* Similiar to the Solaris Checksum bug - but need to
* add
* the size of the TCP payload (only for raw
* sockets).
*/
tcph_p->th_sum = (tcph_p->th_off << 2) +
(len - (tcph_p->th_off << 2));
return (1);
}
#endif
Reading the code from libne_link_dlpi, it also seems HPUX made many
changes in its network link layer handling when reaching the version
11. Thus, these changes are used. For instance, writing use a specific
structure called dl_hp_rawdata_req_t.
> + AC_DEFINE(NO_SNPRINTF, 1, [I don't know what this does.])
Not all system do define snprintf(). For those who dont, snprintf is
porrly replaced with sprintf() and the length field is ignored.
I hope this helps,
Fred Raynal