Commit b2abd4c0 authored by Paul Gortmaker's avatar Paul Gortmaker Committed by David S. Miller

tipc: Optimize handling excess content on incoming messages

Remove code that trimmed excess trailing info from incoming messages
arriving over an Ethernet interface.  TIPC now ignores the extra info
while the message is being processed by the node, and only trims it off
if the message is retransmitted to another node.  (This latter step is
done to ensure the extra info doesn't cause the sk_buff to exceed the
outgoing interface's MTU limit.) The outgoing buffer is guaranteed to
be linear.
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fb621bac
...@@ -101,15 +101,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, ...@@ -101,15 +101,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
* Accept only packets explicitly sent to this node, or broadcast packets; * Accept only packets explicitly sent to this node, or broadcast packets;
* ignores packets sent using Ethernet multicast, and traffic sent to other * ignores packets sent using Ethernet multicast, and traffic sent to other
* nodes (which can happen if interface is running in promiscuous mode). * nodes (which can happen if interface is running in promiscuous mode).
* Routine truncates any Ethernet padding/CRC appended to the message,
* and ensures message size matches actual length
*/ */
static int recv_msg(struct sk_buff *buf, struct net_device *dev, static int recv_msg(struct sk_buff *buf, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev) struct packet_type *pt, struct net_device *orig_dev)
{ {
struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
u32 size;
if (!net_eq(dev_net(dev), &init_net)) { if (!net_eq(dev_net(dev), &init_net)) {
kfree_skb(buf); kfree_skb(buf);
...@@ -118,13 +115,9 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, ...@@ -118,13 +115,9 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
if (likely(eb_ptr->bearer)) { if (likely(eb_ptr->bearer)) {
if (likely(buf->pkt_type <= PACKET_BROADCAST)) { if (likely(buf->pkt_type <= PACKET_BROADCAST)) {
size = msg_size((struct tipc_msg *)buf->data); buf->next = NULL;
skb_trim(buf, size); tipc_recv_msg(buf, eb_ptr->bearer);
if (likely(buf->len == size)) { return 0;
buf->next = NULL;
tipc_recv_msg(buf, eb_ptr->bearer);
return 0;
}
} }
} }
kfree_skb(buf); kfree_skb(buf);
......
...@@ -248,6 +248,7 @@ void tipc_net_route_msg(struct sk_buff *buf) ...@@ -248,6 +248,7 @@ void tipc_net_route_msg(struct sk_buff *buf)
/* Handle message for another node */ /* Handle message for another node */
msg_dbg(msg, "NET>SEND>: "); msg_dbg(msg, "NET>SEND>: ");
skb_trim(buf, msg_size(msg));
tipc_link_send(buf, dnode, msg_link_selector(msg)); tipc_link_send(buf, dnode, msg_link_selector(msg));
} }
......
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