diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-14 01:51:25 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-14 01:51:25 +0200 |
commit | 6e93844647f2af858cf1ee4d6351f6f78dc1e5b7 (patch) | |
tree | f7a2253be9a33a16a94959d14e527d4dcb4d88bd | |
parent | e8b776c4bb8881239162f1df48c50da4a783aec9 (diff) | |
download | modfastd-6e93844647f2af858cf1ee4d6351f6f78dc1e5b7.tar modfastd-6e93844647f2af858cf1ee4d6351f6f78dc1e5b7.zip |
Set netns for created socket
-rw-r--r-- | fastd.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |