tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pflogd lwp
The attached patch prevents a coredump from pflogd. I went the #ifdef
route in case this wants to go upstream?
Cheers,
Patrick
? usr.sbin/pf/pflogd/pflogd.core
Index: dist/pf/sbin/pflogd/pflogd.c
===================================================================
RCS file: /cvsroot/src/dist/pf/sbin/pflogd/pflogd.c,v
retrieving revision 1.5
diff -u -r1.5 pflogd.c
--- dist/pf/sbin/pflogd/pflogd.c 18 Jun 2008 09:06:26 -0000 1.5
+++ dist/pf/sbin/pflogd/pflogd.c 15 Jul 2009 14:46:19 -0000
@@ -200,6 +200,29 @@
}
}
+#ifdef HAVE_STRUCT_IFDATAREQ
+int
+if_exists(char *ifname)
+{
+ int s;
+ struct ifdatareq ifdr;
+
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+ err(1, "socket");
+ bzero(&ifdr, sizeof(ifdr));
+ if (strlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name)) >=
+ sizeof(ifdr.ifdr_name))
+ errx(1, "main ifdr_name: strlcpy");
+ if (ioctl(s, SIOCGIFDATA, &ifdr) == -1)
+ return (0);
+ if (close(s))
+ err(1, "close");
+
+ return (1);
+}
+
+#else
+
int
if_exists(char *ifname)
{
@@ -221,6 +244,7 @@
return (1);
}
+#endif /* HAVE_STRUCT_IFDATAREQ */
int
init_pcap(void)
Index: usr.sbin/pf/pflogd/Makefile
===================================================================
RCS file: /cvsroot/src/usr.sbin/pf/pflogd/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- usr.sbin/pf/pflogd/Makefile 9 Nov 2006 20:33:25 -0000 1.4
+++ usr.sbin/pf/pflogd/Makefile 15 Jul 2009 14:46:19 -0000
@@ -4,6 +4,7 @@
.include <bsd.own.mk> # for MKDYNAMICROOT definition
CPPFLAGS+=-I${NETBSDSRCDIR}/dist/pf/sbin/pflogd -I${NETBSDSRCDIR}/dist/libpcap
+CPPFLAGS+=-DHAVE_STRUCT_IFDATAREQ
LDADD+= -lpcap -lutil
DPAPP+= ${LIBPCAP} ${LIBUTIL}
Home |
Main Index |
Thread Index |
Old Index