Lines Matching refs:t
166 struct ip_tunnel *t; in ipgre_tunnel_lookup() local
168 for (t = tunnels_r_l[h0^h1]; t; t = t->next) { in ipgre_tunnel_lookup()
169 if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) { in ipgre_tunnel_lookup()
170 if (t->parms.i_key == key && (t->dev->flags&IFF_UP)) in ipgre_tunnel_lookup()
171 return t; in ipgre_tunnel_lookup()
174 for (t = tunnels_r[h0^h1]; t; t = t->next) { in ipgre_tunnel_lookup()
175 if (remote == t->parms.iph.daddr) { in ipgre_tunnel_lookup()
176 if (t->parms.i_key == key && (t->dev->flags&IFF_UP)) in ipgre_tunnel_lookup()
177 return t; in ipgre_tunnel_lookup()
180 for (t = tunnels_l[h1]; t; t = t->next) { in ipgre_tunnel_lookup()
181 if (local == t->parms.iph.saddr || in ipgre_tunnel_lookup()
182 (local == t->parms.iph.daddr && MULTICAST(local))) { in ipgre_tunnel_lookup()
183 if (t->parms.i_key == key && (t->dev->flags&IFF_UP)) in ipgre_tunnel_lookup()
184 return t; in ipgre_tunnel_lookup()
187 for (t = tunnels_wc[h1]; t; t = t->next) { in ipgre_tunnel_lookup()
188 if (t->parms.i_key == key && (t->dev->flags&IFF_UP)) in ipgre_tunnel_lookup()
189 return t; in ipgre_tunnel_lookup()
196 static struct ip_tunnel **ipgre_bucket(struct ip_tunnel *t) in ipgre_bucket() argument
198 u32 remote = t->parms.iph.daddr; in ipgre_bucket()
199 u32 local = t->parms.iph.saddr; in ipgre_bucket()
200 u32 key = t->parms.i_key; in ipgre_bucket()
214 static void ipgre_tunnel_link(struct ip_tunnel *t) in ipgre_tunnel_link() argument
216 struct ip_tunnel **tp = ipgre_bucket(t); in ipgre_tunnel_link()
218 t->next = *tp; in ipgre_tunnel_link()
220 *tp = t; in ipgre_tunnel_link()
224 static void ipgre_tunnel_unlink(struct ip_tunnel *t) in ipgre_tunnel_unlink() argument
228 for (tp = ipgre_bucket(t); *tp; tp = &(*tp)->next) { in ipgre_tunnel_unlink()
229 if (t == *tp) { in ipgre_tunnel_unlink()
231 *tp = t->next; in ipgre_tunnel_unlink()
243 struct ip_tunnel *t, **tp, *nt; in ipgre_tunnel_locate() local
254 for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) { in ipgre_tunnel_locate()
255 if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) { in ipgre_tunnel_locate()
256 if (key == t->parms.i_key) in ipgre_tunnel_locate()
257 return t; in ipgre_tunnel_locate()
264 dev = kmalloc(sizeof(*dev) + sizeof(*t), GFP_KERNEL); in ipgre_tunnel_locate()
269 memset(dev, 0, sizeof(*dev) + sizeof(*t)); in ipgre_tunnel_locate()
339 struct ip_tunnel *t; in ipgre_err() local
386 …t = ipgre_tunnel_lookup(iph->daddr, iph->saddr, (flags&GRE_KEY) ? *(((u32*)p) + (grehlen>>2) - 1) … in ipgre_err()
387 if (t == NULL || t->parms.iph.daddr == 0 || MULTICAST(t->parms.iph.daddr)) in ipgre_err()
390 if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) in ipgre_err()
393 if (jiffies - t->err_time < IPTUNNEL_ERR_TIMEO) in ipgre_err()
394 t->err_count++; in ipgre_err()
396 t->err_count = 1; in ipgre_err()
397 t->err_time = jiffies; in ipgre_err()
523 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; in ipgre_err()
524 if (t->parms.iph.ttl) { in ipgre_err()
894 struct ip_tunnel *t; in ipgre_tunnel_ioctl() local
900 t = NULL; in ipgre_tunnel_ioctl()
906 t = ipgre_tunnel_locate(&p, 0); in ipgre_tunnel_ioctl()
908 if (t == NULL) in ipgre_tunnel_ioctl()
909 t = (struct ip_tunnel*)dev->priv; in ipgre_tunnel_ioctl()
910 memcpy(&p, &t->parms, sizeof(p)); in ipgre_tunnel_ioctl()
938 t = ipgre_tunnel_locate(&p, cmd == SIOCADDTUNNEL); in ipgre_tunnel_ioctl()
941 t != &ipgre_fb_tunnel) { in ipgre_tunnel_ioctl()
942 if (t != NULL) { in ipgre_tunnel_ioctl()
943 if (t->dev != dev) { in ipgre_tunnel_ioctl()
950 t = (struct ip_tunnel*)dev->priv; in ipgre_tunnel_ioctl()
961 ipgre_tunnel_unlink(t); in ipgre_tunnel_ioctl()
962 t->parms.iph.saddr = p.iph.saddr; in ipgre_tunnel_ioctl()
963 t->parms.iph.daddr = p.iph.daddr; in ipgre_tunnel_ioctl()
964 t->parms.i_key = p.i_key; in ipgre_tunnel_ioctl()
965 t->parms.o_key = p.o_key; in ipgre_tunnel_ioctl()
968 ipgre_tunnel_link(t); in ipgre_tunnel_ioctl()
973 if (t) { in ipgre_tunnel_ioctl()
976 t->parms.iph.ttl = p.iph.ttl; in ipgre_tunnel_ioctl()
977 t->parms.iph.tos = p.iph.tos; in ipgre_tunnel_ioctl()
978 t->parms.iph.frag_off = p.iph.frag_off; in ipgre_tunnel_ioctl()
980 if (copy_to_user(ifr->ifr_ifru.ifru_data, &t->parms, sizeof(p))) in ipgre_tunnel_ioctl()
996 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL) in ipgre_tunnel_ioctl()
999 if (t == &ipgre_fb_tunnel) in ipgre_tunnel_ioctl()
1001 dev = t->dev; in ipgre_tunnel_ioctl()
1062 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; in ipgre_header() local
1063 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); in ipgre_header()
1066 memcpy(iph, &t->parms.iph, sizeof(struct iphdr)); in ipgre_header()
1067 p[0] = t->parms.o_flags; in ipgre_header()
1079 return t->hlen; in ipgre_header()
1082 return t->hlen; in ipgre_header()
1084 return -t->hlen; in ipgre_header()
1089 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; in ipgre_open() local
1092 if (MULTICAST(t->parms.iph.daddr)) { in ipgre_open()
1094 if (ip_route_output(&rt, t->parms.iph.daddr, in ipgre_open()
1095 t->parms.iph.saddr, RT_TOS(t->parms.iph.tos), in ipgre_open()
1096 t->parms.link)) { in ipgre_open()
1106 t->mlink = dev->ifindex; in ipgre_open()
1107 ip_mc_inc_group(__in_dev_get(dev), t->parms.iph.daddr); in ipgre_open()
1114 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; in ipgre_close() local
1115 if (MULTICAST(t->parms.iph.daddr) && t->mlink) { in ipgre_close()
1116 struct in_device *in_dev = inetdev_by_index(t->mlink); in ipgre_close()
1118 ip_mc_dec_group(in_dev, t->parms.iph.daddr); in ipgre_close()
1130 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; in ipgre_tunnel_init_gen() local
1145 memcpy(dev->dev_addr, &t->parms.iph.saddr, 4); in ipgre_tunnel_init_gen()
1146 memcpy(dev->broadcast, &t->parms.iph.daddr, 4); in ipgre_tunnel_init_gen()