*BSD News Article 49465


Return to BSD News archive

#! rnews 2753 bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!daffy!uwvax!uwm.edu!math.ohio-state.edu!sol.ctr.columbia.edu!startide.ctr.columbia.edu!wpaul
From: wpaul@ctr.columbia.edu (Bill Paul)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: How to set up routing tables?
Date: 21 Aug 1995 18:20:03 GMT
Organization: Columbia University Center for Telecommunications Research
Lines: 52
Message-ID: <41aiok$fnk@sol.ctr.columbia.edu>
References: <ARNULF.95Aug17095614@arnulf.dialup.fu-berlin.de> <411n6s$e62@bonnie.tcd-dresden.de> <415a6d$eui@sol.ctr.columbia.edu> <419qij$r1h@bonnie.tcd-dresden.de>
NNTP-Posting-Host: startide.ctr.columbia.edu
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se,
J Wunsch (j@bonnie.heep.sax.de) had the courage to say:

: Bill Paul <wpaul@ctr.columbia.edu> wrote:

[munch]

: >
: ># echo "set ipforwarding = 1" | gdb -k -w /vmunix /dev/mem

: Won't work in FreeBSD though.  (I think you'll get a ``Readonly file
: system'' or so.)

It does too work in FreeBSD (2.0.5 and up, anyway):

skynet# sysctl -a |& grep forward
net.inet.ip.forwarding = 0
skynet# echo "set ipforwarding = 1" | gdb -k -w /vmunix /dev/mem
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.13 (i386-unknown-freebsd), 
Copyright 1994 Free Software Foundation, Inc...(no debugging symbols found)...
IdlePTD 192000
current pcb at 262000
#0  0xf010bb03 in mi_switch ()
(kgdb) (kgdb) skynet#
skynet# sysctl -a |& grep forward
net.inet.ip.forwarding = 1

(I wouldn't have posted it if I hadn't already tried it myself. :)
If you omit the -w flag, _then_ you'll get an error from kvm_write()
about not being able to change the variable value.

: I rather like the sysctl version.  It's less error-prone and allows
: the kernel some sort of control (e.g. you can have read/only
: variables).

Aw, c'mon: blowing up the system by accidentally splattering junk
all over kernel memory with the debugger is half the fun of running
UNIX. :) Granted sysctl is nice, but gdb has its advantages too.

-Bill

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~T~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Bill Paul            (212) 854-6020 | System Manager
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Møøse Illuminati: ignore it and be confused, or join it and be confusing!
~~~~~~ "Welcome to All Things BSDish! If it's not BSDish, it's crap!" ~~~~~~~