SPX for Linux RedHat 6.0 (kernel 2.2.15)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



      Hi guys!

   I have LINUX 6.0 with kernel 2.2.15 and  installed SPX protocol (module
af_spx.o).
This module was loaded using utility insmod.
   Using this feature i was create two programs: for server and for client.
Listing below

SERVER
#include <stdio.h>
#include <sys/types.h>
#include <netipx/ipx.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <errno.h>

int main(int argc,char** argv){
    struct sockaddr_ipx sa_ipx;
    int sock2;
    int len=sizeof(sa_ipx);
    int sock=socket(PF_IPX,SOCK_SEQPACKET,PF_IPX);

    sa_ipx.sipx_family = AF_IPX;
    sa_ipx.sipx_network = 0;
    sa_ipx.sipx_port = htons(0x8003);
    sa_ipx.sipx_type = 5;
    if(bind(sock,(struct sockaddr *)&sa_ipx,len)==-1){
        perror("Error bind");
        exit(3);
    }
    if(listen(sock,1)==-1){
        perror("Error listen");
         exit(3);
    }
    if((sock2=accept(sock,(struct sockaddr *)&sa_ipx,&len))<0){
        perror("Error accept");
       exit(3);
    }
    shutdown(sock,2);
    printf("Connected from %08lX:%02X%02X%02X%02X%02X%02X:%04X\n",
       htonl(sa_ipx.sipx_network),
       sa_ipx.sipx_node[0], sa_ipx.sipx_node[1],
       sa_ipx.sipx_node[2], sa_ipx.sipx_node[3],
       sa_ipx.sipx_node[4], sa_ipx.sipx_node[5],
       htons(sa_ipx.sipx_port));
....
   shutdown(sock2,2);
   return 0;
}


CLIENT
#include <stdio.h>
#include <sys/types.h>
#include <netipx/ipx.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <errno.h>

int main(int argc,char** argv){
    int result;
    struct sockaddr_ipx sa_ipx;
    int len=sizeof(sa_ipx);
    int sock=socket(PF_IPX,SOCK_SEQPACKET,PF_IPX);

    sa_ipx.sipx_family = AF_IPX;
    sa_ipx.sipx_network = 0;
    sa_ipx.sipx_port = 0;
    sa_ipx.sipx_type = 5;
    if(bind(sock,(struct sockaddr *)&sa_ipx,len)==-1){
        perror("Error bind");
       exit(3);
    }
    result = getsockname(sock, (struct sockaddr *)&sa_ipx, &len);
    if (result < 0) {
      perror("SPX: getsockname: ");
      exit(3);
   }
   sa_ipx.sipx_port = htons(0x8003);
   if(connect(sock,(struct sockaddr *)&sa_ipx,len)<0) {
      perror("SPX: connect: ");
      exit(3);
   }
   printf("Connected to %08lX:%02X%02X%02X%02X%02X%02X:%04X\n",
      htonl(sa_ipx.sipx_network),
      sa_ipx.sipx_node[0], sa_ipx.sipx_node[1],
      sa_ipx.sipx_node[2], sa_ipx.sipx_node[3],
      sa_ipx.sipx_node[4], sa_ipx.sipx_node[5],
      htons(sa_ipx.sipx_port));
.....
   shutdown(sock,2);
   return 0;
}

    Both programs running on the same machine (with LINUX OS).
After established spx connection  on the screen occurs message from kernel:

UNABLE TO HANDLE KERNEL NULL POINTER DEREFERENCE
AT VIRTUAL ADDRESS 00000030
...

PROCESS SPX...
STACK...
CALL TRACE...
SEGMENTATION FAUL

  In file /usr/src/linux/net/ipx/af_spx.c present function spx_accept. This
function contains follow rows:

 217:    sk = sock->sk;
              ......
              ......
254:    sock->sk = null;
255:    sk->ack_backlog--;

   Variable <sk> is pointer to structure <sock>.On my mind asiign to pointer
null and after working
with pointer  - it's  greatest mistake and such program can't work right.
Because i changed places line 254 and line 255
And now

254:    sk->ack_backlog--;
255:    sock->sk = null;

However, this action don't help me. Probably the driver(af_spx.c) have some
more errors which i can't find.

And consequently I ask help if there is such opportunity.
Beforehand is grateful



With best regards
Rodion Matvienko


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux