raw IPv6 socket for SCTP stack
Hi,
I am trying to add IPv6 capability to an SCTP stack which runs on CentOS platforms. Currently it works using IPv4. But I am having some issues with IPv6.
Both IPv4 and IPv6 connectivity is via a RAW socket with IPPROTO_SCTP. Socket is opened as below for IPv4 and IPv6:
fd4 = socket(AF_INET, SOCK_RAW, IPPROTO_SCTP);
fd6 = socket(AF_INET6, SOCK_RAW, IPPROTO_SCTP);
After this I simply try to send a message by using sendto(fd, sctpMsg, msgSize, 0,(struct sockaddr*) toAddr, sizeof (struct sockaddr_in6));
The sendto call succeeds and I can see the packet outgoing from the interface via tcpdump. It even reaches the remote host. This is the SCTP INIT message I am trying to send.
But, the message goes out with a different destination port value than the one I had set in the message. I have debugged this and confirmed that right before the sendto call sctpMsg buffer has the correct values for source and destination port. But somehow the destination port of the SCTP INIT message goes out with a different value.
I am aware that this is a weird issue. But I would like to get any kind of pointers that might help. I could use any help in terms of how a transport layer protocol would be implemented using RAW sockets with IPV6.
I think I need to check the kernel source code of CentOS. Any ideas?
Thanks in advance.
|