stp
[Top] [All Lists]

[Fwd: STP patch for 2.4.0-test5]

To: stp@xxxxxxxxxxx
Subject: [Fwd: STP patch for 2.4.0-test5]
From: Aman Singla <aman@xxxxxxxxxxxx>
Date: Tue, 01 Aug 2000 15:45:48 -0700
Organization: SGI
Sender: owner-stp@xxxxxxxxxxx
A patch from Pekka.

:a

-------- Original Message --------
Subject: STP patch for 2.4.0-test5
Date: Tue, 1 Aug 2000 19:37:04 +0200 (CEST)
From: Pekka Pietikainen <Pekka.Pietikainen@xxxxxxx>
Reply-To: Pekka Pietikainen <Pekka.Pietikainen@xxxxxxx>
To: aman@xxxxxxxxxxxxxxxxxxxx

Hi

I took another shot at porting STP to the latest kernel, and found
the original problem, sendmsg was pointing at sock_no_fcntl and recvmsg 
to sendmsg, which "might" have caused some problems ;)

Here's a patch on top of 2.4.0-test5 + stp-0.32-2.3.99pre2 that actually
works...

diff -urN 1/include/linux/if_ether.h 2/include/linux/if_ether.h
--- 1/include/linux/if_ether.h  Tue Aug  1 20:41:38 2000
+++ 2/include/linux/if_ether.h  Tue Aug  1 18:25:42 2000
@@ -58,6 +58,7 @@
 #define ETH_P_IPV6     0x86DD          /* IPv6 over bluebook           */
 #define ETH_P_PPP_DISC 0x8863          /* PPPoE discovery messages     */
 #define ETH_P_PPP_SES  0x8864          /* PPPoE session messages       */
+#define ETH_P_STP      0x8183          /* STP over 802.3               */
 
 /*
  *     Non DIX types. Won't clash for 1500 types.
diff -urN 1/net/Makefile 2/net/Makefile
--- 1/net/Makefile      Tue Aug  1 20:41:38 2000
+++ 2/net/Makefile      Tue Aug  1 18:26:55 2000
@@ -10,7 +10,7 @@
 MOD_SUB_DIRS := ipv4
 ALL_SUB_DIRS := 802 ax25 bridge core ethernet ipv4 ipv6 ipx unix
appletalk \
                netrom rose lapb x25 wanrouter netlink sched packet sunrpc \
-               econet irda decnet atm khttpd ipv4/netfilter ipv6/netfilter
+               econet irda decnet atm khttpd ipv4/netfilter ipv6/netfilter stp
 SUB_DIRS     := core ethernet
 MOD_LIST_NAME := NET_MISC_MODULES
 
diff -urN 1/net/ipv4/proc.c 2/net/ipv4/proc.c
--- 1/net/ipv4/proc.c   Tue Aug  1 20:41:38 2000
+++ 2/net/ipv4/proc.c   Tue Aug  1 18:52:15 2000
@@ -80,6 +80,15 @@
                       fold_prot_inuse(&raw_prot));
        len += sprintf(buffer+len, "FRAG: inuse %d memory %d\n",
                       ip_frag_nqueues, atomic_read(&ip_frag_mem));
+#if defined(CONFIG_STP) || defined(CONFIG_STP_MODULE)
+{
+       extern struct proto* stp_prot_ptr;
+
+       if (stp_prot_ptr)
+               len += sprintf(buffer+len, "STP: inuse %d\n",
+                       fold_prot_inuse(stp_prot_ptr));
+}
+#endif
        if (offset >= len)
        {
                *start = buffer;
diff -urN 1/net/stp/core/stp_inet.c 2/net/stp/core/stp_inet.c
--- 1/net/stp/core/stp_inet.c   Tue Aug  1 20:41:38 2000
+++ 2/net/stp/core/stp_inet.c   Tue Aug  1 20:21:15 2000
@@ -247,7 +247,7 @@
                sk->sport = htons(sk->num);
                sk_dst_reset(sk);
                sk->prot->hash(sk);
-               sk->socket->flags |= SO_ACCEPTCON;
+               sk->socket->flags |= __SO_ACCEPTCON;
                sk->write_space = stp_inet_nop_write_space;
        }
        sk->max_ack_backlog = backlog;
@@ -274,7 +274,7 @@
        lock_sock(sk);
 
        err = -EINVAL;
-       if ((sock->state != SS_UNCONNECTED) || (!(sock->flags & SO_ACCEPTCON))
|| (sk->state != TCP_LISTEN))
+       if ((sock->state != SS_UNCONNECTED) || (!(sock->flags &
__SO_ACCEPTCON)) || (sk->state != TCP_LISTEN))
                goto out;
 
        /* assumption: should be able to call prot->accept multiple
@@ -533,24 +533,23 @@
 }
 
 struct proto_ops stp_inet_ops = {
-       PF_INET,
+        family: PF_INET,
 
-       stp_inet_release,
-       stp_inet_bind,
-       stp_inet_stream_connect,
-       sock_no_socketpair,
-       stp_inet_accept,
-       inet_getname,
-       stp_inet_poll,
-       inet_ioctl,
-       stp_inet_listen,
-       inet_shutdown,
-       inet_setsockopt,
-       inet_getsockopt,
-       sock_no_fcntl,
-       inet_sendmsg,
-       inet_recvmsg,
-       stp_inet_mmap
+       release: stp_inet_release,
+       bind: stp_inet_bind,
+       connect: stp_inet_stream_connect,
+       socketpair: sock_no_socketpair,
+       accept: stp_inet_accept,
+       getname: inet_getname,
+       poll: stp_inet_poll,
+       ioctl: inet_ioctl,
+       listen: stp_inet_listen,
+       shutdown: inet_shutdown,
+       setsockopt: inet_setsockopt,
+       getsockopt: inet_getsockopt,
+       sendmsg: inet_sendmsg,
+       recvmsg: inet_recvmsg,
+       mmap: stp_inet_mmap
 };
 
 
diff -urN 1/net/stp/core/stp_timers.h 2/net/stp/core/stp_timers.h
--- 1/net/stp/core/stp_timers.h Tue Aug  1 20:41:38 2000
+++ 2/net/stp/core/stp_timers.h Tue Aug  1 19:25:55 2000
@@ -53,19 +53,17 @@
        {                                                                       
                        \
                struct sock* sk = p->_sock;                                     
                        \
                                                                                
                        \
-               spin_lock_bh(&sk->timer_lock);                                  
                        \
                if (!when) {                                                    
                        \
                        if (del_timer(&p->_timer))                              
                        \
                                sock_put(sk);                                   
                        \
                        p->_timer.data = 0;                                     
                        \
                } else {                                                        
                        \
-                       if (!p->_timer.prev) {                                  
                        \
+                       if (!timer_pending(&p->_timer)) {                       
                                        \
                                p->_timer.data = (unsigned long)p;              
                        \
                                sock_hold(sk);                                  
                        \
                        }                                                       
                        \
                        mod_timer(&p->_timer, jiffies+when);                    
                        \
                }                                                               
                        \
-               spin_unlock_bh(&sk->timer_lock);                                
                        \
        }
 
 #define DEFINE_STP_TIMEOUT_FUNCTION(_func, _desctype, _varname, _sock,
_timer, _fsm_func_call)         \
@@ -86,13 +84,11 @@
                        /* reschedule for later - only if no one added/deleted 
the timer                \
                         * between it going off and getting here                
                        \
                         */                                                     
                        \
-                       spin_lock_bh(&sk->timer_lock);                          
                        \
-                       if ((!_varname->_timer.prev) && _varname->_timer.data) 
{                        \
+                       if (!timer_pending(&_varname->_timer) && 
_varname->_timer.data) {               
\
                                _varname->_timer.expires = jiffies + 
STP_TIMEOUT_RESCHEDULE;            \
                                add_timer(&_varname->_timer);                   
                        \
                                sock_hold(sk);                                  
                        \
                        }                                                       
                        \
-                       spin_unlock_bh(&sk->timer_lock);                        
                        \
                }                                                               
                        \
                bh_unlock_sock(sk);                                             
                        \
                sock_put(sk);                                                   
                        \

<Prev in Thread] Current Thread [Next in Thread>
  • [Fwd: STP patch for 2.4.0-test5], Aman Singla <=