Commit 18c0ab87 authored by Taehee Yoo's avatar Taehee Yoo Committed by Pablo Neira Ayuso

netfilter: xt_TEE: add missing code to get interface index in checkentry.

checkentry(tee_tg_check) should initialize priv->oif from dev if possible.
But only netdevice notifier handler can set that.
Hence priv->oif is always -1 until notifier handler is called.

Fixes: 9e2f6c5d ("netfilter: Rework xt_TEE netdevice notifier")
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f24d2d4f
...@@ -104,6 +104,8 @@ static int tee_tg_check(const struct xt_tgchk_param *par) ...@@ -104,6 +104,8 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
return -EINVAL; return -EINVAL;
if (info->oif[0]) { if (info->oif[0]) {
struct net_device *dev;
if (info->oif[sizeof(info->oif)-1] != '\0') if (info->oif[sizeof(info->oif)-1] != '\0')
return -EINVAL; return -EINVAL;
...@@ -115,6 +117,11 @@ static int tee_tg_check(const struct xt_tgchk_param *par) ...@@ -115,6 +117,11 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
priv->oif = -1; priv->oif = -1;
info->priv = priv; info->priv = priv;
dev = dev_get_by_name(par->net, info->oif);
if (dev) {
priv->oif = dev->ifindex;
dev_put(dev);
}
mutex_lock(&tn->lock); mutex_lock(&tn->lock);
list_add(&priv->list, &tn->priv_list); list_add(&priv->list, &tn->priv_list);
mutex_unlock(&tn->lock); mutex_unlock(&tn->lock);
......
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