Re: trafshow doesn't work?

2000-07-23 Thread Mark Murray

 Fallout from the malloc.conf changes. tcpdump has the same bug.

Could this break dhclient as well?

M
--
Mark Murray
Join the anti-SPAM movement: http://www.cauce.org


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: trafshow doesn't work?

2000-07-20 Thread Ollivier Robert

[ Bill Fenner added as "maintainer" of libpcap/tcpdump ]

According to Kris Kennaway:
 Fallout from the malloc.conf changes. tcpdump has the same bug.
 
I think^W'm sure the bug is in libpcap though as several libpcap applications
fail with the same error (tcpdump, ntop, trafshow).

The problem is inside pcap_lookupdev(), "buf" is used to store interface data,
then freed then the buffer is used again :

-=-=-
for (;;) {
buf = malloc (buf_size);
if (buf == NULL) {
close (fd);
(void)sprintf(errbuf, "out of memory");
return (NULL);
}

ifc.ifc_len = buf_size;
ifc.ifc_buf = buf;
memset (buf, 0, buf_size);
...
for (cp = ifrp-ifr_name; !isdigit(*cp); ++cp)
continue;
n = atoi(cp);
if (n  minunit) {
minunit = n;
mp = ifrp;
}
}
free(buf);  
(void)close(fd);
if (mp == NULL) {
(void)strcpy(errbuf, "no suitable device found");
return (NULL);
}

(void)strncpy(device, mp-ifr_name, sizeof(device) - 1);
device[sizeof(device) - 1] = '\0';
return (device);
-=-=-

The last free(buf) has filled "buf" with 0xd0 so "mp" points to the same
area. If anyone has the address of the mailing list for libpcap, please send
this patch. I won't commit it as it would get the file out of the vendor
branch.

Index: inet.c
===
RCS file: /spare/FreeBSD-current/src/contrib/libpcap/inet.c,v
retrieving revision 1.1.1.4
diff -u -2 -I.*$Id:.* -r1.1.1.4 inet.c
--- inet.c  2000/01/30 00:32:41 1.1.1.4
+++ inet.c  2000/07/20 20:41:36
@@ -174,7 +174,7 @@
}
}
-   free(buf);
(void)close(fd);
if (mp == NULL) {
+   free(buf);
(void)strcpy(errbuf, "no suitable device found");
return (NULL);
@@ -183,4 +183,5 @@
(void)strncpy(device, mp-ifr_name, sizeof(device) - 1);
device[sizeof(device) - 1] = '\0';
+   free(buf);
return (device);
 }

-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- [EMAIL PROTECTED]
FreeBSD keltia.freenix.fr 5.0-CURRENT #80: Sun Jun  4 22:44:19 CEST 2000



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: trafshow doesn't work?

2000-07-20 Thread Bill Fenner


I guess this is

http://www.tcpdump.org/cgi-bin/cvsweb/libpcap/inet.c?r1=1.25r2=1.26

The easiest thing to do is probably cvs import their rev 1.26 of
inet.c .  Shall I do this?

  Bill


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: trafshow doesn't work?

2000-07-20 Thread Bill Fenner


This should be fixed by rev 1.1.1.5 of src/contrib/libpcap/inet.c .

  Bill


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: trafshow doesn't work?

2000-07-20 Thread Ollivier Robert

According to Bill Fenner:
 http://www.tcpdump.org/cgi-bin/cvsweb/libpcap/inet.c?r1=1.25r2=1.26

Yes, that's almost my patch, I swear I didn't know :)
 
 The easiest thing to do is probably cvs import their rev 1.26 of
 inet.c .  Shall I do this?

That's probably the best, thanks!
-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- [EMAIL PROTECTED]
FreeBSD keltia.freenix.fr 5.0-CURRENT #80: Sun Jun  4 22:44:19 CEST 2000



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



trafshow doesn't work?

2000-07-19 Thread Sam Xie

Hi! There,
My trafshow doesn't work.  Whenever I tried to run trafshow, it gave me
error message says, "trafshow: : Device not configured" I check my 
Kernel configuration file, a line
   "device  bpf 4   #Berkeley packet filter"
is there and device drivers bpf0, bpf1, bpf2, and bpf3 are in /dev. 
I don't know whatelse I should configure.  Can someone help me?
My OS is FreeBSD 5.0-CURRENT #21.
Thanks!
Sam


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: trafshow doesn't work?

2000-07-19 Thread Kris Kennaway

On Wed, 19 Jul 2000, Sam Xie wrote:

 Hi! There,
 My trafshow doesn't work.  Whenever I tried to run trafshow, it gave me
 error message says, "trafshow: : Device not configured" I check my 
Kernel configuration file, a line

Fallout from the malloc.conf changes. tcpdump has the same bug.

Kris

--
In God we Trust -- all others must submit an X.509 certificate.
-- Charles Forsythe [EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: trafshow doesn't work?

2000-07-19 Thread Leif Neland



On Wed, 19 Jul 2000, Sam Xie wrote:

 Hi! There,
 My trafshow doesn't work.  Whenever I tried to run trafshow, it gave me
 error message says, "trafshow: : Device not configured" I check my 
Kernel configuration file, a line
"device  bpf 4   #Berkeley packet filter"

I get the same message when running arpwatch which also uses bpf.
It still works, though.

Leif




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message