Subject: lib/2031: libpcap uses yyparse(), which is bad
To: None <gnats-bugs@NetBSD.ORG>
From: Luke Mewburn <lukem@supp.cpr.itg.telecom.com.au>
List: netbsd-bugs
Date: 02/06/1996 13:40:15
>Number:         2031
>Category:       lib
>Synopsis:       libpcap uses yyparse(), which is bad
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   lm
>Arrival-Date:   Mon Feb  5 21:50:01 1996
>Last-Modified:
>Originator:     Luke Mewburn
>Organization:
Telstra
>Release:        NetBSD-960206
>Environment:
System: NetBSD shelob.supp.cpr.itg.telecom.com.au 1.1A NetBSD 1.1A (SHELOB) #0: Mon Jan 8 12:58:14 EST 1996 root@shelob:/z/src/sys/arch/i386/compile/SHELOB i386

>Description:
	libpcap uses yyparse(), etc, which makes it impossible to 
	use your own yaccer if you -lpcap.

>How-To-Repeat:

>Fix:
	this patch should fix it.
	you can close [misc/1993] as well.

diff -c /ftp/pub/NetBSD/NetBSD-current/src/lib/libpcap/Makefile lib/libpcap/Makefile
*** /ftp/pub/NetBSD/NetBSD-current/src/lib/libpcap/Makefile	Sat Oct 14 11:01:00 1995
--- lib/libpcap/Makefile	Tue Feb  6 12:32:57 1996
***************
*** 3,9 ****
  LIB=	pcap
  MAN=	pcap.3
  
! CFLAGS+=-I. -I${.CURDIR}
  
  HDRS=	pcap.h pcap-namedb.h
  SRCS=	pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
--- 3,9 ----
  LIB=	pcap
  MAN=	pcap.3
  
! CFLAGS+=-I. -I${.CURDIR} -Dyylval=pcap_yylval
  
  HDRS=	pcap.h pcap-namedb.h
  SRCS=	pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
***************
*** 12,17 ****
--- 12,24 ----
  .PATH:	${.CURDIR}/../../sys/net
  
  CLEANFILES+= grammar.c scanner.c y.tab.h
+ 
+ grammar.c:	grammar.y
+ 	${YACC.y} -ppcap_yy -b ${.TARGET:R} ${.IMPSRC}
+ 	mv ${.TARGET:R}.tab.c ${.TARGET}
+ 
+ scanner.c:	scanner.l grammar.c
+ 	${LEX.l} -Ppcap_yy -o${.TARGET} ${.IMPSRC}
  
  beforeinstall:
  	@cd ${.CURDIR}; for i in $(HDRS); do \
Only in lib/libpcap: obj.i386
diff -c /ftp/pub/NetBSD/NetBSD-current/src/lib/libpcap/scanner.l lib/libpcap/scanner.l
*** /ftp/pub/NetBSD/NetBSD-current/src/lib/libpcap/scanner.l	Sat Oct 14 11:01:00 1995
--- lib/libpcap/scanner.l	Tue Feb  6 12:36:09 1996
***************
*** 35,41 ****
  #include <pcap-namedb.h>
  
  #include "gencode.h"
! #include "y.tab.h"
  
  #ifndef __GNUC__
  #define inline
--- 35,41 ----
  #include <pcap-namedb.h>
  
  #include "gencode.h"
! #include "grammar.tab.h"
  
  #ifndef __GNUC__
  #define inline
>Audit-Trail:
>Unformatted: