Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 1999 08:22:33 -0700 (MST)
From:      John Reynolds~ <jreynold@sedona.ch.intel.com>
To:        freebsd-stable@freebsd.org
Subject:   defaultrouter variable in /etc/rc.conf -- Used?
Message-ID:  <14388.6585.781834.681200@hip186.ch.intel.com>

next in thread | raw e-mail | index | archive | help

Hello all,

First off, I'd like to thank every single person who ever contributed a line of
code or docs to FreeBSD! I've recently put togther a small machine to act as a
firewall and gateway for a home network (connected to cable modem) and the code
and docs have just been wonderful (when I don't have to ask a question, it's
straight forward <grin>)!

However, I've run into something that has bewildered me in the setup for one of
my networked machines (behind firewall).

I needed to add a default route so that all packets would be sent to the
gateway. No problem. A little looking around at /etc/defaults/rc.conf and the
man page for said file and I find:

  defaultrouter
               (str) If not set to NO then create a default route to this
               host name or IP address (use IP address value if you also
               require this router to get to a name server!)

Great! Sounds like just what I need. However, upon rebooting, things did not
work as expected. I track things down to the following code in rc.network
(my machine has been freshly CVSuped and mergemastered).

    # Configure routing

    if [ "x$defaultrouter" != "xNO" ] ; then
            static_routes="default ${static_routes}"
            route_default="default ${defaultrouter}"
    fi
    
    # Set up any static routes.  This should be done before router discovery.
    if [ "x${static_routes}" != "x" ]; then
            for i in ${static_routes}; do
                    eval route_args=\$route_${i}
                    route add ${route_args}
            done
    fi

So, $defaultrouter is appended to the string "default " and set into the
route_default variable. Fine. However, route_default isn't used ANYWHERE in
this file nor seen in any other rc* files. ? Additionally, even if you don't
have a list of static routes in your /etc/rc.conf, the "if" section for the
static routes will execute (and not do very much but make "route" commands that
fail due to incorrect usage) because the static_routes variable is prepended
with "default " too ("x${static_routes}" != "x" is always true).

I think I understand what the defaultrouter variable in rc.conf was supposed to
trigger. I'm less clueful as to what static_routes is supposed to accomplish,
but my local hack to make things work the way I needed them was to make this
section of rc.network appear as follows:

    if [ "x$defaultrouter" != "xNO" ] ; then
#           static_routes="default ${static_routes}"
#           route_default="default ${defaultrouter}"
            route add default ${defaultrouter}
    fi

Now upon boot, the proper "route add default" command is run with my value for
defaultrouter and the static_routes "if" statement doesn't trigger anything to
happen (which seems to be okie dokie to me).

Is defaultrouter a deprecated variable in defaults/rc.conf? It doesn't appear
to be. If not, is the above what "should be" in rc.network to accomplish this
default route? Finally, why was the static_route variable being prepended with
the word "default " too? What is the appropriate thing to do with static_routes
from rc.conf?

I have things working "ok for me" but I figured with Jordan's message yesterday
about a code slush coming at the end of this month, I'd better bring this up so
that we get it fixed.

-Jr

ps: I did not send-pr this because I'm not sure what the "static_routes"
variable "should do" ....

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| John Reynolds               CEG, CCE, Next Generation Flows, HLA          |
| Intel Corporation      MS: CH6-210   Phone: 480-554-9092   pgr: 868-6512  |
| jreynold@sedona.ch.intel.com  http://www-aec.ch.intel.com/~jreynold/      |
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14388.6585.781834.681200>