
\begin{DoxyItemize}
\item infos = Information about network plugin is in keys below
\item infos/author = Markus Raab \href{mailto:elektra@libelektra.org}{\tt elektra@libelektra.\+org}
\item infos/licence = B\+S\+D
\item infos/provides = check
\item infos/needs =
\item infos/placements = presetstorage
\item infos/status = maintained libc
\item infos/metadata = check/ipaddr
\item infos/description = Checks keys if they contain a valid ip address
\end{DoxyItemize}

This plugin is a check plugin that checks if a key contains a valid ip address. It uses the {\ttfamily P\+O\+S\+I\+X.\+1-\/2001} interface {\ttfamily getaddrinfo()} in order to check if an ip address is valid.

\subsection*{Purpose}

While, in theory, a regular expression can express if a string is a network address, in practice, such an attempt does not work well. The reason is that an unmanageable number of valid shortenings for I\+Pv6 addresses makes the regular expression hard to write and understand.

So the idea of building such a complicated regular expression was discarded, but instead a dedicated checker was introduced. The idea is to use the operating system facilities to resolve the network address. If this succeeds, it is guaranteed that this network address will be valid when it is resolved by the same interface afterwards.

Many network address translators coexist. In {\ttfamily P\+O\+S\+I\+X.\+1-\/2001} a powerful address translator is provided with the interface {\ttfamily getaddrinfo()}. It is a common network address translation for both I\+Pv4 and I\+Pv6. We used it to implement this plugin.

\subsection*{Usage}

Every key tagged with the metakey {\ttfamily check/ipaddr} will be checked using {\ttfamily getaddrinfo()}. If additionally the values {\ttfamily ipv4} or {\ttfamily ipv6} are supplied, the address family will be specified. 