From 74bb646ee5a812e91949c03fa461bc4bd7d2d7b8 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 16 Nov 2015 12:15:47 +0530 Subject: socket: Add support for socket protcol Now we don't support the socket protocol like sctp and udplite . This patch add a new config param SocketProtocol: udplite/sctp With this now we can configure the protocol as udplite = IPPROTO_UDPLITE sctp = IPPROTO_SCTP Tested with nspawn: --- src/core/socket.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/socket.c') diff --git a/src/core/socket.c b/src/core/socket.c index 5b9e32ce9d..687675b24e 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1266,6 +1266,19 @@ static int socket_open_fds(Socket *s) { know_label = true; } + /* Apply the socket protocol */ + switch(p->address.type) { + case SOCK_STREAM: + case SOCK_SEQPACKET: + if (p->socket->socket_protocol == IPPROTO_SCTP) + p->address.protocol = p->socket->socket_protocol; + break; + case SOCK_DGRAM: + if (p->socket->socket_protocol == IPPROTO_UDPLITE) + p->address.protocol = p->socket->socket_protocol; + break; + } + r = socket_address_listen( &p->address, SOCK_CLOEXEC|SOCK_NONBLOCK, -- cgit v1.2.3-54-g00ecf