diff -ubr 2.0.29/include/linux/ipx.h linux/include/linux/ipx.h --- 2.0.29/include/linux/ipx.h Mon May 13 22:39:28 1996 +++ linux/include/linux/ipx.h Tue May 27 02:50:48 1997 @@ -75,5 +75,6 @@ #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2) +#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3) #endif diff -ubr 2.0.29/include/net/sock.h linux/include/net/sock.h --- 2.0.29/include/net/sock.h Tue Dec 10 18:35:21 1996 +++ linux/include/net/sock.h Tue May 27 02:50:48 1997 @@ -112,7 +112,11 @@ * know the connection this socket belongs to. */ struct ncp_server *ncp_server; - +/* + * To handle special ncp connection-handling sockets for mars_nwe, + * the connection number must be stored in the socket. + */ + unsigned short ipx_ncp_conn; }; #endif diff -ubr 2.0.29/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c --- 2.0.29/net/ipx/af_ipx.c Tue Dec 10 18:35:35 1996 +++ linux/net/ipx/af_ipx.c Tue May 27 02:50:48 1997 @@ -468,7 +468,60 @@ ipx_socket *sock1 = NULL, *sock2 = NULL; struct sk_buff *skb1 = NULL, *skb2 = NULL; + if (intrfc == ipx_primary_net + && ntohs(ipx->ipx_dest.sock) == 0x451) + { + /* + * The packet's target is a NCP connection handler. We want to + * hand it to the correct socket directly within the kernel, + * so that the mars_nwe packet distribution process + * does not have to do it. Here we only care about NCP and + * BURST packets. + * You might call this a hack, but believe me, you do not + * want a complete NCP layer in the kernel, and this is + * VERY fast as well. + */ + int connection = 0; + + if ( *((char*)(ipx+1)) == 0x22 + && *((char*)(ipx+1)+1) == 0x22) + { + /* + * The packet is a NCP request + */ + connection = ( ((int) *((char*)(ipx+1)+5)) << 8 ) + | (int) *((char*)(ipx+1)+3); + } + else if ( *((char*)(ipx+1)) == 0x77 + && *((char*)(ipx+1)+1) == 0x77) + { + /* + * The packet is a BURST packet + */ + connection = ( ((int) *((char*)(ipx+1)+9)) << 8 ) + | (int) *((char*)(ipx+1)+8); + } + + if (connection) + { + /* + * Now we have to look for a special NCP connection handling + * socket. Only these sockets have ipx_ncp_conn != 0, set + * by SIOCIPXNCPCONN. + */ + for (sock1=intrfc->if_sklist; + (sock1 != NULL) && + (sock1->protinfo.af_ipx.ipx_ncp_conn != connection); + sock1=sock1->next);; + } + } + if (sock1 == NULL) + { + /* No special socket found, forward the packet the + * normal way. + */ sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock); + } /* * We need to check if there is a primary net and if @@ -2242,6 +2295,21 @@ if(err) return err; return(ipxcfg_get_config_data((void *)arg)); } + + case SIOCIPXNCPCONN: + { + /* + * This socket wants to take care of the NCP connection + * handed to us in arg. + */ + if (!suser()) return(-EPERM); + err = verify_area(VERIFY_READ, (void *)arg, + sizeof(unsigned short)); + if (err) return err; + sk->protinfo.af_ipx.ipx_ncp_conn = get_fs_word(arg); + return 0; + } + case SIOCGSTAMP: if (sk) {