Возможно ли привязаться к IPv4 "0.0.0.0" после привязки к первичному IPv6 "::"?
Просьба подсобить или ткнуть урл-ом на стандарт или обсуждение.Исходный выхлоп (gcc -lsctp -o sctp sctp.c && strace ./sctp),
...
socket(PF_INET6, SOCK_STREAM, 0x84 /* IPPROTO_??? */) = 3
setsockopt(3, 0x84 /* SOL_?? */, 11, "\1\1\0\0\0\0\0\0\0", 9) = 0
setsockopt(3, 0x84 /* SOL_?? */, 2, "\4\0\4\0\4\0\0\0", 8) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(55555), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
setsockopt(3, 0x84 /* SOL_?? */, 100, "\2\0\331\3\0\0\0\0\0\0\0\0\0\0\0\0", 16) = -1 EINVAL (Invalid argument)
...
Исходник (sctp.c),
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
#include <errno.h>
#include "hassalen.h"
#if !defined(SHOULD_IPPROTO_SCTP)
#define SHOULD_IPPROTO_SCTP 132
#endif
#define MAX_STREAM 4
struct sctp_initmsg initmsg = {0};
struct sctp_event_subscribe events = {0};
int fd1;
int fd2;
struct sockaddr *sa;
struct sockaddr_in a4 = {0};
struct sockaddr_in6 a6 = {0};
char *addr4 = "0.0.0.0";
char *addr6 = "::";
unsigned int port1 = 55555;
unsigned int port2 = 55555;
int main() {
int ret;
if (inet_pton(AF_INET6,addr6,(void *) &a6.sin6_addr) <= 0)
_exit(1);
a6.sin6_port = htons((unsigned short) port1);
a6.sin6_family = AF_INET6;
#if defined(HASSALEN)
a6.sin6_len = sizeof (struct sockaddr_in6);
#endif
fd1 = socket(AF_INET6,SOCK_STREAM,SHOULD_IPPROTO_SCTP);
if (fd1 < 0) _exit(1);
events.sctp_association_event = 1;
events.sctp_data_io_event = 1;
ret = setsockopt(fd1, IPPROTO_SCTP, SCTP_EVENTS, &events,sizeof (events));
if (ret < 0) _exit(1);
initmsg.sinit_num_ostreams = MAX_STREAM;
initmsg.sinit_max_instreams = MAX_STREAM;
initmsg.sinit_max_attempts = MAX_STREAM;
ret = setsockopt(fd1, IPPROTO_SCTP, SCTP_INITMSG, &initmsg, sizeof(struct sctp_initmsg));
if (ret < 0) _exit(1);
ret = bind(fd1,(struct sockaddr *) &a6,sizeof(a6));
if (ret < 0) _exit(1);
//
if (inet_pton(AF_INET,addr4,(void *) &a4.sin_addr) <= 0)
_exit(1);
a4.sin_port = htons((unsigned short) port2);
a4.sin_family = AF_INET;
#if defined(HASSALEN)
a4.sin_len = sizeof(struct sockaddr_in);
#endif
sa = (struct sockaddr *) &a4;
ret = sctp_bindx(fd1,sa,1,SCTP_BINDX_ADD_ADDR);
if (ret != 0) _exit(1);
close(fd1);
_exit(0);
}