net: add a new bind_add method
The SCTP protocol allows to bind multiple address to a socket. That feature is currently only exposed as a socket option. Add a bind_add method struct proto that allows to bind additional addresses, and switch the dlm code to use the method instead of going through the socket option from kernel space. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
05bfd36614
commit
c0425a4249
@@ -882,6 +882,7 @@ static void writequeue_entry_complete(struct writequeue_entry *e, int completed)
|
||||
static int sctp_bind_addrs(struct connection *con, uint16_t port)
|
||||
{
|
||||
struct sockaddr_storage localaddr;
|
||||
struct sockaddr *addr = (struct sockaddr *)&localaddr;
|
||||
int i, addr_len, result = 0;
|
||||
|
||||
for (i = 0; i < dlm_local_count; i++) {
|
||||
@@ -889,13 +890,9 @@ static int sctp_bind_addrs(struct connection *con, uint16_t port)
|
||||
make_sockaddr(&localaddr, port, &addr_len);
|
||||
|
||||
if (!i)
|
||||
result = kernel_bind(con->sock,
|
||||
(struct sockaddr *)&localaddr,
|
||||
addr_len);
|
||||
result = kernel_bind(con->sock, addr, addr_len);
|
||||
else
|
||||
result = kernel_setsockopt(con->sock, SOL_SCTP,
|
||||
SCTP_SOCKOPT_BINDX_ADD,
|
||||
(char *)&localaddr, addr_len);
|
||||
result = sock_bind_add(con->sock->sk, addr, addr_len);
|
||||
|
||||
if (result < 0) {
|
||||
log_print("Can't bind to %d addr number %d, %d.\n",
|
||||
|
Reference in New Issue
Block a user