diff -urNp v6eval-2.2b6/CHANGELOG.v6eval v6ev
al-2.2b6-linux/CHANGELOG.v6eval
--- v6eval-2
.2b6/CHANGELOG.v6eval	2003-12-26 22:25:00.000
000000 +0900
+++ v6eval-2.2b6-linux/CHANGELO
G.v6eval	2004-01-26 14:45:33.000000000 +0900
@@ -3,6 +3,8 @@
 
 		     $Date: 2004/11/0
3 17:48:26 $
 
+2004/01/07	by Kazuo Hiekata

+	(Experimental) Su
pport RedHat 9 and UnitedLinux 1.0 as TN
 
 2003/12/26	Release 2.2b6
 	Official beta re
lease
diff -urNp v6eval-2.2b6/INSTALL.linux 
v6eval-2.2b6-linux/INSTALL.linux
--- v6eval-
2.2b6/INSTALL.linux	1970-01-01 09:00:00.00000
0000 +0900
+++ v6eval-2.2b6-linux/INSTALL.li
nux	2004-01-26 14:45:33.000000000 +0900
@@ -
0,0 +1,176 @@
+# Copyright (C) IBM Corporati
on 2004.
+# All rights reserved.
+#
+# Red
istribution and use of this software in sourc
e and binary forms, with 
+# or without modi
fication, are permitted provided that the fol
lowing 
+# conditions and disclaimer are agr
eed and accepted by the user:
+#
+# 1. Redi
stributions of source code must retain the ab
ove copyright 
+# notice, this list of condi
tions and the following disclaimer.
+#
+# 2
. Redistributions in binary form must reprodu
ce the above copyright 
+# notice, this list
 of conditions and the following disclaimer i
n the 
+# documentation and/or other materia
ls provided with the distribution.
+#
+# 3.
 Neither the names of the copyrighters, the n
ame of the project which 
+# is related to t
his software (hereinafter referred to as "pro
ject") nor 
+# the names of the contributors
 may be used to endorse or promote products 
+# derived from this software without specif
ic prior written permission.
+#
+# 4. No me
rchantable use may be permitted without prior
 written 
+# notification to the copyrighter
s. However, using this software for the 
+# 
purpose of testing or evaluating any products
 including merchantable 
+# products may be 
permitted without any notification to the cop
yrighters.
+#
+#
+#
+# THIS SOFTWARE IS P
ROVIDED BY THE COPYRIGHTERS, THE PROJECT AND 
+# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
IMPLIED WARRANTIES, INCLUDING 
+# BUT NOT LI
MITED THE IMPLIED WARRANTIES OF MERCHANTABILI
TY AND FITNESS 
+# FOR A PARTICULAR PURPOSE,
 ARE DISCLAIMED.  IN NO EVENT SHALL THE 
+# 
COPYRIGHTERS, THE PROJECT OR CONTRIBUTORS BE 
LIABLE FOR ANY DIRECT, 
+# INDIRECT, INCIDEN
TAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAM
AGES 
+# (INCLUDING, BUT NOT LIMITED TO, PRO
CUREMENT OF SUBSTITUTE GOODS OR 
+# SERVICES
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) 
+# HOWEVER CAUSED AND ON ANY 
THEORY OF LIABILITY, WHETHER IN 
+# CONTRACT
,STRICT LIABILITY, OR TORT (INCLUDING NEGLIGE
NCE OR OTHERWISE) 
+# ARISING IN ANY WAY OUT
 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 OF 
+# THE POSSIBILITY OF SUCH DAMAGE.
+# 
INTAP(Interoperability Technology Association
 for Information 
+# Processing, Japan) , IP
A (Information-technology Promotion Agency,Ja
pan)
+# All rights reserved.
+#
+# Redistr
ibution and use of this software in source an
d binary forms, with 
+# or without modifica
tion, are permitted provided that the followi
ng 
+# conditions and disclaimer are agreed 
and accepted by the user:
+#
+# 1. Redistri
butions of source code must retain the above 
copyright 
+# notice, this list of condition
s and the following disclaimer.
+#
+# 2. Re
distributions in binary form must reproduce t
he above copyright 
+# notice, this list of 
conditions and the following disclaimer in th
e 
+# documentation and/or other materials p
rovided with the distribution.
+#
+# 3. Nei
ther the names of the copyrighters, the name 
of the project which 
+# is related to this 
software (hereinafter referred to as "project
") nor 
+# the names of the contributors may
 be used to endorse or promote products 
+# 
derived from this software without specific p
rior written permission.
+#
+# 4. No mercha
ntable use may be permitted without prior wri
tten 
+# notification to the copyrighters. H
owever, using this software for the 
+# purp
ose of testing or evaluating any products inc
luding merchantable 
+# products may be perm
itted without any notification to the copyrig
hters.
+#
+#
+#
+# THIS SOFTWARE IS PROVI
DED BY THE COPYRIGHTERS, THE PROJECT AND 
+#
 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPL
IED WARRANTIES, INCLUDING 
+# BUT NOT LIMITE
D THE IMPLIED WARRANTIES OF MERCHANTABILITY A
ND FITNESS 
+# FOR A PARTICULAR PURPOSE, ARE
 DISCLAIMED.  IN NO EVENT SHALL THE 
+# COPY
RIGHTERS, THE PROJECT OR CONTRIBUTORS BE LIAB
LE FOR ANY DIRECT, 
+# INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
+# (INCLUDING, BUT NOT LIMITED TO, PROCURE
MENT OF SUBSTITUTE GOODS OR 
+# SERVICES; LO
SS OF USE, DATA, OR PROFITS; OR BUSINESS INTE
RRUPTION) 
+# HOWEVER CAUSED AND ON ANY THEO
RY OF LIABILITY, WHETHER IN 
+# CONTRACT,STR
ICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
OR OTHERWISE) 
+# ARISING IN ANY WAY OUT OF 
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
+# THE POSSIBILITY OF SUCH DAMAGE.
+#
+# 
   Author: Kazuo Hiekata 
com>
+#
+
+
+Installing the package onto 
TN (the case of RedHat 9/UnitedLinux 1.0)
+=
=============================================
==================
+
+0. Install RedHat 9 o
r UnitedLinux 1.0
+
+1. Extracting the pack
age
+
+	% cd $SOMEWHERE
+	% tar zxvf v6eva
l-X.X.tar.gz
+
+2. Installing perl-related 
modules
+
+	The package requires the below-
listed perl5 modules.
+
+		- Expect v1.15
+		- IO-Tty v1.02
+		
+	These packages are 
available on the web.
+		http://sourceforge.
net/project/showfiles.php?group_id=6894
+
+
		$ tar zxvf IO-Tty-1.02.tar.gz
+		$ cd IO-T
ty-1.02
+		$ perl Makefile.PL
+		$ make
+	
	$ make test
+		# make install
+
+		$ tar 
zxvf Expect-1.15.tar.gz
+		$ cd Expect-1.15
+		$ perl Makefile.PL
+		$ make
+		$ make 
test
+		# make install
+
+
+3. Checking t
he environment
+	
+	Make sure that "libpcap
" and "tcpdump" are already 
+	installed on 
your TN.
+	These packages are available on t
he Install CD-ROM.
+	And "pmake" is also nee
ded and is available only on RedHat 9 CD-ROM.
+	If you're using UnitedLinux 1.0, get RedH
at 9 CD-ROM and pick up
+	pmake package from
 it.
+	
+	To compile TAHI, perl5 and lorder
 are needed but Linux doesn't
+	have those.
+	
+	i. perl5
+		Just create a symbolic li
nk to /usr/bin/perl
+		
+		# ln -s /usr/bin
/perl /usr/bin/perl5
+	ii. lorder
+		This p
ackage contains "lorder" only for TAHI compil
ation on Linux.
+		
+		# cd $SOMEWHERE/v6ev
al-X.X
+		# cp lorder /usr/bin/lorder
+
+
+4. Compiling & installing the tool
+
+	In
stall the Tool in /usr/local/v6eval directory
.
+
+		% cd $SOMEWHERE/v6eval-X.X
+		% pma
ke
+		# pmake install
+
+
+4. Configure s
erial line
+
+	Make sure that "uucp" is ins
talled on your system
+	And change the permi
ssion of the serial line device.
+
+		# chm
od 777 /dev/ttyS0
+
+5. Interface configura
tion
+
+	At least, one interface used in te
sting, must be 'up' status.
+
+
+6. Back t
o the "Configuration of TN" section in INSTAL
L.v6eval.
+	
+	
+	* As for ct installation
, pmake must be used anywhere instead of make
.
+	Be careful when reading INSTALL.ct.
+		
+		% su -
+		# cd ct-X.X
+		# pmake insta
ll
+	
+	* "(iii) Customizing tn.def" in INS
TALL.v6eval refer to "filter ipv6",
+	but Li
nux TAHI doesn't support this feature.
+	
+
	
+							[end of INSTALL.linux]
diff -urNp
 v6eval-2.2b6/INSTALL.v6eval v6eval-2.2b6-lin
ux/INSTALL.v6eval
--- v6eval-2.2b6/INSTALL.v
6eval	2003-12-22 16:28:36.000000000 +0900
++
+ v6eval-2.2b6-linux/INSTALL.v6eval	2004-01-2
6 14:45:33.000000000 +0900
@@ -34,7 +34,7 @@
 Prerequisites
 Prerequisites for TN:
 	- T
he package supports FreeBSD 4.6 or higher and
 FreeBSD 5.1 or lower.
 	- The package can a
lso coexist with FreeBSD 4.X version of KAME.
-
+	- If you use RedHat 9 and UnitedLinux 
1.0 as TN, consult INSTALL.linux, too
 
 
 Installing the package onto TN (the case of 
FreeBSD 4.X-RELEASE)
diff -urNp v6eval-2.2b6
/bin/Makefile.inc v6eval-2.2b6-linux/bin/Make
file.inc
--- v6eval-2.2b6/bin/Makefile.inc	2
002-12-02 21:31:27.000000000 +0900
+++ v6eva
l-2.2b6-linux/bin/Makefile.inc	2004-01-26 14:
45:33.000000000 +0900
@@ -1,5 +1,5 @@
 BIND
IR?=	/usr/local/v6eval/bin
-MANDIR=	/usr/loc
al/v6eval/man/man
+MANDIR=	/usr/local/v6eval
/man
 l=../../lib
 Cm=$l/Cm
 Pz=$l/Pz
dif
f -urNp v6eval-2.2b6/bin/checker/Makefile v6e
val-2.2b6-linux/bin/checker/Makefile
--- v6e
val-2.2b6/bin/checker/Makefile	2003-02-03 23:
05:04.000000000 +0900
+++ v6eval-2.2b6-linux
/bin/checker/Makefile	2004-01-26 14:45:33.000
000000 +0900
@@ -1,3 +1,4 @@
+CC=c++
 CXXF
LAGS+= -I${Cm} -I${Pz} -I${pkt} -I/usr/local/
include
 LDFLAGS += -L${Cm} -L${Pz} -L${pkt}
 -L/usr/local/lib
 LDADD   += -lPkt -lPz -lC
m -lcrypto
diff -urNp v6eval-2.2b6/bin/dhcom
p/Makefile v6eval-2.2b6-linux/bin/dhcomp/Make
file
--- v6eval-2.2b6/bin/dhcomp/Makefile	20
03-12-04 13:59:47.000000000 +0900
+++ v6eval
-2.2b6-linux/bin/dhcomp/Makefile	2004-01-26 1
5:02:26.000000000 +0900
@@ -42,6 +42,7 @@
 
#
 #########################################
#############################
 
+CC = c++
 CXXFLAGS+= -I/usr/local/include
 LDFLAGS +=
 -L/usr/local/lib
 LDADD   += -lcrypto
diff
 -urNp v6eval-2.2b6/bin/dhgen/Makefile v6eval
-2.2b6-linux/bin/dhgen/Makefile
--- v6eval-2
.2b6/bin/dhgen/Makefile	2003-12-04 13:59:47.0
00000000 +0900
+++ v6eval-2.2b6-linux/bin/dh
gen/Makefile	2004-01-29 16:19:02.000000000 +0
900
@@ -42,6 +42,7 @@
 #
 ################
#############################################
#########
 
+CC=c++
 CXXFLAGS+= -I/usr/loc
al/include
 LDFLAGS += -L/usr/local/lib
 LD
ADD   += -lcrypto
diff -urNp v6eval-2.2b6/bi
n/pktbuf/Makefile v6eval-2.2b6-linux/bin/pktb
uf/Makefile
--- v6eval-2.2b6/bin/pktbuf/Make
file	2003-02-03 23:05:04.000000000 +0900
+++
 v6eval-2.2b6-linux/bin/pktbuf/Makefile	2004-
01-26 14:45:33.000000000 +0900
@@ -1,3 +1,4 
@@
+CC=c++
 CXXFLAGS+= -I${Cm} -I${Pz} -I${
pkt} -I/usr/local/include
 LDFLAGS += -L${Cm
} -L${Pz} -L${pkt} -L/usr/local/lib
 LDADD  
 += -lPkt -lPz -lCm -lcrypto
diff -urNp v6ev
al-2.2b6/bin/pktctl/Makefile v6eval-2.2b6-lin
ux/bin/pktctl/Makefile
--- v6eval-2.2b6/bin/
pktctl/Makefile	2003-02-03 23:05:04.000000000
 +0900
+++ v6eval-2.2b6-linux/bin/pktctl/Mak
efile	2004-01-26 14:45:33.000000000 +0900
@@
 -1,3 +1,4 @@
+CC=c++
 CXXFLAGS+= -I${Cm} -
I${Pz} -I${pkt} -I/usr/local/include
 LDFLAG
S += -L${Cm} -L${Pz} -L${pkt} -L/usr/local/li
b
 LDADD   += -lPkt -lPz -lCm -lcrypto
diff
 -urNp v6eval-2.2b6/bin/pktrecv/Makefile v6ev
al-2.2b6-linux/bin/pktrecv/Makefile
--- v6ev
al-2.2b6/bin/pktrecv/Makefile	2003-02-03 23:0
5:04.000000000 +0900
+++ v6eval-2.2b6-linux/
bin/pktrecv/Makefile	2004-01-26 14:45:33.0000
00000 +0900
@@ -1,3 +1,4 @@
+CC=c++
 CXXFL
AGS+= -I${Cm} -I${Pz} -I${pkt} -I/usr/local/i
nclude
 LDFLAGS += -L${Cm} -L${Pz} -L${pkt} 
-L/usr/local/lib
 LDADD   += -lPkt -lPz -lCm
  -lcrypto
diff -urNp v6eval-2.2b6/bin/pktse
nd/Makefile v6eval-2.2b6-linux/bin/pktsend/Ma
kefile
--- v6eval-2.2b6/bin/pktsend/Makefile
	2003-02-03 23:05:04.000000000 +0900
+++ v6e
val-2.2b6-linux/bin/pktsend/Makefile	2004-01-
26 14:45:33.000000000 +0900
@@ -1,3 +1,4 @@
+CC=c++
 CXXFLAGS+= -I${Cm} -I${Pz} -I${pkt
} -I/usr/local/include
 LDFLAGS += -L${Cm} -
L${Pz} -L${pkt} -L/usr/local/lib
 LDADD   +=
 -lPkt -lPz -lCm  -lcrypto
diff -urNp v6eval
-2.2b6/lib/Cm/CmSocket.h v6eval-2.2b6-linux/l
ib/Cm/CmSocket.h
--- v6eval-2.2b6/lib/Cm/CmS
ocket.h	2003-10-23 13:37:30.000000000 +0900
+++ v6eval-2.2b6-linux/lib/Cm/CmSocket.h	2004
-01-26 14:45:33.000000000 +0900
@@ -54,6 +54
,7 @@
 #include "CmTypes.h"
 
 #if !define
d(__KAME__) 
+#if !defined(__linux__)
 stru
ct  in6_addr {
 	union {
 		uint8_t   u6_ad
dr8[16];
@@ -68,9 +69,14 @@ struct sockaddr_
in6 {
 	uint32_t	sin6_scope_id;	/* intface s
cope id */
 };
 #define	s6_addr		u6_addr.u6
_addr8
+#endif
 #define getipnodebyname(a,b
,c,d)0
 #endif
 
+#if defined(__linux__)
+#define SO_REUSEPORT 15
+#endif
+
 #ifnde
f IN6_IS_ADDR_LINKLOCAL
 #define	IN6_IS_ADDR
_LINKLOCAL(a)\
 	(((a)->s6_addr[0] == 0xfe) 
&& (((a)->s6_addr[1] & 0xc0) == 0x80))
diff 
-urNp v6eval-2.2b6/lib/Cm/CmTypes.h v6eval-2.
2b6-linux/lib/Cm/CmTypes.h
--- v6eval-2.2b6/
lib/Cm/CmTypes.h	2001-10-12 13:56:14.00000000
0 +0900
+++ v6eval-2.2b6-linux/lib/Cm/CmType
s.h	2004-01-26 14:45:33.000000000 +0900
@@ -
48,16 +48,18 @@
 #include 
 typede
f char *STR;
 typedef const char *CSTR;
-#i
f defined(__FreeBSD__) || defined(__bsdi__)
+#if defined(__FreeBSD__) || defined(__bsdi__
) || defined(__linux__)
 typedef u_int8_t ui
nt8_t;
 typedef u_int16_t uint16_t;
 typede
f u_int32_t uint32_t;
 typedef u_int64_t uin
t64_t;
 #endif
 #if (__FreeBSD__ <= 3) || d
efined(__bsdi__) || defined(__hpux)
+#if !de
fined(__linux__)
 typedef int socklen_t;
 #
endif
-#if defined(__hpux)
+#endif
+#if de
fined(__hpux) || defined(__linux__)
 #define
 SETPGRP(a,b)setpgrp()
 #else
 #define SETP
GRP(a,b)setpgrp(a,b)
diff -urNp v6eval-2.2b6
/lib/Cm/Makefile v6eval-2.2b6-linux/lib/Cm/Ma
kefile
--- v6eval-2.2b6/lib/Cm/Makefile	2000
-04-19 18:45:20.000000000 +0900
+++ v6eval-2
.2b6-linux/lib/Cm/Makefile	2004-01-29 16:29:4
8.000000000 +0900
@@ -9,4 +9,5 @@ SRCS	= \
 
 CXXFLAGS+= -I. 
 
+MKLINT=no
 .include
 "bsd.lib.mk"
diff -urNp v6eval-2.2b6/lib/Pz
/Makefile v6eval-2.2b6-linux/lib/Pz/Makefile
--- v6eval-2.2b6/lib/Pz/Makefile	2003-12-05 
17:51:57.000000000 +0900
+++ v6eval-2.2b6-li
nux/lib/Pz/Makefile	2004-01-29 16:30:20.00000
0000 +0900
@@ -57,4 +57,5 @@ CFLAGS+= -I$(Cm
) -I.
 
 #CXXFLAGS+=	-DNOT_USE_IGMPV3_QUERY
 
+MKLINT=no
 .include "bsd.lib.mk"
diff
 -urNp v6eval-2.2b6/lib/Pz/MfAlgorithm.cc v6e
val-2.2b6-linux/lib/Pz/MfAlgorithm.cc
--- v6
eval-2.2b6/lib/Pz/MfAlgorithm.cc	2003-10-23 1
3:37:30.000000000 +0900
+++ v6eval-2.2b6-lin
ux/lib/Pz/MfAlgorithm.cc	2004-01-26 14:45:33.
000000000 +0900
@@ -205,6 +205,7 @@ void MfB
LOWFISH::decrypt(OCTSTR os,OCTST
 	scheduleK
eys(key,schd);
 	BF_cbc_encrypt(is,os,l,&sch
d,iv,DES_DECRYPT);}
 
+#if ! defined(__linu
x__)
 #include 
 //---------
---------------------------------------------
----------------
 // RC5 CRYPT ALGORITHM
@@
 -222,6 +223,7 @@ void MfRC5::decrypt(OCTSTR 
os,OCTSTR is,
 	RC5_32_KEY schd;
 	schedule
Keys(key,schd);
 	RC5_32_cbc_encrypt(is,os,l
,&schd,iv,DES_DECRYPT);}
+#endif
 
 #inclu
de 
 //---------------------
---------------------------------------------
----
@@ -431,8 +433,10 @@ MfDESCBC::MfDESCBC
(CSTR s,uint8_t k,uint
 MfDESCBC::~MfDESCBC(
) {}
 MfBLOWFISH::MfBLOWFISH(CSTR s,uint8_t 
k,uint8_t i,uint8_t a):MfCryptKey(s,k,i,a) {}
 MfBLOWFISH::~MfBLOWFISH() {}
+#if ! defin
ed(__linux__)
 MfRC5::MfRC5(CSTR s,uint8_t k
,uint8_t i,uint8_t a):MfCryptKey(s,k,i,a) {}
 MfRC5::~MfRC5() {}
+#endif
 MfCAST128::Mf
CAST128(CSTR s,uint8_t k,uint8_t i,uint8_t a)
:MfCryptKey(s,k,i,a) {}
 MfCAST128::~MfCAST1
28() {}
 MfDES3CBC::MfDES3CBC(CSTR s,uint8_t
 k,uint8_t i,uint8_t a):MfCryptKey(s,k,i,a) {
}
diff -urNp v6eval-2.2b6/lib/Pz/MfAlgorithm
.h v6eval-2.2b6-linux/lib/Pz/MfAlgorithm.h
-
-- v6eval-2.2b6/lib/Pz/MfAlgorithm.h	2003-04-
16 18:40:59.000000000 +0900
+++ v6eval-2.2b6
-linux/lib/Pz/MfAlgorithm.h	2004-01-26 14:45:
33.000000000 +0900
@@ -47,7 +47,9 @@
 #incl
ude 
 #include 
>
 #include 
+#if ! def
ined(__linux__)
 #include 
+
#endif
 #include 
 
 class
 PFunction;
@@ -214,6 +216,7 @@ virtual	void
 decrypt(OCTSTR,OCTSTR,uint3
 };
 
 //----
---------------------------------------------
---------------------
+#if ! defined(__linux
__)
 class MfRC5:public MfCryptKey {
 publi
c:
 	MfRC5(CSTR,uint8_t,uint8_t,uint8_t);
@
@ -222,6 +225,7 @@ virtual	~MfRC5();
 virtua
l	void encrypt(OCTSTR,OCTSTR,uint32_t,const P
Object*,OCTSTR) const;
 virtual	void decrypt
(OCTSTR,OCTSTR,uint32_t,const PObject*,OCTSTR
) const;
 };
+#endif
 
 //---------------
---------------------------------------------
----------
 class MfCAST128:public MfCryptKe
y {
diff -urNp v6eval-2.2b6/lib/Pz/PvOctets.
cc v6eval-2.2b6-linux/lib/Pz/PvOctets.cc
---
 v6eval-2.2b6/lib/Pz/PvOctets.cc	2003-12-04 1
3:59:47.000000000 +0900
+++ v6eval-2.2b6-lin
ux/lib/Pz/PvOctets.cc	2004-01-26 14:45:33.000
000000 +0900
@@ -66,6 +66,9 @@ int ether_lin
e __P((const char *, struct
 }
 */
 #endif
+#if defined(__linux__)
+#include 
/ether.h>
+#endif
 #include 
 
 PvOctets::~PvOctets() {
@@ -122,7 +125,11 @
@ PvObject* PvEther::shallowCopy() const {
 
bool PvEther::pton(CSTR p) {
 	if(p==0) {ret
urn false;}
 	struct ether_addr *n=ether_ato
n((char*)p);
+#if defined(__linux__)
+	if(n
!=0) {set(length(),n->ether_addr_octet);}
+#
else
 	if(n!=0) {set(length(),n->octet);}
+
#endif
 	return (n!=0);}
 PvEther::PvEther(
const PvV6Addr& v6,OCTSTR o):PvOctets(sizeof(
etheraddr),o) {
 	multicast(v6);}
diff -urN
p v6eval-2.2b6/lib/Pz/crypto/sha2/sha2.c v6ev
al-2.2b6-linux/lib/Pz/crypto/sha2/sha2.c
---
 v6eval-2.2b6/lib/Pz/crypto/sha2/sha2.c	2003-
04-18 19:46:37.000000000 +0900
+++ v6eval-2.
2b6-linux/lib/Pz/crypto/sha2/sha2.c	2004-01-2
6 14:45:33.000000000 +0900
@@ -39,7 +39,11 @
@
 
 #include 
 #include 
/time.h>
+#if defined(__linux__)
+#include 

+#else
 #include 
.h>
+#endif
 #include 
 #include 
 
diff -urNp v6e
val-2.2b6/lib/pkt/BpfAgent.cc v6eval-2.2b6-li
nux/lib/pkt/BpfAgent.cc
--- v6eval-2.2b6/lib
/pkt/BpfAgent.cc	2002-05-27 18:56:21.00000000
0 +0900
+++ v6eval-2.2b6-linux/lib/pkt/BpfAg
ent.cc	2004-01-26 14:45:33.000000000 +0900
@
@ -134,7 +134,7 @@ bufStat BpfAgent::stat() c
onst{
 	return rc;}
 
 void BpfAgent::clea
r() {
-#if 1
+#if ! defined(__linux__)
 	/
*
 	  In rare case, clear() function is call
ed before filterd out
 	  all sent packets. 
So need to wait all sent packets filtered
di
ff -urNp v6eval-2.2b6/lib/pkt/Bpfilter.cc v6e
val-2.2b6-linux/lib/pkt/Bpfilter.cc
--- v6ev
al-2.2b6/lib/pkt/Bpfilter.cc	2001-10-29 10:41
:34.000000000 +0900
+++ v6eval-2.2b6-linux/l
ib/pkt/Bpfilter.cc	2004-01-26 14:45:33.000000
000 +0900
@@ -53,7 +53,21 @@
 #include 
/bpf.h>
 #include 
 
+#if define
d(__linux__)
+#include     /* fo
r the glibc version number */
+#if __GLIBC__
 >= 2 && __GLIBC_MINOR >= 1
+#include 
cket/packet.h>
+#include    
  /* the L2 protocols */
+#else
+#include <
asm/types.h>
+#include 
+#include    /* The L2 prot
ocols */
+#endif
+#include 
+#endif
+
 Bpfilter::Bpfilter(CSTR n):fd_(-
1),bufsize_(0) {
+#if !defined(__linux__)
 
	int i, fd=-1;
 	char dev[32];
 	struct ifr
eq ifr;
@@ -91,67 +105,159 @@ Bpfilter::Bpfi
lter(CSTR n):fd_(-1),bufsi
 		::close(fd);
 		return;}
 	fd_=fd;}
+#else
+	int i, fd=
-1;
+	char dev[32];
+	struct sockaddr_ll sl
l;
+	
+	fd = socket(PF_PACKET, SOCK_RAW, ht
ons(ETH_P_ALL));
+	if(fd<0) {
+		perror("er
r:open");
+		return;}
+	memset(&sll, 0xff, 
sizeof(sll));
+	sll.sll_family = AF_PACKET;
+	sll.sll_protocol = htons(ETH_P_ALL);
+	if
index_ = if_nametoindex(n);
+	if(ifindex_<0)
 {
+		perror("err:if_nametoindex()");
+		re
turn;}
+	sll.sll_ifindex = ifindex_;
+	int 
rc = bind(fd, (struct sockaddr *)&sll, sizeof
(sll));
+	if(rc<0) {
+		perror("err:bind");
+		return;}
+	bufsize_=BPF_MAXBUFSIZE;
+	
fd_=fd;}
+#endif
 
 int Bpfilter::setfilte
r(struct bpf_program *filter) const {
+#if !
defined(__linux__)
 	int fd=fileDesc();
 	i
f(fd<0) return -1;
 	int rc = ioctl(fd,BIOCS
ETF,filter);
 	if(rc<0){perror("err:ioctl(BI
OCSETF)");}
 	return rc;
 }
+#else
+	/* x
xx: For Linux, "filter ipv6" in tn.def is NOT
 supported */
+	return 0;
+}
+#endif
 
 
int Bpfilter::promiscuous() const {
 	int fd
=fileDesc();
 	if(fd<0) return -1;
+#if !de
fined(__linux__)
 	int rc=ioctl(fd,BIOCPROMI
SC,NULL);
 	if(rc<0) {perror("err:ioctl(BIOC
PROMISC)");}
 	return rc;}
+#else
+	struct
 ifreq ifr;
+	int rc=ioctl(fd,SIOCGIFFLAGS,&
ifr);
+	if(rc<0) {perror("err:ioctl(SIOCGIFF
LAGS)");}
+	ifr.ifr_flags = ifr.ifr_flags | 
IFF_PROMISC;
+	rc=ioctl(fd,SIOCSIFFLAGS,&ifr
);
+	if(rc<0) {perror("err:ioctl(SIOCSIFFLAG
S)");}
+	return 0;}
+#endif
 
 int Bpfilt
er::flush() const {
 	int fd=fileDesc();
 	
if(fd<0) return -1;
+#if !defined(__linux__)
 	int rc=ioctl(fd,BIOCFLUSH,NULL);
 	if(rc
<0) {perror("err:ioctl(BIOCFLUSH)");}
 	retu
rn rc;}
+#else
+	unsigned char buf[2048];
+	int i=0;
+	do {
+		fd_set fds;
+		struct
 timeval t;
+		FD_ZERO(&fds);	
+		FD_SET(fd
, &fds);
+		memset(&t, 0, sizeof(t));
+		i 
= select(FD_SETSIZE, &fds, NULL, NULL, &t);
+		if (i > 0)
+			recv(fd, buf, i, 0);
+	} 
while (i);
+	return 0;}
+#endif
 
 int Bp
filter::immediate(uint32_t n) const {
+#if !
defined(__linux__)
 	int fd=fileDesc();
 	i
f(fd<0) return -1;
 	int rc=ioctl(fd,BIOCIMM
EDIATE,&n);
 	if(rc<0) {perror("err:ioctl(BI
OCIMMEDIATE)");}
 	return rc;}
+#else
+	/*
 xxx: For Linux, tahi works only in immediate
=true mode */
+	return 0;}
+#endif
 
 int
 Bpfilter::statistics(uint32_t& recv,uint32_t
& drop) const {
 	struct bpf_stat stat;
 	i
nt fd=fileDesc();
 	recv=0; drop=0;
 	if(fd
<0) return -1;
+#if !defined(__linux__)
 	i
nt rc=ioctl(fd,BIOCGSTATS,(caddr_t)&stat);
 
	if(rc<0) {perror("err:ioctl(BIOCGSTATS)");}
 	else {recv=stat.bs_recv; drop=stat.bs_drop
;}
 	return rc;}
+#else
+	/* xxx: Linux ca
nnot get per-socket statistics */
+	return 0
;}
+#endif
 
 int Bpfilter::receive(caddr_
t p) const {
 	int fd=fileDesc();
 	if(fd<0
) return -1;
 	uint32_t l=bufferSize();
+#i
f !defined(__linux__)
 	int rc=::read(fd,p,l
);
 	if(rc<0) {perror("err:read");}
 	retur
n rc;}
+#else
+#define SIZEOF_BPF_HDR 18
+
	int rc =recv(fd, (p+SIZEOF_BPF_HDR), (l-SIZE
OF_BPF_HDR), 0);
+	gettimeofday( &((struct b
pf_hdr *)p)->bh_tstamp, 0) ;
+	((struct bpf_
hdr *)p)->bh_caplen = rc;
+	((struct bpf_hdr
 *)p)->bh_datalen =rc + SIZEOF_BPF_HDR;
+	((
struct bpf_hdr *)p)->bh_hdrlen = SIZEOF_BPF_H
DR;
+	if(rc<0) {
+		perror("err:recv");
+	
	return rc;}
+	return (rc+SIZEOF_BPF_HDR);}
+#undef SIZEOF_BPF_HDR
+#endif
 
 int Bpf
ilter::send(caddr_t p, uint32_t l) const {
 
	int fd=fileDesc();
 	if(fd<0) return -1;
 
	if(l>bufferSize()){perror("err:send packet t
oo long");return -1;};
+#if !defined(__linux
__)
 	int rc=::write(fd,p,l);
+#else
+	str
uct sockaddr_ll sll;
+	memset(&sll, 0, sizeo
f(sll));
+	sll.sll_ifindex = ifindex_;
+	in
t rc = sendto(fd, p, l, 0, (struct sockaddr *
)&sll, sizeof(sll));
+#endif
 	if(rc<0) {pe
rror("err:write");}
 	return rc;}
 
 uint3
2_t Bpfilter::getDLT() const {
 	int fd=file
Desc();
 	if(fd<0) return 0xffff; /* xxx */
+#if !defined(__linux__)
 	uint32_t dlt;
 
	int rc=ioctl(fd,BIOCGDLT,&dlt);
 	if(rc<0) 
{perror("err:ioctl(BIOCGSTATS)");}
 	return 
dlt;}
+#else
+	/* Linux assumes ethernet */
+	return DLT_EN10MB;}
+#endif
 
diff -ur
Np v6eval-2.2b6/lib/pkt/Bpfilter.h v6eval-2.2
b6-linux/lib/pkt/Bpfilter.h
--- v6eval-2.2b6
/lib/pkt/Bpfilter.h	2001-10-05 20:41:19.00000
0000 +0900
+++ v6eval-2.2b6-linux/lib/pkt/Bp
filter.h	2004-01-26 14:45:33.000000000 +0900
@@ -51,6 +51,9 @@ struct Bpfilter {
 privat
e:
 	int fd_;
 	uint32_t bufsize_;
+#if de
fined(__linux__)
+	int ifindex_;
+#endif
 
public:
 	Bpfilter(CSTR);
 	int fileDesc() 
const;
diff -urNp v6eval-2.2b6/lib/pkt/LxLex
er.cc v6eval-2.2b6-linux/lib/pkt/LxLexer.cc
--- v6eval-2.2b6/lib/pkt/LxLexer.cc	2003-10-2
3 13:37:30.000000000 +0900
+++ v6eval-2.2b6-
linux/lib/pkt/LxLexer.cc	2004-01-26 14:45:33.
000000000 +0900
@@ -262,7 +262,9 @@ void LxL
exer::initialize() {
 	function(new MfCrypt(
"null_crypt",0,0,1));
 	function(new MfDESCB
C("descbc",8,8,8));
 	function(new MfBLOWFIS
H("blowfish",8,8,8));
+#if ! defined(__linux
__)
 	function(new MfRC5("rc5",8,8,8));
+#e
ndif
 	function(new MfCAST128("cast128",8,8,
8));
 	function(new MfDES3CBC("des3cbc",8*3,
8,8));
 	function(new MfRIJNDAEL("rijndael_1
28",16,16,16));
diff -urNp v6eval-2.2b6/lib/
pkt/Makefile v6eval-2.2b6-linux/lib/pkt/Makef
ile
--- v6eval-2.2b6/lib/pkt/Makefile	2000-0
7-28 16:25:18.000000000 +0900
+++ v6eval-2.2
b6-linux/lib/pkt/Makefile	2004-01-29 16:29:55
.000000000 +0900
@@ -10,4 +10,5 @@ CXXFLAGS+
= -I. -I$(Cm) -I$(Pz) -DHAVE_BP
 
 CLEANFIL
ES+=PzParse.h
 
+MKLINT=no
 .include "bsd.
lib.mk"
diff -urNp v6eval-2.2b6/lib/pkt/PzPa
rse.y v6eval-2.2b6-linux/lib/pkt/PzParse.y
-
-- v6eval-2.2b6/lib/pkt/PzParse.y	2003-01-27 
14:55:23.000000000 +0900
+++ v6eval-2.2b6-li
nux/lib/pkt/PzParse.y	2004-01-26 14:45:33.000
000000 +0900
@@ -175,7 +175,11 @@
 #define 
YYPARSE_PARAM_TYPE LxLexer&
 #define yyparse
(lex)parse(lex)
 #else
+#if ! defined(__lin
ux__)
 #define	yyparse()parse(LxLexer& lexer
)
+#else
+#define	yyparse(void)parse(LxLexe
r& lexer)
+#endif
 #endif
 #define	yylex()
lexer.lex(compound_)
 #define yyerror lexer.
yaccError
diff -urNp v6eval-2.2b6/lib/pkt/Ru
nEnv.cc v6eval-2.2b6-linux/lib/pkt/RunEnv.cc
--- v6eval-2.2b6/lib/pkt/RunEnv.cc	2003-10-2
3 13:37:31.000000000 +0900
+++ v6eval-2.2b6-
linux/lib/pkt/RunEnv.cc	2004-01-26 14:45:33.0
00000000 +0900
@@ -51,6 +51,9 @@
 #include 

 #include 
 #incl
ude 
+#if defined(__linux__)
+#in
clude 
+#endif
 IfName::IfName(CSTR
 n,CSTR i,CSTR e):CmCString(n),interface_(i),
ether_(e) {}
 IfName::~IfName() {}
 IfName*
 IfName::create(CSTR n,CSTR i,CSTR m,CSTR fil
e,uint32_t line) {
diff -urNp v6eval-2.2b6/l
order v6eval-2.2b6-linux/lorder
--- v6eval-2
.2b6/lorder	1970-01-01 09:00:00.000000000 +09
00
+++ v6eval-2.2b6-linux/lorder	2004-01-29 
16:34:20.000000000 +0900
@@ -0,0 +1,6 @@
+#
!/bin/sh
+#
+# *** This is a dummy lorder o
nly for compiling TAHI on Linux ***
+#
+whi
le [ $1 ]; do echo $1; shift; done;
+exit 0;