提交 6375da9d 编写于 作者: J Jakub Kicinski

Merge branch 'tipc-some-minor-improvements'

Jon Maloy says:

====================
tipc: some minor improvements

We add some improvements that will be useful in future commits.
====================

Link: https://lore.kernel.org/r/20201125182915.711370-1-jmaloy@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
...@@ -55,12 +55,11 @@ bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr) ...@@ -55,12 +55,11 @@ bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr)
void tipc_set_node_id(struct net *net, u8 *id) void tipc_set_node_id(struct net *net, u8 *id)
{ {
struct tipc_net *tn = tipc_net(net); struct tipc_net *tn = tipc_net(net);
u32 *tmp = (u32 *)id;
memcpy(tn->node_id, id, NODE_ID_LEN); memcpy(tn->node_id, id, NODE_ID_LEN);
tipc_nodeid2string(tn->node_id_string, id); tipc_nodeid2string(tn->node_id_string, id);
tn->trial_addr = tmp[0] ^ tmp[1] ^ tmp[2] ^ tmp[3]; tn->trial_addr = hash128to32(id);
pr_info("Own node identity %s, cluster identity %u\n", pr_info("Node identity %s, cluster identity %u\n",
tipc_own_id_string(net), tn->net_id); tipc_own_id_string(net), tn->net_id);
} }
...@@ -76,7 +75,7 @@ void tipc_set_node_addr(struct net *net, u32 addr) ...@@ -76,7 +75,7 @@ void tipc_set_node_addr(struct net *net, u32 addr)
} }
tn->trial_addr = addr; tn->trial_addr = addr;
tn->addr_trial_end = jiffies; tn->addr_trial_end = jiffies;
pr_info("32-bit node address hash set to %x\n", addr); pr_info("Node number set to %u\n", addr);
} }
char *tipc_nodeid2string(char *str, u8 *id) char *tipc_nodeid2string(char *str, u8 *id)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (c) 2000-2006, 2018, Ericsson AB * Copyright (c) 2000-2006, 2018, Ericsson AB
* Copyright (c) 2004-2005, Wind River Systems * Copyright (c) 2004-2005, Wind River Systems
* Copyright (c) 2020, 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
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (c) 2005-2006, 2013-2018 Ericsson AB * Copyright (c) 2005-2006, 2013-2018 Ericsson AB
* Copyright (c) 2005-2007, 2010-2013, Wind River Systems * Copyright (c) 2005-2007, 2010-2013, Wind River Systems
* Copyright (c) 2020, 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
...@@ -210,6 +211,17 @@ static inline u32 tipc_net_hash_mixes(struct net *net, int tn_rand) ...@@ -210,6 +211,17 @@ static inline u32 tipc_net_hash_mixes(struct net *net, int tn_rand)
return net_hash_mix(&init_net) ^ net_hash_mix(net) ^ tn_rand; return net_hash_mix(&init_net) ^ net_hash_mix(net) ^ tn_rand;
} }
static inline u32 hash128to32(char *bytes)
{
__be32 *tmp = (__be32 *)bytes;
u32 res;
res = ntohl(tmp[0] ^ tmp[1] ^ tmp[2] ^ tmp[3]);
if (likely(res))
return res;
return ntohl(tmp[0] | tmp[1] | tmp[2] | tmp[3]);
}
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
int tipc_register_sysctl(void); int tipc_register_sysctl(void);
void tipc_unregister_sysctl(void); void tipc_unregister_sysctl(void);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* net/tipc/group.c: TIPC group messaging code * net/tipc/group.c: TIPC group messaging code
* *
* Copyright (c) 2017, Ericsson AB * Copyright (c) 2017, Ericsson AB
* Copyright (c) 2020, 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
...@@ -359,7 +360,7 @@ struct tipc_nlist *tipc_group_dests(struct tipc_group *grp) ...@@ -359,7 +360,7 @@ struct tipc_nlist *tipc_group_dests(struct tipc_group *grp)
return &grp->dests; return &grp->dests;
} }
void tipc_group_self(struct tipc_group *grp, struct tipc_name_seq *seq, void tipc_group_self(struct tipc_group *grp, struct tipc_service_range *seq,
int *scope) int *scope)
{ {
seq->type = grp->type; seq->type = grp->type;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* net/tipc/group.h: Include file for TIPC group unicast/multicast functions * net/tipc/group.h: Include file for TIPC group unicast/multicast functions
* *
* Copyright (c) 2017, Ericsson AB * Copyright (c) 2017, Ericsson AB
* Copyright (c) 2020, 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,7 +51,7 @@ void tipc_group_delete(struct net *net, struct tipc_group *grp); ...@@ -50,7 +51,7 @@ void tipc_group_delete(struct net *net, struct tipc_group *grp);
void tipc_group_add_member(struct tipc_group *grp, u32 node, void tipc_group_add_member(struct tipc_group *grp, u32 node,
u32 port, u32 instance); u32 port, u32 instance);
struct tipc_nlist *tipc_group_dests(struct tipc_group *grp); struct tipc_nlist *tipc_group_dests(struct tipc_group *grp);
void tipc_group_self(struct tipc_group *grp, struct tipc_name_seq *seq, void tipc_group_self(struct tipc_group *grp, struct tipc_service_range *seq,
int *scope); int *scope);
u32 tipc_group_exclude(struct tipc_group *grp); u32 tipc_group_exclude(struct tipc_group *grp);
void tipc_group_filter_msg(struct tipc_group *grp, void tipc_group_filter_msg(struct tipc_group *grp,
......
...@@ -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-2008, 2010-2014, Wind River Systems * Copyright (c) 2004-2008, 2010-2014, Wind River Systems
* Copyright (c) 2020, 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
...@@ -403,12 +404,12 @@ static void tipc_service_subscribe(struct tipc_service *service, ...@@ -403,12 +404,12 @@ static void tipc_service_subscribe(struct tipc_service *service,
struct publication *p, *first, *tmp; struct publication *p, *first, *tmp;
struct list_head publ_list; struct list_head publ_list;
struct service_range *sr; struct service_range *sr;
struct tipc_name_seq ns; struct tipc_service_range r;
u32 filter; u32 filter;
ns.type = tipc_sub_read(sb, seq.type); r.type = tipc_sub_read(sb, seq.type);
ns.lower = tipc_sub_read(sb, seq.lower); r.lower = tipc_sub_read(sb, seq.lower);
ns.upper = tipc_sub_read(sb, seq.upper); r.upper = tipc_sub_read(sb, seq.upper);
filter = tipc_sub_read(sb, filter); filter = tipc_sub_read(sb, filter);
tipc_sub_get(sub); tipc_sub_get(sub);
...@@ -418,7 +419,7 @@ static void tipc_service_subscribe(struct tipc_service *service, ...@@ -418,7 +419,7 @@ static void tipc_service_subscribe(struct tipc_service *service,
return; return;
INIT_LIST_HEAD(&publ_list); INIT_LIST_HEAD(&publ_list);
service_range_foreach_match(sr, service, ns.lower, ns.upper) { service_range_foreach_match(sr, service, r.lower, r.upper) {
first = NULL; first = NULL;
list_for_each_entry(p, &sr->all_publ, all_publ) { list_for_each_entry(p, &sr->all_publ, all_publ) {
if (filter & TIPC_SUB_PORTS) if (filter & TIPC_SUB_PORTS)
......
...@@ -132,7 +132,7 @@ static void tipc_net_finalize(struct net *net, u32 addr) ...@@ -132,7 +132,7 @@ static void tipc_net_finalize(struct net *net, u32 addr)
tipc_named_reinit(net); tipc_named_reinit(net);
tipc_sk_reinit(net); tipc_sk_reinit(net);
tipc_mon_reinit_self(net); tipc_mon_reinit_self(net);
tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, tipc_nametbl_publish(net, TIPC_NODE_STATE, addr, addr,
TIPC_CLUSTER_SCOPE, 0, addr); TIPC_CLUSTER_SCOPE, 0, addr);
} }
......
/* /*
* net/tipc/socket.c: TIPC socket API * net/tipc/socket.c: TIPC socket API
* *
* Copyright (c) 2001-2007, 2012-2017, 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
* 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
...@@ -138,9 +139,9 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags, ...@@ -138,9 +139,9 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags,
bool kern); bool kern);
static void tipc_sk_timeout(struct timer_list *t); static void tipc_sk_timeout(struct timer_list *t);
static int tipc_sk_publish(struct tipc_sock *tsk, uint scope, static int tipc_sk_publish(struct tipc_sock *tsk, uint scope,
struct tipc_name_seq const *seq); struct tipc_service_range const *seq);
static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
struct tipc_name_seq const *seq); struct tipc_service_range const *seq);
static int tipc_sk_leave(struct tipc_sock *tsk); static int tipc_sk_leave(struct tipc_sock *tsk);
static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid); static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid);
static int tipc_sk_insert(struct tipc_sock *tsk); static int tipc_sk_insert(struct tipc_sock *tsk);
...@@ -644,10 +645,10 @@ static int tipc_release(struct socket *sock) ...@@ -644,10 +645,10 @@ static int tipc_release(struct socket *sock)
} }
/** /**
* tipc_bind - associate or disassocate TIPC name(s) with a socket * __tipc_bind - associate or disassocate TIPC name(s) with a socket
* @sock: socket structure * @sock: socket structure
* @uaddr: socket address describing name(s) and desired operation * @skaddr: socket address describing name(s) and desired operation
* @uaddr_len: size of socket address data structure * @alen: size of socket address data structure
* *
* Name and name sequence binding is indicated using a positive scope value; * Name and name sequence binding is indicated using a positive scope value;
* a negative scope value unbinds the specified name. Specifying no name * a negative scope value unbinds the specified name. Specifying no name
...@@ -658,44 +659,33 @@ static int tipc_release(struct socket *sock) ...@@ -658,44 +659,33 @@ static int tipc_release(struct socket *sock)
* NOTE: This routine doesn't need to take the socket lock since it doesn't * NOTE: This routine doesn't need to take the socket lock since it doesn't
* access any non-constant socket information. * access any non-constant socket information.
*/ */
static int __tipc_bind(struct socket *sock, struct sockaddr *skaddr, int alen)
int tipc_sk_bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
{ {
struct sock *sk = sock->sk; struct sockaddr_tipc *addr = (struct sockaddr_tipc *)skaddr;
struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr; struct tipc_sock *tsk = tipc_sk(sock->sk);
struct tipc_sock *tsk = tipc_sk(sk);
int res = -EINVAL;
lock_sock(sk); if (unlikely(!alen))
if (unlikely(!uaddr_len)) { return tipc_sk_withdraw(tsk, 0, NULL);
res = tipc_sk_withdraw(tsk, 0, NULL);
goto exit;
}
if (tsk->group) {
res = -EACCES;
goto exit;
}
if (uaddr_len < sizeof(struct sockaddr_tipc)) {
res = -EINVAL;
goto exit;
}
if (addr->family != AF_TIPC) {
res = -EAFNOSUPPORT;
goto exit;
}
if (addr->addrtype == TIPC_ADDR_NAME) if (addr->addrtype == TIPC_SERVICE_ADDR)
addr->addr.nameseq.upper = addr->addr.nameseq.lower; addr->addr.nameseq.upper = addr->addr.nameseq.lower;
else if (addr->addrtype != TIPC_ADDR_NAMESEQ) {
res = -EAFNOSUPPORT;
goto exit;
}
res = (addr->scope >= 0) ? if (tsk->group)
tipc_sk_publish(tsk, addr->scope, &addr->addr.nameseq) : return -EACCES;
tipc_sk_withdraw(tsk, -addr->scope, &addr->addr.nameseq);
exit: if (addr->scope >= 0)
release_sock(sk); return tipc_sk_publish(tsk, addr->scope, &addr->addr.nameseq);
else
return tipc_sk_withdraw(tsk, -addr->scope, &addr->addr.nameseq);
}
int tipc_sk_bind(struct socket *sock, struct sockaddr *skaddr, int alen)
{
int res;
lock_sock(sock->sk);
res = __tipc_bind(sock, skaddr, alen);
release_sock(sock->sk);
return res; return res;
} }
...@@ -706,6 +696,10 @@ static int tipc_bind(struct socket *sock, struct sockaddr *skaddr, int alen) ...@@ -706,6 +696,10 @@ static int tipc_bind(struct socket *sock, struct sockaddr *skaddr, int alen)
if (alen) { if (alen) {
if (alen < sizeof(struct sockaddr_tipc)) if (alen < sizeof(struct sockaddr_tipc))
return -EINVAL; return -EINVAL;
if (addr->family != AF_TIPC)
return -EAFNOSUPPORT;
if (addr->addrtype > TIPC_SERVICE_ADDR)
return -EAFNOSUPPORT;
if (addr->addr.nameseq.type < TIPC_RESERVED_TYPES) { if (addr->addr.nameseq.type < TIPC_RESERVED_TYPES) {
pr_warn_once("Can't bind to reserved service type %u\n", pr_warn_once("Can't bind to reserved service type %u\n",
addr->addr.nameseq.type); addr->addr.nameseq.type);
...@@ -746,7 +740,7 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -746,7 +740,7 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr,
addr->addr.id.node = tipc_own_addr(sock_net(sk)); addr->addr.id.node = tipc_own_addr(sock_net(sk));
} }
addr->addrtype = TIPC_ADDR_ID; addr->addrtype = TIPC_SOCKET_ADDR;
addr->family = AF_TIPC; addr->family = AF_TIPC;
addr->scope = 0; addr->scope = 0;
addr->addr.name.domain = 0; addr->addr.name.domain = 0;
...@@ -824,7 +818,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock, ...@@ -824,7 +818,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
* Called from function tipc_sendmsg(), which has done all sanity checks * Called from function tipc_sendmsg(), which has done all sanity checks
* Returns the number of bytes sent on success, or errno * Returns the number of bytes sent on success, or errno
*/ */
static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq, static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq,
struct msghdr *msg, size_t dlen, long timeout) struct msghdr *msg, size_t dlen, long timeout)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -1409,7 +1403,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) ...@@ -1409,7 +1403,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
bool syn = !tipc_sk_type_connectionless(sk); bool syn = !tipc_sk_type_connectionless(sk);
struct tipc_group *grp = tsk->group; struct tipc_group *grp = tsk->group;
struct tipc_msg *hdr = &tsk->phdr; struct tipc_msg *hdr = &tsk->phdr;
struct tipc_name_seq *seq; struct tipc_service_range *seq;
struct sk_buff_head pkts; struct sk_buff_head pkts;
u32 dport = 0, dnode = 0; u32 dport = 0, dnode = 0;
u32 type = 0, inst = 0; u32 type = 0, inst = 0;
...@@ -1428,9 +1422,9 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) ...@@ -1428,9 +1422,9 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
if (grp) { if (grp) {
if (!dest) if (!dest)
return tipc_send_group_bcast(sock, m, dlen, timeout); return tipc_send_group_bcast(sock, m, dlen, timeout);
if (dest->addrtype == TIPC_ADDR_NAME) if (dest->addrtype == TIPC_SERVICE_ADDR)
return tipc_send_group_anycast(sock, m, dlen, timeout); return tipc_send_group_anycast(sock, m, dlen, timeout);
if (dest->addrtype == TIPC_ADDR_ID) if (dest->addrtype == TIPC_SOCKET_ADDR)
return tipc_send_group_unicast(sock, m, dlen, timeout); return tipc_send_group_unicast(sock, m, dlen, timeout);
if (dest->addrtype == TIPC_ADDR_MCAST) if (dest->addrtype == TIPC_ADDR_MCAST)
return tipc_send_group_mcast(sock, m, dlen, timeout); return tipc_send_group_mcast(sock, m, dlen, timeout);
...@@ -1450,7 +1444,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) ...@@ -1450,7 +1444,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
return -EISCONN; return -EISCONN;
if (tsk->published) if (tsk->published)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (dest->addrtype == TIPC_ADDR_NAME) { if (dest->addrtype == TIPC_SERVICE_ADDR) {
tsk->conn_type = dest->addr.name.name.type; tsk->conn_type = dest->addr.name.name.type;
tsk->conn_instance = dest->addr.name.name.instance; tsk->conn_instance = dest->addr.name.name.instance;
} }
...@@ -1461,14 +1455,14 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) ...@@ -1461,14 +1455,14 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
if (dest->addrtype == TIPC_ADDR_MCAST) if (dest->addrtype == TIPC_ADDR_MCAST)
return tipc_sendmcast(sock, seq, m, dlen, timeout); return tipc_sendmcast(sock, seq, m, dlen, timeout);
if (dest->addrtype == TIPC_ADDR_NAME) { if (dest->addrtype == TIPC_SERVICE_ADDR) {
type = dest->addr.name.name.type; type = dest->addr.name.name.type;
inst = dest->addr.name.name.instance; inst = dest->addr.name.name.instance;
dnode = dest->addr.name.domain; dnode = dest->addr.name.domain;
dport = tipc_nametbl_translate(net, type, inst, &dnode); dport = tipc_nametbl_translate(net, type, inst, &dnode);
if (unlikely(!dport && !dnode)) if (unlikely(!dport && !dnode))
return -EHOSTUNREACH; return -EHOSTUNREACH;
} else if (dest->addrtype == TIPC_ADDR_ID) { } else if (dest->addrtype == TIPC_SOCKET_ADDR) {
dnode = dest->addr.id.node; dnode = dest->addr.id.node;
} else { } else {
return -EINVAL; return -EINVAL;
...@@ -1480,7 +1474,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) ...@@ -1480,7 +1474,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
if (unlikely(rc)) if (unlikely(rc))
return rc; return rc;
if (dest->addrtype == TIPC_ADDR_NAME) { if (dest->addrtype == TIPC_SERVICE_ADDR) {
msg_set_type(hdr, TIPC_NAMED_MSG); msg_set_type(hdr, TIPC_NAMED_MSG);
msg_set_hdr_sz(hdr, NAMED_H_SIZE); msg_set_hdr_sz(hdr, NAMED_H_SIZE);
msg_set_nametype(hdr, type); msg_set_nametype(hdr, type);
...@@ -1488,7 +1482,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) ...@@ -1488,7 +1482,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
msg_set_lookup_scope(hdr, tipc_node2scope(dnode)); msg_set_lookup_scope(hdr, tipc_node2scope(dnode));
msg_set_destnode(hdr, dnode); msg_set_destnode(hdr, dnode);
msg_set_destport(hdr, dport); msg_set_destport(hdr, dport);
} else { /* TIPC_ADDR_ID */ } else { /* TIPC_SOCKET_ADDR */
msg_set_type(hdr, TIPC_DIRECT_MSG); msg_set_type(hdr, TIPC_DIRECT_MSG);
msg_set_lookup_scope(hdr, 0); msg_set_lookup_scope(hdr, 0);
msg_set_destnode(hdr, dnode); msg_set_destnode(hdr, dnode);
...@@ -1693,7 +1687,7 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb) ...@@ -1693,7 +1687,7 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb)
return; return;
srcaddr->sock.family = AF_TIPC; srcaddr->sock.family = AF_TIPC;
srcaddr->sock.addrtype = TIPC_ADDR_ID; srcaddr->sock.addrtype = TIPC_SOCKET_ADDR;
srcaddr->sock.scope = 0; srcaddr->sock.scope = 0;
srcaddr->sock.addr.id.ref = msg_origport(hdr); srcaddr->sock.addr.id.ref = msg_origport(hdr);
srcaddr->sock.addr.id.node = msg_orignode(hdr); srcaddr->sock.addr.id.node = msg_orignode(hdr);
...@@ -1705,7 +1699,7 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb) ...@@ -1705,7 +1699,7 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb)
/* Group message users may also want to know sending member's id */ /* Group message users may also want to know sending member's id */
srcaddr->member.family = AF_TIPC; srcaddr->member.family = AF_TIPC;
srcaddr->member.addrtype = TIPC_ADDR_NAME; srcaddr->member.addrtype = TIPC_SERVICE_ADDR;
srcaddr->member.scope = 0; srcaddr->member.scope = 0;
srcaddr->member.addr.name.name.type = msg_nametype(hdr); srcaddr->member.addr.name.name.type = msg_nametype(hdr);
srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member; srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member;
...@@ -2873,7 +2867,7 @@ static void tipc_sk_timeout(struct timer_list *t) ...@@ -2873,7 +2867,7 @@ static void tipc_sk_timeout(struct timer_list *t)
} }
static int tipc_sk_publish(struct tipc_sock *tsk, uint scope, static int tipc_sk_publish(struct tipc_sock *tsk, uint scope,
struct tipc_name_seq const *seq) struct tipc_service_range const *seq)
{ {
struct sock *sk = &tsk->sk; struct sock *sk = &tsk->sk;
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
...@@ -2901,7 +2895,7 @@ static int tipc_sk_publish(struct tipc_sock *tsk, uint scope, ...@@ -2901,7 +2895,7 @@ static int tipc_sk_publish(struct tipc_sock *tsk, uint scope,
} }
static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
struct tipc_name_seq 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 *publ;
...@@ -3048,7 +3042,7 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq) ...@@ -3048,7 +3042,7 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq)
struct net *net = sock_net(&tsk->sk); struct net *net = sock_net(&tsk->sk);
struct tipc_group *grp = tsk->group; struct tipc_group *grp = tsk->group;
struct tipc_msg *hdr = &tsk->phdr; struct tipc_msg *hdr = &tsk->phdr;
struct tipc_name_seq seq; struct tipc_service_range seq;
int rc; int rc;
if (mreq->type < TIPC_RESERVED_TYPES) if (mreq->type < TIPC_RESERVED_TYPES)
...@@ -3085,7 +3079,7 @@ static int tipc_sk_leave(struct tipc_sock *tsk) ...@@ -3085,7 +3079,7 @@ static int tipc_sk_leave(struct tipc_sock *tsk)
{ {
struct net *net = sock_net(&tsk->sk); struct net *net = sock_net(&tsk->sk);
struct tipc_group *grp = tsk->group; struct tipc_group *grp = tsk->group;
struct tipc_name_seq seq; struct tipc_service_range seq;
int scope; int scope;
if (!grp) if (!grp)
...@@ -3209,7 +3203,7 @@ static int tipc_getsockopt(struct socket *sock, int lvl, int opt, ...@@ -3209,7 +3203,7 @@ static int tipc_getsockopt(struct socket *sock, int lvl, int opt,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct tipc_sock *tsk = tipc_sk(sk); struct tipc_sock *tsk = tipc_sk(sk);
struct tipc_name_seq seq; struct tipc_service_range seq;
int len, scope; int len, scope;
u32 value; u32 value;
int res; int res;
...@@ -3310,12 +3304,12 @@ static int tipc_socketpair(struct socket *sock1, struct socket *sock2) ...@@ -3310,12 +3304,12 @@ static int tipc_socketpair(struct socket *sock1, struct socket *sock2)
u32 onode = tipc_own_addr(sock_net(sock1->sk)); u32 onode = tipc_own_addr(sock_net(sock1->sk));
tsk1->peer.family = AF_TIPC; tsk1->peer.family = AF_TIPC;
tsk1->peer.addrtype = TIPC_ADDR_ID; tsk1->peer.addrtype = TIPC_SOCKET_ADDR;
tsk1->peer.scope = TIPC_NODE_SCOPE; tsk1->peer.scope = TIPC_NODE_SCOPE;
tsk1->peer.addr.id.ref = tsk2->portid; tsk1->peer.addr.id.ref = tsk2->portid;
tsk1->peer.addr.id.node = onode; tsk1->peer.addr.id.node = onode;
tsk2->peer.family = AF_TIPC; tsk2->peer.family = AF_TIPC;
tsk2->peer.addrtype = TIPC_ADDR_ID; tsk2->peer.addrtype = TIPC_SOCKET_ADDR;
tsk2->peer.scope = TIPC_NODE_SCOPE; tsk2->peer.scope = TIPC_NODE_SCOPE;
tsk2->peer.addr.id.ref = tsk1->portid; tsk2->peer.addr.id.ref = tsk1->portid;
tsk2->peer.addr.id.node = onode; tsk2->peer.addr.id.node = onode;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (c) 2000-2017, Ericsson AB * Copyright (c) 2000-2017, Ericsson AB
* Copyright (c) 2005-2007, 2010-2013, Wind River Systems * Copyright (c) 2005-2007, 2010-2013, Wind River Systems
* Copyright (c) 2020, 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
...@@ -60,7 +61,7 @@ static void tipc_sub_send_event(struct tipc_subscription *sub, ...@@ -60,7 +61,7 @@ static void tipc_sub_send_event(struct tipc_subscription *sub,
* *
* Returns 1 if there is overlap, otherwise 0. * Returns 1 if there is overlap, otherwise 0.
*/ */
int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower, int tipc_sub_check_overlap(struct tipc_service_range *seq, u32 found_lower,
u32 found_upper) u32 found_upper)
{ {
if (found_lower < seq->lower) if (found_lower < seq->lower)
...@@ -79,7 +80,7 @@ void tipc_sub_report_overlap(struct tipc_subscription *sub, ...@@ -79,7 +80,7 @@ void tipc_sub_report_overlap(struct tipc_subscription *sub,
{ {
struct tipc_subscr *s = &sub->evt.s; struct tipc_subscr *s = &sub->evt.s;
u32 filter = tipc_sub_read(s, filter); u32 filter = tipc_sub_read(s, filter);
struct tipc_name_seq seq; struct tipc_service_range seq;
seq.type = tipc_sub_read(s, seq.type); seq.type = tipc_sub_read(s, seq.type);
seq.lower = tipc_sub_read(s, seq.lower); seq.lower = tipc_sub_read(s, seq.lower);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (c) 2003-2017, Ericsson AB * Copyright (c) 2003-2017, Ericsson AB
* Copyright (c) 2005-2007, 2012-2013, Wind River Systems * Copyright (c) 2005-2007, 2012-2013, Wind River Systems
* Copyright (c) 2020, 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
...@@ -71,8 +72,8 @@ struct tipc_subscription *tipc_sub_subscribe(struct net *net, ...@@ -71,8 +72,8 @@ struct tipc_subscription *tipc_sub_subscribe(struct net *net,
int conid); int conid);
void tipc_sub_unsubscribe(struct tipc_subscription *sub); void tipc_sub_unsubscribe(struct tipc_subscription *sub);
int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower, int tipc_sub_check_overlap(struct tipc_service_range *seq,
u32 found_upper); u32 found_lower, u32 found_upper);
void tipc_sub_report_overlap(struct tipc_subscription *sub, void tipc_sub_report_overlap(struct tipc_subscription *sub,
u32 found_lower, u32 found_upper, u32 found_lower, u32 found_upper,
u32 event, u32 port, u32 node, u32 event, u32 port, u32 node,
......
...@@ -519,8 +519,8 @@ static int tipc_topsrv_create_listener(struct tipc_topsrv *srv) ...@@ -519,8 +519,8 @@ static int tipc_topsrv_create_listener(struct tipc_topsrv *srv)
goto err; goto err;
saddr.family = AF_TIPC; saddr.family = AF_TIPC;
saddr.addrtype = TIPC_ADDR_NAMESEQ; saddr.addrtype = TIPC_SERVICE_RANGE;
saddr.addr.nameseq.type = TIPC_TOP_SRV; saddr.addr.nameseq.type = TIPC_TOP_SRV;
saddr.addr.nameseq.lower = TIPC_TOP_SRV; saddr.addr.nameseq.lower = TIPC_TOP_SRV;
saddr.addr.nameseq.upper = TIPC_TOP_SRV; saddr.addr.nameseq.upper = TIPC_TOP_SRV;
saddr.scope = TIPC_NODE_SCOPE; saddr.scope = TIPC_NODE_SCOPE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册