diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-05-08 15:04:05 +0800 |
---|---|---|
committer | Jiri Pirko <jiri@mellanox.com> | 2017-05-08 09:55:37 +0200 |
commit | 49c1de9b67a5a26f120294743d206f3a9286a314 (patch) | |
tree | f699a7affb09decab6206b13c150759c9a0e61e4 | |
parent | 9a9fbff3e75f78cbff76e9dbd1cfa0a05fd1f120 (diff) | |
download | libteam-49c1de9b67a5a26f120294743d206f3a9286a314.tar.gz |
teamd: check target host with nap.nah.nd_na_target
Now in lw_nsnap_receive, it compares ip6h.ip6_src with nsnap_ppriv->dst
to check target host.
But when target_host is set with a global addr, the na packet from some
switch may use it's link/local addr as the ip6_src addr, instead of the
global addr. It will cause to fail to validate the ipv6 na packet, and
nsna_ping couldn't work.
Since nap.nah.nd_na_target is always set with target_host, this patch is
to fix it by using nap.nah.nd_na_target to compare with nsnap_ppriv->dst
to check target host instead.
Reported-by: Amit Supugade <asupugad@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
-rw-r--r-- | teamd/teamd_lw_nsna_ping.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/teamd/teamd_lw_nsna_ping.c b/teamd/teamd_lw_nsna_ping.c index 4f5dfcd..127d950 100644 --- a/teamd/teamd_lw_nsna_ping.c +++ b/teamd/teamd_lw_nsna_ping.c @@ -250,13 +250,13 @@ static int lw_nsnap_receive(struct lw_psr_port_priv *psr_ppriv) 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 */ || - memcmp(&nap.ip6h.ip6_src, &nsnap_ppriv->dst.sin6_addr, - sizeof(struct in6_addr))) + nap.ip6h.ip6_hlim != 255 /* Do not route */) return 0; /* check ICMP6 header */ if (nap.nah.nd_na_type != ND_NEIGHBOR_ADVERT || + memcmp(&nap.nah.nd_na_target, &nsnap_ppriv->dst.sin6_addr, + sizeof(struct in6_addr)) || nap.opt.nd_opt_type != ND_OPT_TARGET_LINKADDR || nap.opt.nd_opt_len != 1 /* 8 bytes */) return 0; |