Commit 998d3907 authored by Jon Maloy's avatar Jon Maloy Committed by David S. Miller

tipc: re-organize members of struct publication

In a future commit we will introduce more members to struct publication.
In order to keep this structure comprehensible we now group some of
its current fields into the sub-structures where they really belong,
- A struct tipc_service_range for the functional address the publication
  is representing.
- A struct tipc_socket_addr for the socket bound to that service range.

We also rename the stack variable 'publ' to just 'p' in a few places.
This is just as easy to understand in the given context, and keeps the
number of wrapped code lines to a minimum.

There are no functional changes in this commit.
Signed-off-by: default avatarJon Maloy <jmaloy@redhat.com>
Acked-by: default avatarYing Xue <ying.xue@windriver.com>
Acked-by: default avatarHoang Le <hoang.h.le@dektech.com.au>
Acked-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
Acked-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c9e418b
/* /*
* net/tipc/name_distr.c: TIPC name distribution code * net/tipc/name_distr.c: TIPC name distribution code
* *
* Copyright (c) 2000-2006, 2014, Ericsson AB * Copyright (c) 2000-2006, 2014-2019, Ericsson AB
* Copyright (c) 2005, 2010-2011, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* Copyright (c) 2020-2021, Red Hat Inc
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -55,10 +56,10 @@ struct distr_queue_item { ...@@ -55,10 +56,10 @@ struct distr_queue_item {
*/ */
static void publ_to_item(struct distr_item *i, struct publication *p) static void publ_to_item(struct distr_item *i, struct publication *p)
{ {
i->type = htonl(p->type); i->type = htonl(p->sr.type);
i->lower = htonl(p->lower); i->lower = htonl(p->sr.lower);
i->upper = htonl(p->upper); i->upper = htonl(p->sr.upper);
i->port = htonl(p->port); i->port = htonl(p->sk.ref);
i->key = htonl(p->key); i->key = htonl(p->key);
} }
...@@ -90,20 +91,20 @@ static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, ...@@ -90,20 +91,20 @@ static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size,
/** /**
* tipc_named_publish - tell other nodes about a new publication by this node * tipc_named_publish - tell other nodes about a new publication by this node
* @net: the associated network namespace * @net: the associated network namespace
* @publ: the new publication * @p: the new publication
*/ */
struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ) struct sk_buff *tipc_named_publish(struct net *net, struct publication *p)
{ {
struct name_table *nt = tipc_name_table(net); struct name_table *nt = tipc_name_table(net);
struct distr_item *item; struct distr_item *item;
struct sk_buff *skb; struct sk_buff *skb;
if (publ->scope == TIPC_NODE_SCOPE) { if (p->scope == TIPC_NODE_SCOPE) {
list_add_tail_rcu(&publ->binding_node, &nt->node_scope); list_add_tail_rcu(&p->binding_node, &nt->node_scope);
return NULL; return NULL;
} }
write_lock_bh(&nt->cluster_scope_lock); write_lock_bh(&nt->cluster_scope_lock);
list_add_tail(&publ->binding_node, &nt->cluster_scope); list_add_tail(&p->binding_node, &nt->cluster_scope);
write_unlock_bh(&nt->cluster_scope_lock); write_unlock_bh(&nt->cluster_scope_lock);
skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0); skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
if (!skb) { if (!skb) {
...@@ -113,25 +114,25 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ) ...@@ -113,25 +114,25 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
msg_set_named_seqno(buf_msg(skb), nt->snd_nxt++); msg_set_named_seqno(buf_msg(skb), nt->snd_nxt++);
msg_set_non_legacy(buf_msg(skb)); msg_set_non_legacy(buf_msg(skb));
item = (struct distr_item *)msg_data(buf_msg(skb)); item = (struct distr_item *)msg_data(buf_msg(skb));
publ_to_item(item, publ); publ_to_item(item, p);
return skb; return skb;
} }
/** /**
* tipc_named_withdraw - tell other nodes about a withdrawn publication by this node * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
* @net: the associated network namespace * @net: the associated network namespace
* @publ: the withdrawn publication * @p: the withdrawn publication
*/ */
struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ) struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *p)
{ {
struct name_table *nt = tipc_name_table(net); struct name_table *nt = tipc_name_table(net);
struct distr_item *item; struct distr_item *item;
struct sk_buff *skb; struct sk_buff *skb;
write_lock_bh(&nt->cluster_scope_lock); write_lock_bh(&nt->cluster_scope_lock);
list_del(&publ->binding_node); list_del(&p->binding_node);
write_unlock_bh(&nt->cluster_scope_lock); write_unlock_bh(&nt->cluster_scope_lock);
if (publ->scope == TIPC_NODE_SCOPE) if (p->scope == TIPC_NODE_SCOPE)
return NULL; return NULL;
skb = named_prepare_buf(net, WITHDRAWAL, ITEM_SIZE, 0); skb = named_prepare_buf(net, WITHDRAWAL, ITEM_SIZE, 0);
...@@ -142,7 +143,7 @@ struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ) ...@@ -142,7 +143,7 @@ struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ)
msg_set_named_seqno(buf_msg(skb), nt->snd_nxt++); msg_set_named_seqno(buf_msg(skb), nt->snd_nxt++);
msg_set_non_legacy(buf_msg(skb)); msg_set_non_legacy(buf_msg(skb));
item = (struct distr_item *)msg_data(buf_msg(skb)); item = (struct distr_item *)msg_data(buf_msg(skb));
publ_to_item(item, publ); publ_to_item(item, p);
return skb; return skb;
} }
...@@ -233,33 +234,32 @@ void tipc_named_node_up(struct net *net, u32 dnode, u16 capabilities) ...@@ -233,33 +234,32 @@ void tipc_named_node_up(struct net *net, u32 dnode, u16 capabilities)
/** /**
* tipc_publ_purge - remove publication associated with a failed node * tipc_publ_purge - remove publication associated with a failed node
* @net: the associated network namespace * @net: the associated network namespace
* @publ: the publication to remove * @p: the publication to remove
* @addr: failed node's address * @addr: failed node's address
* *
* Invoked for each publication issued by a newly failed node. * Invoked for each publication issued by a newly failed node.
* Removes publication structure from name table & deletes it. * Removes publication structure from name table & deletes it.
*/ */
static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr) static void tipc_publ_purge(struct net *net, struct publication *p, u32 addr)
{ {
struct tipc_net *tn = tipc_net(net); struct tipc_net *tn = tipc_net(net);
struct publication *p; struct publication *_p;
spin_lock_bh(&tn->nametbl_lock); spin_lock_bh(&tn->nametbl_lock);
p = tipc_nametbl_remove_publ(net, publ->type, publ->lower, publ->upper, _p = tipc_nametbl_remove_publ(net, p->sr.type, p->sr.lower,
publ->node, publ->key); p->sr.upper, p->sk.node, p->key);
if (p) if (_p)
tipc_node_unsubscribe(net, &p->binding_node, addr); tipc_node_unsubscribe(net, &_p->binding_node, addr);
spin_unlock_bh(&tn->nametbl_lock); spin_unlock_bh(&tn->nametbl_lock);
if (p != publ) { if (_p != p) {
pr_err("Unable to remove publication from failed node\n" pr_err("Unable to remove publication from failed node\n"
" (type=%u, lower=%u, node=0x%x, port=%u, key=%u)\n", " (type=%u, lower=%u, node=0x%x, port=%u, key=%u)\n",
publ->type, publ->lower, publ->node, publ->port, p->sr.type, p->sr.lower, p->sk.node, p->sk.ref, p->key);
publ->key);
} }
if (p) if (_p)
kfree_rcu(p, rcu); kfree_rcu(_p, rcu);
} }
void tipc_publ_notify(struct net *net, struct list_head *nsub_list, void tipc_publ_notify(struct net *net, struct list_head *nsub_list,
...@@ -410,15 +410,15 @@ void tipc_named_reinit(struct net *net) ...@@ -410,15 +410,15 @@ void tipc_named_reinit(struct net *net)
{ {
struct name_table *nt = tipc_name_table(net); struct name_table *nt = tipc_name_table(net);
struct tipc_net *tn = tipc_net(net); struct tipc_net *tn = tipc_net(net);
struct publication *publ; struct publication *p;
u32 self = tipc_own_addr(net); u32 self = tipc_own_addr(net);
spin_lock_bh(&tn->nametbl_lock); spin_lock_bh(&tn->nametbl_lock);
list_for_each_entry_rcu(publ, &nt->node_scope, binding_node) list_for_each_entry_rcu(p, &nt->node_scope, binding_node)
publ->node = self; p->sk.node = self;
list_for_each_entry_rcu(publ, &nt->cluster_scope, binding_node) list_for_each_entry_rcu(p, &nt->cluster_scope, binding_node)
publ->node = self; p->sk.node = self;
nt->rc_dests = 0; nt->rc_dests = 0;
spin_unlock_bh(&tn->nametbl_lock); spin_unlock_bh(&tn->nametbl_lock);
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2006, 2014-2018, Ericsson AB * Copyright (c) 2000-2006, 2014-2018, Ericsson AB
* Copyright (c) 2004-2008, 2010-2014, Wind River Systems * Copyright (c) 2004-2008, 2010-2014, Wind River Systems
* Copyright (c) 2020, Red Hat Inc * Copyright (c) 2020-2021, Red Hat Inc
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -234,24 +234,24 @@ static struct publication *tipc_publ_create(u32 type, u32 lower, u32 upper, ...@@ -234,24 +234,24 @@ static struct publication *tipc_publ_create(u32 type, u32 lower, u32 upper,
u32 scope, u32 node, u32 port, u32 scope, u32 node, u32 port,
u32 key) u32 key)
{ {
struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); struct publication *p = kzalloc(sizeof(*p), GFP_ATOMIC);
if (!publ) if (!p)
return NULL; return NULL;
publ->type = type; p->sr.type = type;
publ->lower = lower; p->sr.lower = lower;
publ->upper = upper; p->sr.upper = upper;
publ->scope = scope; p->scope = scope;
publ->node = node; p->sk.node = node;
publ->port = port; p->sk.ref = port;
publ->key = key; p->key = key;
INIT_LIST_HEAD(&publ->binding_sock); INIT_LIST_HEAD(&p->binding_sock);
INIT_LIST_HEAD(&publ->binding_node); INIT_LIST_HEAD(&p->binding_node);
INIT_LIST_HEAD(&publ->local_publ); INIT_LIST_HEAD(&p->local_publ);
INIT_LIST_HEAD(&publ->all_publ); INIT_LIST_HEAD(&p->all_publ);
INIT_LIST_HEAD(&publ->list); INIT_LIST_HEAD(&p->list);
return publ; return p;
} }
/** /**
...@@ -347,7 +347,7 @@ static struct publication *tipc_service_insert_publ(struct net *net, ...@@ -347,7 +347,7 @@ static struct publication *tipc_service_insert_publ(struct net *net,
/* Return if the publication already exists */ /* Return if the publication already exists */
list_for_each_entry(p, &sr->all_publ, all_publ) { list_for_each_entry(p, &sr->all_publ, all_publ) {
if (p->key == key && (!p->node || p->node == node)) if (p->key == key && (!p->sk.node || p->sk.node == node))
return NULL; return NULL;
} }
...@@ -363,8 +363,8 @@ static struct publication *tipc_service_insert_publ(struct net *net, ...@@ -363,8 +363,8 @@ static struct publication *tipc_service_insert_publ(struct net *net,
/* Any subscriptions waiting for notification? */ /* Any subscriptions waiting for notification? */
list_for_each_entry_safe(sub, tmp, &sc->subscriptions, service_list) { list_for_each_entry_safe(sub, tmp, &sc->subscriptions, service_list) {
tipc_sub_report_overlap(sub, p->lower, p->upper, TIPC_PUBLISHED, tipc_sub_report_overlap(sub, p->sr.lower, p->sr.upper, TIPC_PUBLISHED,
p->port, p->node, p->scope, first); p->sk.ref, p->sk.node, p->scope, first);
} }
return p; return p;
err: err:
...@@ -384,7 +384,7 @@ static struct publication *tipc_service_remove_publ(struct service_range *sr, ...@@ -384,7 +384,7 @@ static struct publication *tipc_service_remove_publ(struct service_range *sr,
struct publication *p; struct publication *p;
list_for_each_entry(p, &sr->all_publ, all_publ) { list_for_each_entry(p, &sr->all_publ, all_publ) {
if (p->key != key || (node && node != p->node)) if (p->key != key || (node && node != p->sk.node))
continue; continue;
list_del(&p->all_publ); list_del(&p->all_publ);
list_del(&p->local_publ); list_del(&p->local_publ);
...@@ -452,8 +452,8 @@ static void tipc_service_subscribe(struct tipc_service *service, ...@@ -452,8 +452,8 @@ static void tipc_service_subscribe(struct tipc_service *service,
/* Sort the publications before reporting */ /* Sort the publications before reporting */
list_sort(NULL, &publ_list, tipc_publ_sort); list_sort(NULL, &publ_list, tipc_publ_sort);
list_for_each_entry_safe(p, tmp, &publ_list, list) { list_for_each_entry_safe(p, tmp, &publ_list, list) {
tipc_sub_report_overlap(sub, p->lower, p->upper, tipc_sub_report_overlap(sub, p->sr.lower, p->sr.upper,
TIPC_PUBLISHED, p->port, p->node, TIPC_PUBLISHED, p->sk.ref, p->sk.node,
p->scope, true); p->scope, true);
list_del_init(&p->list); list_del_init(&p->list);
} }
...@@ -525,7 +525,7 @@ struct publication *tipc_nametbl_remove_publ(struct net *net, u32 type, ...@@ -525,7 +525,7 @@ struct publication *tipc_nametbl_remove_publ(struct net *net, u32 type,
last = list_empty(&sr->all_publ); last = list_empty(&sr->all_publ);
list_for_each_entry_safe(sub, tmp, &sc->subscriptions, service_list) { list_for_each_entry_safe(sub, tmp, &sc->subscriptions, service_list) {
tipc_sub_report_overlap(sub, lower, upper, TIPC_WITHDRAWN, tipc_sub_report_overlap(sub, lower, upper, TIPC_WITHDRAWN,
p->port, node, p->scope, last); p->sk.ref, node, p->scope, last);
} }
/* Remove service range item if this was its last publication */ /* Remove service range item if this was its last publication */
...@@ -603,8 +603,8 @@ u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance, u32 *dnode) ...@@ -603,8 +603,8 @@ u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance, u32 *dnode)
all_publ); all_publ);
list_move_tail(&p->all_publ, &sr->all_publ); list_move_tail(&p->all_publ, &sr->all_publ);
} }
port = p->port; port = p->sk.ref;
node = p->node; node = p->sk.node;
/* Todo: as for legacy, pick the first matching range only, a /* Todo: as for legacy, pick the first matching range only, a
* "true" round-robin will be performed as needed. * "true" round-robin will be performed as needed.
*/ */
...@@ -643,9 +643,9 @@ bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope, ...@@ -643,9 +643,9 @@ bool tipc_nametbl_lookup(struct net *net, u32 type, u32 instance, u32 scope,
list_for_each_entry(p, &sr->all_publ, all_publ) { list_for_each_entry(p, &sr->all_publ, all_publ) {
if (p->scope != scope) if (p->scope != scope)
continue; continue;
if (p->port == exclude && p->node == self) if (p->sk.ref == exclude && p->sk.node == self)
continue; continue;
tipc_dest_push(dsts, p->node, p->port); tipc_dest_push(dsts, p->sk.node, p->sk.ref);
(*dstcnt)++; (*dstcnt)++;
if (all) if (all)
continue; continue;
...@@ -675,7 +675,7 @@ void tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper, ...@@ -675,7 +675,7 @@ void tipc_nametbl_mc_lookup(struct net *net, u32 type, u32 lower, u32 upper,
service_range_foreach_match(sr, sc, lower, upper) { service_range_foreach_match(sr, sc, lower, upper) {
list_for_each_entry(p, &sr->local_publ, local_publ) { list_for_each_entry(p, &sr->local_publ, local_publ) {
if (p->scope == scope || (!exact && p->scope < scope)) if (p->scope == scope || (!exact && p->scope < scope))
tipc_dest_push(dports, 0, p->port); tipc_dest_push(dports, 0, p->sk.ref);
} }
} }
spin_unlock_bh(&sc->lock); spin_unlock_bh(&sc->lock);
...@@ -702,7 +702,7 @@ void tipc_nametbl_lookup_dst_nodes(struct net *net, u32 type, u32 lower, ...@@ -702,7 +702,7 @@ void tipc_nametbl_lookup_dst_nodes(struct net *net, u32 type, u32 lower,
spin_lock_bh(&sc->lock); spin_lock_bh(&sc->lock);
service_range_foreach_match(sr, sc, lower, upper) { service_range_foreach_match(sr, sc, lower, upper) {
list_for_each_entry(p, &sr->all_publ, all_publ) { list_for_each_entry(p, &sr->all_publ, all_publ) {
tipc_nlist_add(nodes, p->node); tipc_nlist_add(nodes, p->sk.node);
} }
} }
spin_unlock_bh(&sc->lock); spin_unlock_bh(&sc->lock);
...@@ -731,7 +731,7 @@ void tipc_nametbl_build_group(struct net *net, struct tipc_group *grp, ...@@ -731,7 +731,7 @@ void tipc_nametbl_build_group(struct net *net, struct tipc_group *grp,
list_for_each_entry(p, &sr->all_publ, all_publ) { list_for_each_entry(p, &sr->all_publ, all_publ) {
if (p->scope != scope) if (p->scope != scope)
continue; continue;
tipc_group_add_member(grp, p->node, p->port, p->lower); tipc_group_add_member(grp, p->sk.node, p->sk.ref, p->sr.lower);
} }
} }
spin_unlock_bh(&sc->lock); spin_unlock_bh(&sc->lock);
...@@ -909,7 +909,7 @@ static void tipc_service_delete(struct net *net, struct tipc_service *sc) ...@@ -909,7 +909,7 @@ static void tipc_service_delete(struct net *net, struct tipc_service *sc)
spin_lock_bh(&sc->lock); spin_lock_bh(&sc->lock);
rbtree_postorder_for_each_entry_safe(sr, tmpr, &sc->ranges, tree_node) { rbtree_postorder_for_each_entry_safe(sr, tmpr, &sc->ranges, tree_node) {
list_for_each_entry_safe(p, tmp, &sr->all_publ, all_publ) { list_for_each_entry_safe(p, tmp, &sr->all_publ, all_publ) {
tipc_service_remove_publ(sr, p->node, p->key); tipc_service_remove_publ(sr, p->sk.node, p->key);
kfree_rcu(p, rcu); kfree_rcu(p, rcu);
} }
rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks);
...@@ -993,9 +993,9 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg, ...@@ -993,9 +993,9 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,
goto publ_msg_full; goto publ_msg_full;
if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_SCOPE, p->scope)) if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_SCOPE, p->scope))
goto publ_msg_full; goto publ_msg_full;
if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_NODE, p->node)) if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_NODE, p->sk.node))
goto publ_msg_full; goto publ_msg_full;
if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_REF, p->port)) if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_REF, p->sk.ref))
goto publ_msg_full; goto publ_msg_full;
if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_KEY, p->key)) if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_KEY, p->key))
goto publ_msg_full; goto publ_msg_full;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (c) 2000-2006, 2014-2018, Ericsson AB * Copyright (c) 2000-2006, 2014-2018, Ericsson AB
* Copyright (c) 2004-2005, 2010-2011, Wind River Systems * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
* Copyright (c) 2020-2021, Red Hat Inc
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -50,13 +51,10 @@ struct tipc_group; ...@@ -50,13 +51,10 @@ struct tipc_group;
#define TIPC_NAMETBL_SIZE 1024 /* must be a power of 2 */ #define TIPC_NAMETBL_SIZE 1024 /* must be a power of 2 */
/** /**
* struct publication - info about a published (name or) name sequence * struct publication - info about a published service address or range
* @type: name sequence type * @sr: service range represented by this publication
* @lower: name sequence lower bound * @sk: address of socket bound to this publication
* @upper: name sequence upper bound
* @scope: scope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPE * @scope: scope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPE
* @node: network address of publishing socket's node
* @port: publishing port
* @key: publication key, unique across the cluster * @key: publication key, unique across the cluster
* @id: publication id * @id: publication id
* @binding_node: all publications from the same node which bound this one * @binding_node: all publications from the same node which bound this one
...@@ -74,12 +72,9 @@ struct tipc_group; ...@@ -74,12 +72,9 @@ struct tipc_group;
* @rcu: RCU callback head used for deferred freeing * @rcu: RCU callback head used for deferred freeing
*/ */
struct publication { struct publication {
u32 type; struct tipc_service_range sr;
u32 lower; struct tipc_socket_addr sk;
u32 upper;
u32 scope; u32 scope;
u32 node;
u32 port;
u32 key; u32 key;
u32 id; u32 id;
struct list_head binding_node; struct list_head binding_node;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2001-2007, 2012-2019, Ericsson AB * Copyright (c) 2001-2007, 2012-2019, Ericsson AB
* Copyright (c) 2004-2008, 2010-2013, Wind River Systems * Copyright (c) 2004-2008, 2010-2013, Wind River Systems
* Copyright (c) 2020, Red Hat Inc * Copyright (c) 2020-2021, Red Hat Inc
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -2923,30 +2923,30 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, ...@@ -2923,30 +2923,30 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
struct tipc_service_range const *seq) struct tipc_service_range const *seq)
{ {
struct net *net = sock_net(&tsk->sk); struct net *net = sock_net(&tsk->sk);
struct publication *publ; struct publication *p;
struct publication *safe; struct publication *safe;
int rc = -EINVAL; int rc = -EINVAL;
if (scope != TIPC_NODE_SCOPE) if (scope != TIPC_NODE_SCOPE)
scope = TIPC_CLUSTER_SCOPE; scope = TIPC_CLUSTER_SCOPE;
list_for_each_entry_safe(publ, safe, &tsk->publications, binding_sock) { list_for_each_entry_safe(p, safe, &tsk->publications, binding_sock) {
if (seq) { if (seq) {
if (publ->scope != scope) if (p->scope != scope)
continue; continue;
if (publ->type != seq->type) if (p->sr.type != seq->type)
continue; continue;
if (publ->lower != seq->lower) if (p->sr.lower != seq->lower)
continue; continue;
if (publ->upper != seq->upper) if (p->sr.upper != seq->upper)
break; break;
tipc_nametbl_withdraw(net, publ->type, publ->lower, tipc_nametbl_withdraw(net, p->sr.type, p->sr.lower,
publ->upper, publ->key); p->sr.upper, p->key);
rc = 0; rc = 0;
break; break;
} }
tipc_nametbl_withdraw(net, publ->type, publ->lower, tipc_nametbl_withdraw(net, p->sr.type, p->sr.lower,
publ->upper, publ->key); p->sr.upper, p->key);
rc = 0; rc = 0;
} }
if (list_empty(&tsk->publications)) if (list_empty(&tsk->publications))
...@@ -3711,11 +3711,11 @@ static int __tipc_nl_add_sk_publ(struct sk_buff *skb, ...@@ -3711,11 +3711,11 @@ static int __tipc_nl_add_sk_publ(struct sk_buff *skb,
if (nla_put_u32(skb, TIPC_NLA_PUBL_KEY, publ->key)) if (nla_put_u32(skb, TIPC_NLA_PUBL_KEY, publ->key))
goto attr_msg_cancel; goto attr_msg_cancel;
if (nla_put_u32(skb, TIPC_NLA_PUBL_TYPE, publ->type)) if (nla_put_u32(skb, TIPC_NLA_PUBL_TYPE, publ->sr.type))
goto attr_msg_cancel; goto attr_msg_cancel;
if (nla_put_u32(skb, TIPC_NLA_PUBL_LOWER, publ->lower)) if (nla_put_u32(skb, TIPC_NLA_PUBL_LOWER, publ->sr.lower))
goto attr_msg_cancel; goto attr_msg_cancel;
if (nla_put_u32(skb, TIPC_NLA_PUBL_UPPER, publ->upper)) if (nla_put_u32(skb, TIPC_NLA_PUBL_UPPER, publ->sr.upper))
goto attr_msg_cancel; goto attr_msg_cancel;
nla_nest_end(skb, attrs); nla_nest_end(skb, attrs);
...@@ -3863,9 +3863,9 @@ bool tipc_sk_filtering(struct sock *sk) ...@@ -3863,9 +3863,9 @@ bool tipc_sk_filtering(struct sock *sk)
p = list_first_entry_or_null(&tsk->publications, p = list_first_entry_or_null(&tsk->publications,
struct publication, binding_sock); struct publication, binding_sock);
if (p) { if (p) {
type = p->type; type = p->sr.type;
lower = p->lower; lower = p->sr.lower;
upper = p->upper; upper = p->sr.upper;
} }
} }
...@@ -3964,9 +3964,9 @@ int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf) ...@@ -3964,9 +3964,9 @@ int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf)
if (tsk->published) { if (tsk->published) {
p = list_first_entry_or_null(&tsk->publications, p = list_first_entry_or_null(&tsk->publications,
struct publication, binding_sock); struct publication, binding_sock);
i += scnprintf(buf + i, sz - i, " %u", (p) ? p->type : 0); i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.type : 0);
i += scnprintf(buf + i, sz - i, " %u", (p) ? p->lower : 0); i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.lower : 0);
i += scnprintf(buf + i, sz - i, " %u", (p) ? p->upper : 0); i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.upper : 0);
} }
i += scnprintf(buf + i, sz - i, " | %u", tsk->snd_win); i += scnprintf(buf + i, sz - i, " | %u", tsk->snd_win);
i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_win); i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_win);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment