Browse Source

Integration of rock-net (0.0.3) - this is mostly tested and

some cleanups need to be done - as well as a updated rock-net core
is scheduled for tonight.


git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@1821 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
rocklinux
Rene Rebe 21 years ago
parent
commit
a9bbbe3c75
17 changed files with 347 additions and 77 deletions
  1. +4
    -0
      Documentation/Developers/CHANGELOG-RENE
  2. +3
    -0
      package/base/dhcp/dhcp.conf
  3. +6
    -0
      package/base/dhcp/rocknet_dhcp.sh
  4. +4
    -2
      package/base/iproute2/iproute2.conf
  5. +0
    -67
      package/base/iproute2/network.conf
  6. +3
    -6
      package/base/iproute2/network.init
  7. +19
    -0
      package/base/iproute2/rocknet_iproute2.sh
  8. +3
    -0
      package/base/iptables/iptables.conf
  9. +49
    -0
      package/base/iptables/rocknet_iptables.sh
  10. +17
    -0
      package/base/sysfiles/ifup.sh
  11. +80
    -0
      package/base/sysfiles/rocknet.sh
  12. +46
    -0
      package/base/sysfiles/rocknet_modules_base.sh
  13. +19
    -0
      package/base/sysfiles/rocknet_modules_script.sh
  14. +12
    -0
      package/base/sysfiles/rocknet_modules_sysctl.sh
  15. +10
    -1
      package/base/sysfiles/sysfiles.conf
  16. +69
    -0
      package/base/wireless-tools/rocknet_wireless.sh
  17. +3
    -1
      package/base/wireless-tools/wireless-tools.conf

+ 4
- 0
Documentation/Developers/CHANGELOG-RENE

@ -1,4 +1,8 @@
*) 2003-11-20 (2.0.0-rc2 - 2.0.0-rc3)
- integrated rock-net (0.0.3)
*) 2003-11-19 (2.0.0-rc2 - 2.0.0-rc3)
- Juergen Sawinski: fixed typo in xfce4/xffm

+ 3
- 0
package/base/dhcp/dhcp.conf

@ -30,6 +30,8 @@ EOP
pm_dhcp() {
cp -v doc/* client/dhclient.conf server/dhcpd.conf $docdir
install_init dhcp $confdir/dhcp.init
cp -v $confdir/rocknet_dhcp.sh \
$root/etc/network/modules/dhcp.sh
}
confopt=""
@ -37,3 +39,4 @@ var_append makeopt ' ' 'CC_OPTIONS="-DPARANOIA -DEARLY_CHROOT"'
preconf="pre_dhcp"
postmake="pm_dhcp"

+ 6
- 0
package/base/dhcp/rocknet_dhcp.sh

@ -0,0 +1,6 @@
public_dhcp() {
addcode up 5 5 "/sbin/dhclient -q $if"
addcode down 5 5 "killall -15 dhclient"
}

+ 4
- 2
package/base/iproute2/iproute2.conf

@ -33,8 +33,10 @@ ipr2_pm() {
[ -f $root/$x ] || cp -v $x $root/$x
done
cp -v $confdir/network.conf $root/etc/conf/network
install_init network $confdir/network.init
cp -v $confdir/rocknet_iproute2.sh \
$root/etc/network/modules/iproute2.sh
install_init network $confdir/network.init
install_init netfs $confdir/netfs.init
$CC -O2 $confdir/ipnm2nwbc.c -o $root/sbin/ipnm2nwbc

+ 0
- 67
package/base/iproute2/network.conf

@ -1,67 +0,0 @@
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/iproute2/network.conf
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# This file defines two shell functions: start_net() and stop_net()
#
# This functions are called by /etc/init.d/network to set up and shut
# down the networking stuff. In most cases its enought to change this
# variables. If your setup is more complex you need to rewrite the
# functions below.
#
DHCP="on"
IF="eth0"
IPADDR="192.168.5.10/24"
GATEWAY="192.168.5.1"
#
# start and stop functions (called by /etc/init.d/network)
#
xx() { echo ">> $*" ; eval "$*" ; return $? ; }
start_net() {
if [ -f /etc/mactab ]; then
xx nameif -c /etc/mactab
fi
if [ ".$DHCP" = ".on" ]; then
xx /sbin/dhclient -q $IF
else
xx ip link set $IF up
for addr in $IPADDR; do
xx ip addr add $addr dev $IF
done
[ "$GATEWAY" ] && xx ip route add default via $GATEWAY
fi
return 0
}
stop_net() {
if [ ".$DHCP" = ".on" ]; then
xx killall -15 /sbin/dhclient
fi
xx ip route del default
xx ip addr flush dev $IF
xx ip link set $IF down
return 0
}

+ 3
- 6
package/base/iproute2/network.init

@ -26,18 +26,15 @@
# Runlevel: 15 rcX rc3 rc4 rc5
#
. /etc/conf/network
main_begin
block_begin(start, `Setting up network devices.')
check(`start_net')
block_split(`Setting domainname using dnsdomainname.')
check(`[ "$(dnsdomainname)" ] && domainname "$(dnsdomainname)"')
[ -x /etc/network/getprofile ] && /etc/network/getprofile
check(`/etc/network/rocknet auto auto up')
block_end
block_begin(stop, `Shutting down network devices.')
check(`stop_net')
check(`/etc/network/rocknet auto auto down')
block_end
main_end

+ 19
- 0
package/base/iproute2/rocknet_iproute2.sh

@ -0,0 +1,19 @@
iproute2_init_if() {
if isfirst "iproute2_$if"; then
addcode up 5 4 "ip link set $if up"
addcode down 5 4 "ip link set $if down"
addcode down 5 5 "ip addr flush dev $if"
fi
}
public_ip() {
addcode up 5 5 "ip addr add $1 dev $if"
iproute2_init_if
}
public_gw() {
addcode up 6 5 "ip route add default via $1 dev $if"
iproute2_init_if
}

+ 3
- 0
package/base/iptables/iptables.conf

@ -25,3 +25,6 @@ var_append makeinstopt ' ' "PREFIX=$root/$prefix BINDIR=$root/sbin"
runconf=0
hook_add postmake 5 "cp -v $confdir/rocknet_iptables.sh \
$root/etc/network/modules/iptables.sh"

+ 49
- 0
package/base/iptables/rocknet_iptables.sh

@ -0,0 +1,49 @@
iptables_init_if() {
if isfirst "iptables_$if"; then
addcode up 1 1 "iptables -N firewall_$if"
addcode up 1 2 "iptables -A INPUT -i $if -j firewall_$if"
addcode up 1 3 "iptables -A firewall_$if `
`-m state --state ESTABLISHED,RELATED -j ACCEPT"
addcode down 1 3 "iptables -F firewall_$if"
addcode down 1 2 "iptables -D INPUT -i $if -j firewall_$if"
addcode down 1 1 "iptables -X firewall_$if"
fi
}
iptales_parse_conditions() {
iptables_cond=""
while [ -n "$1" ]
do
case "$1" in
all)
shift
;;
tcp|udp)
iptables_cond="$iptables_cond -p $1 --dport $2"
shift; shift
;;
ip)
iptables_cond="$iptables_cond -s $2"
shift; shift
;;
*)
error "Unkown allow/deny condition: $1"
shift
esac
done
}
public_allow() {
iptales_parse_conditions "$@"
addcode up 1 5 "iptables -A firewall_$if $iptables_cond -j ACCEPT"
iptables_init_if
}
public_deny() {
iptales_parse_conditions "$@"
addcode up 1 5 "iptables -A firewall_$if $iptables_cond -j REJECT"
iptables_init_if
}

+ 17
- 0
package/base/sysfiles/ifup.sh

@ -0,0 +1,17 @@
#!/bin/sh
useage() {
echo "Useage: $0 interface [ profile ]"
exit 1
}
[ "$1" ] || useage
if [ "$2" = "" ] ; then
profile="`cat /etc/network/profile`"
else
profile="$2"
fi
/etc/network/rocknet $1 $2 ${x#if}

+ 80
- 0
package/base/sysfiles/rocknet.sh

@ -0,0 +1,80 @@
#!/bin/bash
rocknet_debug=1
rocknet_base="/etc/network"
unset code_snipplets_idx code_snipplets_dat code_snipplets_counter
declare -a code_snipplets_idx='()'
declare -a code_snipplets_dat='()'
code_snipplets_counter=0
lineno=0
ignore=0
if [ "$3" != "up" -a "$3" != "down" ]; then
echo "Usage: $0 { profile | default } { interface | auto } { up | down }"
exit 1
fi
profile=$1
interface=$2
mode=$3
#
# addcode mode major-priority minor-priority code1
#
addcode() {
[ "$mode" != "$1" ] && return
[ "$ignore" -gt 0 ] && return
if [ "$1" = "up" ]; then udo="+"; else udo="-"; fi
code_snipplets_idx[code_snipplets_counter]="`
printf '%04d.%04d.%04d' $((5000$udo$2)) $((5000$udo$lineno)) \
$((5000$udo$3))` $code_snipplets_counter"
code_snipplets_dat[code_snipplets_counter]="$4"
(( code_snipplets_counter++ ))
}
#
# isfirst unique-id
#
isfirst() {
[ "$ignore" -gt 0 ] && return 0
eval "\$isfirst_$1"
eval "isfirst_$1='return 1'"
return 0
}
#
# error error-message
#
error() {
echo "$*"
}
for x in "$rocknet_base"/modules/*.sh; do . "$x"; done
while read cmd para
do
(( lineno++ ))
if [ -n "$cmd" ]; then
cmd="${cmd//-/_}"
para="$( echo "$para" | sed 's,[\*\?],\\&,g' )"
if declare -f public_$cmd > /dev/null
then
public_$cmd $para
else
error "Unknown statement in config file: $cmd"
fi
fi
done < <( sed 's,#.*,,' < "$rocknet_base"/config )
while read id1 id2; do
if [ "$rocknet_debug" = 1 ]; then
echo ">> $id1 -> $id2: ${code_snipplets_dat[id2]}"
fi
eval "${code_snipplets_dat[id2]}"
done < <(
for x in "${code_snipplets_idx[@]}"; do echo "$x"
done | sort
)

+ 46
- 0
package/base/sysfiles/rocknet_modules_base.sh

@ -0,0 +1,46 @@
if="none"
declare -a auto_if=()
auto_if[0]="*"
public_auto() {
auto_if=()
for x in "$@"; do
a="${x%(*}"; b="${x#*(}"
b="${b#)}"; b="${b//,/ }"
if [ "$a" = "$b" ]; then
auto_if[${#auto_if[*]}]="$a"
else
for x in $b; do
[ "$x" = "$profile" ] && \
auto_if[${#auto_if[*]}]="$a"
done
fi
done
}
public_interface() {
ignore=1 if="${1%(*}"
local prof="${1#*(}"
prof="${prof/)}"; prof="${prof//,/ }"
if [ "$if" = "$prof" ]; then
ignore=0
else
for x in $prof; do
[ "$x" = "$profile" ] && ignore=0
done
fi
if [ "$ignore" = 0 ]; then
if [ "$if" = "auto" ]; then
ignore=1
for x in "${auto_if[@]}"; do
[[ "$if" == $x ]] && ignore=0
done
else
[ "$if" = "$interface" ] || ignore=1
fi
fi
}

+ 19
- 0
package/base/sysfiles/rocknet_modules_script.sh

@ -0,0 +1,19 @@
public_script() {
local a="$1"; shift
addcode up 5 5 "$a up $*"
addcode down 5 5 "$a down $*"
}
public_run_up() {
addcode up 5 5 "$*"
}
public_run_down() {
addcode down 5 5 "$*"
}
public_code() {
addcode $1 $2 5 "$3"
}

+ 12
- 0
package/base/sysfiles/rocknet_modules_sysctl.sh

@ -0,0 +1,12 @@
public_forward() {
if [ "$if" != "none" ]; then
error "Keyword >>forward<< not allowed" \
"in an interface section."
return
fi
[ "$interface" != all ] && return
addcode up 9 5 "echo 1 > /proc/sys/net/ipv4/ip_forward"
addcode down 9 5 "echo 0 > /proc/sys/net/ipv4/ip_forward"
}

+ 10
- 1
package/base/sysfiles/sysfiles.conf

@ -25,7 +25,7 @@ main_sf() {
cd $root/
echo "Creating various etc/* files ..."
mkdir -p etc/conf etc/rc.d etc/stone.d
mkdir -p etc/conf etc/rc.d etc/stone.d etc/network
for x in $( cd $confdir ; echo etc_*.txt ) ; do
y="${x%.txt}" ; z="/"
if [ -f "${y//_/$z}" ]
@ -65,6 +65,15 @@ EOT
cp -v $confdir/$x etc/stone.d/${x#stone_}
done
echo "Installing the rock-net tool ..."
cp -v $confdir/rocknet.sh etc/network/rocknet
chmod +x etc/network/rocknet ; mkdir -p etc/network/modules
for x in $( cd $confdir ; echo rocknet_*.sh ) ; do
dst="${x#rocknet_}" ; z="/"
dst="${dst//_/$z}"
cp -v $confdir/$x etc/network/$dst
done
echo "Create /etc/issue, /etc/issue.ansi and /etc/issue.net ... "
rocktxt="ROCK Linux $rockver $arch"
. $confdir/issue-std.sh

+ 69
- 0
package/base/wireless-tools/rocknet_wireless.sh

@ -0,0 +1,69 @@
public_essid() {
addcode up 4 5 "iwconfig $if essid $*"
}
public_nwid() {
addcode up 4 5 "iwconfig $if nwid $*"
}
public_domain() {
addcode up 4 5 "iwconfig $if domain $*"
}
public_freq() {
addcode up 4 5 "iwconfig $if freq $*"
}
public_channel() {
addcode up 4 5 "iwconfig $if channel $*"
}
public_sens() {
addcode up 4 5 "iwconfig $if sens $*"
}
public_mode() {
addcode up 4 4 "iwconfig $if mode $*"
}
public_ap() {
addcode up 4 5 "iwconfig $if ap $*"
}
public_nick() {
addcode up 4 5 "iwconfig $if nick $*"
}
public_rate() {
addcode up 4 5 "iwconfig $if rate $*"
}
public_rts() {
addcode up 4 5 "iwconfig $if rts $*"
}
public_frag() {
addcode up 4 5 "iwconfig $if frag $*"
}
public_key() {
addcode up 4 5 "iwconfig $if key $*"
}
public_power() {
addcode up 4 5 "iwconfig $if power $*"
}
public_txpower() {
addcode up 4 5 "iwconfig $if txpower $*"
}
public_retry() {
addcode up 4 5 "iwconfig $if retry $*"
}
public_commit() {
addcode up 4 9 "iwconfig $if commit"
}

+ 3
- 1
package/base/wireless-tools/wireless-tools.conf

@ -20,7 +20,9 @@
#
# --- ROCK-COPYRIGHT-NOTE-END ---
var_append makeopt " " "PREFIX=$root/$prefix"
var_append makeinstopt " " "PREFIX=$root/$prefix"
hook_add postmake 5 "cp -v $confdir/rocknet_wireless.sh \
$root/etc/network/modules/wireless.sh"

Loading…
Cancel
Save