Lines Matching full:if
47 #if IS_ENABLED(CONFIG_IPV6)
62 if (p->i_flags & TUNNEL_KEY) { in ip_tunnel_key_match()
63 if (flags & TUNNEL_KEY) in ip_tunnel_key_match()
75 We require exact key match i.e. if a key is present in packet
76 it will match only tunnel with the same key; if it is not present,
79 All keysless packets, if not matched configured keyless tunnels
97 if (local != t->parms.iph.saddr || 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()
112 if (remote != t->parms.iph.daddr || 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()
122 else if (!cand) in ip_tunnel_lookup()
130 if ((local != t->parms.iph.saddr || t->parms.iph.daddr != 0) && 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()
142 else if (!cand) in ip_tunnel_lookup()
147 if ((!(flags & TUNNEL_NO_KEY) && t->parms.i_key != key) || in ip_tunnel_lookup()
153 if (t->parms.link == link) in ip_tunnel_lookup()
155 else if (!cand) in ip_tunnel_lookup()
159 if (cand) in ip_tunnel_lookup()
163 if (t && t->dev->flags & IFF_UP) in ip_tunnel_lookup()
167 if (ndev && ndev->flags & IFF_UP) in ip_tunnel_lookup()
181 if (parms->iph.daddr && !ipv4_is_multicast(parms->iph.daddr)) in ip_bucket()
186 if (!(parms->i_flags & TUNNEL_KEY) && (parms->i_flags & VTI_ISVTI)) in ip_bucket()
197 if (t->collect_md) in ip_tunnel_add()
204 if (t->collect_md) in ip_tunnel_del()
222 if (local == t->parms.iph.saddr && in ip_tunnel_find()
242 if (parms->name[0]) { in __ip_tunnel_create()
243 if (!dev_valid_name(parms->name)) in __ip_tunnel_create()
247 if (strlen(ops->kind) > (IFNAMSIZ - 3)) in __ip_tunnel_create()
255 if (!dev) { in __ip_tunnel_create()
268 if (err) in __ip_tunnel_create()
291 if (iph->daddr) { in ip_tunnel_bind_dev()
301 if (!IS_ERR(rt)) { in ip_tunnel_bind_dev()
305 if (dev->type != ARPHRD_ETHER) in ip_tunnel_bind_dev()
311 if (!tdev && tunnel->parms.link) in ip_tunnel_bind_dev()
314 if (tdev) { in ip_tunnel_bind_dev()
322 if (mtu < IPV4_MIN_MTU) in ip_tunnel_bind_dev()
339 if (IS_ERR(dev)) in ip_tunnel_create()
344 if (err) in ip_tunnel_create()
351 if (dev->type == ARPHRD_ETHER) in ip_tunnel_create()
367 if (iph->protocol != IPPROTO_UDP) in ip_tunnel_md_udp_encap()
384 if (ipv4_is_multicast(iph->daddr)) { in ip_tunnel_rcv()
390 if ((!(tpi->flags&TUNNEL_CSUM) && (tunnel->parms.i_flags&TUNNEL_CSUM)) || in ip_tunnel_rcv()
397 if (tunnel->parms.i_flags&TUNNEL_SEQ) { in ip_tunnel_rcv()
398 if (!(tpi->flags&TUNNEL_SEQ) || in ip_tunnel_rcv()
410 if (unlikely(err)) { in ip_tunnel_rcv()
411 if (log_ecn_error) in ip_tunnel_rcv()
414 if (err > 1) { in ip_tunnel_rcv()
424 if (tunnel->dev->type == ARPHRD_ETHER) { in ip_tunnel_rcv()
431 if (tun_dst) in ip_tunnel_rcv()
438 if (tun_dst) in ip_tunnel_rcv()
448 if (num >= MAX_IPTUN_ENCAP_OPS) in ip_tunnel_encap_add_ops()
462 if (num >= MAX_IPTUN_ENCAP_OPS) in ip_tunnel_encap_del_ops()
483 if (hlen < 0) in ip_tunnel_encap_setup()
511 if (df) { in tnl_update_pmtu()
518 if (skb_valid_dst(skb)) in tnl_update_pmtu()
521 if (skb->protocol == htons(ETH_P_IP)) { in tnl_update_pmtu()
522 if (!skb_is_gso(skb) && in tnl_update_pmtu()
529 #if IS_ENABLED(CONFIG_IPV6) in tnl_update_pmtu()
530 else if (skb->protocol == htons(ETH_P_IPV6)) { in tnl_update_pmtu()
538 if (rt6 && mtu < dst_mtu(skb_dst(skb)) && in tnl_update_pmtu()
540 if ((daddr && !ipv4_is_multicast(daddr)) || in tnl_update_pmtu()
547 if (!skb_is_gso(skb) && mtu >= IPV6_MIN_MTU && in tnl_update_pmtu()
564 if (headroom > max_allowed) in ip_tunnel_adj_headroom()
567 if (headroom > READ_ONCE(dev->needed_headroom)) in ip_tunnel_adj_headroom()
586 if (unlikely(!tun_info || !(tun_info->mode & IP_TUNNEL_INFO_TX) || in ip_md_tunnel_xmit()
593 if (tos == 1) { in ip_md_tunnel_xmit()
594 if (skb->protocol == htons(ETH_P_IP)) in ip_md_tunnel_xmit()
596 else if (skb->protocol == htons(ETH_P_IPV6)) in ip_md_tunnel_xmit()
604 if (!tunnel_hlen) in ip_md_tunnel_xmit()
607 if (ip_tunnel_encap(skb, &tun_info->encap, &proto, &fl4) < 0) in ip_md_tunnel_xmit()
611 if (use_cache) in ip_md_tunnel_xmit()
613 if (!rt) { in ip_md_tunnel_xmit()
615 if (IS_ERR(rt)) { in ip_md_tunnel_xmit()
619 if (use_cache) in ip_md_tunnel_xmit()
623 if (rt->dst.dev == dev) { in ip_md_tunnel_xmit()
629 if (key->tun_flags & TUNNEL_DONT_FRAGMENT) in ip_md_tunnel_xmit()
631 if (tnl_update_pmtu(dev, skb, rt, df, inner_iph, tunnel_hlen, in ip_md_tunnel_xmit()
639 if (ttl == 0) { in ip_md_tunnel_xmit()
640 if (skb->protocol == htons(ETH_P_IP)) in ip_md_tunnel_xmit()
642 else if (skb->protocol == htons(ETH_P_IPV6)) in ip_md_tunnel_xmit()
649 if (skb_cow_head(skb, headroom)) { in ip_md_tunnel_xmit()
693 if (dst == 0) { in ip_tunnel_xmit()
696 if (!skb_dst(skb)) { in ip_tunnel_xmit()
702 if (tun_info && (tun_info->mode & IP_TUNNEL_INFO_TX) && in ip_tunnel_xmit()
708 } else if (payload_protocol == htons(ETH_P_IP)) { in ip_tunnel_xmit()
712 #if IS_ENABLED(CONFIG_IPV6) in ip_tunnel_xmit()
713 else if (payload_protocol == htons(ETH_P_IPV6)) { in ip_tunnel_xmit()
721 if (!neigh) in ip_tunnel_xmit()
727 if (addr_type == IPV6_ADDR_ANY) { in ip_tunnel_xmit()
732 if ((addr_type & IPV6_ADDR_COMPATv4) == 0) in ip_tunnel_xmit()
739 if (do_tx_error_icmp) in ip_tunnel_xmit()
746 if (!md) in ip_tunnel_xmit()
751 if (tos & 0x1) { in ip_tunnel_xmit()
753 if (payload_protocol == htons(ETH_P_IP)) { in ip_tunnel_xmit()
756 } else if (payload_protocol == htons(ETH_P_IPV6)) { in ip_tunnel_xmit()
767 if (ip_tunnel_encap(skb, &tunnel->encap, &protocol, &fl4) < 0) in ip_tunnel_xmit()
770 if (connected && md) { in ip_tunnel_xmit()
772 if (use_cache) in ip_tunnel_xmit()
780 if (!rt) { in ip_tunnel_xmit()
783 if (IS_ERR(rt)) { in ip_tunnel_xmit()
787 if (use_cache) in ip_tunnel_xmit()
790 else if (!md && connected) in ip_tunnel_xmit()
795 if (rt->dst.dev == dev) { in ip_tunnel_xmit()
802 if (payload_protocol == htons(ETH_P_IP) && !tunnel->ignore_df) in ip_tunnel_xmit()
805 if (tnl_update_pmtu(dev, skb, rt, df, inner_iph, 0, 0, false)) { in ip_tunnel_xmit()
810 if (tunnel->err_count > 0) { in ip_tunnel_xmit()
811 if (time_before(jiffies, in ip_tunnel_xmit()
822 if (ttl == 0) { in ip_tunnel_xmit()
823 if (payload_protocol == htons(ETH_P_IP)) in ip_tunnel_xmit()
825 #if IS_ENABLED(CONFIG_IPV6) in ip_tunnel_xmit()
826 else if (payload_protocol == htons(ETH_P_IPV6)) in ip_tunnel_xmit()
836 if (skb_cow_head(skb, max_headroom)) { in ip_tunnel_xmit()
849 #if IS_ENABLED(CONFIG_IPV6) in ip_tunnel_xmit()
871 if (dev->type != ARPHRD_ETHER) { in ip_tunnel_update()
881 if (t->parms.link != p->link || t->fwmark != fwmark) { in ip_tunnel_update()
887 if (set_mtu) in ip_tunnel_update()
903 if (dev == itn->fb_tunnel_dev) { in ip_tunnel_ctl()
905 if (!t) in ip_tunnel_ctl()
914 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in ip_tunnel_ctl()
916 if (p->iph.ttl) in ip_tunnel_ctl()
918 if (!(p->i_flags & VTI_ISVTI)) { in ip_tunnel_ctl()
919 if (!(p->i_flags & TUNNEL_KEY)) in ip_tunnel_ctl()
921 if (!(p->o_flags & TUNNEL_KEY)) in ip_tunnel_ctl()
927 if (cmd == SIOCADDTUNNEL) { in ip_tunnel_ctl()
928 if (!t) { in ip_tunnel_ctl()
937 if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { in ip_tunnel_ctl()
938 if (t) { in ip_tunnel_ctl()
939 if (t->dev != dev) { in ip_tunnel_ctl()
946 if (ipv4_is_multicast(p->iph.daddr)) in ip_tunnel_ctl()
948 else if (p->iph.daddr) in ip_tunnel_ctl()
951 if ((dev->flags^nflags)&(IFF_POINTOPOINT|IFF_BROADCAST)) { in ip_tunnel_ctl()
960 if (t) { in ip_tunnel_ctl()
970 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in ip_tunnel_ctl()
973 if (dev == itn->fb_tunnel_dev) { in ip_tunnel_ctl()
976 if (!t) in ip_tunnel_ctl()
979 if (t == netdev_priv(itn->fb_tunnel_dev)) in ip_tunnel_ctl()
1002 if (copy_from_user(&p, data, sizeof(p))) in ip_tunnel_siocdevprivate()
1005 if (!err && copy_to_user(data, &p, sizeof(p))) in ip_tunnel_siocdevprivate()
1017 if (dev->type == ARPHRD_ETHER) in __ip_tunnel_change_mtu()
1020 if (new_mtu < ETH_MIN_MTU) in __ip_tunnel_change_mtu()
1023 if (new_mtu > max_mtu) { in __ip_tunnel_change_mtu()
1024 if (strict) in __ip_tunnel_change_mtu()
1057 if (itn->fb_tunnel_dev != dev) { in ip_tunnel_dellink()
1091 if (!ops || !net_has_fallback_tunnels(net)) { in ip_tunnel_init_net()
1101 if (devname) in ip_tunnel_init_net()
1109 if (!IS_ERR(itn->fb_tunnel_dev)) { in ip_tunnel_init_net()
1129 if (dev->rtnl_link_ops == ops) in ip_tunnel_destroy()
1138 /* If dev is in the same netns, it has already in ip_tunnel_destroy()
1141 if (!net_eq(dev_net(t->dev), net)) in ip_tunnel_destroy()
1175 if (nt->collect_md) { in ip_tunnel_newlink()
1176 if (rtnl_dereference(itn->collect_md_tun)) in ip_tunnel_newlink()
1179 if (ip_tunnel_find(itn, p, dev->type)) in ip_tunnel_newlink()
1187 if (err) in ip_tunnel_newlink()
1190 if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS]) in ip_tunnel_newlink()
1194 if (tb[IFLA_MTU]) { in ip_tunnel_newlink()
1197 if (dev->type == ARPHRD_ETHER) in ip_tunnel_newlink()
1204 if (err) in ip_tunnel_newlink()
1225 if (dev == itn->fb_tunnel_dev) in ip_tunnel_changelink()
1230 if (t) { in ip_tunnel_changelink()
1231 if (t->dev != dev) in ip_tunnel_changelink()
1236 if (dev->type != ARPHRD_ETHER) { in ip_tunnel_changelink()
1239 if (ipv4_is_multicast(p->iph.daddr)) in ip_tunnel_changelink()
1241 else if (p->iph.daddr) in ip_tunnel_changelink()
1244 if ((dev->flags ^ nflags) & in ip_tunnel_changelink()
1264 if (!dev->tstats) in ip_tunnel_init()
1268 if (err) { in ip_tunnel_init()
1274 if (err) { in ip_tunnel_init()
1286 if (tunnel->collect_md) in ip_tunnel_init()
1300 if (itn->fb_tunnel_dev == dev) in ip_tunnel_uninit()