summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2005-11-05 06:31:33 +0000
committerChristian Heim <phreak@gentoo.org>2005-11-05 06:31:33 +0000
commitc19e259b2b3334adde61c3db89774b9db41b8704 (patch)
treed6aa04fd4bd07e9bb83abae6d63f7cb9c7b82c2f
parentMerging changes from baselayout 1583 (diff)
downloadbaselayout-vserver-c19e259b2b3334adde61c3db89774b9db41b8704.tar.gz
baselayout-vserver-c19e259b2b3334adde61c3db89774b9db41b8704.tar.bz2
baselayout-vserver-c19e259b2b3334adde61c3db89774b9db41b8704.zip
Merging changes between baselayout r1583 and r1596.
svn path=/baselayout-vserver/trunk/; revision=64
-rw-r--r--ChangeLog57
-rw-r--r--ChangeLog.vserver41
-rwxr-xr-xbin/rc-status2
-rw-r--r--etc/services249
-rwxr-xr-xinit.d/domainname5
-rwxr-xr-xinit.d/hostname7
-rwxr-xr-xnet-scripts/init.d/net.lo307
-rw-r--r--net-scripts/net.modules.d/adsl62
-rw-r--r--net-scripts/net.modules.d/apipa47
-rw-r--r--net-scripts/net.modules.d/arping100
-rw-r--r--net-scripts/net.modules.d/bonding35
-rw-r--r--net-scripts/net.modules.d/bridge41
-rw-r--r--net-scripts/net.modules.d/dhclient42
-rw-r--r--net-scripts/net.modules.d/dhcpcd36
-rw-r--r--net-scripts/net.modules.d/essidnet35
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhcp6
-rw-r--r--net-scripts/net.modules.d/helpers.d/functions49
-rw-r--r--net-scripts/net.modules.d/helpers.d/module-loader26
-rw-r--r--net-scripts/net.modules.d/ifconfig49
-rw-r--r--net-scripts/net.modules.d/ifplugd38
-rw-r--r--net-scripts/net.modules.d/ipppd26
-rw-r--r--net-scripts/net.modules.d/iproute250
-rw-r--r--net-scripts/net.modules.d/iptunnel42
-rw-r--r--net-scripts/net.modules.d/iwconfig34
-rw-r--r--net-scripts/net.modules.d/macchanger32
-rw-r--r--net-scripts/net.modules.d/macnet35
-rw-r--r--net-scripts/net.modules.d/netplugd36
-rw-r--r--net-scripts/net.modules.d/pppd15
-rw-r--r--net-scripts/net.modules.d/pump35
-rw-r--r--net-scripts/net.modules.d/rename33
-rw-r--r--net-scripts/net.modules.d/system37
-rw-r--r--net-scripts/net.modules.d/tuntap34
-rw-r--r--net-scripts/net.modules.d/udhcpc52
-rw-r--r--net-scripts/net.modules.d/vlan40
-rw-r--r--net-scripts/net.modules.d/wpa_supplicant54
-rwxr-xr-xsbin/runscript.sh12
-rw-r--r--src/core/parse.c2
37 files changed, 795 insertions, 1008 deletions
diff --git a/ChangeLog b/ChangeLog
index b94acbb..3c53d01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,63 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2
+ 04 Nov 2005; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc now checks the dhcp lease file for a valid IP address.
+
+ We prefer iproute2 when stopping an interface by default.
+
+ 03 Nov 2005; Roy Marples <uberlord@gentoo.org>:
+
+ iwconfig now detects an unencrypted AP and doesn't apply any configured
+ WEP settings.
+
+ baselayout now caters for systems without /bin/hostname (from net-tools)
+ and uses sysctl instead.
+
+ 02 Nov 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Grab updates from IANA for /etc/services including OpenVPN #111194.
+
+ 31 Oct 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Replace the bubble-esq sort routine with a tsort based one for
+ loading modules. This means that we are much faster than before :)
+
+ Fix ifconfig with multiple IP addresses, #110956
+
+ 28 Oct 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Fix typo in rc-status error message #110685 by Eduardo Tongson.
+
+ 27 Oct 2005; Roy Marples <uberlord@gentoo.org>:
+
+ New net scripts depend calls - functions, variables and provide.
+ This saves having to create 3 seperate functions in each module which means
+ a saving of around 600-800 bytes per module.
+
+ Split apipa out of arping module due to user demand for seperate
+ functionality.
+
+ arping module now works correctly.
+
+ runscript sets RC_KILL_CHILDREN="no" when restarting a service, otherwise
+ things like your ssh session get killed.
+
+ adsl module supports new rp-pppoe-3.6 ebuild, #102820
+
+ Config profile is now changed correctly when doing "rc foo" and you're in
+ the default runlevel, #101105
+
+ 26 Oct 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Tweak runscript error output to only show the invalid arg once rather than
+ twice #110558 by Toralf Förster.
+
+ 24 Oct 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Fix remove_net_fs space handling in netmount script #110313 DominikBuerkle.
+
19 Oct 2005; Roy Marples <uberlord@gentoo.org>:
rc-daemon.sh now kills children correctly.
diff --git a/ChangeLog.vserver b/ChangeLog.vserver
index 67a132b..546b8c3 100644
--- a/ChangeLog.vserver
+++ b/ChangeLog.vserver
@@ -1,6 +1,47 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2
+ 05 Nov 2005; Christian Heim <phreak@gentoo.org>:
+ Merging changes between baselayout r1583 and r1596.
+
+ ChangeLog | 57 ++++
+ ChangeLog.vserver | 42 +++
+ bin/rc-status | 2
+ etc/services | 249 ++++++++++++++++--
+ init.d/domainname | 5
+ init.d/hostname | 7
+ net-scripts/init.d/net.lo | 303 +++++++++++-----------
+ net-scripts/net.modules.d/adsl | 62 ++--
+ net-scripts/net.modules.d/arping | 100 +------
+ net-scripts/net.modules.d/bonding | 35 --
+ net-scripts/net.modules.d/bridge | 41 --
+ net-scripts/net.modules.d/dhclient | 42 ---
+ net-scripts/net.modules.d/dhcpcd | 36 --
+ net-scripts/net.modules.d/essidnet | 35 --
+ net-scripts/net.modules.d/helpers.d/dhcp | 6
+ net-scripts/net.modules.d/helpers.d/functions | 49 ++-
+ net-scripts/net.modules.d/helpers.d/module-loader | 26 +
+ net-scripts/net.modules.d/ifconfig | 49 ---
+ net-scripts/net.modules.d/ifplugd | 38 --
+ net-scripts/net.modules.d/ipppd | 26 -
+ net-scripts/net.modules.d/iproute2 | 50 ---
+ net-scripts/net.modules.d/iptunnel | 42 ---
+ net-scripts/net.modules.d/iwconfig | 34 --
+ net-scripts/net.modules.d/macchanger | 32 --
+ net-scripts/net.modules.d/macnet | 35 --
+ net-scripts/net.modules.d/netplugd | 36 --
+ net-scripts/net.modules.d/pppd | 15 -
+ net-scripts/net.modules.d/pump | 35 --
+ net-scripts/net.modules.d/rename | 33 --
+ net-scripts/net.modules.d/system | 37 --
+ net-scripts/net.modules.d/tuntap | 34 --
+ net-scripts/net.modules.d/udhcpc | 52 ---
+ net-scripts/net.modules.d/vlan | 40 --
+ net-scripts/net.modules.d/wpa_supplicant | 54 ---
+ sbin/runscript.sh | 12
+ src/core/parse.c | 2
+ 36 files changed, 747 insertions(+), 1006 deletions(-)
+
20 Oct 2005; Christian Heim <phreak@gentoo.org> ChangeLog, ChangeLog.vserver,
net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper,
net-scripts/net.modules.d/iwconfig,
diff --git a/bin/rc-status b/bin/rc-status
index 6934291..3450ba0 100755
--- a/bin/rc-status
+++ b/bin/rc-status
@@ -97,7 +97,7 @@ if [[ -z ${runlevel} ]] ; then
eerror "Your installation is probably broken ... please \`emerge baselayout-vserver\`"
exit 1
fi
- ewarn "Assuming current runrevel is '${runlevel}'"
+ ewarn "Assuming current runlevel is '${runlevel}'"
fi
fi
if [[ ! -d ${runleveldir}/${runlevel} ]] ; then
diff --git a/etc/services b/etc/services
index eabc167..1db81d2 100644
--- a/etc/services
+++ b/etc/services
@@ -180,7 +180,7 @@ dixie 96/tcp # DIXIE Protocol Specification
dixie 96/udp
swift-rvf 97/tcp # Swift Remote Virtural File Protocol
swift-rvf 97/udp
-tacnews 98/tcp # TAC News
+tacnews 98/tcp linuxconf # TAC News
tacnews 98/udp
metagram 99/tcp # Metagram Relay
metagram 99/udp
@@ -449,8 +449,12 @@ microsoft-ds 445/tcp Microsoft-DS
microsoft-ds 445/udp Microsoft-DS
kpasswd 464/tcp kpwd # Kerberos "passwd"
kpasswd 464/udp kpwd
+urd 465/tcp smtps ssmtp # URL Rendesvous Directory for SSM / smtp protocol over TLS/SSL
+igmpv3lite 465/udp smtps ssmtp # IGMP over UDP for SSM
photuris 468/tcp
photuris 468/udp
+rcp 469/tcp # Radio Control Protocol
+rcp 469/udp
saft 487/tcp # Simple Asynchronous File Transfer
saft 487/udp
gss-http 488/tcp
@@ -567,14 +571,38 @@ tinc 655/tcp # TINC control port
tinc 655/udp
acap 674/tcp # Application Configuration Access Protocol
acap 674/udp
+asipregistry 687/tcp
+asipregistry 687/udp
+realm-rusd 688/tcp # ApplianceWare managment protocol
+realm-rusd 688/udp
+nmap 689/tcp # Opensource Network Mapper
+nmap 689/udp
ha-cluster 694/tcp # Heartbeat HA-cluster
ha-cluster 694/udp
+epp 700/tcp # Extensible Provisioning Protocol
+epp 700/udp
+iris-beep 702/tcp # IRIS over BEEP
+iris-beep 702/udp
silc 706/tcp # SILC
silc 706/udp
kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
kerberos-adm 749/udp
kerberos-iv 750/tcp kerberos4 kdc # Kerberos (server)
kerberos-iv 750/udp kerberos4 kdc
+pump 751/tcp kerberos_master
+pump 751/udp kerberos_master # Kerberos authentication
+qrh 752/tcp passwd_server
+qrh 752/udp passwd_server # Kerberos passwd server
+rrh 753/tcp
+rrh 753/udp
+tell 754/tcp send krb_prop # Kerberos slave propagation
+tell 754/udp send
+nlogin 758/tcp
+nlogin 758/udp
+con 759/tcp
+con 759/udp
+ns 760/tcp krbupdate kreg # Kerberos registration
+ns 760/udp
webster 765/tcp # Network dictionary
webster 765/udp
phonebook 767/tcp # Network phonebook
@@ -613,10 +641,32 @@ pop3s 995/udp
# UDP [RFC768].
# The Registered Ports are in the range 1024-49151.
#
+imgames 1077/tcp
+imgames 1077/udp
socks 1080/tcp # socks proxy server
socks 1080/udp
rmiregistry 1099/tcp # Java RMI Registry
rmiregistry 1099/udp
+bnetgame 1119/tcp # Battle.net Chat/Game Protocol
+bnetgame 1119/udp
+bnetfile 1120/tcp # Battle.net File Transfer Protocol
+bnetfile 1120/udp
+hpvmmcontrol 1124/tcp # HP VMM Control
+hpvmmcontrol 1124/udp
+hpvmmagent 1125/tcp # HP VMM Agent
+hpvmmagent 1125/udp
+hpvmmdata 1126/tcp # HP VMM Agent
+hpvmmdata 1126/udp
+resacommunity 1154/tcp # Community Service
+resacommunity 1154/udp
+3comnetman 1181/tcp # 3Com Net Management
+3comnetman 1181/udp
+mysql-cluster 1186/tcp # MySQL Cluster Manager
+mysql-cluster 1186/udp
+alias 1187/tcp # Alias Service
+alias 1187/udp
+openvpn 1194/tcp # OpenVPN
+openvpn 1194/udp
kazaa 1214/tcp # KAZAA
kazaa 1214/udp
bvcontrol 1236/tcp rmtcfg # Gracilis Packeten remote config server
@@ -657,6 +707,10 @@ h323gatestat 1719/tcp
h323gatestat 1719/udp
h323hostcall 1720/tcp
h323hostcall 1720/udp
+iberiagames 1726/tcp
+iberiagames 1726/udp
+gamegen1 1738/tcp
+gamegen1 1738/udp
tftp-mcast 1758/tcp
tftp-mcast 1758/udp
hello 1789/tcp
@@ -667,6 +721,8 @@ radius-acct 1813/tcp radacct # Radius Accounting
radius-acct 1813/udp radacct
mtp 1911/tcp # Starlight Networks Multimedia Transport Protocol
mtp 1911/udp
+egs 1926/tcp # Evolution Game Server
+egs 1926/udp
unix-status 1957/tcp # remstats unix-status server
unix-status 1957/udp
hsrp 1985/tcp # Hot Standby Router Protocol
@@ -701,6 +757,10 @@ cisco-sccp 2000/tcp sieve # Cisco SCCP
cisco-sccp 2000/udp sieve
nfs 2049/tcp # Network File System
nfs 2049/udp
+radsec 2083/tcp # Secure Radius Service
+radsec 2083/udp
+gnunet 2086/tcp # GNUnet
+gnunet 2086/udp
rtcm-sc104 2101/tcp # RTCM SC-104
rtcm-sc104 2101/udp
zephyr-srv 2102/tcp # Zephyr server
@@ -709,6 +769,36 @@ zephyr-clt 2103/tcp # Zephyr serv-hm connection
zephyr-clt 2103/udp
zephyr-hm 2104/tcp # Zephyr hostmanager
zephyr-hm 2104/udp
+eyetv 2170/tcp # EyeTV Server Port
+eyetv 2170/udp
+msfw-storage 2171/tcp # MS Firewall Storage
+msfw-storage 2171/udp
+msfw-s-storage 2172/tcp # MS Firewall SecureStorage
+msfw-s-storage 2172/udp
+msfw-replica 2173/tcp # MS Firewall Replication
+msfw-replica 2173/udp
+msfw-array 2174/tcp # MS Firewall Intra Array
+msfw-array 2174/udp
+airsync 2175/tcp # Microsoft Desktop AirSync Protocol
+airsync 2175/udp
+rapi 2176/tcp # Microsoft ActiveSync Remote API
+rapi 2176/udp
+qwave 2177/tcp # qWAVE Bandwidth Estimate
+qwave 2177/udp
+tivoconnect 2190/tcp # TiVoConnect Beacon
+tivoconnect 2190/udp
+tvbus 2191/tcp # TvBus Messaging
+tvbus 2191/udp
+mysql-im 2273/tcp # MySQL Instance Manager
+mysql-im 2273/udp
+dict-lookup 2289/tcp # Lookup dict server
+dict-lookup 2289/udp
+redstorm_join 2346/tcp # Game Connection Port
+redstorm_join 2346/udp
+redstorm_find 2347/tcp # Game Announcement and Location
+redstorm_find 2347/udp
+redstorm_info 2348/tcp # Information to query for game status
+redstorm_info 2348/udp
cvspserver 2401/tcp # CVS client/server operations
cvspserver 2401/udp
venus 2430/tcp # codacon port
@@ -719,6 +809,16 @@ codasrv 2432/tcp # not used
codasrv 2432/udp
codasrv-se 2433/tcp # tcp side effects
codasrv-se 2433/udp
+netadmin 2450/tcp
+netadmin 2450/udp
+netchat 2451/tcp
+netchat 2451/udp
+snifferclient 2452/tcp
+snifferclient 2452/udp
+ppcontrol 2505/tcp # PowerPlay Control
+ppcontrol 2505/udp
+lstp 2559/tcp #
+lstp 2559/udp
mon 2583/tcp
mon 2583/udp
hpstgmgr 2600/tcp zebrasrv
@@ -741,16 +841,30 @@ wag-service 2608/tcp # Wag Service
wag-service 2608/udp
dict 2628/tcp # Dictionary server
dict 2628/udp
+exce 2769/tcp # eXcE
+exce 2769/udp
+dvr-esm 2804/tcp # March Networks Digital Video Recorders and Enterprise Service Manager products
+dvr-esm 2804/udp
corbaloc 2809/tcp # CORBA LOC
corbaloc 2809/udp
ndtp 2882/tcp # Network Dictionary Transfer Protocol
ndtp 2882/udp
+gamelobby 2914/tcp # Game Lobby
+gamelobby 2914/udp
gds_db 3050/tcp # InterBase server
gds_db 3050/udp
+xbox 3074/tcp # Xbox game port
+xbox 3074/udp
icpv2 3130/tcp icp # Internet Cache Protocol (Squid)
icpv2 3130/udp icp
+nm-game-admin 3148/tcp # NetMike Game Administrator
+nm-game-admin 3148/udp
+nm-game-server 3149/tcp # NetMike Game Server
+nm-game-server 3149/udp
mysql 3306/tcp # MySQL
mysql 3306/udp
+sftu 3326/tcp
+sftu 3326/udp
trnsprntproxy 3346/tcp # Transparent Proxy
trnsprntproxy 3346/udp
ms-wbt-server 3389/tcp rdp # MS WBT Server
@@ -759,16 +873,30 @@ prsvp 3455/tcp # RSVP Port
prsvp 3455/udp
nut 3493/tcp # Network UPS Tools
nut 3493/udp
+ironstorm 3504/tcp # IronStorm game server
+ironstorm 3504/udp
+cctv-port 3559/tcp # CCTV control port
+cctv-port 3559/udp
+iw-mmogame 3596/tcp # Illusion Wireless MMOG
+iw-mmogame 3596/udp
distcc 3632/tcp # Distributed Compiler
distcc 3632/udp
daap 3689/tcp # Digital Audio Access Protocol
daap 3689/udp
svn 3690/tcp # Subversion
svn 3690/udp
+blizwow 3724/tcp # World of Warcraft
+blizwow 3724/udp
netboot-pxe 3928/tcp pxe # PXE NetBoot Manager
netboot-pxe 3928/udp pxe
smauth-port 3929/tcp # AMS Port
smauth-port 3929/udp
+treehopper 3959/tcp # Tree Hopper Networking
+treehopper 3959/udp
+cobraclient 3970/tcp # Cobra Client
+cobraclient 3970/udp
+cobraserver 3971/tcp # Cobra Server
+cobraserver 3971/udp
pxc-spvr-ft 4002/tcp pxc-spvr-ft
pxc-spvr-ft 4002/udp pxc-spvr-ft
pxc-splr-ft 4003/tcp pxc-splr-ft rquotad
@@ -781,26 +909,62 @@ pxc-spvr 4006/tcp pxc-spvr
pxc-spvr 4006/udp pxc-spvr
pxc-splr 4007/tcp pxc-splr
pxc-splr 4007/udp pxc-splr
+xgrid 4111/tcp # Mac OS X Server Xgrid
+xgrid 4111/udp
rwhois 4321/tcp # Remote Who Is
rwhois 4321/udp
+epmd 4369/tcp # Erlang Port Mapper Daemon
+epmd 4369/udp
krb524 4444/tcp
krb524 4444/udp
+ipsec-nat-t 4500/tcp # IPsec NAT-Traversal
+ipsec-nat-t 4500/udp
hylafax 4559/tcp # HylaFAX client-server protocol (new)
hylafax 4559/udp
piranha1 4600/tcp
piranha1 4600/udp
+playsta2-app 4658/tcp # PlayStation2 App Port
+playsta2-app 4658/udp
+playsta2-lob 4659/tcp # PlayStation2 Lobby Port
+playsta2-lob 4659/udp
+snap 4752/tcp # Simple Network Audio Protocol
+snap 4752/udp
radmin-port 4899/tcp # RAdmin Port
radmin-port 4899/udp
rfe 5002/tcp # Radio Free Ethernet
rfe 5002/udp
ita-agent 5051/tcp # ITA Agent
ita-agent 5051/udp
+sdl-ets 5081/tcp # SDL - Ent Trans Server
+sdl-ets 5081/udp
+bzflag 5154/tcp # BZFlag game server
+bzflag 5154/udp
+aol 5190/tcp # America-Online
+aol 5190/udp
xmpp-client 5222/tcp # XMPP Client Connection
xmpp-client 5222/udp
+caevms 5251/tcp # CA eTrust VM Service
+caevms 5251/udp
xmpp-server 5269/tcp # XMPP Server Connection
xmpp-server 5269/udp
cfengine 5308/tcp # CFengine
cfengine 5308/udp
+nat-pmp 5351/tcp # NAT Port Mapping Protocol
+nat-pmp 5351/udp
+dns-llq 5352/tcp # DNS Long-Lived Queries
+dns-llq 5352/udp
+mdns 5353/tcp # Multicast DNS
+mdns 5353/udp
+mdnsresponder 5354/tcp noclog # Multicast DNS Responder IPC
+mdnsresponder 5354/udp noclog # noclogd with TCP (nocol)
+llmnr 5355/tcp hostmon # Link-Local Multicast Name Resolution
+llmnr 5355/udp hostmon # hostmon uses TCP (nocol)
+dj-ice 5419/tcp
+dj-ice 5419/udp
+beyond-remote 5424/tcp # Beyond Remote
+beyond-remote 5424/udp
+br-channel 5425/tcp # Beyond Remote Command Channel
+br-channel 5425/udp
postgresql 5432/tcp # POSTGRES
postgresql 5432/udp
sgi-eventmond 5553/tcp # SGI Eventmond Port
@@ -811,12 +975,20 @@ cvsup 5999/tcp # CVSup
cvsup 5999/udp
x11 6000/tcp # X Window System
x11 6000/udp
+kftp-data 6620/tcp # Kerberos V5 FTP Data
+kftp-data 6620/udp
+kftp 6621/tcp # Kerberos V5 FTP Control
+kftp 6621/udp
+ktelnet 6623/tcp # Kerberos V5 Telnet
+ktelnet 6623/udp
gnutella-svc 6346/tcp
gnutella-svc 6346/udp
gnutella-rtr 6347/tcp
gnutella-rtr 6347/udp
sane-port 6566/tcp # SANE Network Scanner Control Port
sane-port 6566/udp
+parsec-game 6582/tcp # Parsec Gameserver
+parsec-game 6582/udp
afs3-fileserver 7000/tcp bbs # file server itself
afs3-fileserver 7000/udp bbs
afs3-callback 7001/tcp # callbacks to cache managers
@@ -839,30 +1011,72 @@ afs3-rmtsys 7009/tcp # remote cache manager service
afs3-rmtsys 7009/udp
font-service 7100/tcp xfs # X Font Service
font-service 7100/udp xfs
+sncp 7560/tcp # Sniffer Command Protocol
+sncp 7560/udp
+soap-http 7627/tcp # SOAP Service Port
+soap-http 7627/udp
http-alt 8008/tcp # HTTP Alternate
http-alt 8008/udp
-http-alt 8080/tcp # HTTP Alternate
-http-alt 8080/udp
+http-alt 8080/tcp webcache # HTTP Alternate
+http-alt 8080/udp webcache # WWW caching service
+sunproxyadmin 8081/tcp tproxy # Sun Proxy Admin Service
+sunproxyadmin 8081/udp tproxy # Transparent Proxy
+pichat 9009/tcp # Pichat Server
+pichat 9009/udp
bacula-dir 9101/tcp # Bacula Director
bacula-dir 9101/udp
bacula-fd 9102/tcp # Bacula File Daemon
bacula-fd 9102/udp
bacula-sd 9103/tcp # Bacula Storage Daemon
bacula-sd 9103/udp
+dddp 9131/tcp # Dynamic Device Discovery
+dddp 9131/udp
+wap-wsp 9200/tcp # WAP connectionless session service
+wap-wsp 9200/udp
+wap-wsp-wtp 9201/tcp # WAP session service
+wap-wsp-wtp 9201/udp
+wap-wsp-s 9202/tcp # WAP secure connectionless session service
+wap-wsp-s 9202/udp
+wap-wsp-wtp-s 9203/tcp # WAP secure session service
+wap-wsp-wtp-s 9203/udp
+wap-vcard 9204/tcp # WAP vCard
+wap-vcard 9204/udp
+wap-vcal 9205/tcp # WAP vCal
+wap-vcal 9205/udp
+wap-vcard-s 9206/tcp # WAP vCard Secure
+wap-vcard-s 9206/udp
+wap-vcal-s 9207/tcp # WAP vCal Secure
+wap-vcal-s 9207/udp
+git 9418/tcp # git pack transfer service
+git 9418/udp
+cba8 9593/tcp # LANDesk Management Agent
+cba8 9593/udp
+davsrc 9800/tcp # WebDav Source Port
+davsrc 9800/udp
sd 9876/tcp # Session Director
sd 9876/udp
cyborg-systems 9888/tcp # CYBORG Systems
cyborg-systems 9888/udp
monkeycom 9898/tcp # MonkeyCom
monkeycom 9898/udp
+sctp-tunneling 9899/tcp # SCTP TUNNELING
+sctp-tunneling 9899/udp
+domaintime 9909/tcp # domaintime
+domaintime 9909/udp
amanda 10080/tcp # amanda backup services
amanda 10080/udp
+vce 11111/tcp # Viral Computing Environment (VCE)
+vce 11111/udp
smsqp 11201/tcp # Alamin SMS gateway
smsqp 11201/udp
hkp 11371/tcp # OpenPGP HTTP Keyserver
hkp 11371/udp
h323callsigalt 11720/tcp # h323 Call Signal Alternate
h323callsigalt 11720/udp
+rets-ssl 12109/tcp # RETS over SSL
+rets-ssl 12109/udp
+cawas 12168/tcp # CA Web Access Service
+cawas 12168/udp
bprd 13720/tcp # BPRD Protocol (VERITAS NetBackup)
bprd 13720/udp
bpdbm 13721/tcp # BPDBM Protocol (VERITAS NetBackup)
@@ -885,20 +1099,24 @@ quake 26000/tcp # Quake @!#
quake 26000/udp
wnn6-ds 26208/tcp
wnn6-ds 26208/udp
+tetrinet 31457/tcp # TetriNET Protocol
+tetrinet 31457/udp
+gamesmith-port 31765/tcp # GameSmith Port
+gamesmith-port 31765/udp
traceroute 33434/tcp # traceroute use
traceroute 33434/udp
+candp 42508/tcp # Computer Associates network discovery protocol
+candp 42508/udp
+candrp 42509/tcp # CA discovery response
+candrp 42509/udp
+caerpc 42510/tcp # CA eTrust RPC
+caerpc 42510/udp
#=========================================================================
# The remaining port numbers are not as allocated by IANA.
# Kerberos (Project Athena/MIT) services
# Note that these are for Kerberos v4, and are unofficial
-kerberos_master 751/tcp # Kerberos authentication
-kerberos_master 751/udp
-passwd_server 752/tcp # Kerberos passwd server
-passwd_server 752/udp
-krb_prop 754/tcp # Kerberos slave propagation
-krbupdate 760/tcp kreg # Kerberos registration
kpop 1109/tcp # Pop with Kerberos
knetd 2053/tcp # Kerberos de-multiplexor
eklogin 2105/tcp # Kerberos encrypted rlogin
@@ -914,9 +1132,6 @@ echo 4/ddp # AppleTalk Echo Protocol
zip 6/ddp # Zone Information Protocol
# Many services now accepted as 'standard'
-linuxconf 98/tcp # LinuxConf
-smtps 465/tcp ssmtp # smtp protocol over TLS/SSL
-smtps 465/udp ssmtp
swat 901/tcp # Samba configuration tool
rndc 953/tcp # rndc control sockets (BIND 9)
rndc 953/udp
@@ -929,10 +1144,6 @@ ninstall 2150/udp
afbackup 2988/tcp # Afbackup system
afbackup 2988/udp
fax 4557/tcp # FAX transmission service (old)
-noclog 5354/tcp # noclogd with TCP (nocol)
-noclog 5354/udp
-hostmon 5355/tcp # hostmon uses TCP (nocol)
-hostmon 5355/udp
rplay 5555/tcp # RPlay audio service
rplay 5555/udp
canna 5680/tcp # Canna (Japanese Input)
@@ -940,11 +1151,7 @@ x11-ssh 6010/tcp x11-ssh-offset
x11-ssh 6010/udp x11-ssh-offset
ircd 6667/tcp # Internet Relay Chat
ircd 6667/udp
-webcache 8080/tcp # WWW caching service
-webcache 8080/udp
-tproxy 8081/tcp # Transparent Proxy
-tproxy 8081/udp
-jetdirect 9100/tcp #HP JetDirect card
+jetdirect 9100/tcp # HP JetDirect card
jetdirect 9100/udp
mandelspawn 9359/udp mandelbrot # network mandelbrot
kamanda 10081/tcp # amanda backup services (Kerberos)
diff --git a/init.d/domainname b/init.d/domainname
index 07bd4f7..619ad38 100755
--- a/init.d/domainname
+++ b/init.d/domainname
@@ -32,12 +32,15 @@ checkconfig_dns() {
}
start() {
+ # Ensure that we have a hostname binary or function
+ source /lib/rcscripts/net.modules.d/helpers.d/functions
+
local retval=0
local retval2=0
if checkconfig_nis ; then
ebegin "Setting NIS domainname to ${NISDOMAIN}"
- /bin/domainname "${NISDOMAIN}"
+ hostname -y "${NISDOMAIN}"
retval=$?
eend ${retval} "Failed to set the NIS domainname"
fi
diff --git a/init.d/hostname b/init.d/hostname
index 8efdf96..47c200a 100755
--- a/init.d/hostname
+++ b/init.d/hostname
@@ -3,7 +3,10 @@
# Distributed under the terms of the GNU General Public License v2
start() {
- local myhost=$(/bin/hostname 2>/dev/null)
+ # Ensure that we have a hostname binary or function
+ source /lib/rcscripts/net.modules.d/helpers.d/functions
+
+ local myhost=$(hostname 2>/dev/null)
local retval=0
# If the hostname is already set via the kernel, and /etc/hostname
@@ -20,7 +23,7 @@ start() {
fi
ebegin "Setting hostname to ${myhost}"
- /bin/hostname "${myhost}"
+ hostname "${myhost}"
retval=$?
eend ${retval} "Failed to set the hostname"
diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo
index 523dd65..f1dbfdc 100755
--- a/net-scripts/init.d/net.lo
+++ b/net-scripts/init.d/net.lo
@@ -17,7 +17,7 @@ depend() {
# Load any custom depend functions for the given interface
# For example, br0 may need eth0 and eth1
local iface="${myservice##*.}"
- [[ $( type -t depend_${iface} ) == "function" ]] && depend_${iface}
+ [[ $(type -t "depend_${iface}") == "function" ]] && depend_${iface}
return 0
}
@@ -34,30 +34,27 @@ source "${MODULES_DIR}/helpers.d/functions"
# Make some wrappers to fudge after/before/need/use depend flags.
# These are callbacks so MODULE will be set.
after() {
- local x="$*"
- [[ $# -gt 1 ]] && x=$( echo -e "${x// /\n}" | sort | xargs )
- eval "${MODULE}_after() { echo \"$x\"; }"
+ eval "${MODULE}_after() { echo \"$*\"; }"
}
before() {
- local x="$*"
- [[ $# -gt 1 ]] && x=$( echo -e "${x// /\n}" | sort | xargs )
- eval "${MODULE}_before() { echo \"$x\"; }"
+ eval "${MODULE}_before() { echo \"$*\"; }"
}
need() {
- local x="$*"
- [[ $# -gt 1 ]] && x=$( echo -e "${x// /\n}" | sort | xargs )
- eval "${MODULE}_need() { echo \"$x\"; }"
+ eval "${MODULE}_need() { echo \"$*\"; }"
}
installed() {
- local x="$*"
- [[ $# -gt 1 ]] && x=$( echo -e "${x// /\n}" | sort | xargs )
# We deliberately misspell this as _installed will probably be used
# at some point
- eval "${MODULE}_instlled() { echo \"$x\"; }"
+ eval "${MODULE}_instlled() { echo \"$*\"; }"
}
-
-sort() {
- LC_ALL=C /bin/sort "$@"
+provide() {
+ eval "${MODULE}_provide() { echo \"$*\"; }"
+}
+functions() {
+ eval "${MODULE}_functions() { echo \"$*\"; }"
+}
+variables() {
+ eval "${MODULE}_variables() { echo \"$*\"; }"
}
# void go_background(void)
@@ -85,8 +82,8 @@ module_load_minimum() {
return 1
fi
- for f in check_installed provides check_depends depend; do
- [[ $( type -t "${MODULE}_${f}" ) == "function" ]] && continue
+ for f in depend; do
+ is_function "${MODULE}_${f}" && continue
eerror "${MODULE} does not support the required function ${f}"
return 1
done
@@ -99,7 +96,7 @@ module_load_minimum() {
# Load and check each module for sanity
# If the module is not installed, the functions are to be removed
modules_load_auto() {
- local i j
+ local i j inst
# Populate the MODULES array
# Basically we treat evey file in ${MODULES_DIR} as a module
@@ -122,10 +119,16 @@ modules_load_auto() {
eerror "interface is a reserved name - cannot load a module called interface"
return 1
fi
+
(
u=0;
module_load_minimum "${MODULES[i]}" || u=1;
- [[ ${u} == 0 ]] && ${MODULES[i]##*/}_check_installed false || u=1;
+ if [[ ${u} == 0 ]]; then
+ inst="${MODULES[i]##*/}_check_installed";
+ if is_function "${inst}" ; then
+ ${inst} false || u=1;
+ fi
+ fi
exit "${u}";
)
@@ -154,11 +157,13 @@ modules_check_installed() {
local i j missingdeps nmods="${#MODULES[@]}"
for (( i=0; i<nmods; i++ )); do
- [[ $( type -t "${MODULES[i]}_instlled" ) != "function" ]] && continue
+ is_function "${MODULES[i]}_instlled" || continue
for j in $( ${MODULES[i]}_instlled ); do
missingdeps=true
- if [[ $( type -t "${j}_check_installed" ) == "function" ]]; then
+ if is_function "${j}_check_installed" ; then
${j}_check_installed && missingdeps=false
+ elif is_function "${j}_depend" ; then
+ missingdeps=false
fi
${missingdeps} && unset MODULES[i] && unset PROVIDES[i] && break
done
@@ -209,13 +214,12 @@ modules_check_user() {
)
unset MODULES[j]
unset PROVIDES[j]
- break
fi
done
continue
fi
- if [[ $( type -t "${umods[i]}_provides" ) != "function" ]]; then
+ if ! is_function "${umods[i]}_depend" ; then
# If the module is one of our preferred modules, then
# ignore this error; whatever is available will be
# used instead.
@@ -225,14 +229,19 @@ modules_check_user() {
# not installed. Load the module and report its error
if [[ -e "${MODULES_DIR}/${umods[i]}" ]]; then
source "${MODULES_DIR}/${umods[i]}"
- ${umods[i]}_check_installed true
+ is_function "${umods[i]}_check_installed" \
+ && ${umods[i]}_check_installed true
else
eerror "The module \"${umods[i]}\" does not exist"
fi
return 1
fi
- mod=$( ${umods[i]}_provides )
+ if is_function "${umods[i]}_provide" ; then
+ mod=$( ${umods[i]}_provide )
+ else
+ mod="${umods[i]}"
+ fi
for (( j=0; j<nmods; j++ )); do
[[ -z ${MODULES[j]} ]] && continue
if [[ ${PROVIDES[j]} == "${mod}" && ${umods[i]} != "${MODULES[j]}" ]]; then
@@ -269,84 +278,82 @@ modules_check_user() {
}
# void modules_sort(void)
-
+#
+# Sort our modules
modules_sort() {
- local -a modnums sort_history modafter modbefore
- local i j k p changed_something nmods="${#MODULES[@]}"
-
- # Sort our modules
- # We do this by assigning numbers to each module
- # We also assign modbefore and modafter so we don't
- # shell out as much because it's expensive on CPU.
- modnums=()
- for (( i=0; i<nmods; i++ )); do
- modnums[i]="${i}"
- [[ $( type -t "${MODULES[i]}_after" ) == "function" ]] \
- && modafter[i]=$( ${MODULES[i]}_after )
- [[ $( type -t "${MODULES[i]}_before" ) == "function" ]] \
- && modbefore[i]=$( ${MODULES[i]}_before )
+ local i j nmods=${#MODULES[@]} m
+ local -a provide=() provide_list=() after=() dead=() sorted=() sortedp=()
+
+ # Make our provide list
+ for ((i=0; i<nmods; i++)); do
+ dead[i]="false"
+ if [[ ${MODULES[i]} != "${PROVIDES[i]}" ]] ; then
+ local provided=false
+ for ((j=0; j<${#provide[@]}; j++)); do
+ if [[ ${provide[j]} == "${PROVIDES[i]}" ]]; then
+ provide_list[j]="${provide_list[j]} ${MODULES[i]}"
+ provided=true
+ fi
+ done
+ if ! ${provided}; then
+ provide[j]="${PROVIDES[i]}"
+ provide_list[j]="${MODULES[i]}"
+ fi
+ fi
done
- # Then we swap numbers based on and after/before flags
- # until we don't swap anymore. The sort_history array prevents
- # the possibility of an infinite loop
- sort_history[0]="${modnums[*]}"
- for (( k=1; 1; k++ )); do
- changed_something=false
- for (( i=0; i<nmods; i++ )); do
- for p in ${modafter[i]}; do
- for (( j=0; j<nmods; j++ )); do
- [[ ${p} != "${MODULES[j]}" && ${p} != "${PROVIDES[j]}" ]] \
- && continue
-
- if [[ ${modnums[i]} -lt "${modnums[j]}" ]]; then
- tmp="${modnums[i]}"
- modnums[i]="${modnums[j]}"
- modnums[j]="${tmp}"
- changed_something=true
- fi
- done
- done
- for p in ${modbefore[i]}; do
- for (( j=0; j<nmods; j++ )); do
- [[ ${p} != "${MODULES[j]}" && ${p} != "${PROVIDES[j]}" ]] \
- && continue
-
- if [[ ${modnums[i]} -gt "${modnums[j]}" ]]; then
- tmp="${modnums[i]}"
- modnums[i]="${modnums[j]}"
- modnums[j]="${tmp}"
- changed_something=true
+ # Create an after array, which holds which modules the module at
+ # index i must be after
+ for ((i=0; i<nmods; i++)); do
+ if is_function "${MODULES[i]}_after" ; then
+ after[i]=" ${after[i]} $(${MODULES[i]}_after) "
+ fi
+ if is_function "${MODULES[i]}_before" ; then
+ for m in $(${MODULES[i]}_before); do
+ for ((j=0; j<nmods; j++)) ; do
+ if [[ ${PROVIDES[j]} == "${m}" ]]; then
+ after[j]=" ${after[j]} ${MODULES[i]} "
+ break
fi
done
done
- done
- ${changed_something} || break
-
- # Make sure we aren't repeating a previous state
- # First time through, k=1, k/2=0
- sort_history[k]="${modnums[*]}"
- if [[ ${sort_history[k]} == "${sort_history[k/2]}" ]]; then
- eerror "Detected an infinite loop sorting modules; blundering ahead"
- break
fi
done
- # Finally we sort our modules in number order
- um=""
- for (( i=0; i<nmods; i++ )); do
- um="${um}${modnums[i]} ${MODULES[i]} ${PROVIDES[i]}\n"
+ # Replace the after list modules with real modules
+ for ((i=0; i<nmods; i++)); do
+ if [[ -n ${after[i]} ]]; then
+ for ((j=0; j<${#provide[@]}; j++)); do
+ after[i]="${after[i]// ${provide[j]} / ${provide_list[j]} }"
+ done
+ fi
done
+
+ # We then use the below code to provide a topologial sort
+ module_after_visit() {
+ local name=$1 i x
- p=( $( echo -e "${um}" | sort -n | cut -d' ' -f2,3 ) )
- MODULES=()
- PROVIDES=()
- j=0
- for (( i=0; i<${#p[@]}; i+=2 )); do
- MODULES[j]="${p[i]}"
- PROVIDES[j]="${p[i+1]}"
- (( j++ ))
+ for ((i=0; i<nmods; i++)); do
+ [[ ${MODULES[i]} == "$1" ]] && break
+ done
+
+ ${dead[i]} && return
+ dead[i]="true"
+
+ for x in ${after[i]} ; do
+ module_after_visit "${x}"
+ done
+
+ sorted=( "${sorted[@]}" "${MODULES[i]}" )
+ sortedp=( "${sortedp[@]}" "${PROVIDES[i]}" )
+ }
+
+ for x in ${MODULES[@]}; do
+ module_after_visit "${x}"
done
+
+ MODULES=( "${sorted[@]}" )
+ PROVIDES=( "${sortedp[@]}" )
}
# bool modules_check_depends(bool showprovides)
@@ -355,7 +362,7 @@ modules_check_depends() {
local missingdeps p interface=false
for (( i=0; i<nmods; i++ )); do
- if [[ $( type -t "${MODULES[i]}_need" ) == "function" ]]; then
+ if is_function "${MODULES[i]}_need" ; then
for needmod in $( ${MODULES[i]}_need ); do
missingdeps=true
for (( j=0; j<nmods; j++ )); do
@@ -372,7 +379,15 @@ modules_check_depends() {
done
fi
- ${MODULES[i]}_check_depends || return 1
+ if is_function "${MODULES[i]}_functions" ; then
+ for f in $( ${MODULES[i]}_functions ); do
+ if ! is_function "${f}" ; then
+ eerror "${MODULES[i]}: missing required function \"${f}\""
+ return 1
+ fi
+ done
+ fi
+
[[ ${PROVIDES[i]} == "interface" ]] && interface=true
if ${showprovides} ; then
@@ -418,57 +433,63 @@ modules_load() {
j="${#modules_force[@]}"
for (( i=0; i<j; i++ )); do
module_load_minimum "${MODULES_DIR}/${modules_force[i]}" || return 1
- ${modules_force[i]}_check_installed || unset modules_force[i]
- done
- modules_force=( "${modules_force[@]}" )
-
- # Strip any duplicate modules providing the same thing
- j="${#modules_force[@]}"
- for (( i=0; i<j-1; i++ )); do
- [[ -z ${modules_force[i]} ]] && continue
- for (( k=i+1; k<j; k++ )); do
- [[ -z ${modules_force[k]} ]] && continue
- [[ $( ${modules_force[i]}_provides ) \
- == $( ${modules_force[k]}_provides ) ]] \
- && unset modules_force[k]
- done
+ if is_function "${modules_force[i]}_check_installed" ; then
+ ${modules_force[i]}_check_installed || unset modules_force[i]
+ fi
done
-
MODULES=( "${modules_force[@]}" )
fi
- # We now buffer the _provides functions for a big speed boost
j="${#MODULES[@]}"
for (( i=0; i<j; i++ )); do
- PROVIDES[i]=$( ${MODULES[i]}_provides )
+ # Now load our dependencies - we need to use the MODULE variable
+ # here as the after/before/need functions use it
+ MODULE="${MODULES[i]}"
+ ${MODULE}_depend
+
+ # If no provide is given, assume module name
+ if is_function "${MODULES[i]}_provide" ; then
+ PROVIDES[i]=$( ${MODULES[i]}_provide )
+ else
+ PROVIDES[i]="${MODULES[i]}"
+ fi
done
- if [[ -z ${modules_force[@]} ]]; then
+ if [[ -n ${modules_force[@]} ]]; then
+ # Strip any duplicate modules providing the same thing
+ j="${#MODULES[@]}"
+ for (( i=0; i<j-1; i++ )); do
+ [[ -z ${MODULES[i]} ]] && continue
+ for (( k=i+1; k<j; k++ )); do
+ if [[ ${PROVIDES[i]} == ${PROVIDES[k]} ]]; then
+ unset MODULES[k]
+ unset PROVIDES[k]
+ fi
+ done
+ done
+ MODULES=( "${MODULES[@]}" )
+ PROVIDES=( "${PROVIDES[@]}" )
+ else
if ${starting}; then
modules_check_user || return 1
+ else
+ # Always prefer iproute2 for taking down interfaces
+ if is_function iproute2_provide ; then
+ function_wrap iproute2 $(iproute2_provide)
+ fi
fi
fi
-
- # Setup class wrappers: interface_up -> iproute2_up, for example
+
+ # Wrap our modules
j="${#MODULES[@]}"
for (( i=0; i<j; i++ )); do
function_wrap "${MODULES[i]}" "${PROVIDES[i]}"
-
- # Now load our dependencies - we need to use the MODULE variable
- # here as the after/before/need functions use it
- if [[ -z ${modules_force[@]} ]]; then
- MODULE="${MODULES[i]}"
- ${MODULE}_depend
- fi
done
-
- # Some modules may be installed, but not selected by user preference
- # so we wrap these if needed
j="${#WRAP_MODULES[@]}"
for (( i=0; i<j; i++ )); do
- function_wrap "${WRAP_MODULES[i]}"
+ function_wrap ${WRAP_MODULES[i]}
done
-
+
if [[ -z ${modules_force[@]} ]]; then
modules_check_installed || return 1
modules_sort || return 1
@@ -506,7 +527,7 @@ iface_start() {
# pre Start any modules with
for mod in ${MODULES[@]}; do
- if [[ $( type -t "${mod}_pre_start" ) == "function" ]]; then
+ if is_function "${mod}_pre_start" ; then
${mod}_pre_start "${iface}" || { eend 1; return 1; }
fi
done
@@ -554,7 +575,7 @@ iface_start() {
# Otherwise a default of NULL
if [[ -z ${config} ]]; then
# if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
- if [[ $( type -t "dhcp_start" ) == "function" ]]; then
+ if is_function "dhcp_start" ; then
config=( "dhcp" )
ewarn "Configuration not set for ${iface} - assuming dhcp"
else
@@ -585,7 +606,7 @@ iface_start() {
einfo "${conf[0]}"
# Do we have a function for our config?
- if [[ $( type -t "${conf[0]}_start" ) == "function" ]]; then
+ if is_function "${conf[0]}_start" ; then
eindent
${conf[0]}_start "${iface}" ; x=$?
eoutdent
@@ -594,9 +615,9 @@ iface_start() {
# We do this by testing if the 1st character is a digit
elif [[ ${conf[0]:0:1} == [[:digit:]] || ${conf[0]} == *:* ]]; then
x="0"
- if [[ ${RC_AUTO_INTERFACE} == "yes" \
- && $(type -t address_exists ) == "function" ]]; then
- if address_exists "${iface}" "${conf[0]}" ; then
+ if [[ ${RC_AUTO_INTERFACE} == "yes" ]] \
+ && is_function arping_address_exists ; then
+ if arping_address_exists "${iface}" "${conf[0]}" ; then
eerror "${conf[0]%%/*} already taken on ${iface}"
x="1"
fi
@@ -629,7 +650,7 @@ iface_start() {
# Start any modules with _post_start
for mod in ${MODULES[@]}; do
- if [[ $( type -t "${mod}_post_start" ) == "function" ]]; then
+ if is_function "${mod}_post_start" ; then
${mod}_post_start "${iface}" || return 1
fi
done
@@ -649,8 +670,7 @@ iface_stop() {
# pre Stop any modules
for mod in ${MODULES[@]}; do
- [[ $( type -t "${mod}_pre_stop" ) == "function" ]] \
- && ${mod}_pre_stop "${iface}"
+ is_function "${mod}_pre_stop" && ${mod}_pre_stop "${iface}"
done
einfo "Bringing down ${iface}"
@@ -667,7 +687,7 @@ iface_stop() {
for i in ${aliases} ${iface}; do
# Stop all our modules
for mod in ${MODULES[@]}; do
- [[ $( type -t "${mod}_stop" ) == "function" ]] && ${mod}_stop "${i}"
+ is_function "${mod}_stop" && ${mod}_stop "${i}"
done
# A module may have removed the interface
@@ -690,8 +710,7 @@ iface_stop() {
# post Stop any modules
for mod in ${MODULES[@]}; do
# We have already taken down the interface, so no need to error
- [[ $( type -t "${mod}_post_stop" ) == "function" ]] \
- && ${mod}_post_stop "${iface}"
+ is_function "${mod}_post_stop" && ${mod}_post_stop "${iface}"
done
return 0
@@ -730,7 +749,7 @@ run_start() {
fi
# Call user-defined preup function if it exists
- if [[ $( type -t preup ) == "function" ]]; then
+ if is_function preup ; then
einfo "Running preup function"
eindent
( preup "${iface}" )
@@ -762,7 +781,7 @@ run_start() {
fi
# Call user-defined postup function if it exists
- if [[ $( type -t postup ) == "function" ]]; then
+ if is_function postup ; then
einfo "Running postup function"
eindent
( postup "${iface}" )
@@ -786,7 +805,7 @@ run_stop() {
[[ -n ${ESSID} ]] && ESSIDVAR=$( bash_variable "${ESSID}" )
# Call user-defined predown function if it exists
- if [[ $( type -t predown ) == "function" ]]; then
+ if is_function predown ; then
einfo "Running predown function"
eindent
( predown "${iface}" )
@@ -800,7 +819,7 @@ run_stop() {
iface_stop "${iface}" || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
- if [[ $( type -t postdown ) == "function" ]]; then
+ if is_function postdown ; then
einfo "Running postdown function"
eindent
( postdown "${iface}" )
@@ -870,7 +889,7 @@ run() {
else
if [[ ${cmd} == "start" ]]; then
# Call user-defined failup if it exists
- if [[ $( type -t failup ) == "function" ]]; then
+ if is_function failup ; then
einfo "Running failup function"
eindent
( failup "${iface}" )
@@ -878,7 +897,7 @@ run() {
fi
else
# Call user-defined faildown if it exists
- if [[ $( type -t faildown ) == "function" ]]; then
+ if is_function faildown ; then
einfo "Running faildown function"
eindent
( faildown "${iface}" )
diff --git a/net-scripts/net.modules.d/adsl b/net-scripts/net.modules.d/adsl
index 87bf6ab..dbf6be7 100644
--- a/net-scripts/net.modules.d/adsl
+++ b/net-scripts/net.modules.d/adsl
@@ -4,18 +4,10 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* adsl_provides(void)
-#
-# Returns a string to change module definition for starting up
-adsl_provides() {
- echo "adsl"
-}
-
# void adsl_depend(void)
#
# Sets up the dependancies for the module
adsl_depend() {
- after interface
before dhcp
}
@@ -23,23 +15,24 @@ adsl_depend() {
#
# Returns 1 if rp-pppoe is installed, otherwise 0
adsl_check_installed() {
- [[ -x /usr/sbin/adsl-start ]] && return 0
+ [[ -x /usr/sbin/adsl-start || -x /usr/sbin/pppoe-start ]] && return 0
${1:-false} && eerror "For ADSL support, emerge net-dialup/rp-pppoe"
return 1
}
-# bool adsl_check_depends(void)
-#
-# Checks to see if we have the needed functions
-adsl_check_depends() {
- return 0
-}
-
# bool adsl_setup_vars(char *iface)
#
# Checks to see if the ADSL script has been created or not
adsl_setup_vars() {
- local iface="$1"
+ local iface="$1" startstop="$2" cfgexe
+
+ if [[ -x /usr/sbin/pppoe-start ]]; then
+ exe="/usr/sbin/pppoe-${startstop}"
+ cfgexe=pppoe-setup
+ else
+ exe="/usr/sbin/adsl-${startstop}"
+ cfgexe=adsl-setup
+ fi
# Decide which configuration to use. Hopefully there is an
# interface-specific one
@@ -48,7 +41,7 @@ adsl_setup_vars() {
if [[ ! -f ${cfgfile} ]]; then
eerror "no pppoe.conf file found!"
- eerror "Please run adsl-setup to create one"
+ eerror "Please run ${cfgexe} to create one"
return 1
fi
@@ -61,41 +54,42 @@ adsl_setup_vars() {
#
# Returns 0 (true) when successful, non-zero otherwise
adsl_start() {
- local iface="$1" user ifvar=$( bash_variable "$1" ) cfgfile
+ local iface="$1" exe cfgfile user ifvar=$( bash_variable "$1" )
- adsl_setup_vars "${iface}" || return 1
+ adsl_setup_vars "${iface}" start || return 1
# Might or might not be set in conf.d/net
eval user=\"\$\{adsl_user_${ifvar}\}\"
# Start ADSL with the cfgfile, but override ETH and PIDFILE
einfo "Starting ADSL for ${iface}"
- /usr/sbin/adsl-start <(cat "${cfgfile}"; \
- echo "ETH=${iface}"; \
- echo "PIDFILE=/var/run/adsl-${iface}.pid"; \
- [[ -n ${user} ]] && echo "USER=${user}") \
- >/dev/null
+ ${exe} <(cat "${cfgfile}"; \
+ echo "ETH=${iface}"; \
+ echo "PIDFILE=/var/run/rp-pppoe-${iface}.pid"; \
+ [[ -n ${user} ]] && echo "USER=${user}") \
+ >/dev/null
eend $?
}
# bool adsl_stop(char *iface)
#
-# Stop ADSL on an interface by calling adsl-stop
# Returns 0 when there is no ADSL to stop or we stop ADSL successfully
# Otherwise 1
adsl_stop() {
- local iface="$1" cfgfile
+ local iface="$1" exe cfgfile
- adsl_check_installed || return 0
- [[ ! -f "/var/run/adsl-${iface}.pid" ]] && return 0
+ adsl_check_installed || return 1
+ [[ ! -f "/var/run/rp-pppoe-${iface}.pid" ]] && return 0
- adsl_setup_vars "${iface}" || return 0
+ adsl_setup_vars "${iface}" stop || return 1
einfo "Stopping ADSL for ${iface}"
- /usr/sbin/adsl-stop <(cat "${cfgfile}"; \
- echo "ETH=${iface}"; echo "PIDFILE=/var/run/adsl-${iface}.pid") \
- >/dev/null
+ ${exe} <(cat "${cfgfile}"; \
+ echo "ETH=${iface}"; echo "PIDFILE=/var/run/rp-pppoe-${iface}.pid") \
+ >/dev/null
eend $?
+
+ return 0
}
-# vim:ts=4
+# vim: ts=4
diff --git a/net-scripts/net.modules.d/apipa b/net-scripts/net.modules.d/apipa
new file mode 100644
index 0000000..9e6bbfa
--- /dev/null
+++ b/net-scripts/net.modules.d/apipa
@@ -0,0 +1,47 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+# void apipa_depend(void)
+#
+# Sets up the dependancies for the module
+apipa_depend() {
+ installed arping
+ functions interface_exists
+}
+
+# bool apipa_start(char *iface)
+#
+# Tries to detect a config based on arpinging things
+apipa_start() {
+ local iface="$1" i1 i2 addr i=0
+
+ interface_exists "$1" true || return 1
+
+ einfo "Searching for free addresses in 169.254.0.0/16"
+ eindent
+
+ while [[ ${i} -lt 64516 ]]; do
+ (( i1=${RANDOM}%255 ))
+ (( i2=${RANDOM}%255 ))
+
+ addr="169.254.${i1}.${i2}"
+ vebegin "${addr}/16"
+ if ! arping_address_exists "${iface}" "${addr}" ; then
+ config[config_counter]="${addr}/16 broadcast 169.254.255.255"
+ (( config_counter-- ))
+ veend 0
+ eoutdent
+ return 0
+ fi
+
+ (( i++ ))
+ done
+
+ eerror "No free address found!"
+ eoutdent
+ return 1
+}
+
+# vim:ts=4
diff --git a/net-scripts/net.modules.d/arping b/net-scripts/net.modules.d/arping
index 5f04978..aed04e7 100644
--- a/net-scripts/net.modules.d/arping
+++ b/net-scripts/net.modules.d/arping
@@ -4,18 +4,11 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* arping_provides(void)
-#
-# Returns a string to change module definition for starting up
-arping_provides() {
- echo "arping"
-}
-
# void arping_depend(void)
#
# Sets up the dependancies for the module
arping_depend() {
- after system dhcp vlan
+ functions interface_exists interface_up
}
# bool arping_check_installed(void)
@@ -29,28 +22,13 @@ arping_check_installed() {
return 1
}
-# bool arping_check_depends(void)
-#
-# Checks to see if we have the needed functions
-arping_check_depends() {
- local f
-
- for f in interface_exists interface_up ; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "arping: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# bool address_exists(char *interface, char *address)
+# bool arping_address_exists(char *interface, char *address)
#
# Returns 0 if the address on the interface responds to an arping
# 1 if not - packets defaults to 1
# If neither arping (net-misc/iputils) or arping2 (net-analyzer/arping)
# is installed then we return 1
-address_exists() {
+arping_address_exists() {
local iface="$1" address="${2%%/*}" i
# We only handle IPv4 addresses
@@ -74,22 +52,28 @@ address_exists() {
return 1
}
-# bool arping_gateways(void)
+# bool arping_start(char *iface)
#
# arpings a list of gateways
# If one is foung then apply it's configuration
-arping_gateways() {
- local gateways x conf i
-
- eval gateways=\"\$\{arping_${ifvar}\}\"
- [[ -z ${gateways} ]] && return 1
+arping_start() {
+ local iface="$1" gateways x conf i
+
+ interface_exists "${iface}" true || return 1
einfo "Pinging gateways on ${iface} for configuration"
- eindent
+ eval gateways=\"\$\{arping_${ifvar}\}\"
+ if [[ -z ${gateways} ]]; then
+ eerror "No gateways have been defined (gateways_${ifvar}=\"...\")"
+ return 1
+ fi
+
+ eindent
+
for x in ${gateways}; do
vebegin "${x}"
- if address_exists "${iface}" "${x}" ; then
+ if arping_address_exists "${iface}" "${x}" ; then
for i in ${x//./ } ; do
if [[ ${#i} == "2" ]]; then
conf="${conf}0${i}"
@@ -103,6 +87,10 @@ arping_gateways() {
eoutdent
veinfo "Configuring ${iface} for ${x}"
configure_variables "${iface}" "${conf}"
+ eval config=( \"\$\{config_${ifvar}\[@\]\}\" )
+ eval fallback_config=( \"\$\{fallback_config_${ifvar}\[@\]\}\" )
+ eval fallback_route=( \"\$\{fallback_route_${ifvar}\[@\]\}\" )
+ config_counter=-1
return 0
fi
veend 1
@@ -112,50 +100,4 @@ arping_gateways() {
return 1
}
-# bool arping_apipa(char *iface)
-#
-# Tries to locate an address in the 169.254.0.0 netmask 169.254.255.255 range
-arping_apipa() {
- local iface="$1" i1 i2 addr i=0
-
- einfo "Searching for free addresses in 169.254.0.0/16"
- eindent
-
- while [[ ${i} -lt 64516 ]]; do
- (( i1=${RANDOM}%255 ))
- (( i2=${RANDOM}%255 ))
-
- addr="169.254.${i1}.${i2}"
- vebegin "${addr}/16"
- if ! address_exists "${iface}" "${addr}" ; then
- config[config_counter]="${addr}/16 broadcast 169.254.255.255"
- (( config_counter-- ))
- veend 0
- eoutdent
- return 0
- fi
-
- (( i++ ))
- done
-
- eerror "No free address found!"
- eoutdent
- return 1
-}
-
-# bool arping_start(char *iface)
-#
-# Tries to detect a config based on arpinging things
-arping_start() {
- local iface="$1"
-
- interface_exists "${iface}" true || return 1
- interface_up "${iface}"
-
- arping_gateways "${iface}" && return 0
- arping_apipa "${iface}" && return 0
-
- return 1
-}
-
# vim:ts=4
diff --git a/net-scripts/net.modules.d/bonding b/net-scripts/net.modules.d/bonding
index b1e7dbe..8a9b13f 100644
--- a/net-scripts/net.modules.d/bonding
+++ b/net-scripts/net.modules.d/bonding
@@ -4,19 +4,15 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* bonding_provides(void)
-#
-# Returns a string to change module definition for starting up
-bonding_provides() {
- echo "bonding"
-}
-
# void bonding_depend(void)
#
# Sets up the dependancies for the module
bonding_depend() {
- after interface
- before vlan dhcp arping
+ after interface macnet
+ before vlan dhcp bridge
+ functions interface_exists interface_up interface_down \
+ interface_del_addresses
+ variables slaves
}
# bool bonding_check_installed(void)
@@ -28,21 +24,6 @@ bonding_check_installed() {
return 1
}
-# bool bonding_check_depends(void)
-#
-# Checks to see if we have the needed functions
-bonding_check_depends() {
- local f
-
- for f in interface_exists interface_up interface_down interface_del_addresses; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "bonding: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool bonding_post_start(char *iface)
#
# Bonds the interface
@@ -87,15 +68,13 @@ bonding_pre_start() {
return 0 #important
}
-# bool bonding_pre_stop(void)
+# bool bonding_stop(void)
# Unbonds bonded interfaces
#
# Always returns 0 (true)
-bonding_pre_stop() {
+bonding_stop() {
local iface="$1" slaves s
- bonding_check_installed || return 0
-
# return silently if this is not a bonding interface
[[ ! -f "/proc/net/bonding/${iface}" ]] && return 0
diff --git a/net-scripts/net.modules.d/bridge b/net-scripts/net.modules.d/bridge
index 59f25ee..a44aa9a 100644
--- a/net-scripts/net.modules.d/bridge
+++ b/net-scripts/net.modules.d/bridge
@@ -9,20 +9,14 @@
brctl() {
LC_ALL=C /sbin/brctl "$@"
}
-
-# char* bridge_provides(void)
-#
-# Returns a string to change module definition for starting up
-bridge_provides() {
- echo "bridge"
-}
-
# void bridge_depend(void)
#
# Sets up the dependancies for the module
bridge_depend() {
- after interface tuntap
- before dhcp arping
+ after interface macnet tuntap
+ before dhcp
+ functions interface_down interface_del_addresses interface_set_flag
+ variables bridge bridge_add brctl
}
# bool bridge_check_installed(void)
@@ -34,35 +28,12 @@ bridge_check_installed() {
return 1
}
-# bool bridge_check_depends(void)
-#
-# Checks to see if we have the needed functions
-bridge_check_depends() {
- local f
-
- for f in interface_down interface_del_addresses interface_set_flag; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "bridge: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# char* bridge_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-bridge_get_vars() {
- echo "bridge_$1 brctl_$1"
-}
-
# char* bridge_get_ports(char *interface)
#
# Returns the interfaces added to the given bridge
bridge_get_ports() {
brctl show 2>/dev/null \
- | sed -n -e '/^'"$1"'/,/^\S/ { /^\('"$1"'\|\t\)/s/^.*\t//p }'
+ | sed -n -e '/^'"$1"'/,/^\S/ { /^\('"$1"'\|\t\)/s/^.*\t//p }'
}
# char* bridge_get_bridge(char *interface)
@@ -192,8 +163,6 @@ bridge_pre_start() {
# Removes the device
# returns 0
bridge_stop() {
- bridge_check_installed || return 0
-
local iface="$1" ports i deletebridge=false extra=""
if bridge_exists "${iface}" ; then
diff --git a/net-scripts/net.modules.d/dhclient b/net-scripts/net.modules.d/dhclient
index 6d31321..72290b1 100644
--- a/net-scripts/net.modules.d/dhclient
+++ b/net-scripts/net.modules.d/dhclient
@@ -10,18 +10,14 @@ dhclient() {
LC_ALL=C /sbin/dhclient "$@"
}
-# char* dhclient_provides(void)
-#
-# Returns a string to change module definition for starting up
-dhclient_provides() {
- echo "dhcp"
-}
-
# void dhclient_depend(void)
#
# Sets up the dependancies for the module
dhclient_depend() {
after interface
+ provide dhcp
+ functions interface_exists interface_get_address
+ variables dhclient dhcp
}
# bool dhclient_check_installed(void)
@@ -33,29 +29,6 @@ dhclient_check_installed() {
return 1
}
-# bool dhclient_check_depends(void)
-#
-# Checks to see if we have the needed functions
-dhclient_check_depends() {
- local f
-
- for f in interface_exists interface_get_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "dhclient: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# char* dhclient_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-dhclient_get_vars() {
- echo "dhclient_$1 dhcp_$1"
-}
-
# bool dhclient_stop(char *iface)
#
# Stop dhclient on an interface
@@ -64,7 +37,6 @@ dhclient_stop() {
local iface="$1" d
local pidfile="/var/run/dhclient-${iface}.pid"
- dhclient_check_installed || return 0
[[ ! -f ${pidfile} ]] && return 0
# We check for a dhclient process first as if we attempt to release
@@ -148,13 +120,13 @@ dhclient_start() {
# Send our hostname by editing cffile
if ${edit} && [[ -e ${cffile} && ${d} != *" nosendhost "* ]] ; then
- local hostname=$( hostname )
- if [[ ${hostname} != "(none)" && ${hostname} != "localhost" ]]; then
+ local hname=$( hostname )
+ if [[ ${hname} != "(none)" && ${hname} != "localhost" ]]; then
sed -i '/^[ \t]*send[ \t]*host-name[ \t]*/d' "${cffile}"
if [[ -s ${cffile} ]]; then
- sed -i '1 isend host-name "'"${hostname}"'";' "${cffile}"
+ sed -i '1 isend host-name "'"${hname}"'";' "${cffile}"
else
- echo "send host-name \"${hostname}\";" > "${cffile}"
+ echo "send host-name \"${hname}\";" > "${cffile}"
fi
fi
fi
diff --git a/net-scripts/net.modules.d/dhcpcd b/net-scripts/net.modules.d/dhcpcd
index 25e3069..ea50e30 100644
--- a/net-scripts/net.modules.d/dhcpcd
+++ b/net-scripts/net.modules.d/dhcpcd
@@ -10,18 +10,14 @@ dhcpcd() {
LC_ALL=C /sbin/dhcpcd "$@"
}
-# char* dhcpcd_provides(void)
-#
-# Returns a string to change module definition for starting up
-dhcpcd_provides() {
- echo "dhcp"
-}
-
# void dhcpcd_depend(void)
#
# Sets up the dependancies for the module
dhcpcd_depend() {
after interface
+ provide dhcp
+ functions interface_exists interface_get_address
+ variables dhcpcd dhcp
}
# bool dhcpcd_check_installed(void)
@@ -41,21 +37,6 @@ dhcpcd_check_installed() {
return 1
}
-# bool dhcpcd_check_depends(void)
-#
-# Checks to see if we have the needed functions
-dhcpcd_check_depends() {
- local f
-
- for f in interface_exists interface_get_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "dhcpcd: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# char* dhcpcd_get_vars(char *interface)
#
# Returns a string spaced with possible user set
@@ -73,8 +54,6 @@ dhcpcd_get_vars() {
dhcpcd_stop() {
local iface=$1 count signal pidfile="/var/run/dhcpcd-$1.pid" d
- dhcpcd_check_installed || return 0
-
[[ ! -f ${pidfile} ]] && return 0
ebegin "Stopping dhcpcd on ${iface}"
@@ -102,7 +81,7 @@ dhcpcd_stop() {
#
# Returns 0 (true) when a DHCP address is obtained, otherwise 1
dhcpcd_start() {
- local iface="$1" opts hostname pidfile="/var/run/dhcpcd-$1.pid"
+ local iface="$1" opts pidfile="/var/run/dhcpcd-$1.pid"
local ifvar=$( bash_variable "${iface}" ) metric d
interface_exists "${iface}" true || return 1
@@ -120,10 +99,9 @@ dhcpcd_start() {
# We transmit the hostname by default
if [[ ${d} != *" nosendhost "* && ${opts} != *" -h "* ]]; then
- hostname=$( hostname )
- [[ -n ${hostname} && ${hostname} != "(none)" \
- && ${hostname} != "localhost" ]] \
- && opts="-h \"${hostname}\" ${opts}"
+ local hname=$( hostname )
+ [[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \
+ && opts="-h \"${hname}\" ${opts}"
fi
# Stop dhcpcd from bringing the interface down when we exit
diff --git a/net-scripts/net.modules.d/essidnet b/net-scripts/net.modules.d/essidnet
index 967776b..32f0f3f 100644
--- a/net-scripts/net.modules.d/essidnet
+++ b/net-scripts/net.modules.d/essidnet
@@ -8,44 +8,17 @@
# Load our config if it exists
[[ -f $(add_suffix "/etc/conf.d/wireless" ) ]] \
-&& source $(add_suffix "/etc/conf.d/wireless" )
+ && source $(add_suffix "/etc/conf.d/wireless" )
# void essidnet_depend(void)
#
# Sets up the dependancies for the module
essidnet_depend() {
- before interface
+ before interface system
after wireless
installed wireless
-}
-
-# bool essidnet_check_installed(void)
-#
-# Always returns 0 as we are "installed" by wireless in the depend function
-essidnet_check_installed() {
- return 0
-}
-
-# char* essidnet_provides(void)
-#
-# Returns a string to change module definition for starting up
-essidnet_provides() {
- echo "essidnet"
-}
-
-# bool essidnet_check_depends(void)
-#
-# Checks to see if we have the needed functions
-essidnet_check_depends() {
- local f
-
- for f in wireless_check_extensions wireless_get_essid wireless_get_ap_mac_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "essidnet: missing required function ${f}\n"
- return 1
- done
-
- return 0
+ functions wireless_check_extensions wireless_get_essid \
+ wireless_get_ap_mac_address
}
# bool essidnet_start(char *iface)
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp b/net-scripts/net.modules.d/helpers.d/dhcp
index 3996c1a..133ffae 100755
--- a/net-scripts/net.modules.d/helpers.d/dhcp
+++ b/net-scripts/net.modules.d/helpers.d/dhcp
@@ -102,12 +102,12 @@ fi
# Configure our hostname - but only if we need it
if [[ -n ${hostname} ]]; then
- x=$( /bin/hostname )
- [[ ${x} == "(none)" || ${x} == "localhost" ]] && /bin/hostname "${hostname}"
+ x=$( hostname )
+ [[ ${x} == "(none)" || ${x} == "localhost" ]] && hostname "${hostname}"
fi
[[ ! -d "${statedir}/${interface}" ]] \
-&& mkdir -m 0755 -p "${statedir}/${interface}"
+ && mkdir -m 0755 -p "${statedir}/${interface}"
# Only setup the information we're told to
# By default that's everything
diff --git a/net-scripts/net.modules.d/helpers.d/functions b/net-scripts/net.modules.d/helpers.d/functions
index 5f80d34..3931fb4 100644
--- a/net-scripts/net.modules.d/helpers.d/functions
+++ b/net-scripts/net.modules.d/helpers.d/functions
@@ -508,6 +508,14 @@ process_finished() {
return 1
}
+# bool is_function(char* name)
+#
+# Returns 0 if the given name is a shell function, otherwise 1
+is_function() {
+ [[ -z $1 ]] && return 1
+ [[ $(type -t "$1") == "function" ]]
+}
+
# void function_wrap(char* source, char* target)
#
# wraps function calls - for example function_wrap(this, that)
@@ -515,7 +523,7 @@ process_finished() {
function_wrap() {
local i
- [[ $( type -t "${2}_provides" ) == "function" ]] && return
+ is_function "${2}_depend" && return
for i in $( typeset -f | grep -o '^'"${1}"'_[^ ]*' ); do
eval "${2}${i#${1}}() { ${i} \"\$@\"; }"
@@ -557,21 +565,36 @@ configure_variables() {
local ifvar=$( bash_variable "${iface}" )
for mod in ${MODULES[@]}; do
- func="${mod}_get_vars"
- if [[ $( type -t ${func} ) == "function" ]]; then
- ivars=( $( "${func}" "${ifvar}" ) )
- ovars1=( $( "${func}" "${option1}" ) )
- [[ -n ${option2} ]] && ovars2=( $( "${func}" "${option2}" ) )
- for ((i = 0; i<${#ivars[@]}; i++)); do
- x=""
- [[ -n ${ovars2[i]} ]] && eval x=( \"\$\{${ovars2[i]}\[@\]\}\" )
- [[ -z ${x} ]] && eval x=( \"\$\{${ovars1[i]}\[@\]\}\" )
- [[ -n ${x} ]] && eval "${ivars[i]}=( "\"\$\{x\[@\]\}\"" )"
- done
- fi
+ is_function ${mod}_variables || continue
+ for v in $(${mod}_variables) ; do
+ x=""
+ [[ -n ${option2} ]] && eval x=( \"\$\{${v}_${option2}\[@\]\}\" )
+ [[ -z ${x} ]] && eval x=( \"\$\{${v}_${option1}\[@\]\}\" )
+ [[ -n ${x} ]] && eval "${v}_${ifvar}=( "\"\$\{x\[@\]\}\"" )"
+ done
done
return 0
}
+# Provide a wrapper for hostname if it's not available
+if [[ -z $(type -p hostname) ]]; then
+ hostname() {
+ # Linux and *BSD seem to differ
+ local kernel="kern" ctl="hostname"
+ [[ $(uname) == "Linux" ]] && kernel="kernel"
+
+ if [[ $1 == "-y" || $1 == "--yp" || $1 == "nis" ]]; then
+ ctl="domainname"
+ shift
+ fi
+
+ if [[ -n $1 ]]; then
+ sysctl -q -w "${kernel}.${ctl}=$1"
+ else
+ sysctl -n "${kernel}.${ctl}"
+ fi
+ }
+fi
+
# vim:ts=4
diff --git a/net-scripts/net.modules.d/helpers.d/module-loader b/net-scripts/net.modules.d/helpers.d/module-loader
index f4f5f95..1434bbb 100644
--- a/net-scripts/net.modules.d/helpers.d/module-loader
+++ b/net-scripts/net.modules.d/helpers.d/module-loader
@@ -11,6 +11,15 @@
conf=$(add_suffix "/etc/conf.d/net")
[[ -e ${conf} ]] && source "${conf}"
+# Create some dummy functions, so we can depend on a module
+after() { return; }
+before() { return; }
+need() { return; }
+provide() { return; }
+installed() { return; }
+functions() { return; }
+variables() { eval "${MODULE}_variables() { echo \"$*\"; }"; }
+
# Guess which interface module to load - we prefer iproute2
if [[ -x /sbin/ip ]]; then
interface_module="iproute2"
@@ -34,14 +43,29 @@ MODULES=( "system" )
# Load our modules
. "${MODULES_DIR}/${interface_module}"
+MODULE="interface"
+${interface_module}_depend
function_wrap "${interface_module}" interface
-. "${MODULES_DIR}/macnet"
+
+if [[ -e "${MODULES_DIR}/macnet" ]]; then
+ . "${MODULES_DIR}/macnet"
+ MODULE="macnet"
+ macnet_depend
+fi
+
. "${MODULES_DIR}/system"
+MODULE="system"
+system_depend
if [[ -n ${wireless_module} ]]; then
. "${MODULES_DIR}/${wireless_module}"
+ MODULE="${wireless_module}"
+ ${wireless_module}_depend
function_wrap "${wireless_module}" wireless
. "${MODULES_DIR}/essidnet"
fi
+# Dummy dhcp
+dhcp_variables() { echo "dhcp"; }
+
# vim:ts=4
diff --git a/net-scripts/net.modules.d/ifconfig b/net-scripts/net.modules.d/ifconfig
index 48a65fb..2f96c29 100644
--- a/net-scripts/net.modules.d/ifconfig
+++ b/net-scripts/net.modules.d/ifconfig
@@ -22,7 +22,9 @@ route() {
#
# Sets up the dependancies for the module
ifconfig_depend() {
- after macnet wireless
+ provide interface
+ variables config routes fallback metric ifconfig \
+ ifconfig_fallback routes inet6 iface alias broadcast netmask
}
# bool ifconfig_check_installed(void)
@@ -34,29 +36,6 @@ ifconfig_check_installed() {
return 1
}
-# char* ifconfig_provides(void)
-#
-# Returns a string to change module definition for starting up
-ifconfig_provides() {
- echo "interface"
-}
-
-# char* ifconfig_module(void)
-#
-# Returns the module name
-# This is needed by dhclient as we run different scripts
-# based on the interface
-ifconfig_module() {
- echo "ifconfig"
-}
-
-# bool ifconfig_check_depends(void)
-#
-# Checks to see if we have the needed functions
-ifconfig_check_depends() {
- return 0
-}
-
# bool ifconfig_exists(char *interface, bool report)
#
# Returns 1 if the interface exists, otherwise 0
@@ -190,18 +169,6 @@ ifconfig_del_addresses() {
return 0
}
-# char* ifconfig_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-ifconfig_get_vars() {
- echo "config_$1 routes_$1 fallback_$1 metric_$1 ifconfig_$1 \
- ifconfig_fallback_$1 routes_$1 inet6_$1 iface_$1 alias_$1 \
- broadcast_$1 netmask_$1"
- # The depreciated gateway var has to be handled by
- # each module if needed
-}
-
# bool ifconfig_get_old_config(char *iface)
#
# Returns config and config_fallback for the given interface
@@ -352,9 +319,9 @@ ifconfig_post_start() {
#
# Adds the given address to the interface
ifconfig_add_address() {
- local iface="$1" i=0 r e
+ local iface="$1" i=0 r e real_iface=$(interface_device "$1")
- ifconfig_exists "${iface}" true || return 1
+ ifconfig_exists "${real_iface}" true || return 1
# Extract the config
local -a config=( "$@" )
@@ -390,18 +357,18 @@ ifconfig_add_address() {
fi
# Ensure that the interface is up so we can add IPv6 addresses
- interface_up "${iface}"
+ interface_up "${real_iface}"
# Some kernels like to apply lo with an address when they are brought up
if [[ ${iface} == "lo" && ${config[@]} == "127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255" ]]; then
ifconfig "${iface}" 0.0.0.0
fi
-
+
ifconfig "${iface}" ${config[@]}
r="$?"
[[ ${r} != "0" ]] && return ${r}
- local metric ifvar=$( bash_variable "${iface}" )
+ local metric ifvar=$(bash_variable "${real_iface}")
# Remove the newly added route and replace with our metric
eval metric=\"\$\{metric_${ifvar}\}\"
[[ ${metric} == "0" || ${RC_AUTO_INTERFACE} != "yes" ]] && return ${r}
diff --git a/net-scripts/net.modules.d/ifplugd b/net-scripts/net.modules.d/ifplugd
index d7006ea..2d6024c 100644
--- a/net-scripts/net.modules.d/ifplugd
+++ b/net-scripts/net.modules.d/ifplugd
@@ -4,19 +4,14 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* ifplugd_provides(void)
-#
-# Returns a string to change module definition for starting up
-ifplugd_provides() {
- echo "plug"
-}
-
# void ifplugd_depend(void)
#
# Sets up the dependancies for the module
ifplugd_depend() {
- after macnet
+ after macnet rename
before interface
+ functions interface_exists interface_get_mac_address
+ provide plug
}
# bool ifplugd_check_installed(void)
@@ -30,21 +25,6 @@ ifplugd_check_installed() {
return 0
}
-# bool ifplugd_check_depends(void)
-#
-# Checks to see if we have the needed functions
-ifplugd_check_depends() {
- local f
-
- for f in interface_exists interface_get_mac_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "ifplugd: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool ifplugd_pre_start(char *interface)
#
# Start ifplugd on an interface
@@ -72,7 +52,7 @@ ifplugd_pre_start() {
fi
# We don't work on bridges
- if [[ $(type -t bridge_exists) == "function" ]]; then
+ if is_function bridge_exists ; then
if bridge_exists "${iface}"; then
veinfo "netplug does not work on bridges"
return 0
@@ -80,7 +60,7 @@ ifplugd_pre_start() {
fi
# We don't work on tun/tap interfaces
- if [[ $(type -t tuntap_exists) == "function" ]]; then
+ if is_function tuntap_exists ; then
if tuntap_exists "${iface}"; then
veinfo "netplug does not work on tun/tap interfaces"
return 0
@@ -94,7 +74,7 @@ ifplugd_pre_start() {
# Although ifplugd can, we prefer wpa_supplicant, unless explicitly told
# so via our options
if [[ ${opts} != *" -m wlan "* && ${opts} != *" --api-mode=wlan "* ]]; then
- if [[ $(type -t wireless_check_extensions) == "function" ]]; then
+ if is_function wireless_check_extensions ; then
if wireless_check_extensions "${iface}"; then
veinfo "ifplugd does not work on wireless interfaces"
return 0
@@ -144,11 +124,11 @@ ifplugd_pre_start() {
exit 0
}
-# bool ifplugd_post_stop(char *iface)
+# bool ifplugd_stop(char *iface)
#
# Stops ifplugd on an interface
# Returns 0 (true) when successful, non-zero otherwise
-ifplugd_post_stop() {
+ifplugd_stop() {
${IN_BACKGROUND} && return 0
local iface="$1"
local pidfile="/var/run/ifplugd.${iface}.pid"
@@ -157,7 +137,7 @@ ifplugd_post_stop() {
ebegin "Stopping ifplugd on ${iface}"
start-stop-daemon --stop --exec /usr/sbin/ifplugd \
- --pidfile "${pidfile}"
+ --pidfile "${pidfile}" --signal 3
eend $?
}
diff --git a/net-scripts/net.modules.d/ipppd b/net-scripts/net.modules.d/ipppd
index 8f5fc37..5688954 100644
--- a/net-scripts/net.modules.d/ipppd
+++ b/net-scripts/net.modules.d/ipppd
@@ -4,19 +4,15 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* ipppd_provides(void)
-#
-# Returns a string to change module definition for starting up
-ipppd_provides() {
- echo "isdn"
-}
-
# void ipppd_depend(void)
#
# Sets up the dependancies for the module
ipppd_depend() {
after macnet
before interface
+ provide isdn
+ functions interface_exists interface_type clean_pidfile
+ variables ipppd
}
# bool ipppd_check_installed(void)
@@ -28,21 +24,6 @@ ipppd_check_installed() {
return 1
}
-# bool ipppd_check_depends(void)
-#
-# Checks to see if we have the needed functions
-ipppd_check_depends() {
- local f
-
- for f in interface_exists interface_type clean_pidfile; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "ipppd: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool ipppd_start(char *iface)
#
# Start isdn on an interface
@@ -83,7 +64,6 @@ ipppd_pre_start() {
ipppd_stop() {
local iface="$1" pidfile="/var/run/ipppd-$1.pid"
- ipppd_check_installed || return 0
[[ ! -f ${pidfile} ]] && return 0
clean_pidfile "${pidfile}" && return 0
diff --git a/net-scripts/net.modules.d/iproute2 b/net-scripts/net.modules.d/iproute2
index d069550..62dd92d 100644
--- a/net-scripts/net.modules.d/iproute2
+++ b/net-scripts/net.modules.d/iproute2
@@ -18,7 +18,9 @@ iproute2_tunnel() {
#
# Sets up the dependancies for the module
iproute2_depend() {
- after macnet wireless
+ provide interface
+ functions interface_device
+ variables config routes fallback metric ipaddr ipaddr_fallback iproute inet6
}
# bool iproute2_check_installed(void)
@@ -37,37 +39,6 @@ iproute2_check_installed() {
return "${installed}"
}
-# char* iproute2_provides(void)
-#
-# Returns a string to change module definition for starting up
-iproute2_provides() {
- echo "interface"
-}
-
-# char* iproute2_module(void)
-#
-# Returns the module name
-# This is needed by dhclient as we run different scripts
-# based on the interface
-iproute2_module() {
- echo "iproute2"
-}
-
-# bool iproute2_check_depends(void)
-#
-# Checks to see if we have the needed functions
-iproute2_check_depends() {
- local f
-
- for f in interface_device; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "iproute2: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool iproute2_exists(char *interface, bool report)
#
# Returns 1 if the interface exists, otherwise 0
@@ -172,14 +143,6 @@ iproute2_del_addresses() {
return 0
}
-# char* iproute2_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-iproute2_get_vars() {
- echo "config_$1 routes_$1 fallback_$1 metric_$1 ipaddr_$1 ipaddr_fallback_$1 iproute_$1 inet6_$1"
-}
-
# bool iproute2_get_old_config(char *iface)
#
# Returns config and config_fallback for the given interface
@@ -198,8 +161,11 @@ iproute2_get_old_config() {
[[ -n ${inet6} ]] && config=( "${config[@]}" "${inet6[@]}" )
# Support old style iface_xxx syntax
- [[ -z ${config} && $(type -t ifconfig_get_old_config) == "function" ]] \
- && ifconfig_get_old_config "${iface}"
+ if [[ -z ${config} ]] ; then
+ if is_function ifconfig_get_old_config ; then
+ ifconfig_get_old_config "${iface}"
+ fi
+ fi
return 0
}
diff --git a/net-scripts/net.modules.d/iptunnel b/net-scripts/net.modules.d/iptunnel
index f547a99..572f369 100644
--- a/net-scripts/net.modules.d/iptunnel
+++ b/net-scripts/net.modules.d/iptunnel
@@ -4,49 +4,14 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* iptunnel_provides(void)
-#
-# Returns a string to change module definition for starting up
-iptunnel_provides() {
- echo "iptunnel"
-}
-
# void iptunnel_depend(void)
#
# Sets up the dependancies for the module
iptunnel_depend() {
after wireless
before interface
-}
-
-# bool iptunnel_check_installed(void)
-#
-# Tunnelling is provided by the interface
-iptunnel_check_installed() {
- return 0
-}
-
-# bool iptunnel_check_depends(void)
-#
-# Checks to see if we have the needed functions
-iptunnel_check_depends() {
- local f
-
- for f in interface_exists interface_tunnel; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "iptunnel: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# char* iptunnel_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-iptunnel_get_vars() {
- echo "iptunnel_$1"
+ functions interface_exists interface_tunnel
+ variables iptunnel
}
# bool iptunnel_pre_start(char *iface)
@@ -62,8 +27,6 @@ iptunnel_pre_start() {
ebegin "Creating tunnel ${iface}"
interface_tunnel add "${iface}" ${opts}
eend "$?"
- return "$?"
-
}
# bool iptunnel_stop(char *iface)
@@ -78,7 +41,6 @@ iptunnel_stop() {
ebegin "Destroying tunnel ${iface}"
interface_tunnel del "${iface}"
eend "$?"
- return "$?"
}
# vim:ts=4
diff --git a/net-scripts/net.modules.d/iwconfig b/net-scripts/net.modules.d/iwconfig
index 04055eb..7c389b3 100644
--- a/net-scripts/net.modules.d/iwconfig
+++ b/net-scripts/net.modules.d/iwconfig
@@ -27,6 +27,8 @@ iwpriv() {
iwconfig_depend() {
after plug
before interface
+ provide wireless
+ functions interface_up interface_down interface_exists
}
# bool iwconfig_check_installed(void)
@@ -48,28 +50,6 @@ iwconfig_check_installed() {
return 1
}
-# char* iwconfig_provides(void)
-#
-# Returns a string to change module definition for starting up
-iwconfig_provides() {
- echo "wireless"
-}
-
-# bool iwconfig_check_depends(void)
-#
-# Checks to see if we have the needed functions
-iwconfig_check_depends() {
- local f
-
- for f in interface_up interface_down interface_exists; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "iwconfig: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool iwconfig_check_extensions(char *interface)
#
# Checks to see if wireless extensions are enabled on the interface
@@ -355,11 +335,11 @@ iwconfig_associate() {
else
ESSIDVAR=$( bash_variable "${ESSID}" )
key=$( iwconfig_get_wep_key "${mac}" )
- if [[ ${wep_required} == "yes" && ${key} == "off" ]]; then
+ if [[ ${wep_required} == "on" && ${key} == "off" ]]; then
vewarn "WEP key is not set for \"${dessid}\" - not connecting"
return 1
fi
- if [[ ${wep_required} == "no" && ${key} != "off" ]]; then
+ if [[ ${wep_required} == "off" && ${key} != "off" ]]; then
key="off"
vewarn "\"${dessid}\" is not WEP enabled - ignoring setting"
fi
@@ -383,7 +363,7 @@ iwconfig_associate() {
vebegin "Connecting to \"${dessid}\" ${w}"
- if [[ ${ESSID} != "any" && $( type -t preassociate ) == "function" ]]; then
+ if [[ ${ESSID} != "any" ]] && is_function preassociate ; then
veinfo "Running preassociate function"
eindent
( preassociate "${iface}" )
@@ -410,7 +390,7 @@ iwconfig_associate() {
iwconfig_user_config "${iface}"
iwconfig_report "${iface}"
- if [[ $( type -t postassociate ) == "function" ]]; then
+ if is_function postassociate ; then
veinfo "Running postassociate function"
eindent
( postassociate "${iface}" )
@@ -457,7 +437,7 @@ iwconfig_scan() {
veinfo "Scanning for access points"
# Sleep if required
- eval x=\"\$\{sleep_scan_${ifvar}\}\"
+ eval x=\"\$\{sleep_scan_${ifvar}\:-1}\"
[[ -n ${x} ]] && sleep "${x}"
local error=true i=-1 line
diff --git a/net-scripts/net.modules.d/macchanger b/net-scripts/net.modules.d/macchanger
index 7cc2c5b..7096a2a 100644
--- a/net-scripts/net.modules.d/macchanger
+++ b/net-scripts/net.modules.d/macchanger
@@ -4,41 +4,13 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* macchanger_provides(void)
-#
-# Returns a string to change module definition for starting up
-macchanger_provides() {
- echo "macchanger"
-}
-
# void macchanger_depend(void)
#
# Sets up the dependancies for the module
macchanger_depend() {
before macnet
-}
-
-# bool macchanger_check_installed(void)
-#
-# macchanger is always installed as an interface can change to a specific
-# mac address, and an interface is always installed
-macchanger_check_installed() {
- return 0
-}
-
-# bool macchanger_check_depends(void)
-#
-# Checks to see if we have the needed functions
-macchanger_check_depends() {
- local f
-
- for f in interface_get_mac_address interface_set_mac_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "macchanger: missing required function ${f}\n"
- return 1
- done
-
- return 0
+ functions interface_get_mac_address interface_set_mac_address
+ variables mac
}
# bool macchanger_pre_start(char *iface)
diff --git a/net-scripts/net.modules.d/macnet b/net-scripts/net.modules.d/macnet
index 3ab8cd1..5ef8f30 100644
--- a/net-scripts/net.modules.d/macnet
+++ b/net-scripts/net.modules.d/macnet
@@ -10,37 +10,10 @@
#
# Sets up the dependancies for the module
macnet_depend() {
- before interface wireless
- after macchanger
-}
-
-# bool macnet_check_installed(void)
-#
-# Always returns 0 as we are "installed" by wireless in the depend function
-macnet_check_installed() {
- return 0
-}
-
-# char* macnet_provides(void)
-#
-# Returns a string to change module definition for starting up
-macnet_provides() {
- echo "macnet"
-}
-
-# bool macnet_check_depends(void)
-#
-# Checks to see if we have the needed functions
-macnet_check_depends() {
- local f
-
- for f in interface_get_mac_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "macnet: missing required function ${f}\n"
- return 1
- done
-
- return 0
+ before rename interface wireless
+ after macchanger
+ installed macchanger
+ functions interface_get_mac_address
}
# bool macnet_start(char *iface)
diff --git a/net-scripts/net.modules.d/netplugd b/net-scripts/net.modules.d/netplugd
index 2307a17..966b5da 100644
--- a/net-scripts/net.modules.d/netplugd
+++ b/net-scripts/net.modules.d/netplugd
@@ -4,19 +4,14 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* netplugd_provides(void)
-#
-# Returns a string to change module definition for starting up
-netplugd_provides() {
- echo "plug"
-}
-
# void netplugd_depend(void)
#
# Sets up the dependancies for the module
netplugd_depend() {
- after macnet
+ after macnet rename
before interface
+ provide plug
+ functions interface_exists interface_get_mac_address
}
# bool netplugd_check_installed(void)
@@ -30,21 +25,6 @@ netplugd_check_installed() {
return 0
}
-# bool netplugd_check_depends(void)
-#
-# Checks to see if we have the needed functions
-netplugd_check_depends() {
- local f
-
- for f in interface_exists interface_get_mac_address ; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "netplugd: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool netplugd_pre_start(char *interface)
#
# Start netplug on an interface
@@ -66,7 +46,7 @@ netplugd_pre_start() {
fi
# We don't work on bridges
- if [[ $(type -t bridge_exists) == "function" ]]; then
+ if is_function bridge_exists ; then
if bridge_exists "${iface}"; then
veinfo "netplug does not work on bridges"
return 0
@@ -74,7 +54,7 @@ netplugd_pre_start() {
fi
# We don't work on tun/tap interfaces
- if [[ $(type -t tuntap_exists) == "function" ]]; then
+ if is_function tuntap_exists ; then
if tuntap_exists "${iface}"; then
veinfo "netplug does not work on tun/tap interfaces"
return 0
@@ -82,7 +62,7 @@ netplugd_pre_start() {
fi
# We don't work on wirelesss interfaces
- if [[ $(type -t wireless_check_extensions) == "function" ]]; then
+ if is_function wireless_check_extensions ; then
if wireless_check_extensions "${iface}"; then
veinfo "netplug does not work on wireless interfaces"
return 0
@@ -131,11 +111,11 @@ netplugd_pre_start() {
exit 0
}
-# bool netplugd_post_stop(char *iface)
+# bool netplugd_stop(char *iface)
#
# Stops netplug on an interface
# Returns 0 (true) when successful, non-zero otherwise
-netplugd_post_stop() {
+netplugd_stop() {
${IN_BACKGROUND} && return 0
local iface="$1"
local pidfile="/var/run/netplugd.${iface}.pid"
diff --git a/net-scripts/net.modules.d/pppd b/net-scripts/net.modules.d/pppd
index a9017a4..fb0e15e 100644
--- a/net-scripts/net.modules.d/pppd
+++ b/net-scripts/net.modules.d/pppd
@@ -2,19 +2,13 @@
# Copyright (c) 2004-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# char* pppd_provides(void)
-#
-# Returns a string to change module definition for starting up
-pppd_provides() {
- echo "ppp"
-}
-
# void pppd_depend(void)
#
# Sets up the dependancies for the module
pppd_depend() {
after interface
before dhcp
+ provide ppp
}
# bool pppd_check_installed(void)
@@ -28,13 +22,6 @@ pppd_check_installed() {
return 0
}
-# bool pppd_check_depends(void)
-#
-# Checks to see if we have the needed functions
-pppd_check_depends() {
- return 0
-}
-
# char *pppd_regex_escape(char *string)
#
# Returns the supplied string with any special regex
diff --git a/net-scripts/net.modules.d/pump b/net-scripts/net.modules.d/pump
index 95eb61a..69eb675 100644
--- a/net-scripts/net.modules.d/pump
+++ b/net-scripts/net.modules.d/pump
@@ -10,18 +10,14 @@ pump() {
LC_ALL=C /sbin/pump "$@"
}
-# char* pump_provides(void)
-#
-# Returns a string to change module definition for starting up
-pump_provides() {
- echo "dhcp"
-}
-
# void pump_depend(void)
#
# Sets up the dependancies for the module
pump_depend() {
after interface
+ provide dhcp
+ functions interface_exists interface_get_address
+ variables pump dhcp
}
# bool pump_check_installed(void)
@@ -33,29 +29,6 @@ pump_check_installed() {
return 1
}
-# bool pump_check_depends(void)
-#
-# Checks to see if we have the needed functions
-pump_check_depends() {
- local f
-
- for f in interface_exists interface_get_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "pump: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# char* pump_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-pump_get_vars() {
- echo "pump_$1 dhcp_$1"
-}
-
# bool pump_stop(char *iface)
#
# Stop pump on an interface
@@ -64,8 +37,6 @@ pump_get_vars() {
pump_stop() {
local iface="$1" count e
- pump_check_installed || return 0
-
# We check for a pump process first as querying for status
# causes pump to spawn a process
pidof /sbin/pump &>/dev/null || return 0
diff --git a/net-scripts/net.modules.d/rename b/net-scripts/net.modules.d/rename
index ddab8b0..2e531b1 100644
--- a/net-scripts/net.modules.d/rename
+++ b/net-scripts/net.modules.d/rename
@@ -4,41 +4,14 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* rename_provides(void)
-#
-# Returns a string to change module definition for starting up
-rename_provides() {
- echo "rename"
-}
-
# void rename_depend(void)
#
# Sets up the dependancies for the module
rename_depend() {
- after macchanger macnet
+ after macchanger
before wireless interface
-}
-
-# bool rename_check_installed(void)
-#
-# We are always installed
-rename_check_installed() {
- return 0
-}
-
-# bool rename_check_depends(void)
-#
-# Checks to see if we have the needed functions
-rename_check_depends() {
- return 0
-}
-
-# char* rename_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-rename_get_vars() {
- echo "rename_$1"
+ functions interface_exists interface_down interface_del_addresses
+ variables rename
}
# bool rename_pre_start(char *iface)
diff --git a/net-scripts/net.modules.d/system b/net-scripts/net.modules.d/system
index c8bd0ff..ec5f028 100644
--- a/net-scripts/net.modules.d/system
+++ b/net-scripts/net.modules.d/system
@@ -6,36 +6,9 @@
#
# Sets up the dependancies for the module
system_depend() {
- after interface essidnet
- before dhcp
-}
-
-# bool system_check_installed(void)
-#
-# Always returns 0 as we are writing to files
-system_check_installed() {
- return 0
-}
-
-# char* system_provides(void)
-#
-# Returns a string to change module definition for starting up
-system_provides() {
- echo "system"
-}
-
-# bool system_check_depends(void)
-#
-# Checks to see if we have the needed functions
-system_check_depends() {
- return 0
-}
-
-# char* ifconfig_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set configuration variables
-system_get_vars() {
- echo "dns_servers_$1 dns_domain_$1 dns_options_$1 dns_search_$1 dns_sortlist_$1 ntp_servers_$1 nis_domain_$1 nis_servers_$1"
+ after interface dhcp
+ variables dns_servers dns_domain dns_options dns_search dns_sortlist \
+ ntp_servers nis_domain nis_servers
}
system_dns_extra() {
@@ -128,7 +101,7 @@ system_nis() {
chmod 644 "${tmpfile}"
if [[ -n ${domain} ]]; then
- /bin/hostname -y "${domain}"
+ hostname -y "${domain}"
if [[ -n ${servers} ]]; then
for x in ${servers}; do
echo "domain ${domain} server ${x}" >> "${tmpfile}"
@@ -149,7 +122,7 @@ system_nis() {
#
# Configures the host system for dns, ntp and nis information
# Always returns 0
-system_pre_start() {
+system_post_start() {
local iface="$1"
system_dns "${iface}"
diff --git a/net-scripts/net.modules.d/tuntap b/net-scripts/net.modules.d/tuntap
index eea33db..1cbc621 100644
--- a/net-scripts/net.modules.d/tuntap
+++ b/net-scripts/net.modules.d/tuntap
@@ -10,19 +10,14 @@ tunctl() {
LC_ALL=C /usr/bin/tunctl "$@"
}
-# char* tuntap_provides(void)
-#
-# Returns a string to change module definition for starting up
-tuntap_provides() {
- echo "tuntap"
-}
-
# void tuntap_depend(void)
#
# Sets up the dependancies for the module
tuntap_depend() {
- after interface
+ after interface macnet
before dhcp
+ functions interface_exists interface_type
+ variables tunctl
}
# bool tuntap_check_installed(void)
@@ -34,21 +29,6 @@ tuntap_check_installed() {
return 1
}
-# bool tuntap_check_depends(void)
-#
-# Checks to see if we have the needed functions
-tuntap_check_depends() {
- local f
-
- for f in interface_exists interface_type; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "tuntap: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool tuntap_check_kernel(void)
#
# Checks to see if the tun is present - if not try and load it
@@ -61,14 +41,6 @@ tuntap_check_kernel() {
return 1
}
-# char* tuntap_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-tuntap_get_vars() {
- echo "tunctl_$1"
-}
-
# bool tuntap_exists(char *interface)
#
# Returns 0 if the tun/tap interface exists, otherwise 1
diff --git a/net-scripts/net.modules.d/udhcpc b/net-scripts/net.modules.d/udhcpc
index 25596c5..131231e 100644
--- a/net-scripts/net.modules.d/udhcpc
+++ b/net-scripts/net.modules.d/udhcpc
@@ -10,18 +10,14 @@ udhcpc() {
LC_ALL=C /sbin/udhcpc "$@"
}
-# char* udhcpc_provides(void)
-#
-# Returns a string to change module definition for starting up
-udhcpc_provides() {
- echo "dhcp"
-}
-
# void udhcpc_depend(void)
#
# Sets up the dependancies for the module
udhcpc_depend() {
after interface
+ provide dhcp
+ functions interface_exists interface_get_address
+ variables udhcpc dhcp
}
# bool udhcpc_check_installed(void)
@@ -33,29 +29,6 @@ udhcpc_check_installed() {
return 1
}
-# bool udhcpc_check_depends(void)
-#
-# Checks to see if we have the needed functions
-udhcpc_check_depends() {
- local f
-
- for f in interface_exists interface_get_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "udhcpc: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# char* udhcpc_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-udhcpc_get_vars() {
- echo "udhcpc_$1 dhcp_$1"
-}
-
# bool udhcpc_stop(char *iface)
#
# Stops udhcpc running on an interface
@@ -63,7 +36,6 @@ udhcpc_get_vars() {
udhcpc_stop() {
local iface="$1" pidfile="/var/run/udhcpc-$1.pid" d
- udhcpc_check_installed || return 0
[[ ! -f ${pidfile} ]] && return 0
ebegin "Stopping udhcpc on ${iface}"
@@ -99,7 +71,7 @@ udhcpc_start() {
interface_exists "${iface}" true || return 1
- local ifvar=$( bash_variable "${iface}" ) opts hostname
+ local ifvar=$( bash_variable "${iface}" ) opts
eval opts=\"\$\{udhcpc_${ifvar}\}\"
eval d=\" \$\{dhcp_${ifvar}\} \"
@@ -107,10 +79,9 @@ udhcpc_start() {
if [[ ${d} != *" nosendhost "* ]]; then
if [[ ! " ${opts}" =~ " -([hH] |-hostname=)" ]]; then
- local hostname=$( hostname )
- [[ -n ${hostname} && ${hostname} != "(none)" \
- && ${hostname} != "localhost" ]] \
- && opts="${opts} --hostname=${hostname}"
+ local hname=$( hostname )
+ [[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \
+ && opts="${opts} --hostname=${hname}"
fi
fi
@@ -124,7 +95,8 @@ udhcpc_start() {
if [[ -f ${cachefile} ]]; then
if [[ " ${opts}" != *" --request="* && " ${opts} " != *" -r "* ]]; then
local x=$( < "${cachefile}" )
- [[ -n ${x} ]] && opts="${opts} --request=${x}"
+ # Check for a valid ip
+ [[ ${x} == *.*.*.* ]] && opts="${opts} --request=${x}"
fi
fi
@@ -136,9 +108,9 @@ udhcpc_start() {
fi
x=$( eval udhcpc ${opts} --now --pidfile="${pidfile}" \
- --interface="${iface}" \
- --script="${MODULES_DIR}/helpers.d/udhcpc-wrapper" 2>&1 \
- | egrep -v '^info,' )
+ --interface="${iface}" \
+ --script="${MODULES_DIR}/helpers.d/udhcpc-wrapper" 2>&1 \
+ | egrep -v '^info,' )
# We just check the last 5 letters
[[ ${x:((${#x} - 5)):5} == "bound" ]]
eend "$?" "${x}" || return 1
diff --git a/net-scripts/net.modules.d/vlan b/net-scripts/net.modules.d/vlan
index a1966d5..859e6dd 100644
--- a/net-scripts/net.modules.d/vlan
+++ b/net-scripts/net.modules.d/vlan
@@ -10,19 +10,14 @@ vconfig() {
LC_ALL=C /sbin/vconfig "$@"
}
-# char* vlan_provides(void)
-#
-# Returns a string to change module definition for starting up
-vlan_provides() {
- echo "vlan"
-}
-
# void vlan_depend(void)
#
# Sets up the dependancies for the module
vlan_depend() {
after interface
- before dhcp arping
+ before dhcp
+ functions iface_start iface_stop
+ variables vlans
}
# bool vlan_check_installed(void)
@@ -34,36 +29,13 @@ vlan_check_installed() {
return 1
}
-# bool vlan_check_depends(void)
-#
-# Checks to see if we have the needed functions
-vlan_check_depends() {
- local f
-
- for f in iface_start iface_stop; do
- [[ $( type -t "${f}" ) == function ]] && continue
- eerror "vlan: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
-# char* vlan_get_vars(char *interface)
-#
-# Returns a string spaced with possible user set
-# configuration variables
-vlan_get_vars() {
- echo "vlans_$1 iface_$1_vlans"
-}
-
# char* vlan_get_vlans(char *interface)
#
# Fetch the configured vlans for an interface. Outputs a space
# separated list on stdout. For example "eth0.1 eth0.2 eth0.3"
vlan_get_vlans() {
sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"$1"'$/\1/p' \
- /proc/net/vlan/config 2>/dev/null
+ /proc/net/vlan/config 2>/dev/null
}
# bool vlan_check_kernel(void)
@@ -147,12 +119,12 @@ vlan_post_start() {
return 0
}
-# bool vlan_pre_stop(char *iface)
+# bool vlan_stop(char *iface)
#
# Stops VLANs for a given interface
#
# Always returns 0 (true)
-vlan_pre_stop() {
+vlan_stop() {
local iface="$1" vlan
vlan_check_installed || return 0
diff --git a/net-scripts/net.modules.d/wpa_supplicant b/net-scripts/net.modules.d/wpa_supplicant
index c03774d..24e432a 100644
--- a/net-scripts/net.modules.d/wpa_supplicant
+++ b/net-scripts/net.modules.d/wpa_supplicant
@@ -14,19 +14,14 @@ wpa_cli() {
LC_ALL=C /bin/wpa_cli "$@"
}
-# char* wpa_supplicant_provides(void)
-#
-# Returns a string to change module definition for starting up
-wpa_supplicant_provides() {
- echo "wireless"
-}
-
# void wpa_supplicant_depend(void)
#
# Sets up the dependancies for the module
wpa_supplicant_depend() {
after macnet plug
before interface
+ provide wireless
+ functions interface_exists
}
# bool wpa_supplicant_check_installed(void)
@@ -48,21 +43,6 @@ wpa_supplicant_check_installed() {
return "${installed}"
}
-# bool wpa_supplicant_check_depends(void)
-#
-# Checks to see if we have the needed functions
-wpa_supplicant_check_depends() {
- local f
-
- for f in interface_exists; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "wpa_supplicant: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool wpa_supplicant_check_extensions(char *interface)
#
# Checks to see if wireless extensions are enabled on the interface
@@ -126,7 +106,8 @@ wpa_supplicant_kill() {
pidfile="/var/run/wpa_cli-${iface}.pid"
if ! clean_pidfile "${pidfile}" ; then
${report} && ebegin "Stopping wpa_cli on ${iface}"
- start-stop-daemon --stop --exec /bin/wpa_cli --pidfile "${pidfile}"
+ start-stop-daemon --stop --exec /bin/wpa_cli \
+ --pidfile "${pidfile}"
${report} && eend "$?"
fi
@@ -135,7 +116,7 @@ wpa_supplicant_kill() {
if ! clean_pidfile "${pidfile}" ; then
${report} && ebegin "Stopping wpa_supplicant on ${iface}"
start-stop-daemon --stop --exec /sbin/wpa_supplicant \
- --pidfile "${pidfile}"
+ --pidfile "${pidfile}"
${report} && eend "$?"
else
# Support wpa_supplicant-0.3.x
@@ -149,7 +130,7 @@ wpa_supplicant_kill() {
# If wpa_supplicant exits uncleanly, we need to remove the stale dir
[[ -S "/var/run/wpa_supplicant/${iface}" ]] \
- && rm -f "/var/run/wpa_supplicant/${iface}"
+ && rm -f "/var/run/wpa_supplicant/${iface}"
}
# bool wpa_supplicant_associate(char *interface)
@@ -206,7 +187,8 @@ wpa_supplicant_associate() {
# Start wpa_supplicant on an interface and wait for association
# Returns 0 (true) when successful, non-zero otherwise
wpa_supplicant_pre_start() {
- local iface="$1" opts timeout action=false cfgfile
+ local iface="$1" opts timeout action=false
+ local cfgfile="/etc/wpa_supplicant.conf"
local actfile="/sbin/wpa_cli.action"
# We don't configure wireless if we're being called from
@@ -226,6 +208,8 @@ wpa_supplicant_pre_start() {
local ifvar=$( bash_variable "${iface}" )
eval opts=\" \$\{wpa_supplicant_${ifvar}\} \"
+ [[ ${opts} != *" -D"* ]] \
+ && ewarn "wpa_supplicant_${ifvar} does not define a driver"
# We only work on wirelesss interfaces unless a driver for wired
# has been defined
@@ -237,9 +221,6 @@ wpa_supplicant_pre_start() {
fi
fi
- [[ ${opts} != *" -D"* ]] \
- && ewarn "wpa_supplicant_${ifvar} does not define a driver"
-
# Check for rf_kill - only ipw supports this at present, but other
# cards may in the future
if [[ -e "/sys/class/net/${iface}/device/rf_kill" ]]; then
@@ -252,7 +233,7 @@ wpa_supplicant_pre_start() {
# If wireless-tools is installed, try and apply our user config
# This is needed for some drivers - such as hostap because they start
# the card in Master mode which causes problems with wpa_supplicant.
- if [[ $( type -t iwconfig_defaults ) == "function" ]]; then
+ if is_function iwconfig_defaults ; then
if wpa_supplicant_check_extensions "${iface}" ; then
iwconfig_defaults "${iface}"
iwconfig_user_config "${iface}"
@@ -261,15 +242,6 @@ wpa_supplicant_pre_start() {
ebegin "Starting wpa_supplicant on ${iface}"
- cfgfile="${opts##* -c}"
- if [[ -n ${cfgfile} && ${cfgfile} != "${opts}" ]]; then
- [[ ${cfgfile:0:1} == " " ]] && cfgfile="${cfgfile# *}"
- cfgfile="${cfgfile%% *}"
- else
- cfgfile="/etc/wpa_supplicant.conf"
- opts="${opts} -c/etc/wpa_supplicant.conf"
- fi
-
if [[ ! -f ${cfgfile} ]]; then
eend 1 "configuration file ${cfgfile} not found!"
return 1
@@ -303,8 +275,7 @@ wpa_supplicant_pre_start() {
fi
start-stop-daemon --start --exec /sbin/wpa_supplicant \
- --pidfile "/var/run/wpa_supplicant-${iface}.pid" \
- -- ${opts} -B -i"${iface}"
+ -- ${opts} -B -c/etc/wpa_supplicant.conf -i"${iface}"
eend "$?" || return 1
# Starting wpa_supplication-0.4.0, we can get wpa_cli to
@@ -313,7 +284,6 @@ wpa_supplicant_pre_start() {
mark_service_inactive "net.${iface}"
ebegin "Starting wpa_cli on ${iface}"
start-stop-daemon --start --exec /bin/wpa_cli \
- --pidfile "/var/run/wpa_cli-${iface}.pid" \
-- -a"${actfile}" -i"${iface}" \
-P"/var/run/wpa_cli-${iface}.pid" -B
eend "$?" || return 1
diff --git a/sbin/runscript.sh b/sbin/runscript.sh
index aec6799..6e7404c 100755
--- a/sbin/runscript.sh
+++ b/sbin/runscript.sh
@@ -451,8 +451,8 @@ if [[ -z ${opts} ]] ; then
fi
svc_homegrown() {
- local arg=$1
- local x=
+ local x arg=$1
+ shift
# Walk through the list of available options, looking for the
# requested one.
@@ -466,9 +466,11 @@ svc_homegrown() {
fi
fi
done
+ x=""
# If we're here, then the function wasn't in $opts.
- eerror "ERROR: wrong args. ( "${arg}" / $* )"
+ [[ -n $* ]] && x="/ $* "
+ eerror "ERROR: wrong args ( "${arg}" ${x})"
# Do not quote this either ...
usage ${opts}
exit 1
@@ -517,6 +519,10 @@ for arg in $* ; do
restart)
svcrestart="yes"
+ # We don't kill child processes if we're restarting
+ # This is especically important for sshd ....
+ RC_KILL_CHILDREN="no"
+
# Create a snapshot of started services
rm -rf "${svcdir}/snapshot/$$"
mkdir -p "${svcdir}/snapshot/$$"
diff --git a/src/core/parse.c b/src/core/parse.c
index b36cb54..f75d8b1 100644
--- a/src/core/parse.c
+++ b/src/core/parse.c
@@ -59,7 +59,7 @@
#define PARSE_BUFFER_SIZE 256
#define OUTPUT_MAX_LINE_LENGHT 256
-#define OUTPUT_BUFFER_SIZE (60 * 1024)
+#define OUTPUT_BUFFER_SIZE (60 * 2048)
/* void PRINT_TO_BUFFER(char **_buf, int _count, label _error, format) */
#define PRINT_TO_BUFFER(_buf, _count, _error, _output...) \