aboutsummaryrefslogtreecommitdiff
path: root/net/libpcap
diff options
context:
space:
mode:
authorWesley Shields <wxs@FreeBSD.org>2010-09-26 14:48:46 +0000
committerWesley Shields <wxs@FreeBSD.org>2010-09-26 14:48:46 +0000
commitc6ca1864f97cd818efdd4ddb39a3187d64ae29ef (patch)
treea6db40d3bb98bf6642dc38a47b718a68f08273dd /net/libpcap
parente135c45b8970c478c9ab06a95f69c95f7435e812 (diff)
downloadports-c6ca1864f97cd818efdd4ddb39a3187d64ae29ef.tar.gz
ports-c6ca1864f97cd818efdd4ddb39a3187d64ae29ef.zip
Notes
Diffstat (limited to 'net/libpcap')
-rw-r--r--net/libpcap/files/patch-inet.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/net/libpcap/files/patch-inet.c b/net/libpcap/files/patch-inet.c
new file mode 100644
index 000000000000..a3d93d22922b
--- /dev/null
+++ b/net/libpcap/files/patch-inet.c
@@ -0,0 +1,50 @@
+--- inet.c.orig 2010-03-11 20:56:54.000000000 -0500
++++ inet.c 2010-09-26 10:06:27.397182116 -0400
+@@ -431,26 +431,36 @@
+ strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name);
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s >= 0) {
++#ifdef __FreeBSD__
++ /*
++ * On FreeBSD, if the buffer isn't big enough for the
++ * description, the ioctl succeeds, but the description
++ * isn't copied, ifr_buffer.length is set to the description
++ * length, and ifr_buffer.buffer is set to NULL.
++ */
+ for (;;) {
+ free(description);
+ if ((description = malloc(descrlen)) != NULL) {
+-#ifdef __FreeBSD__
+ ifrdesc.ifr_buffer.buffer = description;
+ ifrdesc.ifr_buffer.length = descrlen;
+-#else /* __FreeBSD__ */
+- ifrdesc.ifr_data = (caddr_t)description;
+-#endif /* __FreeBSD__ */
+- if (ioctl(s, SIOCGIFDESCR, &ifrdesc) == 0)
+- break;
+-#ifdef __FreeBSD__
+- else if (errno == ENAMETOOLONG)
+- descrlen = ifrdesc.ifr_buffer.length;
+-#endif /* __FreeBSD__ */
+- else
++ if (ioctl(s, SIOCGIFDESCR, &ifrdesc) == 0) {
++ if (ifrdesc.ifr_buffer.buffer ==
++ description)
++ break;
++ else
++ descrlen = ifrdesc.ifr_buffer.length;
++ } else {
++ /*
++ * Failed to get interface description.
++ */
++ free(description);
++ description = NULL;
+ break;
++ }
+ } else
+ break;
+ }
++#endif /* __FreeBSD__ */
+ close(s);
+ if (description != NULL && strlen(description) == 0) {
+ free(description);