提交 353ae55e 编写于 作者: A Alexander Lobakin 提交者: Zheng Zengkai

flow_dissector: fix byteorder of dissected ICMP ID

stable inclusion
from stable-5.10.27
commit 33cc382c5830c7fbbc69625c3cb29b5fd0f808f2
bugzilla: 51493

--------------------------------

[ Upstream commit a25f8222 ]

flow_dissector_key_icmp::id is of type u16 (CPU byteorder),
ICMP header has its ID field in network byteorder obviously.
Sparse says:

net/core/flow_dissector.c:178:43: warning: restricted __be16 degrades to integer

Convert ID value to CPU byteorder when storing it into
flow_dissector_key_icmp.

Fixes: 5dec597e ("flow_dissector: extract more ICMP information")
Signed-off-by: NAlexander Lobakin <alobakin@pm.me>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ad9250b8
...@@ -175,7 +175,7 @@ void skb_flow_get_icmp_tci(const struct sk_buff *skb, ...@@ -175,7 +175,7 @@ void skb_flow_get_icmp_tci(const struct sk_buff *skb,
* avoid confusion with packets without such field * avoid confusion with packets without such field
*/ */
if (icmp_has_id(ih->type)) if (icmp_has_id(ih->type))
key_icmp->id = ih->un.echo.id ? : 1; key_icmp->id = ih->un.echo.id ? ntohs(ih->un.echo.id) : 1;
else else
key_icmp->id = 0; key_icmp->id = 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册