aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaehee Yoo <ap420073@gmail.com>2018-10-06 11:09:32 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-11 05:29:14 -0400
commit18c0ab87364ac5128a152055fdcb1d27e01caf01 (patch)
tree0363677faf0fbce8aaeb1b9b8e98749fcc24b316
parentf24d2d4f9586985509320f90308723d3d0c4e47f (diff)
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: 9e2f6c5d78db ("netfilter: Rework xt_TEE netdevice notifier") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/xt_TEE.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 673ad2099f97..1dae02a97ee3 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -104,6 +104,8 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
104 return -EINVAL; 104 return -EINVAL;
105 105
106 if (info->oif[0]) { 106 if (info->oif[0]) {
107 struct net_device *dev;
108
107 if (info->oif[sizeof(info->oif)-1] != '\0') 109 if (info->oif[sizeof(info->oif)-1] != '\0')
108 return -EINVAL; 110 return -EINVAL;
109 111
@@ -115,6 +117,11 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
115 priv->oif = -1; 117 priv->oif = -1;
116 info->priv = priv; 118 info->priv = priv;
117 119
120 dev = dev_get_by_name(par->net, info->oif);
121 if (dev) {
122 priv->oif = dev->ifindex;
123 dev_put(dev);
124 }
118 mutex_lock(&tn->lock); 125 mutex_lock(&tn->lock);
119 list_add(&priv->list, &tn->priv_list); 126 list_add(&priv->list, &tn->priv_list);
120 mutex_unlock(&tn->lock); 127 mutex_unlock(&tn->lock);