- add a dist site that has queso

- make queso use the systems libpcap
- make queso work with datalink types of DLT_LOOP and DLT_ENC
This commit is contained in:
brad 1999-07-27 04:30:06 +00:00
parent 1836c45648
commit e0c07d9486
3 changed files with 22 additions and 93 deletions

View File

@ -1,18 +1,12 @@
# $OpenBSD: Makefile,v 1.2 1999/05/07 21:00:19 brad Exp $
# $OpenBSD: Makefile,v 1.3 1999/07/27 04:30:06 brad Exp $
DISTNAME= queso-980922
CATEGORIES= net
MASTER_SITES= ftp://apostols.org/AposTools/snapshots/ \
ftp://ftp.ee.lbl.gov/ \
ftp://freebsd.ntu.edu.tw/freebsd/_distfiles/
DISTFILES= ${DISTNAME}.tar.gz libpcap-0.4.tar.Z
MASTER_SITES= ftp://ftp.cdrom.com/pub/FreeBSD/distfiles/
MAINTAINER= brad@openbsd.org
USE_AUTOCONF= yes
post-patch:
@cd ${WRKSRC}/../libpcap-0.4/; ./configure; make
GNU_CONFIGURE= yes
post-install:
@${MKDIR} ${PREFIX}/share/doc/queso

View File

@ -1,6 +1,3 @@
MD5 (libpcap-0.4.tar.Z) = 3e0025a24218d327b152075c70a578e9
MD5 (queso-980922.tar.gz) = bb679333867765de866d89d3fcba8a20
RMD160 (libpcap-0.4.tar.Z) = 1ef50ac2f839c8edf3fbd74350b09c33c525a8b7
RMD160 (queso-980922.tar.gz) = 797bb0e8f30ec2eceaf55d038d4eceb4d576198e
SHA1 (libpcap-0.4.tar.Z) = d3410f81c1037baed9701daad77778aa94d4ce8a
SHA1 (queso-980922.tar.gz) = 2c4296bd18e84ec241cfa34cc3876919e7f26fc7

View File

@ -1,81 +1,19 @@
--- tcpip.c.orig Tue Sep 22 13:35:43 1998
+++ tcpip.c Sat Oct 24 11:46:58 1998
@@ -25,6 +25,12 @@
#include <stdarg.h>
#include <net/if.h>
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+#include <err.h>
+#include <errno.h>
+#include <sysexits.h>
+#endif
+
#include "tcpip.h"
/*-- LINUX routilng TABLES */
@@ -333,7 +339,64 @@
}
}
-#else /* !LINUX ---------------------------------------------- OTHER --*/
+/*------------------------------- FreeBSD / OpenBSD / NetBSD / BSDI --*/
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+/*
+ FreeBSD Ref: /usr/share/examples/find_interface/
+*/
+ struct sockaddr_in local, remote;
+ int s, rv, namelen;
+
+ remote.sin_addr.s_addr = dest;
+ remote.sin_port = htons(60000);
+ remote.sin_family = AF_INET;
+ remote.sin_len = sizeof remote;
+
+ local.sin_addr.s_addr = htonl(INADDR_ANY);
+ local.sin_port = htons(60000);
+ local.sin_family = AF_INET;
+ local.sin_len = sizeof local;
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ err(EX_OSERR, "socket");
+
+ do
+ {
+ rv = bind(s, (struct sockaddr *)&local, sizeof local);
+ local.sin_port = htons(ntohs(local.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0)
+ err(EX_OSERR, "bind");
+
+ do
+ {
+ rv = connect(s, (struct sockaddr *)&remote, sizeof remote);
+ remote.sin_port = htons(ntohs(remote.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0)
+ err(EX_OSERR, "bind");
+
+ do
+ {
+ rv = connect(s, (struct sockaddr *)&remote, sizeof remote);
+ remote.sin_port = htons(ntohs(remote.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0)
+ err(EX_OSERR, "connect");
+
+ namelen = sizeof local;
+ rv = getsockname(s, (struct sockaddr *)&local, &namelen);
+
+ if (rv < 0)
+ err(EX_OSERR, "getsockname");
+
+ return local.sin_addr;
+
+#else /* !LINUX && !BSD ---------------------------------- OTHER --*/
struct sockaddr_in sin;
char myname[80];
--- tcpip.c.orig Mon Jul 26 23:34:24 1999
+++ tcpip.c Mon Jul 26 23:39:18 1999
@@ -271,6 +271,7 @@
switch(datalink) {
case DLT_EN10MB:
offset = 14; break;
+ case DLT_LOOP:
case DLT_NULL:
case DLT_PPP:
offset = 4; break;
@@ -285,6 +286,8 @@
offset = 8; break;
case DLT_IEEE802:
offset = 22; break;
+ case DLT_ENC:
+ offset = 12; break;
default:
fprintf(stderr, "unknown datalink type (%d)", datalink);
return(0);