Further (broken) argus-2.0.0 patches

Carter Bullard chellyaz at bellatlantic.net
Sat Sep 2 17:21:26 EDT 2000


Hey Peter,
   I may have found it.  We need to call yacc with the -p
option to get the substitutions like I mentioned before.
Try
   yacc -p argus_ -d grammar.y
to see if this does it.

Carter



-----Original Message-----
From: owner-argus at lists.andrew.cmu.edu
[mailto:owner-argus at lists.andrew.cmu.edu]On Behalf Of Peter Van Epp
Sent: Saturday, September 02, 2000 12:20 AM
To: argus
Subject: Further (broken) argus-2.0.0 patches


	Below are a series of patches for argus-2.0.0 on FreeBSD 4.1 RELEASE
which are almost right :-). The problem looks to be that Yacc on FreeBSD
isn't
bison (it looks to be a BSD Yacc which in turn looks to be different than
ATT Yacc in some way). I think the fault is probably the patch in grammar.y
that convinces it that this is bison. While that corrects this error:

test1# make
making in common
yacc -d grammar.y
mv y.tab.c grammar.c
mv y.tab.h tokdefs.h
gcc -O -I. -I../include -DHAVE_SYS_IOCCOM_H=1 -DHAVE_SYS_SOCKIO_H=1 -DHAVE_E
THER
_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_SOCKADDR_SA_LEN=1 -c ./scanner.c
gcc -O -I. -I../include -DHAVE_SYS_IOCCOM_H=1 -DHAVE_SYS_SOCKIO_H=1 -DHAVE_E
THER
_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_SOCKADDR_SA_LEN=1 -Dyylval=argus_lval -c
gra
mmar.c
y.tab.c:686: redefinition of `argus_parse'
grammar.y:81: `argus_parse' previously defined here
*** Error code 1

Stop in /usr/local/src/argus-2.0.0/common.
*** Error code 1

Stop in /usr/local/src/argus-2.0.0.

	It looks to cause this at link time (it also doesn't find libpthread,
but I suspect that will be easy to fix):

gcc -o ../bin/argus_bpf argus.o ArgusModeler.o ArgusOutput.o ArgusSource.o
Argus
Util.o Argus_tcp.o Argus_udp.o Argus_icmp.o Argus_arp.o ../lib/libpcap.a
../lib
/argus_common.a -lpthread -lm
../lib/argus_common.a(scanner.o)(.data+0x10): multiple definition of `yyin'
../lib/libpcap.a(scanner.o)(.data+0x10): first defined here
../lib/argus_common.a(scanner.o)(.data+0x14): multiple definition of `yyout'
../lib/libpcap.a(scanner.o)(.data+0x14): first defined here
../lib/argus_common.a(scanner.o): In function `yy_create_buffer':
scanner.o(.text+0xcc0): multiple definition of `yy_create_buffer'
../lib/libpcap.a(scanner.o)(.text+0xc3c): first defined here
../lib/argus_common.a(scanner.o): In function `yy_load_buffer_state':
scanner.o(.text+0xc8c): multiple definition of `yy_load_buffer_state'
../lib/libpcap.a(scanner.o)(.text+0xc08): first defined here
../lib/argus_common.a(scanner.o): In function `yywrap':
scanner.o(.text+0xfc4): multiple definition of `yywrap'
../lib/libpcap.a(scanner.o)(.text+0xf40): first defined here
../lib/argus_common.a(scanner.o): In function `yyrestart':
scanner.o(.text+0xbf0): multiple definition of `yyrestart'
../lib/libpcap.a(scanner.o)(.text+0xb6c): first defined here
../lib/argus_common.a(scanner.o): In function `yy_init_buffer':
scanner.o(.text+0xd78): multiple definition of `yy_init_buffer'
../lib/libpcap.a(scanner.o)(.text+0xcf4): first defined here
../lib/argus_common.a(scanner.o): In function `yy_switch_to_buffer':
scanner.o(.text+0xc34): multiple definition of `yy_switch_to_buffer'
../lib/libpcap.a(scanner.o)(.text+0xbb0): first defined here
../lib/argus_common.a(scanner.o): In function `yy_delete_buffer':
scanner.o(.text+0xd34): multiple definition of `yy_delete_buffer'
../lib/libpcap.a(scanner.o)(.text+0xcb0): first defined here
../lib/argus_common.a(scanner.o): In function `yy_flush_buffer':
scanner.o(.text+0xdcc): multiple definition of `yy_flush_buffer'
../lib/libpcap.a(scanner.o)(.text+0xd48): first defined here
../lib/argus_common.a(scanner.o): In function `yy_scan_buffer':
scanner.o(.text+0xe10): multiple definition of `yy_scan_buffer'
../lib/libpcap.a(scanner.o)(.text+0xd8c): first defined here
../lib/argus_common.a(scanner.o): In function `yy_scan_string':
scanner.o(.text+0xea8): multiple definition of `yy_scan_string'
../lib/libpcap.a(scanner.o)(.text+0xe24): first defined here
../lib/argus_common.a(scanner.o): In function `yy_scan_bytes':
scanner.o(.text+0xecc): multiple definition of `yy_scan_bytes'
../lib/libpcap.a(scanner.o)(.text+0xe48): first defined here
../lib/argus_common.a(grammar.o)(.rodata+0x4c): multiple definition of
`yylhs'
../lib/libpcap.a(grammar.o)(.rodata+0xc2): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yylhs' changed from 226 to 240
in
grammar.o
../lib/argus_common.a(grammar.o)(.rodata+0x13c): multiple definition of
`yylen'
../lib/libpcap.a(grammar.o)(.rodata+0x1a4): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yylen' changed from 226 to 240
in
grammar.o
../lib/argus_common.a(grammar.o)(.rodata+0x22c): multiple definition of
`yydefre
d'
../lib/libpcap.a(grammar.o)(.rodata+0x286): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yydefred' changed from 324 to
336
in grammar.o
../lib/argus_common.a(grammar.o)(.rodata+0x37c): multiple definition of
`yydgoto
'
../lib/libpcap.a(grammar.o)(.rodata+0x3ca): first defined here
../lib/argus_common.a(grammar.o)(.rodata+0x3b0): multiple definition of
`yysinde
x'
../lib/libpcap.a(grammar.o)(.rodata+0x3fe): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yysindex' changed from 324 to
336
in grammar.o
../lib/argus_common.a(grammar.o)(.rodata+0x500): multiple definition of
`yyrinde
x'
../lib/libpcap.a(grammar.o)(.rodata+0x542): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yyrindex' changed from 324 to
336
in grammar.o
../lib/argus_common.a(grammar.o)(.rodata+0x650): multiple definition of
`yyginde
x'
../lib/libpcap.a(grammar.o)(.rodata+0x686): first defined here
../lib/argus_common.a(grammar.o)(.rodata+0x684): multiple definition of
`yytable
'
../lib/libpcap.a(grammar.o)(.rodata+0x6ba): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yytable' changed from 1678 to
1754
 in grammar.o
../lib/argus_common.a(grammar.o)(.rodata+0xd5e): multiple definition of
`yycheck
'
../lib/libpcap.a(grammar.o)(.rodata+0xd48): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `yycheck' changed from 1678 to
1754
 in grammar.o
/usr/libexec/elf/ld: cannot open -lpthread: No such file or directory
*** Error code 1

Stop in /usr/local/src/argus-2.0.0/server.
*** Error code 1

Stop in /usr/local/src/argus-2.0.0.

	Since the sum total of my knowledge of Yacc/Lex is that these yyxxx
programs are what it generates, it looks like I need someone knowledgable to
either fix this or tell me what to look for. It has deleted y.tab.c in the
error above so I can't see why it thinks argus_parse is multiply defined.
	The consolidated patch list (so far) created from the argus-2.0.0
directory (including the grammar.c patch that breaks the link):


*** server/ArgusModeler.h.orig	Fri Sep  1 20:48:44 2000
--- server/ArgusModeler.h	Fri Sep  1 20:51:05 2000
***************
*** 84,90 ****
  #define TCHECK(var) TCHECK2(var, sizeof(var))


! #if defined(linux)
  #include <pthread.h>
  #else
  #include <thread.h>
--- 84,90 ----
  #define TCHECK(var) TCHECK2(var, sizeof(var))


! #if defined(linux) || defined(__FreeBSD__)
  #include <pthread.h>
  #else
  #include <thread.h>
***************
*** 93,99 ****
  #include <sys/types.h>
  #include <sys/time.h>

! #if defined(HAVE_SOLARIS)
  #include <sys/socket.h>
  #endif

--- 93,99 ----
  #include <sys/types.h>
  #include <sys/time.h>

! #if defined(HAVE_SOLARIS) || defined(__FreeBSD__)
  #include <sys/socket.h>
  #endif

*** server/ArgusOutput.h.orig	Fri Sep  1 20:49:04 2000
--- server/ArgusOutput.h	Fri Sep  1 20:49:22 2000
***************
*** 58,64 ****
  #define ARGUS_MONITORPORT	561
  #define ARGUS_MAXLISTEN		5

! #if defined(linux)
  #include <pthread.h>
  #else
  #include <thread.h>
--- 58,64 ----
  #define ARGUS_MONITORPORT	561
  #define ARGUS_MAXLISTEN		5

! #if defined(linux) || defined(__FreeBSD__)
  #include <pthread.h>
  #else
  #include <thread.h>
*** server/ArgusSource.h.orig	Fri Sep  1 20:43:59 2000
--- server/ArgusSource.h	Fri Sep  1 20:44:33 2000
***************
*** 49,55 ****

  #include <stdio.h>

! #if defined(linux)
  #include <pthread.h>
  #else
  #include <thread.h>
--- 49,55 ----

  #include <stdio.h>

! #if defined(linux) || defined(__FreeBSD__)
  #include <pthread.h>
  #else
  #include <thread.h>
*** include/argus_out.h.orig	Fri Sep  1 20:02:51 2000
--- include/argus_out.h	Fri Sep  1 20:05:34 2000
***************
*** 46,52 ****
  #ifndef Argus_out_h
  #define Argus_out_h

! #if defined(HAVE_SOLARIS)
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <net/if.h>
--- 46,52 ----
  #ifndef Argus_out_h
  #define Argus_out_h

! #if defined(HAVE_SOLARIS) || defined(__FreeBSD__)
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <net/if.h>
*** common/gencode.c.orig	Fri Sep  1 20:15:29 2000
--- common/gencode.c	Fri Sep  1 20:16:35 2000
***************
*** 43,49 ****
   */


! #if defined(HAVE_SOLARIS)
  #include <sys/types.h>
  #include <sys/socket.h>
  #endif
--- 43,49 ----
   */


! #if defined(HAVE_SOLARIS) || defined(__FreeBSD__)
  #include <sys/types.h>
  #include <sys/socket.h>
  #endif
*** common/grammar.y.orig	Fri Sep  1 20:17:57 2000
--- common/grammar.y	Fri Sep  1 20:31:05 2000
***************
*** 45,51 ****
   *
   */

! #if defined(HAVE_SOLARIS)
  #include <sys/types.h>
  #include <sys/socket.h>
  #endif
--- 45,51 ----
   *
   */

! #if defined(HAVE_SOLARIS) || defined(__FreeBSD__)
  #include <sys/types.h>
  #include <sys/socket.h>
  #endif
***************
*** 76,86 ****
--- 76,88 ----
  	/* NOTREACHED */
  }

+ #ifndef __FreeBSD__
  #ifndef YYBISON
  argus_parse()
  {
  	return (yyparse());
  }
+ #endif
  #endif

  %}



More information about the argus mailing list