mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
amt: drop unexpected advertisement message
[ Upstream commit40185f359f
] AMT gateway interface should not receive unexpected advertisement messages. In order to drop these packets, it should check nonce and amt->status. Fixes:cbc21dc1cf
("amt: add data plane of amt interface") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3ef0b18e27
commit
61b58315a7
1 changed files with 5 additions and 0 deletions
|
@ -2260,6 +2260,10 @@ static bool amt_advertisement_handler(struct amt_dev *amt, struct sk_buff *skb)
|
|||
ipv4_is_zeronet(amta->ip4))
|
||||
return true;
|
||||
|
||||
if (amt->status != AMT_STATUS_SENT_DISCOVERY ||
|
||||
amt->nonce != amta->nonce)
|
||||
return true;
|
||||
|
||||
amt->remote_ip = amta->ip4;
|
||||
netdev_dbg(amt->dev, "advertised remote ip = %pI4\n", &amt->remote_ip);
|
||||
mod_delayed_work(amt_wq, &amt->req_wq, 0);
|
||||
|
@ -2975,6 +2979,7 @@ static int amt_dev_open(struct net_device *dev)
|
|||
|
||||
amt->req_cnt = 0;
|
||||
amt->remote_ip = 0;
|
||||
amt->nonce = 0;
|
||||
get_random_bytes(&amt->key, sizeof(siphash_key_t));
|
||||
|
||||
amt->status = AMT_STATUS_INIT;
|
||||
|
|
Loading…
Reference in a new issue