⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run_test_sresolv

📁 Internet Phone, Chat, Conferencing
💻
字号:
#! /bin/bash## Run sresolv_test using our own name server## --------------------------------------------------------------------## This file is part of the Sofia-SIP package## Copyright (C) 2005 Nokia Corporation.## Contact: Pekka Pessi <pekka.pessi@nokia.com>## This library is free software; you can redistribute it and/or# modify it under the terms of the GNU Lesser General Public License# as published by the Free Software Foundation; either version 2.1 of# the License, or (at your option) any later version.## This library is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# Lesser General Public License for more details.## You should have received a copy of the GNU Lesser General Public# License along with this library; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA# 02110-1301 USA## --------------------------------------------------------------------## Author(s): Pekka Pessi <Pekka.Pessi@nokia.com>.##set -xs=${0%/*}test x$s = x$0 && s=`pwd`PATH=/usr/sbin:/usr/local/sbin:/sbin:$PATHexport PATHport=$((($$ % $((65536 - 1024))) + 1024))ipv6='sysctl net.ipv6.conf.default.mtu >& /dev/null'# Bind not working with IPv6 on RHEL 4:# client.c:1325: unexpected error: failed to get request's destination: failureipv6=false# Try to find a free portif netstat --ip >/dev/null 2>&1 ; then    while netstat --ip -n -a | fgrep -q ":$port "    do	port=$(($port + 1))	if [$port = 65536] ; then	    port=1024	fi    donefiif eval $ipv6 &&    ns=$(ip addr ls | awk '   /^[0-9]:/ { up = ($3 ~ /UP/) && ($3 !~ /LOOPBACK/); }   up && $1 ~ /inet6/ { sub(/\/.*$/, "", $2); print $2; exit 0; }')then    listen6="listen-on-v6 port $port { any; };"else    ns="127.0.0.1"    listen4="listen-on port $port { 127.0.0.1; };"fi## We set up a DNS server at $ns#cat > resolv.conf <<EOF# Zeroconf subnet, reserved range - no-one should answer thisnameserver 169.254.0.2nameserver fe80::2nameserver $nsdomain example.comport $portEOFcat > error.conf <<EOFnameserver 0.0.0.2nameserver 1.1.1.1.1search example.comport $portEOFcat > named.conf.tmp <<EOFoptions {	directory "$(cd $s; pwd)";	pid-file "`pwd`/named.pid";	notify no;	$listen6	$listen4};zone "example.com" in {        type master;        file "example.com";};zone "." in {        type master;        file "root.zone";};zone "188.2.194.in-addr.arpa" in {        type master;	file "194.2.188";};zone "0.0.127.in-addr.arpa" in {        type master;	file "127.zone";};zone "0.0.0.c.2.1.0.3.0.0.2.1.e.f.f.3.ip6.int" in {        type master;	file "3.f.f.e.1.2.0.0.3.0.1.2.c.0.0.0";};EOFPATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"#echo $port; sleep 200 & echo sleep pid is $! ; wait $!type -p named >/dev/null || exit 77#named -d5 -c named.conf.tmp || exit 77 &named -f -d 999 -c named.conf.tmp &echo $0: started named pid $!for i in 1 2 3 4 5; do    test -r named.pid && break    sleep 1; donetest -r named.pid || {     echo $0: cannot start named >&2 ;     if fgrep -q -i -e SELINUX=enforcing /etc/selinux/config ; then	echo $0: perhaps you have to disable SELinux protection for named     fi    exit 77}function kill_named{    kill `cat named.pid`}trap kill_named EXIT# export SOFIA_DEBUG=9$VALGRIND ./test_sresolv "$@" - resolv.conf error.conf timeout.conf || exit 1exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -