routes from ippool.conf

From: Victor M. Blood <freebsd_at_masm.elcom.ru>
Date: Sun, 11 Nov 2007 05:23:08 +0300
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="<table name> <table name> ... "
ippool_static_routes_gw="<addr for route>"

May be need to add more what one GW? or addign in one line, as
<tablename> <GW> <tablename> <GW> ... ?, 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
_at__at_ -48,6 +48,35 _at__at_
                        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
_at__at_ -56,6 +85,7 _at__at_
                        atmconfig natm add ${route_args}
                done
        fi
+       
 }
 
 options_start()

-- 
With all regards, Victor M. Blood.     mailto: freebsd_at_masm.elcom.ru
FTN: 2:5024/1.95_at_Fidonet.org, ICQ#3567656
Received on Sun Nov 11 2007 - 01:23:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:21 UTC