iproute2/ip
Dmitry Popov 23d526c426 fix ip tunnel for vti tunnels with ikey
Consider the following command:

ip tunnel add mode vti remote 12.0.0.1 local 12.0.0.3 ikey 15

i_flags will be GRE_KEY|VTI_ISVTI. So, in order to distinguish between ipip and
vti we have to check just VTI_ISVTI bit, not the equality of i_flags and
VTI_ISVTI.

* Note, that there also was a bug in ip_tunnel/ip_vti, see
commit 7c8e6b9c281(ip_vti: Fix 'ip tunnel add' with 'key' parameters),
https://lkml.org/lkml/2014/6/7/125.
Even patched iproute could be unable to create vti tunnels with non-zero keys.

1) Unpatched iproute2:
[root@vm ~]# ip tunnel show
[root@vm ~]# lsmod | egrep '(ipip|vti)'
[root@vm ~]# ip tunnel add mode vti ikey 1
[root@vm ~]# lsmod | egrep '(ipip|vti)'
ipip                    4197  0 
tunnel4                 1659  1 ipip
ip_tunnel               9295  1 ipip
[root@vm ~]# ip tunnel show
tunl0: ip/ip  remote any  local any  ttl inherit
[root@vm ~]# ip tunnel add mode vti remote 1.2.3.4 ikey 2
[root@vm ~]# ip tunnel show
ipip0: ip/ip  remote 1.2.3.4  local any  ttl inherit 
tunl0: ip/ip  remote any  local any  ttl inherit 
[root@vm ~]# lsmod | egrep '(ipip|vti)'
ipip                    4197  0 
tunnel4                 1659  1 ipip
ip_tunnel               9295  1 ipip

# ipip tunnels are created instead of vti

2) Patched iproute2:
[root@vm ~]# ip tunnel show
[root@vm ~]# lsmod | egrep '(ipip|vti)'
[root@vm ~]# ip tunnel add mode vti ikey 1
[root@vm ~]# lsmod | egrep '(ipip|vti)'
ip_vti                  5258  0 
ip_tunnel               9295  1 ip_vti
[root@vm ~]# ip tunnel show
vti0: ip/ip  remote any  local any  ttl inherit  ikey 1  okey 0 
ip_vti0: ip/ip  remote any  local any  ttl inherit  nopmtudisc key 0
[root@vm ~]# ip tunnel add mode vti remote 1.2.3.4 ikey 2
[root@vm ~]# ip tunnel show
vti0: ip/ip  remote any  local any  ttl inherit  ikey 1  okey 0
vti1: ip/ip  remote 1.2.3.4  local any  ttl inherit  ikey 2  okey 0 
ip_vti0: ip/ip  remote any  local any  ttl inherit  nopmtudisc key 0

# Vti tunnels are created as expected
# * If you have unpatched kernel your vti tunnels will have ikey == okey == 0

Same story exists with ip tunnel show/del with non-zero [io]key: requests are 
routed to tunl0 instead of ip_vti0.


Signed-off-by: Dmitry Popov <ixaphire@qrator.net>
2014-07-15 09:49:17 -07:00
..
.gitignore Another .gitignore file. 2006-08-08 12:11:23 -07:00
Makefile iplink: add support for bonding slave 2014-02-17 10:53:34 -08:00
ifcfg Remove trailing whitespace 2006-12-05 10:10:22 -08:00
ip.c ip: Added missing usage for netconf object 2014-07-15 09:43:53 -07:00
ip6tunnel.c Whitespace and indentation cleanup 2014-05-09 12:36:46 -07:00
ip_common.h Add support to configure SR-IOV VF minimum and maximum Tx rate through ip tool 2014-06-09 12:51:57 -07:00
ipaddress.c ip: add paren to silence warning 2014-07-14 12:06:52 -07:00
ipaddrlabel.c kill spaces before tabs 2014-02-17 10:56:31 -08:00
ipl2tp.c iproute2: add l2spec_type param to l2tp add session 2013-03-27 13:20:58 -07:00
iplink.c ip: add nlmon as a device type to help message 2014-07-15 09:41:44 -07:00
iplink_bond.c iplink_bond: fix parameter value matching 2014-02-17 10:58:56 -08:00
iplink_bond_slave.c iplink_bond_slave: show mii_status only once 2014-02-28 10:13:46 -08:00
iplink_can.c iproute2: can: support CAN FD control interface 2014-05-09 12:04:55 -07:00
iplink_hsr.c ip: Add HSR support 2013-12-20 08:33:19 -08:00
iplink_ipoib.c iproute2: improved error messages 2013-02-11 09:22:22 -08:00
iplink_macvlan.c macvlan: fix typo in macvlan_print_opt() 2013-08-31 10:30:11 -07:00
iplink_macvtap.c iproute2: improved error messages 2013-02-11 09:22:22 -08:00
iplink_vlan.c ip: iplink_vlan: add 802.1ad support 2013-06-21 08:59:24 -07:00
iplink_vxlan.c do not exit silently when link is not found 2014-06-09 12:38:32 -07:00
ipmaddr.c ipmaddr: add whitespace around = 2013-03-14 13:44:25 -07:00
ipmonitor.c add ability to filter neighbour discovery by protocol 2013-08-29 12:18:52 -07:00
ipmroute.c ip: use rtnelink to manage mroute 2012-12-14 10:08:17 -08:00
ipneigh.c kill spaces before tabs 2014-02-17 10:56:31 -08:00
ipnetconf.c Merge branch 'master' into net-next-for-3.13 2014-01-09 22:44:17 -08:00
ipnetns.c ipnetns: fixed typo "seting" -> "setTing" 2014-07-15 09:45:37 -07:00
ipntable.c kill spaces before tabs 2014-02-17 10:56:31 -08:00
ipprefix.c Fix FSF address in file headers 2013-12-06 15:05:07 -08:00
iproute.c iproute: Show default type, table, proto and scope of route 2014-03-21 14:21:26 -07:00
iprule.c kill spaces before tabs 2014-02-17 10:56:31 -08:00
iptoken.c ip: ipv6: add tokenized interface identifier support 2013-05-03 13:17:21 -07:00
iptunnel.c fix ip tunnel for vti tunnels with ikey 2014-07-15 09:49:17 -07:00
iptuntap.c iptuntap: allow creation of multi-queue tun/tap device 2013-05-24 08:12:52 -07:00
ipxfrm.c Remove trailing whitespace 2014-02-17 10:55:31 -08:00
link_gre.c do not exit silently when link is not found 2014-06-09 12:38:32 -07:00
link_gre6.c do not exit silently when link is not found 2014-06-09 12:38:32 -07:00
link_ip6tnl.c ip: add missing help about mode argument 2013-05-03 12:29:22 -07:00
link_iptnl.c iproute2: spelling: noptmudisc -> nopmtudisc 2013-08-31 10:30:03 -07:00
link_veth.c veth: Handle flags correctry 2014-04-11 17:44:48 -07:00
link_vti.c do not exit silently when link is not found 2014-06-09 12:38:32 -07:00
routef ip/routef lifesaver 2007-07-10 18:29:20 -07:00
routel (Logical change 1.3) 2004-04-15 20:56:59 +00:00
rtm_map.c (Logical change 1.3) 2004-04-15 20:56:59 +00:00
rtmon.c ip: make local functions static 2013-02-12 11:38:35 -08:00
rtpr (Logical change 1.3) 2004-04-15 20:56:59 +00:00
static-syms.c Fix build when shared libraries are disabled 2013-03-13 08:29:59 -07:00
tcp_metrics.c tcp_metrics: Allow removal based on the source-IP 2014-02-10 14:46:11 -08:00
tunnel.c Remove trailing whitespace 2014-02-17 10:55:31 -08:00
tunnel.h Fix FSF address in file headers 2013-12-06 15:05:07 -08:00
xfrm.h Fix FSF address in file headers 2013-12-06 15:05:07 -08:00
xfrm_monitor.c Fix FSF address in file headers 2013-12-06 15:05:07 -08:00
xfrm_policy.c kill spaces before tabs 2014-02-17 10:56:31 -08:00
xfrm_state.c ipxfrm: allow to setup filter when dumping SA 2014-03-21 14:24:41 -07:00