return (addr == tn->own_addr) || !addr;
}
-int tipc_in_scope(u32 domain, u32 addr)
+bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr)
{
if (!domain || (domain == addr))
- return 1;
+ return true;
+ if (!legacy_format)
+ return false;
if (domain == tipc_cluster_mask(addr)) /* domain <Z.C.0> */
- return 1;
+ return true;
if (domain == (addr & TIPC_ZONE_MASK)) /* domain <Z.0.0> */
- return 1;
- return 0;
+ return true;
+ return false;
}
char *tipc_addr_string_fill(char *string, u32 addr)
u32 tipc_own_addr(struct net *net);
int in_own_node(struct net *net, u32 addr);
-int tipc_in_scope(u32 domain, u32 addr);
+bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr);
char *tipc_addr_string_fill(char *string, u32 addr);
#endif
/*
* net/tipc/core.h: Include file for TIPC global declarations
*
- * Copyright (c) 2005-2006, 2013 Ericsson AB
+ * Copyright (c) 2005-2006, 2013-2018 Ericsson AB
* Copyright (c) 2005-2007, 2010-2013, Wind River Systems
* All rights reserved.
*
u32 own_addr;
int net_id;
int random;
+ bool legacy_addr_format;
/* Node table and node list */
spinlock_t node_list_lock;
struct tipc_net *tn = tipc_net(net);
struct tipc_msg *hdr = buf_msg(skb);
u16 caps = msg_node_capabilities(hdr);
+ bool legacy = tn->legacy_addr_format;
u32 signature = msg_node_sig(hdr);
u32 dst = msg_dest_domain(hdr);
u32 net_id = msg_bc_netid(hdr);
disc_dupl_alert(b, self, &maddr);
return;
}
- /* Domain filter only works if both peers use legacy address format */
- if (b->domain) {
- if (!tipc_in_scope(dst, self))
- return;
- if (!tipc_in_scope(b->domain, src))
- return;
- }
+ if (!tipc_in_scope(legacy, dst, self))
+ return;
+ if (!tipc_in_scope(legacy, b->domain, src))
+ return;
+
tipc_node_check_dest(net, src, b, caps, signature,
&maddr, &respond, &dupl_addr);
if (dupl_addr)
u32 tipc_nametbl_translate(struct net *net, u32 type, u32 instance,
u32 *destnode)
{
- struct tipc_net *tn = net_generic(net, tipc_net_id);
+ struct tipc_net *tn = tipc_net(net);
+ bool legacy = tn->legacy_addr_format;
+ u32 self = tipc_own_addr(net);
struct sub_seq *sseq;
struct name_info *info;
struct publication *publ;
u32 port = 0;
u32 node = 0;
- if (!tipc_in_scope(*destnode, tn->own_addr))
+ if (!tipc_in_scope(legacy, *destnode, self))
return 0;
rcu_read_lock();
info = sseq->info;
/* Closest-First Algorithm */
- if (likely(!*destnode)) {
+ if (legacy && !*destnode) {
if (!list_empty(&info->local_publ)) {
publ = list_first_entry(&info->local_publ,
struct publication,
addr = nla_get_u32(attrs[TIPC_NLA_NET_ADDR]);
if (!addr)
return -EINVAL;
-
+ tn->legacy_addr_format = true;
tipc_net_start(net, addr);
}