aboutsummaryrefslogtreecommitdiffstats
path: root/net/mctp/af_mctp.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@codeconstruct.com.au>2021-07-29 10:20:52 +0800
committerDavid S. Miller <davem@davemloft.net>2021-07-29 15:06:50 +0100
commit03f2bbc4ee57ca53b2fa1d9caabc5006e0b8f375 (patch)
tree488ab5b5447c4a2ca15c455f56e76f7485b1ba31 /net/mctp/af_mctp.c
parentmctp: Add dest neighbour lladdr to route output (diff)
downloadlinux-dev-03f2bbc4ee57ca53b2fa1d9caabc5006e0b8f375.tar.xz
linux-dev-03f2bbc4ee57ca53b2fa1d9caabc5006e0b8f375.zip
mctp: Allow per-netns default networks
Currently we have a compile-time default network (MCTP_INITIAL_DEFAULT_NET). This change introduces a default_net field on the net namespace, allowing future configuration for new interfaces. Signed-off-by: Matt Johnston <matt@codeconstruct.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mctp/af_mctp.c')
-rw-r--r--net/mctp/af_mctp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c
index 9ca836df19d0..84f722d31fd7 100644
--- a/net/mctp/af_mctp.c
+++ b/net/mctp/af_mctp.c
@@ -94,6 +94,9 @@ static int mctp_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
if (!capable(CAP_NET_RAW))
return -EACCES;
+ if (addr->smctp_network == MCTP_NET_ANY)
+ addr->smctp_network = mctp_default_net(sock_net(sk));
+
rt = mctp_route_lookup(sock_net(sk), addr->smctp_network,
addr->smctp_addr.s_addr);
if (!rt)