Now in lw_nsnap_receive, it checks if the packet is ipv6 or not by
ip6h.ip6_vfc != 0x60. But ip6_vfc in ipv6 header is 4 bits version
and top 4 bits tclass.
The na packet from some switch may set this top 4 bits tclass. It
will cause to fail to validate the ipv6 na packet, and nsna_ping
couldn't work.
This patch is to fix it by only using the 4 bits version to check
ipv6 packet.
Reported-by: Amit Supugade <asupugad(a)redhat.com>
Signed-off-by: Xin Long <lucien.xin(a)gmail.com>
---
teamd/teamd_lw_nsna_ping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/teamd/teamd_lw_nsna_ping.c b/teamd/teamd_lw_nsna_ping.c
index 1be8323..4f5dfcd 100644
--- a/teamd/teamd_lw_nsna_ping.c
+++ b/teamd/teamd_lw_nsna_ping.c
@@ -247,7 +247,7 @@ static int lw_nsnap_receive(struct lw_psr_port_priv *psr_ppriv)
return err;
/* check IPV6 header */
- if (nap.ip6h.ip6_vfc != 0x60 /* IPV6 */ ||
+ if ((nap.ip6h.ip6_vfc & 0xf0) != 0x60 /* IPV6 */ ||
nap.ip6h.ip6_plen != htons(sizeof(nap) - sizeof(nap.ip6h)) ||
nap.ip6h.ip6_nxt != IPPROTO_ICMPV6 ||
nap.ip6h.ip6_hlim != 255 /* Do not route */ ||
--
2.1.0