Name
${if_addr}
Synopsis
When sendmail first starts up as a listening daemon, it binds to a port on all interfaces or on a particular interface (See this section). It then waits to accept connections from hosts or programs that wish to route mail through it. Those hosts or programs are called “clients,” and when they initiate a connection, it is called a client connection.
When a client connects to the local machine,
sendmail records the local IP address of the
connected-to interface in this ${if_addr}
macro.
If the address is an IPv4 address, the value stored is just the
address:
123.45.67.8
But if the address is an IPv6 address, the address stored is prefixed
with a literal IPv6
:. For example:
IPv6:3ffe:8050:201:1860:42::1
If the connection was made on the loopback
interface, the ${if_addr}
macro is undefined.
${if_addr}
is available for use in rule sets, and
can be useful for rejecting spam or restricting access to a list of
particular addresses. Note that a $&
prefix is
necessary when you reference this macro in rules (that is, use
$&{if_addr}
, not
${if_addr}
).
${if_addr}
is transient. If it is defined in the
configuration file or in the command line, that definition can be
ignored by sendmail.
Get Sendmail, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.