summaryrefslogtreecommitdiff
path: root/net/sctp
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-29 15:09:42 +0300
committerDavid S. Miller <davem@davemloft.net>2020-05-29 23:10:39 +0300
commitc0425a4249e9d313eec5f81c0bde8a286ebf9a63 (patch)
treedbe8e82ca86e471956cef038764adb299270b0ef /net/sctp
parent05bfd3661448a46db3a258b316160d34cf0a1317 (diff)
downloadlinux-c0425a4249e9d313eec5f81c0bde8a286ebf9a63.tar.xz
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>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/socket.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6e745ac3c4a5..d57e1a002ffc 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1052,6 +1052,18 @@ static int sctp_setsockopt_bindx(struct sock *sk,
return err;
}
+static int sctp_bind_add(struct sock *sk, struct sockaddr *addrs,
+ int addrlen)
+{
+ int err;
+
+ lock_sock(sk);
+ err = sctp_setsockopt_bindx_kernel(sk, addrs, addrlen,
+ SCTP_BINDX_ADD_ADDR);
+ release_sock(sk);
+ return err;
+}
+
static int sctp_connect_new_asoc(struct sctp_endpoint *ep,
const union sctp_addr *daddr,
const struct sctp_initmsg *init,
@@ -9620,6 +9632,7 @@ struct proto sctp_prot = {
.sendmsg = sctp_sendmsg,
.recvmsg = sctp_recvmsg,
.bind = sctp_bind,
+ .bind_add = sctp_bind_add,
.backlog_rcv = sctp_backlog_rcv,
.hash = sctp_hash,
.unhash = sctp_unhash,
@@ -9662,6 +9675,7 @@ struct proto sctpv6_prot = {
.sendmsg = sctp_sendmsg,
.recvmsg = sctp_recvmsg,
.bind = sctp_bind,
+ .bind_add = sctp_bind_add,
.backlog_rcv = sctp_backlog_rcv,
.hash = sctp_hash,
.unhash = sctp_unhash,