aboutsummaryrefslogtreecommitdiffstats
path: root/interface.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-05-23 17:50:59 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-05-23 17:50:59 +0000
commit5d909520548ad3b175fa568554affcca96f294e1 (patch)
tree34059f49b19f47cbf2c0292a71d84f4284d17947 /interface.c
parentaf265f5294d56551304c0278712417b18a31d856 (diff)
downloadfetchmail-5d909520548ad3b175fa568554affcca96f294e1.tar.gz
fetchmail-5d909520548ad3b175fa568554affcca96f294e1.tar.bz2
fetchmail-5d909520548ad3b175fa568554affcca96f294e1.zip
Preserve interface string through parsing.
svn path=/trunk/; revision=1808
Diffstat (limited to 'interface.c')
-rw-r--r--interface.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/interface.c b/interface.c
index 62f14bfb..52939994 100644
--- a/interface.c
+++ b/interface.c
@@ -114,7 +114,15 @@ static int get_ifinfo(const char *ifname, ifinfo_t *ifinfo)
if (socket_fd < 0 || !stats_file)
result = FALSE;
else
- result = _get_ifinfo_(socket_fd, stats_file, ifname, ifinfo);
+ {
+ char *sp = strchr(ifname, '/');
+
+ if (sp)
+ *sp = '\0';
+ result = _get_ifinfo_(socket_fd, stats_file, ifname, ifinfo);
+ if (sp)
+ *sp = '/';
+ }
if (socket_fd >= 0)
close(socket_fd);
if (stats_file)
@@ -155,11 +163,12 @@ void interface_parse(char *buf, struct hostdata *hp)
{
char *cp1, *cp2;
+ hp->interface = xstrdup(buf);
+
/* find and isolate just the IP address */
if (!(cp1 = strchr(buf, '/')))
(void) error(PS_SYNTAX, 0, "missing IP interface address");
*cp1++ = '\000';
- hp->interface = xstrdup(buf);
/* find and isolate just the netmask */
if (!(cp2 = strchr(cp1, '/')))
@@ -176,6 +185,9 @@ void interface_parse(char *buf, struct hostdata *hp)
/* apply the mask now to the IP address (range) required */
hp->interface_pair->interface_address.s_addr &=
hp->interface_pair->interface_mask.s_addr;
+
+ /* restore original interface string (for configuration dumper) */
+ *--cp1 = '/';
return;
}