diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-01-09 02:27:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-12 16:24:33 -0500 |
commit | 347475395434abb2b61bf59c2952470f37072567 (patch) | |
tree | 71a5f63547edecee31f557d0bacbf993b953a099 /net/tipc/socket.c | |
parent | 4ac1c8d0ee9faf3a4be185cc4db1381fa0d81280 (diff) |
tipc: make tipc node address support net namespace
If net namespace is supported in tipc, each namespace will be treated
as a separate tipc node. Therefore, every namespace must own its
private tipc node address. This means the "tipc_own_addr" global
variable of node address must be moved to tipc_net structure to
satisfy the requirement. It's turned out that users also can assign
node address for every namespace.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Tested-by: Tero Aho <Tero.Aho@coriant.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 86 |
1 files changed, 51 insertions, 35 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 4670e1e46c89..9b8470edc783 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -251,10 +251,11 @@ static void tsk_rej_rx_queue(struct sock *sk) | |||
251 | { | 251 | { |
252 | struct sk_buff *skb; | 252 | struct sk_buff *skb; |
253 | u32 dnode; | 253 | u32 dnode; |
254 | struct net *net = sock_net(sk); | ||
254 | 255 | ||
255 | while ((skb = __skb_dequeue(&sk->sk_receive_queue))) { | 256 | while ((skb = __skb_dequeue(&sk->sk_receive_queue))) { |
256 | if (tipc_msg_reverse(skb, &dnode, TIPC_ERR_NO_PORT)) | 257 | if (tipc_msg_reverse(net, skb, &dnode, TIPC_ERR_NO_PORT)) |
257 | tipc_link_xmit_skb(sock_net(sk), skb, dnode, 0); | 258 | tipc_link_xmit_skb(net, skb, dnode, 0); |
258 | } | 259 | } |
259 | } | 260 | } |
260 | 261 | ||
@@ -265,6 +266,7 @@ static void tsk_rej_rx_queue(struct sock *sk) | |||
265 | */ | 266 | */ |
266 | static bool tsk_peer_msg(struct tipc_sock *tsk, struct tipc_msg *msg) | 267 | static bool tsk_peer_msg(struct tipc_sock *tsk, struct tipc_msg *msg) |
267 | { | 268 | { |
269 | struct tipc_net *tn = net_generic(sock_net(&tsk->sk), tipc_net_id); | ||
268 | u32 peer_port = tsk_peer_port(tsk); | 270 | u32 peer_port = tsk_peer_port(tsk); |
269 | u32 orig_node; | 271 | u32 orig_node; |
270 | u32 peer_node; | 272 | u32 peer_node; |
@@ -281,10 +283,10 @@ static bool tsk_peer_msg(struct tipc_sock *tsk, struct tipc_msg *msg) | |||
281 | if (likely(orig_node == peer_node)) | 283 | if (likely(orig_node == peer_node)) |
282 | return true; | 284 | return true; |
283 | 285 | ||
284 | if (!orig_node && (peer_node == tipc_own_addr)) | 286 | if (!orig_node && (peer_node == tn->own_addr)) |
285 | return true; | 287 | return true; |
286 | 288 | ||
287 | if (!peer_node && (orig_node == tipc_own_addr)) | 289 | if (!peer_node && (orig_node == tn->own_addr)) |
288 | return true; | 290 | return true; |
289 | 291 | ||
290 | return false; | 292 | return false; |
@@ -346,7 +348,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, | |||
346 | tsk->max_pkt = MAX_PKT_DEFAULT; | 348 | tsk->max_pkt = MAX_PKT_DEFAULT; |
347 | INIT_LIST_HEAD(&tsk->publications); | 349 | INIT_LIST_HEAD(&tsk->publications); |
348 | msg = &tsk->phdr; | 350 | msg = &tsk->phdr; |
349 | tipc_msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, | 351 | tipc_msg_init(net, msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, |
350 | NAMED_H_SIZE, 0); | 352 | NAMED_H_SIZE, 0); |
351 | 353 | ||
352 | /* Finish initializing socket data structures */ | 354 | /* Finish initializing socket data structures */ |
@@ -471,6 +473,7 @@ static int tipc_release(struct socket *sock) | |||
471 | { | 473 | { |
472 | struct sock *sk = sock->sk; | 474 | struct sock *sk = sock->sk; |
473 | struct net *net = sock_net(sk); | 475 | struct net *net = sock_net(sk); |
476 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
474 | struct tipc_sock *tsk; | 477 | struct tipc_sock *tsk; |
475 | struct sk_buff *skb; | 478 | struct sk_buff *skb; |
476 | u32 dnode, probing_state; | 479 | u32 dnode, probing_state; |
@@ -503,7 +506,8 @@ static int tipc_release(struct socket *sock) | |||
503 | tsk->connected = 0; | 506 | tsk->connected = 0; |
504 | tipc_node_remove_conn(net, dnode, tsk->portid); | 507 | tipc_node_remove_conn(net, dnode, tsk->portid); |
505 | } | 508 | } |
506 | if (tipc_msg_reverse(skb, &dnode, TIPC_ERR_NO_PORT)) | 509 | if (tipc_msg_reverse(net, skb, &dnode, |
510 | TIPC_ERR_NO_PORT)) | ||
507 | tipc_link_xmit_skb(net, skb, dnode, 0); | 511 | tipc_link_xmit_skb(net, skb, dnode, 0); |
508 | } | 512 | } |
509 | } | 513 | } |
@@ -514,9 +518,9 @@ static int tipc_release(struct socket *sock) | |||
514 | sock_put(sk); | 518 | sock_put(sk); |
515 | tipc_sk_remove(tsk); | 519 | tipc_sk_remove(tsk); |
516 | if (tsk->connected) { | 520 | if (tsk->connected) { |
517 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG, | 521 | skb = tipc_msg_create(net, TIPC_CRITICAL_IMPORTANCE, |
518 | SHORT_H_SIZE, 0, dnode, tipc_own_addr, | 522 | TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, |
519 | tsk_peer_port(tsk), | 523 | tn->own_addr, tsk_peer_port(tsk), |
520 | tsk->portid, TIPC_ERR_NO_PORT); | 524 | tsk->portid, TIPC_ERR_NO_PORT); |
521 | if (skb) | 525 | if (skb) |
522 | tipc_link_xmit_skb(net, skb, dnode, tsk->portid); | 526 | tipc_link_xmit_skb(net, skb, dnode, tsk->portid); |
@@ -614,6 +618,7 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr, | |||
614 | { | 618 | { |
615 | struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr; | 619 | struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr; |
616 | struct tipc_sock *tsk = tipc_sk(sock->sk); | 620 | struct tipc_sock *tsk = tipc_sk(sock->sk); |
621 | struct tipc_net *tn = net_generic(sock_net(sock->sk), tipc_net_id); | ||
617 | 622 | ||
618 | memset(addr, 0, sizeof(*addr)); | 623 | memset(addr, 0, sizeof(*addr)); |
619 | if (peer) { | 624 | if (peer) { |
@@ -624,7 +629,7 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr, | |||
624 | addr->addr.id.node = tsk_peer_node(tsk); | 629 | addr->addr.id.node = tsk_peer_node(tsk); |
625 | } else { | 630 | } else { |
626 | addr->addr.id.ref = tsk->portid; | 631 | addr->addr.id.ref = tsk->portid; |
627 | addr->addr.id.node = tipc_own_addr; | 632 | addr->addr.id.node = tn->own_addr; |
628 | } | 633 | } |
629 | 634 | ||
630 | *uaddr_len = sizeof(*addr); | 635 | *uaddr_len = sizeof(*addr); |
@@ -741,7 +746,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq, | |||
741 | new_mtu: | 746 | new_mtu: |
742 | mtu = tipc_bclink_get_mtu(); | 747 | mtu = tipc_bclink_get_mtu(); |
743 | __skb_queue_head_init(&head); | 748 | __skb_queue_head_init(&head); |
744 | rc = tipc_msg_build(mhdr, msg, 0, dsz, mtu, &head); | 749 | rc = tipc_msg_build(net, mhdr, msg, 0, dsz, mtu, &head); |
745 | if (unlikely(rc < 0)) | 750 | if (unlikely(rc < 0)) |
746 | return rc; | 751 | return rc; |
747 | 752 | ||
@@ -774,7 +779,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff *buf) | |||
774 | uint i, last, dst = 0; | 779 | uint i, last, dst = 0; |
775 | u32 scope = TIPC_CLUSTER_SCOPE; | 780 | u32 scope = TIPC_CLUSTER_SCOPE; |
776 | 781 | ||
777 | if (in_own_node(msg_orignode(msg))) | 782 | if (in_own_node(net, msg_orignode(msg))) |
778 | scope = TIPC_NODE_SCOPE; | 783 | scope = TIPC_NODE_SCOPE; |
779 | 784 | ||
780 | /* Create destination port list: */ | 785 | /* Create destination port list: */ |
@@ -826,7 +831,7 @@ static int tipc_sk_proto_rcv(struct tipc_sock *tsk, u32 *dnode, | |||
826 | if (conn_cong) | 831 | if (conn_cong) |
827 | tsk->sk.sk_write_space(&tsk->sk); | 832 | tsk->sk.sk_write_space(&tsk->sk); |
828 | } else if (msg_type(msg) == CONN_PROBE) { | 833 | } else if (msg_type(msg) == CONN_PROBE) { |
829 | if (!tipc_msg_reverse(buf, dnode, TIPC_OK)) | 834 | if (!tipc_msg_reverse(sock_net(&tsk->sk), buf, dnode, TIPC_OK)) |
830 | return TIPC_OK; | 835 | return TIPC_OK; |
831 | msg_set_type(msg, CONN_PROBE_REPLY); | 836 | msg_set_type(msg, CONN_PROBE_REPLY); |
832 | return TIPC_FWD_MSG; | 837 | return TIPC_FWD_MSG; |
@@ -959,7 +964,7 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
959 | new_mtu: | 964 | new_mtu: |
960 | mtu = tipc_node_get_mtu(net, dnode, tsk->portid); | 965 | mtu = tipc_node_get_mtu(net, dnode, tsk->portid); |
961 | __skb_queue_head_init(&head); | 966 | __skb_queue_head_init(&head); |
962 | rc = tipc_msg_build(mhdr, m, 0, dsz, mtu, &head); | 967 | rc = tipc_msg_build(net, mhdr, m, 0, dsz, mtu, &head); |
963 | if (rc < 0) | 968 | if (rc < 0) |
964 | goto exit; | 969 | goto exit; |
965 | 970 | ||
@@ -1074,7 +1079,7 @@ next: | |||
1074 | mtu = tsk->max_pkt; | 1079 | mtu = tsk->max_pkt; |
1075 | send = min_t(uint, dsz - sent, TIPC_MAX_USER_MSG_SIZE); | 1080 | send = min_t(uint, dsz - sent, TIPC_MAX_USER_MSG_SIZE); |
1076 | __skb_queue_head_init(&head); | 1081 | __skb_queue_head_init(&head); |
1077 | rc = tipc_msg_build(mhdr, m, sent, send, mtu, &head); | 1082 | rc = tipc_msg_build(net, mhdr, m, sent, send, mtu, &head); |
1078 | if (unlikely(rc < 0)) | 1083 | if (unlikely(rc < 0)) |
1079 | goto exit; | 1084 | goto exit; |
1080 | do { | 1085 | do { |
@@ -1246,6 +1251,7 @@ static int tipc_sk_anc_data_recv(struct msghdr *m, struct tipc_msg *msg, | |||
1246 | static void tipc_sk_send_ack(struct tipc_sock *tsk, uint ack) | 1251 | static void tipc_sk_send_ack(struct tipc_sock *tsk, uint ack) |
1247 | { | 1252 | { |
1248 | struct net *net = sock_net(&tsk->sk); | 1253 | struct net *net = sock_net(&tsk->sk); |
1254 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
1249 | struct sk_buff *skb = NULL; | 1255 | struct sk_buff *skb = NULL; |
1250 | struct tipc_msg *msg; | 1256 | struct tipc_msg *msg; |
1251 | u32 peer_port = tsk_peer_port(tsk); | 1257 | u32 peer_port = tsk_peer_port(tsk); |
@@ -1253,8 +1259,9 @@ static void tipc_sk_send_ack(struct tipc_sock *tsk, uint ack) | |||
1253 | 1259 | ||
1254 | if (!tsk->connected) | 1260 | if (!tsk->connected) |
1255 | return; | 1261 | return; |
1256 | skb = tipc_msg_create(CONN_MANAGER, CONN_ACK, INT_H_SIZE, 0, dnode, | 1262 | skb = tipc_msg_create(net, CONN_MANAGER, CONN_ACK, INT_H_SIZE, 0, |
1257 | tipc_own_addr, peer_port, tsk->portid, TIPC_OK); | 1263 | dnode, tn->own_addr, peer_port, tsk->portid, |
1264 | TIPC_OK); | ||
1258 | if (!skb) | 1265 | if (!skb) |
1259 | return; | 1266 | return; |
1260 | msg = buf_msg(skb); | 1267 | msg = buf_msg(skb); |
@@ -1726,6 +1733,7 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb) | |||
1726 | int rc; | 1733 | int rc; |
1727 | u32 onode; | 1734 | u32 onode; |
1728 | struct tipc_sock *tsk = tipc_sk(sk); | 1735 | struct tipc_sock *tsk = tipc_sk(sk); |
1736 | struct net *net = sock_net(sk); | ||
1729 | uint truesize = skb->truesize; | 1737 | uint truesize = skb->truesize; |
1730 | 1738 | ||
1731 | rc = filter_rcv(sk, skb); | 1739 | rc = filter_rcv(sk, skb); |
@@ -1736,10 +1744,10 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb) | |||
1736 | return 0; | 1744 | return 0; |
1737 | } | 1745 | } |
1738 | 1746 | ||
1739 | if ((rc < 0) && !tipc_msg_reverse(skb, &onode, -rc)) | 1747 | if ((rc < 0) && !tipc_msg_reverse(net, skb, &onode, -rc)) |
1740 | return 0; | 1748 | return 0; |
1741 | 1749 | ||
1742 | tipc_link_xmit_skb(sock_net(sk), skb, onode, 0); | 1750 | tipc_link_xmit_skb(net, skb, onode, 0); |
1743 | 1751 | ||
1744 | return 0; | 1752 | return 0; |
1745 | } | 1753 | } |
@@ -1784,7 +1792,7 @@ int tipc_sk_rcv(struct net *net, struct sk_buff *skb) | |||
1784 | if (likely(!rc)) | 1792 | if (likely(!rc)) |
1785 | return 0; | 1793 | return 0; |
1786 | exit: | 1794 | exit: |
1787 | if ((rc < 0) && !tipc_msg_reverse(skb, &dnode, -rc)) | 1795 | if ((rc < 0) && !tipc_msg_reverse(net, skb, &dnode, -rc)) |
1788 | return -EHOSTUNREACH; | 1796 | return -EHOSTUNREACH; |
1789 | 1797 | ||
1790 | tipc_link_xmit_skb(net, skb, dnode, 0); | 1798 | tipc_link_xmit_skb(net, skb, dnode, 0); |
@@ -2045,6 +2053,7 @@ static int tipc_shutdown(struct socket *sock, int how) | |||
2045 | { | 2053 | { |
2046 | struct sock *sk = sock->sk; | 2054 | struct sock *sk = sock->sk; |
2047 | struct net *net = sock_net(sk); | 2055 | struct net *net = sock_net(sk); |
2056 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
2048 | struct tipc_sock *tsk = tipc_sk(sk); | 2057 | struct tipc_sock *tsk = tipc_sk(sk); |
2049 | struct sk_buff *skb; | 2058 | struct sk_buff *skb; |
2050 | u32 dnode; | 2059 | u32 dnode; |
@@ -2067,15 +2076,16 @@ restart: | |||
2067 | kfree_skb(skb); | 2076 | kfree_skb(skb); |
2068 | goto restart; | 2077 | goto restart; |
2069 | } | 2078 | } |
2070 | if (tipc_msg_reverse(skb, &dnode, TIPC_CONN_SHUTDOWN)) | 2079 | if (tipc_msg_reverse(net, skb, &dnode, |
2080 | TIPC_CONN_SHUTDOWN)) | ||
2071 | tipc_link_xmit_skb(net, skb, dnode, | 2081 | tipc_link_xmit_skb(net, skb, dnode, |
2072 | tsk->portid); | 2082 | tsk->portid); |
2073 | tipc_node_remove_conn(net, dnode, tsk->portid); | 2083 | tipc_node_remove_conn(net, dnode, tsk->portid); |
2074 | } else { | 2084 | } else { |
2075 | dnode = tsk_peer_node(tsk); | 2085 | dnode = tsk_peer_node(tsk); |
2076 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, | 2086 | skb = tipc_msg_create(net, TIPC_CRITICAL_IMPORTANCE, |
2077 | TIPC_CONN_MSG, SHORT_H_SIZE, | 2087 | TIPC_CONN_MSG, SHORT_H_SIZE, |
2078 | 0, dnode, tipc_own_addr, | 2088 | 0, dnode, tn->own_addr, |
2079 | tsk_peer_port(tsk), | 2089 | tsk_peer_port(tsk), |
2080 | tsk->portid, TIPC_CONN_SHUTDOWN); | 2090 | tsk->portid, TIPC_CONN_SHUTDOWN); |
2081 | tipc_link_xmit_skb(net, skb, dnode, tsk->portid); | 2091 | tipc_link_xmit_skb(net, skb, dnode, tsk->portid); |
@@ -2107,6 +2117,8 @@ static void tipc_sk_timeout(unsigned long data) | |||
2107 | { | 2117 | { |
2108 | struct tipc_sock *tsk = (struct tipc_sock *)data; | 2118 | struct tipc_sock *tsk = (struct tipc_sock *)data; |
2109 | struct sock *sk = &tsk->sk; | 2119 | struct sock *sk = &tsk->sk; |
2120 | struct net *net = sock_net(sk); | ||
2121 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
2110 | struct sk_buff *skb = NULL; | 2122 | struct sk_buff *skb = NULL; |
2111 | u32 peer_port, peer_node; | 2123 | u32 peer_port, peer_node; |
2112 | 2124 | ||
@@ -2120,13 +2132,13 @@ static void tipc_sk_timeout(unsigned long data) | |||
2120 | 2132 | ||
2121 | if (tsk->probing_state == TIPC_CONN_PROBING) { | 2133 | if (tsk->probing_state == TIPC_CONN_PROBING) { |
2122 | /* Previous probe not answered -> self abort */ | 2134 | /* Previous probe not answered -> self abort */ |
2123 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG, | 2135 | skb = tipc_msg_create(net, TIPC_CRITICAL_IMPORTANCE, |
2124 | SHORT_H_SIZE, 0, tipc_own_addr, | 2136 | TIPC_CONN_MSG, SHORT_H_SIZE, 0, |
2125 | peer_node, tsk->portid, peer_port, | 2137 | tn->own_addr, peer_node, tsk->portid, |
2126 | TIPC_ERR_NO_PORT); | 2138 | peer_port, TIPC_ERR_NO_PORT); |
2127 | } else { | 2139 | } else { |
2128 | skb = tipc_msg_create(CONN_MANAGER, CONN_PROBE, INT_H_SIZE, | 2140 | skb = tipc_msg_create(net, CONN_MANAGER, CONN_PROBE, INT_H_SIZE, |
2129 | 0, peer_node, tipc_own_addr, | 2141 | 0, peer_node, tn->own_addr, |
2130 | peer_port, tsk->portid, TIPC_OK); | 2142 | peer_port, tsk->portid, TIPC_OK); |
2131 | tsk->probing_state = TIPC_CONN_PROBING; | 2143 | tsk->probing_state = TIPC_CONN_PROBING; |
2132 | if (!mod_timer(&tsk->timer, jiffies + tsk->probing_intv)) | 2144 | if (!mod_timer(&tsk->timer, jiffies + tsk->probing_intv)) |
@@ -2198,14 +2210,16 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, | |||
2198 | static int tipc_sk_show(struct tipc_sock *tsk, char *buf, | 2210 | static int tipc_sk_show(struct tipc_sock *tsk, char *buf, |
2199 | int len, int full_id) | 2211 | int len, int full_id) |
2200 | { | 2212 | { |
2213 | struct net *net = sock_net(&tsk->sk); | ||
2214 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
2201 | struct publication *publ; | 2215 | struct publication *publ; |
2202 | int ret; | 2216 | int ret; |
2203 | 2217 | ||
2204 | if (full_id) | 2218 | if (full_id) |
2205 | ret = tipc_snprintf(buf, len, "<%u.%u.%u:%u>:", | 2219 | ret = tipc_snprintf(buf, len, "<%u.%u.%u:%u>:", |
2206 | tipc_zone(tipc_own_addr), | 2220 | tipc_zone(tn->own_addr), |
2207 | tipc_cluster(tipc_own_addr), | 2221 | tipc_cluster(tn->own_addr), |
2208 | tipc_node(tipc_own_addr), tsk->portid); | 2222 | tipc_node(tn->own_addr), tsk->portid); |
2209 | else | 2223 | else |
2210 | ret = tipc_snprintf(buf, len, "%-10u:", tsk->portid); | 2224 | ret = tipc_snprintf(buf, len, "%-10u:", tsk->portid); |
2211 | 2225 | ||
@@ -2296,8 +2310,8 @@ void tipc_sk_reinit(struct net *net) | |||
2296 | rht_for_each_entry_rcu(tsk, pos, tbl, i, node) { | 2310 | rht_for_each_entry_rcu(tsk, pos, tbl, i, node) { |
2297 | spin_lock_bh(&tsk->sk.sk_lock.slock); | 2311 | spin_lock_bh(&tsk->sk.sk_lock.slock); |
2298 | msg = &tsk->phdr; | 2312 | msg = &tsk->phdr; |
2299 | msg_set_prevnode(msg, tipc_own_addr); | 2313 | msg_set_prevnode(msg, tn->own_addr); |
2300 | msg_set_orignode(msg, tipc_own_addr); | 2314 | msg_set_orignode(msg, tn->own_addr); |
2301 | spin_unlock_bh(&tsk->sk.sk_lock.slock); | 2315 | spin_unlock_bh(&tsk->sk.sk_lock.slock); |
2302 | } | 2316 | } |
2303 | } | 2317 | } |
@@ -2691,6 +2705,8 @@ static int __tipc_nl_add_sk(struct sk_buff *skb, struct netlink_callback *cb, | |||
2691 | int err; | 2705 | int err; |
2692 | void *hdr; | 2706 | void *hdr; |
2693 | struct nlattr *attrs; | 2707 | struct nlattr *attrs; |
2708 | struct net *net = sock_net(skb->sk); | ||
2709 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
2694 | 2710 | ||
2695 | hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, | 2711 | hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, |
2696 | &tipc_genl_v2_family, NLM_F_MULTI, TIPC_NL_SOCK_GET); | 2712 | &tipc_genl_v2_family, NLM_F_MULTI, TIPC_NL_SOCK_GET); |
@@ -2702,7 +2718,7 @@ static int __tipc_nl_add_sk(struct sk_buff *skb, struct netlink_callback *cb, | |||
2702 | goto genlmsg_cancel; | 2718 | goto genlmsg_cancel; |
2703 | if (nla_put_u32(skb, TIPC_NLA_SOCK_REF, tsk->portid)) | 2719 | if (nla_put_u32(skb, TIPC_NLA_SOCK_REF, tsk->portid)) |
2704 | goto attr_msg_cancel; | 2720 | goto attr_msg_cancel; |
2705 | if (nla_put_u32(skb, TIPC_NLA_SOCK_ADDR, tipc_own_addr)) | 2721 | if (nla_put_u32(skb, TIPC_NLA_SOCK_ADDR, tn->own_addr)) |
2706 | goto attr_msg_cancel; | 2722 | goto attr_msg_cancel; |
2707 | 2723 | ||
2708 | if (tsk->connected) { | 2724 | if (tsk->connected) { |