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:
This commit is contained in:
Susant Sahani
2015-11-18 09:34:18 +05:30
parent 92939fc4c0
commit 74bb646ee5
6 changed files with 57 additions and 0 deletions
+13
View File
@@ -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,