summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fastd.c b/fastd.c
index d660c35..c9afc67 100644
--- a/fastd.c
+++ b/fastd.c
@@ -352,6 +352,7 @@ err_module_put:
static int fastd_cmd_bind(struct sk_buff *skb, struct genl_info *info)
{
+ struct net *net = genl_info_net(info);
int err;
sa_family_t af;
struct fastd_socket *socket;
@@ -369,10 +370,12 @@ static int fastd_cmd_bind(struct sk_buff *skb, struct genl_info *info)
if (!socket)
return -ENOMEM;
- err = sock_create_kern(af, SOCK_DGRAM, 0, &socket->sock);
+ err = sock_create_kern(af, SOCK_DGRAM, IPPROTO_UDP, &socket->sock);
if (err)
goto err_free_socket;
+ sk_change_net(socket->sock->sk, net);
+
err = kernel_bind(socket->sock,
nla_data(info->attrs[FASTD_A_LOCALADDR]),
nla_len(info->attrs[FASTD_A_LOCALADDR]));
@@ -381,7 +384,7 @@ static int fastd_cmd_bind(struct sk_buff *skb, struct genl_info *info)
rcu_read_lock();
- fastd = fastd_find(genl_info_net(info), info->snd_portid);
+ fastd = fastd_find(net, info->snd_portid);
if (!fastd) {
err = -EINVAL;
goto err_unlock_rcu;