diff options
author | andre <andre@FreeBSD.org> | 2007-05-18 19:58:37 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2007-05-18 19:58:37 +0000 |
commit | 696f13b7fdbc64ff2137b4759d3fcc0bae6121b3 (patch) | |
tree | d51b510129fddae06935d023c8528c4a3a87232d /contrib/gcc/cppmacro.c | |
parent | b753e575a766d7e9e6f70bacf49e41516a9e5556 (diff) | |
download | FreeBSD-src-696f13b7fdbc64ff2137b4759d3fcc0bae6121b3.zip FreeBSD-src-696f13b7fdbc64ff2137b4759d3fcc0bae6121b3.tar.gz |
Add tcp_log_addrs() function to generate and standardized TCP log line
for use thoughout the tcp subsystem.
It is IPv4 and IPv6 aware creates a line in the following format:
"TCP: [1.2.3.4]:50332 to [1.2.3.4]:80 tcpflags <RST>"
A "\n" is not included at the end. The caller is supposed to add
further information after the standard tcp log header.
The function returns a NUL terminated string which the caller has
to free(s, M_TCPLOG) after use. All memory allocation is done
with M_NOWAIT and the return value may be NULL in memory shortage
situations.
Either struct in_conninfo || (struct tcphdr && (struct ip || struct
ip6_hdr) have to be supplied.
Due to ip[6].h header inclusion limitations and ordering issues the
struct ip and struct ip6_hdr parameters have to be casted and passed
as void * pointers.
tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
void *ip6hdr)
Usage example:
struct ip *ip;
char *tcplog;
if (tcplog = tcp_log_addrs(NULL, th, (void *)ip, NULL)) {
log(LOG_DEBUG, "%s; %s: Connection attempt to closed port\n",
tcplog, __func__);
free(s, M_TCPLOG);
}
Diffstat (limited to 'contrib/gcc/cppmacro.c')
0 files changed, 0 insertions, 0 deletions