diff options
author | Susant Sahani <ssahani@gmail.com> | 2015-11-16 12:15:47 +0530 |
---|---|---|
committer | Susant Sahani <ssahani@gmail.com> | 2015-11-18 09:34:18 +0530 |
commit | 74bb646ee5a812e91949c03fa461bc4bd7d2d7b8 (patch) | |
tree | 77005e44f0d3679e44a2be084aef627ddd92471c /src/core/socket.c | |
parent | 92939fc4c0261dccd4b755186aba84a9b1412bed (diff) |
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:
Diffstat (limited to 'src/core/socket.c')
-rw-r--r-- | src/core/socket.c | 13 |
1 files changed, 13 insertions, 0 deletions
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, |