struct in_addr interface_mask;
} *interface_pair;
-static char *netdevfmt;
-
/*
* Count of packets to see on an interface before monitor considers it up.
* Needed because when pppd shuts down the link, the packet counts go up
#define MONITOR_SLOP 5
#ifdef linux
+#define have_interface_init
+
+static char *netdevfmt;
void interface_init(void)
/* figure out which /proc/net/dev format to use */
else
{
char *sp = strchr(ifname, '/');
-
+ /* hide slash and trailing info from ifname */
if (sp)
*sp = '\0';
result = _get_ifinfoGT_(socket_fd, stats_file, ifname, ifinfo);
{
kvm_read(kvmfd, ifnet_addr, &ifnet, sizeof(ifnet));
kvm_read(kvmfd, (unsigned long) ifnet.if_name, tname, sizeof tname);
- snprintf(tname, sizeof tname, "%s%d", tname, ifnet.if_unit);
+ snprintf(tname + strlen(tname), sizeof(tname) - strlen(tname), "%d", ifnet.if_unit);
if (!strcmp(tname, iname))
{
GT_("get_ifinfo: sysctl (iflist estimate) failed"));
exit(1);
}
- if ((buf = malloc(needed)) == NULL)
+ if ((buf = (char *)malloc(needed)) == NULL)
{
report(stderr,
GT_("get_ifinfo: malloc failed"));
#endif /* __FREEBSD_USE_SYSCTL_GET_IFFINFO */
-#else
-
-void interface_init(void) {};
-
#endif
-
#ifndef HAVE_INET_ATON
/*
* Note: This is not a true replacement for inet_aton(), as it won't
return(TRUE);
}
#endif /* CAN_MONITOR */
+
+#ifndef have_interface_init
+void interface_init(void) {}
+#endif