- add patches which fix compilation of queso on Alpha

- add queso man page

from Debian via rohee@
This commit is contained in:
brad 1999-12-01 03:04:03 +00:00
parent bce974f906
commit 71e64a8297
6 changed files with 399 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.3 1999/07/27 04:30:06 brad Exp $
# $OpenBSD: Makefile,v 1.4 1999/12/01 03:04:03 brad Exp $
DISTNAME= queso-980922
CATEGORIES= net
@ -6,10 +6,12 @@ MASTER_SITES= ftp://ftp.cdrom.com/pub/FreeBSD/distfiles/
MAINTAINER= brad@openbsd.org
GNU_CONFIGURE= yes
GNU_CONFIGURE= yes
post-install:
@${MKDIR} ${PREFIX}/share/doc/queso
@mkdir -p ${PREFIX}/man/man1
@mkdir -p ${PREFIX}/share/doc/queso
${INSTALL_MAN} ${FILESDIR}/queso.1 ${PREFIX}/man/man1
${INSTALL_DATA} ${WRKSRC}/Documentation.txt ${PREFIX}/share/doc/queso
.include <bsd.port.mk>

45
net/queso/files/queso.1 Normal file
View File

@ -0,0 +1,45 @@
.\" $OpenBSD: queso.1,v 1.1 1999/12/01 03:04:04 brad Exp $
.\" From the Debian Linux queso package
.TH QUESO 1
.SH NAME
queso \- guess the operating system of a remote host
.Sh SYNOPSIS
.B queso
.I "[-v] [-d] [-w] [-f srcIP] [-c file] [-t seconds] host[:port]"
.br
.SH "DESCRIPTION"
This manual page documents briefly the
.BR queso
command.
This manual page was written for the Debian GNU/Linux distribution
because the original program does not have a manual page.
Instead, it has documentation as a text file in /usr/local/share/doc/queso.
.PP
.SH OPTIONS
A summary of options are included below.
.TP
.B \-v
Version
.TP
.B \-d
Debug mode, print received PKTs.
.TP
.B \-w
Update /etc/queso.conf when new OS is found.
.TP
.B \-f
srcIP Select correct In/Out IP.
.TP
.B \-c file
Alternate config file.
.TP
.B \-t seconds
Set reception timeout. (default=3)
.TP
.B \-n times
How many times PKTs are sent. (default=1)
.SH "SEE ALSO"
Full documentation in /usr/local/share/doc/queso.
.SH AUTHOR
This manual page was written by Stephane Bortzmeyer <bortzmeyer@debian.org>,
for the Debian GNU/Linux system (but may be used by others).

View File

@ -1,5 +1,81 @@
--- tcpip.c.orig Mon Jul 26 23:34:24 1999
+++ tcpip.c Mon Jul 26 23:39:18 1999
Patch helping 64 bit cleanness taken from the Debian Linux package made
by Stéphane Bortmeyer <bortzmeyer@debian.org>. 64 bit patch originally
by Bart Warmerdam <bartw@xs4all.nl>.
Integrate previous OpenBSD patch using new libpcap types.
--- tcpip.c.orig Tue Sep 22 22:35:43 1998
+++ tcpip.c Wed Sep 29 14:43:06 1999
@@ -40,7 +40,7 @@
typedef struct
{
struct in_addr addr;
- unsigned long naddr; /* netmask */
+ u_int32_t naddr; /* netmask */
interfacerec *iface;
}
routerec;
@@ -61,11 +61,11 @@
#endif
int sendsock, readsock;
-unsigned short ipident;
+u_int16_t ipident;
/* This function will determine the checksum for a specific packet. Used by */
/* nearly EVERYTHING on the internet */
-unsigned short
+u_int16_t
inet_checksum (void *addr, int len)
{
register int nleft = len;
@@ -106,16 +106,16 @@
struct in_addr dest_address;
unsigned char place_holder;
unsigned char protocol;
- unsigned short length;
+ u_int16_t length;
} psuedohdr;
-unsigned short tcp_checksum(char *packet,
+u_int16_t tcp_checksum(char *packet,
int length,
struct in_addr source_address,
struct in_addr dest_address)
{
char *psuedo_packet;
- unsigned short cksum;
+ u_int16_t cksum;
psuedohdr.protocol = IPPROTO_TCP;
psuedohdr.length = htons(length);
@@ -133,7 +133,7 @@
memcpy((psuedo_packet + sizeof(psuedohdr)),
packet,length);
- cksum = inet_checksum((unsigned short *)psuedo_packet,(length + sizeof(psuedohdr)));
+ cksum = inet_checksum((u_int16_t *)psuedo_packet,(length + sizeof(psuedohdr)));
free(psuedo_packet);
return cksum;
}
@@ -153,7 +153,7 @@
memset (sa, 0, sizeof (struct sockaddr));
sa->sin_family = AF_INET;
sa->sin_addr.s_addr = inet_addr (host);
- if ((long) inet_addr (host) == -1)
+ if ((int32_t) inet_addr (host) == -1)
{
ent = gethostbyname (host);
if (ent != NULL)
@@ -173,7 +173,7 @@
/* Sends a TCP packet */
void
-sendtcp (spoofrec * spoof, unsigned short flags, short rep)
+sendtcp (spoofrec * spoof, u_int16_t flags, short rep)
{
struct tcphdr tcp;
struct ip ip;
@@ -271,6 +271,7 @@
switch(datalink) {
case DLT_EN10MB:
@ -13,7 +89,43 @@
case DLT_IEEE802:
offset = 22; break;
+ case DLT_ENC:
+ offset = 12; break;
+ offset = 12; break;
default:
fprintf(stderr, "unknown datalink type (%d)", datalink);
return(0);
@@ -319,7 +322,7 @@
/*-- Linux: Search out IP in Routing tables --*/
/*-- Other: Return hostname ip ---------------*/
struct in_addr
-getlocalip (unsigned long dest)
+getlocalip (u_int32_t dest)
{
static struct in_addr ina;
#ifdef LINUX /*---------------------------------------------- LINUX --*/
@@ -327,7 +330,7 @@
for (i = 0; i < numroutes; i++)
{
- if ((dest & routes[i].naddr) == (unsigned long) routes[i].addr.s_addr)
+ if ((dest & routes[i].naddr) == (u_int32_t) routes[i].addr.s_addr)
{
return (routes[i].iface->addr);
}
@@ -434,7 +437,7 @@
else
strcpy (iface, ptr);
ptr = strtok (NULL, "\t "); /* hack avoiding fscanf */
- routes[i].addr.s_addr=(unsigned long)strtol(ptr,NULL,16);
+ routes[i].addr.s_addr=(u_int32_t)strtol(ptr,NULL,16);
for (i1 = 0; i1 < 6; i1++)
{
ptr = strtok (NULL, "\t "); /* ignore Gateway Flags RefCnt Use Metric */
@@ -443,7 +446,7 @@
fputs ("Error parsing /proc/net/route\n", stderr);
continue;
}
- routes[i].naddr=(unsigned long)strtol(ptr,NULL,16); /* Netmask */
+ routes[i].naddr=(u_int32_t)strtol(ptr,NULL,16); /* Netmask */
found = 0;
for (i1 = 0; i1 < numinterfaces; i1++)

128
net/queso/patches/patch-ab Normal file
View File

@ -0,0 +1,128 @@
Patch helping 64 bit cleanness taken from the Debian Linux package made
by Stéphane Bortmeyer <bortzmeyer@debian.org>. 64 bit patch originally
by Bart Warmerdam <bartw@xs4all.nl>.
A few casts in printfs to shut up warnings.
--- queso.c.orig Tue Sep 22 22:35:43 1998
+++ queso.c Wed Sep 29 15:54:20 1999
@@ -58,19 +58,19 @@
static char CFGFILE[255] = DFLT_CONFIG_FILE;
/*------------- Prototiping -----------------*/
-void debugtcp (unsigned long, tcprec);
+void debugtcp (u_int32_t, tcprec);
void usage (const char *);
int checkos (struct sockaddr_in, short);
/*------------- Print TCP HDR ---------------*/
void
-debugtcp (unsigned long myseq, tcprec tcp)
+debugtcp (u_int32_t myseq, tcprec tcp)
{
fprintf (stderr, "%d->%d S:%1d A:%s%lX W:%04X U:%X F: ",
ntohs (tcp.sport), ntohs (tcp.dport),
(tcp.seqnum?1:0),
tcp.acknum?"+":" ",
- (tcp.acknum?(unsigned long) ntohl (tcp.acknum)-myseq:0),
+ (unsigned long) (tcp.acknum?(u_int32_t) ntohl (tcp.acknum)-myseq:0),
ntohs (tcp.window), ntohs (tcp.urgentptr));
if (tcp.flags & URG)
@@ -142,12 +142,12 @@
typedef struct
{
- unsigned short set;
- unsigned long seq;
- unsigned long ack;
- unsigned short urg;
- unsigned short win;
- unsigned short flag;
+ u_int16_t set;
+ u_int32_t seq;
+ u_int32_t ack;
+ u_int16_t urg;
+ u_int16_t win;
+ u_int16_t flag;
}
OSRES;
@@ -158,12 +158,12 @@
{
spoofrec spoof;
tcprec tcp;
- unsigned short start, s;
+ u_int16_t start, s;
int n;
long timeout;
FILE *f;
char line[1024];
- unsigned long myseq;
+ u_int32_t myseq;
#ifdef PCAP
char fromtxt[16], desttxt[16];
char bpftxt[4096];
@@ -284,8 +284,8 @@
if ((f = fopen (CFGFILE, "r")))
{
char osname[256]; /* should be smaller than line[], 256 should suffice */
- unsigned short flag1 = 0, found = 0, linez = 0;
- unsigned short pn = 0, ps = 0, pa = 0, pw = 0, pf = 0, pu = 0;
+ u_int16_t flag1 = 0, found = 0, linez = 0;
+ u_int16_t pn = 0, ps = 0, pa = 0, pw = 0, pf = 0, pu = 0;
char *p;
while (fgets (line, sizeof (osname) - 1, f))
@@ -412,7 +412,7 @@
if (CONFIGDEBUG)
fprintf (stderr, " ** FAILED %d,%d,%d,%d,%02X != %ld,%ld,%d,%d,%02X\n",
ps, pa, pw, pu, pf,
- r[pn].seq,r[pn].ack,r[pn].win,r[pn].urg,r[pn].flag);
+ (unsigned long) r[pn].seq,(unsigned long) r[pn].ack,r[pn].win,r[pn].urg,r[pn].flag);
found = 0;
flag1 = 0;
continue;
@@ -483,9 +483,9 @@
if (r[pn].set)
{
fprintf ( f, "%d %ld %s",
- pn, r[pn].seq, (r[pn].ack==RANDOM_ACK?"R":((r[pn].ack>=ACK_HACK)?"+":"")) );
+ pn, (long) r[pn].seq, (r[pn].ack==RANDOM_ACK?"R":((r[pn].ack>=ACK_HACK)?"+":"")) );
if(r[pn].ack!=RANDOM_ACK)
- fprintf ( f, "%ld", (r[pn].ack>=ACK_HACK)?r[pn].ack-ACK_HACK:r[pn].ack);
+ fprintf ( f, "%ld", (long) /* shut up a warning */ ((r[pn].ack>=ACK_HACK)?r[pn].ack-ACK_HACK:r[pn].ack));
fprintf ( f, " %d %s\n", r[pn].win ? 1 : 0, line);
}
else
@@ -516,13 +516,13 @@
main (int argc, char *argv[])
{
struct sockaddr_in dest, from;
- unsigned short port;
+ u_int16_t port;
char *s, *p;
int c;
int accuracy;
int limit = 0;
int bits = 32; /* single host */
- unsigned long firsthost, lasthost, netmask, host;
+ u_int32_t firsthost, lasthost, netmask, host;
/*
* Unbuffer stdout and stderr
@@ -652,7 +652,13 @@
}
host = ntohl (dest.sin_addr.s_addr);
- netmask = ~(0xFFFFFFFFL >> bits);
+ netmask = 0xFFFFFFFFL;
+ if(bits >= 1){
+ netmask >>= 1;
+ bits--;
+ }
+ netmask >>= bits;
+ netmask = ~netmask;
/*-- WARNING: 32bit arquitectures have problems when bits==32 --*/
firsthost = (host & netmask) + 1;
lasthost = (host | ~(netmask)) - 1;

105
net/queso/patches/patch-ac Normal file
View File

@ -0,0 +1,105 @@
Patch helping 64 bit cleanness taken from the Debian Linux package made
by Stéphane Bortmeyer <bortzmeyer@debian.org>. 64 bit patch originally
by Bart Warmerdam <bartw@xs4all.nl>.
--- tcpip.h.orig
+++ tcpip.h
@@ -4,12 +4,12 @@
{
unsigned char vh;
unsigned char stype;
- unsigned short length;
- unsigned short ident;
- unsigned short frag;
+ u_int16_t length;
+ u_int16_t ident;
+ u_int16_t frag;
unsigned char ttl;
unsigned char protocol;
- unsigned short cksum;
+ u_int16_t cksum;
struct in_addr sip;
struct in_addr dip;
}
@@ -17,15 +17,15 @@
typedef struct
{
- unsigned short sport;
- unsigned short dport;
- unsigned long seqnum;
- unsigned long acknum;
+ u_int16_t sport;
+ u_int16_t dport;
+ u_int32_t seqnum;
+ u_int32_t acknum;
unsigned char txoff;
unsigned char flags;
- unsigned short window;
- unsigned short cksum;
- unsigned short urgentptr;
+ u_int16_t window;
+ u_int16_t cksum;
+ u_int16_t urgentptr;
}
tcprec;
@@ -35,7 +35,7 @@
struct in_addr dip;
unsigned char zero;
unsigned char proto;
- unsigned short tcplen;
+ u_int16_t tcplen;
}
tcpsrec;
@@ -43,12 +43,12 @@
{
unsigned char type;
unsigned char code;
- unsigned short cksum;
- unsigned long zero;
+ u_int16_t cksum;
+ u_int32_t zero;
iprec ip;
- unsigned short sport;
- unsigned short dport;
- unsigned long seq;
+ u_int16_t sport;
+ u_int16_t dport;
+ u_int32_t seq;
}
icmprec;
@@ -67,23 +67,23 @@
{
struct sockaddr_in from;
struct sockaddr_in dest;
- unsigned short sport;
- unsigned short dport;
- unsigned long seq;
- unsigned long ack;
+ u_int16_t sport;
+ u_int16_t dport;
+ u_int32_t seq;
+ u_int32_t ack;
}
spoofrec;
/* -------------- Prototiping --------------- */
void init_tcpip(void);
int init_pcap(char*);
-unsigned short in_cksum (unsigned short *, int);
+u_int16_t in_cksum (u_int16_t *, int);
void sendip (spoofrec *, char *, short, short *, short *, short);
-unsigned short tcpcksum (spoofrec *, char *, short);
+u_int16_t tcpcksum (spoofrec *, char *, short);
short resolve_host (char *, struct sockaddr_in *);
short gettcp (spoofrec *, tcprec *);
-void sendtcp (spoofrec *, unsigned short, short);
-void sendicmp (spoofrec *, struct sockaddr_in *, unsigned short);
-struct in_addr getlocalip (unsigned long dest);
+void sendtcp (spoofrec *, u_int16_t, short);
+void sendicmp (spoofrec *, struct sockaddr_in *, u_int16_t);
+struct in_addr getlocalip (u_int32_t dest);
char *tcpip_id(void);

View File

@ -1,3 +1,4 @@
man/man1/queso.1
sbin/queso
share/doc/queso/Documentation.txt
@dirrm share/doc/queso