From owner-freebsd-current@FreeBSD.ORG Sun Nov 11 02:23:21 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C63B16A417 for ; Sun, 11 Nov 2007 02:23:21 +0000 (UTC) (envelope-from freebsd@masm.elcom.ru) Received: from smtp.elcom.ru (smtp.elcom.ru [84.53.200.28]) by mx1.freebsd.org (Postfix) with ESMTP id 2159D13C4A5 for ; Sun, 11 Nov 2007 02:23:21 +0000 (UTC) (envelope-from freebsd@masm.elcom.ru) Received: by smtp.elcom.ru (Postfix, from userid 65534) id 972403D8C2F; Sun, 11 Nov 2007 05:23:02 +0300 (MSK) Received: from VMHOST (dsl-212-78.elcom.ru [84.53.212.78]) by smtp.elcom.ru (Postfix) with ESMTP id 6C2933D86E9 for ; Sun, 11 Nov 2007 05:23:02 +0300 (MSK) Date: Sun, 11 Nov 2007 05:23:08 +0300 From: "Victor M. Blood" X-Mailer: The Bat! (v3.80.06) Professional Organization: Home Programming Inc. X-Priority: 3 (Normal) Message-ID: <324179041.20071111052308@masm.elcom.ru> To: All MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: routes from ippool.conf X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-current@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Nov 2007 02:23:21 -0000 Hi, All. I need to adding static routes from some tables in /etc/ippool.conf, may be it's require for any one and may be adding to rc scripts "for use"... sorry for my programming for /bin/sh . in /etc/rc.conf I added two lines ippool_static_routes="
... " ippool_static_routes_gw="" May be need to add more what one GW? or addign in one line, as ... ?, sorry, I don't know how to do it. :( The file ippool.conf should be formatted as follows: ... #Net num 1 table role = ipf type = tree name = table1 { #may be comment 1.2.3.4/5; ... }; ... scripts read /etc/ippool.conf (can be changed in /etc/rc.d/routing) and search for ONLY TABLE NAME! may be need to search full line to prevent errors? patch to /etc/rc.d/routing: --- /root/backup/routing 2007-11-11 04:33:08.000000000 +0300 +++ ./routing 2007-11-11 05:21:18.000000000 +0300 @@ -48,6 +48,35 @@ route add ${route_args} done fi + # Setup static routes from ippool.conf + ippool_file="/etc/ippool.conf" + + if [ \( -n "${ippool_static_routes}" \) -a \( -n "${ippool_static_routes_gw}" \) -a \( -f "${ippool_file}" \) ]; then +# tn_prefix="table role = ipf type = tree name = " +# tn_postfix=" }" + ippool_cnt=`cat ${ippool_file}` + process=0 + collected="" + + for i in ${ippool_static_routes}; do + for k in ${ippool_cnt}; do + if [ $process -eq 1 ]; then + if [ "${k}" = "};" ]; then + process=0 + break + elif [ "${k}" = "{" ]; then + else + val=$(echo $k | grep -Go '[0-9]*.[0-9]*.[0-9]*.[0-9]*/[0-9]*') + if [ -n "${val}" ]; then + route add ${val} ${ippool_static_routes_gw} + fi + fi + elif [ "${i}" = "${k}" ]; then + process=1 + fi + done + done + fi # Now ATM static routes # if [ -n "${natm_static_routes}" ]; then @@ -56,6 +85,7 @@ atmconfig natm add ${route_args} done fi + } options_start() -- With all regards, Victor M. Blood. mailto: freebsd@masm.elcom.ru FTN: 2:5024/1.95@Fidonet.org, ICQ#3567656