Date: Wed, 21 Nov 2007 08:05:21 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 129334 for review Message-ID: <200711210805.lAL85LxC006029@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=129334 Change 129334 by zhouzhouyi@zhouzhouyi_mactest on 2007/11/21 08:04:37 style modification Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tcpconnect.c#3 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/bpf/00.t#2 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tcpconnect.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/tools/regression/mactest/tcpconnect.c,v 1.4 2005/05/16 00:54:47 rwatson Exp $ + * $FreeBSD$ */ #include <pcap.h> #include <sysexits.h> @@ -60,7 +60,7 @@ void my_callback(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_char* packet) { - printf("bpf received!"); + printf("bpf received!\n"); exit(0); } @@ -383,9 +383,11 @@ err(1, "waiter: semop -1"); - logfd = open("/dev/mactest", O_RDWR); + logfd = open("LOGDEV", O_RDWR); ioctl(logfd, BEGINLOG, NULL); + + if ((pid = fork()) == 0) tcpconnect_server(serveraddress, port); @@ -402,7 +404,9 @@ if (waitpid(pid, 0, 0) == -1) fprintf(stderr, "server error\n"); + close(logfd); + if (semctl(semid, 0, IPC_RMID) == -1) warn("semctl IPC_RMID"); if (semctl(semid1, 0, IPC_RMID) == -1) ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/bpf/00.t#2 (text+ko) ==== @@ -1,5 +1,5 @@ #!/bin/sh -# $FreeBSD: src/tools/regression/mactest/tests/bpf/00.t,v 1.2 2007/01/25 20:50:02 zhouzhouyi Exp $ +# $FreeBSD$ desc="test of bpf" @@ -7,79 +7,75 @@ dir=`dirname $0` . ${dir}/../misc.sh -echo "1..2" +case "${os}" in +FreeBSD) + + mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null` + mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null` + mac_test_support=`sysctl -n security.mac.test.pseudoinit 2>/dev/null` + if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] && + [ "${mac_test_support}" != "" ]; then #turn off all the switches -for i in `sysctl security.mac | grep "\.enabled"| - sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do -sysctl ${i}=0 -done + for i in `sysctl security.mac | grep "\.enabled"| + sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do + sysctl ${i}=0 >/dev/null + done -mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null` -mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null` -mac_test_support=`sysctl -n security.mac.test.pseudoinit 2>/dev/null` - +#enabling mactest pseudo interface + t=`sysctl security.mac.test.pseudoinit=1` + t=`ifconfig mac_test0 192.167.0.33` + t=`ifconfig mac_test1 192.167.1.34` -if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] && - [ "${mac_test_support}" != "" ]; then - dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; - - - if [ -f ${mactest_conf} ]; then - rm ${mactest_conf} - fi - touch ${mactest_conf} - - t=`sysctl security.mac.test.pseudoinit=1` - t=`ifconfig mac_test0 192.167.0.33` - t=`ifconfig mac_test1 192.167.1.34` - echo "enabling mactest pseudo interface" - #ensuring there is no firewall thing - notreceived=`${macping} -f ${mactest_conf} -t 2 192.167.0.34` - if [ "${#notreceived}" -eq 0 ]; then + if [ -f ${mactest_conf} ]; then + rm ${mactest_conf} + fi + touch ${mactest_conf} + setfmac "mls/equal,biba/equal" ${mactest_conf} + + notreceived=`${macping} -f ${mactest_conf} -t 2 192.167.0.34` + + if [ "${#notreceived}" -eq 0 ]; then - + echo "1..2" +#case 1: bpf descriptor's label matches that of mbuf's + ifconfig mac_test1 maclabel \ + "mls/5(4-7),biba/5(4-7)" + ifconfig mac_test0 maclabel \ + "mls/5(4-7),biba/5(4-7)" -############################################################# - - - - -#case 1: bpf descriptor's label matches that of mbuf's - ifconfig mac_test1 maclabel \ - "mls/5(4-7),biba/5(4-7)" - ifconfig mac_test0 maclabel \ - "mls/5(4-7),biba/5(4-7)" - touch ${mactest_conf} - setfmac "mls/equal,biba/equal" ${mactest_conf} - t=`sysctl security.mac.mls.enabled=1` - echo "enabling mac/mls!" - echo "enabling mac/biba!" - t=`sysctl security.mac.biba.enabled=1` - bizarretestexpect ${tcpconnect} "" "bpf.received!" \ - -f ${mactest_conf} -t 2 -b "mls/5(4-7),biba/5(4-7)" \ - -s 192.167.0.33 -c 192.167.1.33 -p 1111 + sysctl security.mac.mls.enabled=1 >/dev/null + sysctl security.mac.biba.enabled=1 > /dev/null + + bizarretestexpect ${tcpconnect} "" "bpf.received!" \ + -f ${mactest_conf} -t 2 -b "mls/5(4-7),biba/5(low-high)" \ + -s 192.167.0.33 -c 192.167.1.33 -p 1111 #case 2: bpf descriptor's label doesnot matches that of mbuf's - ifconfig mac_test0 maclabel \ - "mls/6(4-7),biba/5(4-7)" - echo -n "pid = -2 mac_test_check_bpfdesc_receive:" > ${mactest_conf} - echo "biba/5,mls/5 biba/5(4-7),mls/6(4-7)" >> ${mactest_conf} - bizarretestexpect ${tcpconnect} "" \ - "" -f ${mactest_conf} -t 2 -b "mls/5(4-7),biba/5(4-7)" \ - -s 192.167.0.33 -c 192.167.1.33 -p 1111 + ifconfig mac_test0 maclabel \ + "mls/6(4-7),biba/5(4-7)" + echo -n "pid = -2 bpfdesc_check_receive:" > ${mactest_conf} + echo "biba/5,mls/5 biba/5(4-7),mls/6(4-7)" >> ${mactest_conf} + bizarretestexpect ${tcpconnect} "" \ + "" -f ${mactest_conf} -t 2 -b "mls/5(4-7),biba/5(low-high)" \ + -s 192.167.0.33 -c 192.167.1.33 -p 1112 #cleanup: - t=`sysctl security.mac.mls.enabled=0` - echo "disabling mac/mls!" - t=`sysctl security.mac.biba.enabled=0` - echo "disabling mac/biba!" - rm ${mactest_conf} - fi + sysctl security.mac.mls.enabled=0 >/dev/null + sysctl security.mac.biba.enabled=0 > /dev/null + rm ${mactest_conf} +#ping received, no firewall + fi +#mac_mls mac_biba and mac_test support + fi + ;; +*) + quick_exit + ;; +esac -fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711210805.lAL85LxC006029>