]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: let function tipc_msg_reverse() expand header when needed
authorJon Paul Maloy <jon.maloy@ericsson.com>
Wed, 22 Jul 2015 14:11:18 +0000 (10:11 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 26 Jul 2015 23:31:50 +0000 (16:31 -0700)
commit07a63343663877ac5452983297355cc6801960eb
treec56867f0670a1c8d4d20735857dbae24123778f4
parentf8f72fc4c91ffb9c681562829a48eedb6b955617
tipc: let function tipc_msg_reverse() expand header when needed

The shortest TIPC message header, for cluster local CONNECTED messages,
is 24 bytes long. With this format, the fields "dest_node" and
"orig_node" are optimized away, since they in reality are redundant
in this particular case.

However, the absence of these fields leads to code inconsistencies
that are difficult to handle in some cases, especially when we need
to reverse or reject messages at the socket layer.

In this commit, we concentrate the handling of the absent fields
to one place, by letting the function tipc_msg_reverse() reallocate
the buffer and expand the header to 32 bytes when necessary. This
means that the socket code now can assume that the two previously
absent fields are present in the header when a message needs to be
rejected. This opens up for some further simplifications of the
socket code.

Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/msg.c
net/tipc/msg.h
net/tipc/socket.c