Lines Matching refs:t

88 	struct ip_tunnel *t, *cand = NULL;  in ip_tunnel_lookup()  local
96 hlist_for_each_entry_rcu(t, head, hash_node) { in ip_tunnel_lookup()
97 if (local != t->parms.iph.saddr || in ip_tunnel_lookup()
98 remote != t->parms.iph.daddr || in ip_tunnel_lookup()
99 !(t->dev->flags & IFF_UP)) in ip_tunnel_lookup()
102 if (!ip_tunnel_key_match(&t->parms, flags, key)) in ip_tunnel_lookup()
105 if (t->parms.link == link) in ip_tunnel_lookup()
106 return t; in ip_tunnel_lookup()
108 cand = t; in ip_tunnel_lookup()
111 hlist_for_each_entry_rcu(t, head, hash_node) { in ip_tunnel_lookup()
112 if (remote != t->parms.iph.daddr || in ip_tunnel_lookup()
113 t->parms.iph.saddr != 0 || in ip_tunnel_lookup()
114 !(t->dev->flags & IFF_UP)) in ip_tunnel_lookup()
117 if (!ip_tunnel_key_match(&t->parms, flags, key)) in ip_tunnel_lookup()
120 if (t->parms.link == link) in ip_tunnel_lookup()
121 return t; in ip_tunnel_lookup()
123 cand = t; in ip_tunnel_lookup()
129 hlist_for_each_entry_rcu(t, head, hash_node) { in ip_tunnel_lookup()
130 if ((local != t->parms.iph.saddr || t->parms.iph.daddr != 0) && in ip_tunnel_lookup()
131 (local != t->parms.iph.daddr || !ipv4_is_multicast(local))) in ip_tunnel_lookup()
134 if (!(t->dev->flags & IFF_UP)) in ip_tunnel_lookup()
137 if (!ip_tunnel_key_match(&t->parms, flags, key)) in ip_tunnel_lookup()
140 if (t->parms.link == link) in ip_tunnel_lookup()
141 return t; in ip_tunnel_lookup()
143 cand = t; in ip_tunnel_lookup()
146 hlist_for_each_entry_rcu(t, head, hash_node) { in ip_tunnel_lookup()
147 if ((!(flags & TUNNEL_NO_KEY) && t->parms.i_key != key) || in ip_tunnel_lookup()
148 t->parms.iph.saddr != 0 || in ip_tunnel_lookup()
149 t->parms.iph.daddr != 0 || in ip_tunnel_lookup()
150 !(t->dev->flags & IFF_UP)) in ip_tunnel_lookup()
153 if (t->parms.link == link) in ip_tunnel_lookup()
154 return t; in ip_tunnel_lookup()
156 cand = t; in ip_tunnel_lookup()
162 t = rcu_dereference(itn->collect_md_tun); in ip_tunnel_lookup()
163 if (t && t->dev->flags & IFF_UP) in ip_tunnel_lookup()
164 return t; in ip_tunnel_lookup()
193 static void ip_tunnel_add(struct ip_tunnel_net *itn, struct ip_tunnel *t) in ip_tunnel_add() argument
195 struct hlist_head *head = ip_bucket(itn, &t->parms); in ip_tunnel_add()
197 if (t->collect_md) in ip_tunnel_add()
198 rcu_assign_pointer(itn->collect_md_tun, t); in ip_tunnel_add()
199 hlist_add_head_rcu(&t->hash_node, head); in ip_tunnel_add()
202 static void ip_tunnel_del(struct ip_tunnel_net *itn, struct ip_tunnel *t) in ip_tunnel_del() argument
204 if (t->collect_md) in ip_tunnel_del()
206 hlist_del_init_rcu(&t->hash_node); in ip_tunnel_del()
218 struct ip_tunnel *t = NULL; in ip_tunnel_find() local
221 hlist_for_each_entry_rcu(t, head, hash_node) { in ip_tunnel_find()
222 if (local == t->parms.iph.saddr && in ip_tunnel_find()
223 remote == t->parms.iph.daddr && in ip_tunnel_find()
224 link == t->parms.link && in ip_tunnel_find()
225 type == t->dev->type && in ip_tunnel_find()
226 ip_tunnel_key_match(&t->parms, flags, key)) in ip_tunnel_find()
229 return t; in ip_tunnel_find()
488 int ip_tunnel_encap_setup(struct ip_tunnel *t, in ip_tunnel_encap_setup() argument
493 memset(&t->encap, 0, sizeof(t->encap)); in ip_tunnel_encap_setup()
499 t->encap.type = ipencap->type; in ip_tunnel_encap_setup()
500 t->encap.sport = ipencap->sport; in ip_tunnel_encap_setup()
501 t->encap.dport = ipencap->dport; in ip_tunnel_encap_setup()
502 t->encap.flags = ipencap->flags; in ip_tunnel_encap_setup()
504 t->encap_hlen = hlen; in ip_tunnel_encap_setup()
505 t->hlen = t->encap_hlen + t->tun_hlen; in ip_tunnel_encap_setup()
873 struct ip_tunnel *t, in ip_tunnel_update() argument
879 ip_tunnel_del(itn, t); in ip_tunnel_update()
880 t->parms.iph.saddr = p->iph.saddr; in ip_tunnel_update()
881 t->parms.iph.daddr = p->iph.daddr; in ip_tunnel_update()
882 t->parms.i_key = p->i_key; in ip_tunnel_update()
883 t->parms.o_key = p->o_key; in ip_tunnel_update()
888 ip_tunnel_add(itn, t); in ip_tunnel_update()
890 t->parms.iph.ttl = p->iph.ttl; in ip_tunnel_update()
891 t->parms.iph.tos = p->iph.tos; in ip_tunnel_update()
892 t->parms.iph.frag_off = p->iph.frag_off; in ip_tunnel_update()
894 if (t->parms.link != p->link || t->fwmark != fwmark) { in ip_tunnel_update()
897 t->parms.link = p->link; in ip_tunnel_update()
898 t->fwmark = fwmark; in ip_tunnel_update()
903 dst_cache_reset(&t->dst_cache); in ip_tunnel_update()
910 struct ip_tunnel *t = netdev_priv(dev); in ip_tunnel_ctl() local
911 struct net *net = t->net; in ip_tunnel_ctl()
912 struct ip_tunnel_net *itn = net_generic(net, t->ip_tnl_net_id); in ip_tunnel_ctl()
917 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); in ip_tunnel_ctl()
918 if (!t) in ip_tunnel_ctl()
919 t = netdev_priv(dev); in ip_tunnel_ctl()
921 memcpy(p, &t->parms, sizeof(*p)); in ip_tunnel_ctl()
938 t = ip_tunnel_find(itn, p, itn->type); in ip_tunnel_ctl()
941 if (!t) { in ip_tunnel_ctl()
942 t = ip_tunnel_create(net, itn, p); in ip_tunnel_ctl()
943 err = PTR_ERR_OR_ZERO(t); in ip_tunnel_ctl()
951 if (t) { in ip_tunnel_ctl()
952 if (t->dev != dev) { in ip_tunnel_ctl()
969 t = netdev_priv(dev); in ip_tunnel_ctl()
973 if (t) { in ip_tunnel_ctl()
975 ip_tunnel_update(itn, t, dev, p, true, 0); in ip_tunnel_ctl()
988 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); in ip_tunnel_ctl()
989 if (!t) in ip_tunnel_ctl()
992 if (t == netdev_priv(itn->fb_tunnel_dev)) in ip_tunnel_ctl()
994 dev = t->dev; in ip_tunnel_ctl()
1146 struct ip_tunnel *t; in ip_tunnel_destroy() local
1150 hlist_for_each_entry_safe(t, n, thead, hash_node) in ip_tunnel_destroy()
1154 if (!net_eq(dev_net(t->dev), net)) in ip_tunnel_destroy()
1155 unregister_netdevice_queue(t->dev, head); in ip_tunnel_destroy()
1233 struct ip_tunnel *t; in ip_tunnel_changelink() local
1241 t = ip_tunnel_find(itn, p, dev->type); in ip_tunnel_changelink()
1243 if (t) { in ip_tunnel_changelink()
1244 if (t->dev != dev) in ip_tunnel_changelink()
1247 t = tunnel; in ip_tunnel_changelink()
1263 ip_tunnel_update(itn, t, dev, p, !tb[IFLA_MTU], fwmark); in ip_tunnel_changelink()