On 15/09/2021 02.22, miim wrote:
Sorin, thank you. I now have a small chunk of code that appears to do the job.
I do not have access to an IPv6 system to test with but it does identify the
connection type correctly on my IPv4 system.
I am not sure what APR_UNIX is, but it is referenced in the Apache source.
APR_UNIX denotes the family of Unix sockets. They appear in the file
system. They are not network sockets, i.e. a remote machine cannot
connect to a Unix socket. They are used like network sockets for
communication between processes on the same machine. man 7 unix.
I don't think that apache listens on Unix sockets, but I suppose it
could. Examples of applications that listen on Unix sockets are the
docker daemon and the X server.
/* ======================================================== */
/* Testing code prefatory to including IPv6 support */
/* BEGINS */
/* ======================================================== */
switch(r->useragent_addr->family) {
case APR_INET6:
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
" Family %d - IPv6", r->useragent_addr->family);
break;
case APR_INET:
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
" Family %d - IPv4", r->useragent_addr->family);
break;
case APR_UNIX:
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
" Family %d - Unix", r->useragent_addr->family);
break;
default:
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
" Family %d - Unknown", r->useragent_addr->family);
break;
}
/* ======================================================== */
/* Testing code prefatory to including IPv6 support */
/* ENDS */
/* ======================================================== */