[Bridge] RSTP in http://git.kernel.org/?p=linux/kernel/git/shemminger/rstp.git; a=summary problems
Joakim Tjernlund
joakim.tjernlund at transmode.se
Mon Mar 31 04:48:39 PDT 2008
On Mon, 2008-03-31 at 12:55 +0530, Srinivas M.A. wrote:
> >
> > Ahh, I didn't copy bridge-stp to /sbin because I didn't think it was
> > needed. Just to test I blindly copied it to /sbin and did:
> > brclt addbr br0
> >
> > brctl addif br0 eth0
> > brctl stp br0
> > and it hung my board :(
>
> What did your /sbin/bridge-stp have. The file from the tarball? Try a
> simple one which just does exit 0.
>
> > Meanwhile I got 2 patches for you:
> >
>
> I didn't realize offsetof() was in stddef.h. Thanks.
>
> The __builtin_choose_expr stuff is there to trigger a compiler error
> if I try to compare or copy two structs of different sizes. I should
> just make that portion dependent on having a new enough gcc.
Here is a quick hack to make bridge-stp work at all.
The biggest problem is that rstpd cant start if stdio isn't present.
rstpd needs to properly daemonize.
Jocke
diff --git a/bridge-stp b/bridge-stp
index 49d5a41..0a5ac3c 100755
--- a/bridge-stp
+++ b/bridge-stp
@@ -14,7 +14,7 @@ if [ $# -ne 2 ]; then
fi
bridge=$1
service=rstpd
-pid_file=/var/run/${servicename}.pid
+pid_file=/var/run/${service}.pid
# Set $pid to pids from /var/run* for {program}. $pid should be declared
# local in the caller.
@@ -41,7 +41,7 @@ daemon() {
[ -n "$pid" ] && return
# start it
- /sbin/rstpd
+ start-stop-daemon --background --start --exec /sbin/rstpd -- -d
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
}
@@ -53,9 +53,13 @@ start() {
case $2 in
start)
daemon
- exec /sbin/rstpctl $bridge on ;;
+# exec /sbin/rstpctl $bridge on ;;
+ exit 0 ;;
stop)
- exec /sbin/rstpctl $bridge off ;;
+# exec /sbin/rstpctl $bridge off ;;
+ start-stop-daemon --stop --exec /sbin/rstpd --name rstpd
+ exit 0 ;;
+
*)
echo "Unknown action:" $2
echo "Usage: bridge-stp <bridge> {start|stop}"
More information about the Bridge
mailing list