iptunnel: Allow GRE_KEY for vti interface
Subsystems (2)
PATCH 1/1 iptunnel: Allow GRE_KEY for vti interface
The vti interface will use GRE_KEY to match the right policy in kernel. So we can not return fail when the tunnel is vti.
Signed-off-by Hangbin Liu <[email protected]>
--- ip/iptunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ip/iptunnel.c +2 -2
@@ -240,8 +240,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) } } -if (p->iph.protocol ==IPPROTO_IPIP || p->iph.protocol ==IPPROTO_IPV6 ) { -if ((p->i_flags &GRE_KEY ) || (p->o_flags &GRE_KEY )) { +if ((p->i_flags &GRE_KEY ) || (p->o_flags &GRE_KEY )) { +if (!(p->i_flags &VTI_ISVTI ) && (p->iph.protocol !=IPPROTO_GRE )) {fprintf (stderr,"Keys are not allowed with ipip and sit tunnels\n" );return -1 ; }
Signature · 1 line
1.8.1.4
Quoted 13 lines · On Fri, 6 Dec 2013 00:19:01 +0800 Hangbin Liu <[email protected]> wrote:
The vti interface will use
GRE_KEYto match the right policy in kernel. So we can not return fail when the tunnel is vti.Signed-off-by Hangbin Liu <[email protected]>--- ip/iptunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)ip/iptunnel.c +0
-0
ip/iptunnel.c static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) · line 247
Quoted 10 lines
ip/iptunnel.c +2
-2@@ -240,8 +240,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) } } -if (p->iph.protocol ==IPPROTO_IPIP || p->iph.protocol ==IPPROTO_IPV6 ) { -if ((p->i_flags &GRE_KEY ) || (p->o_flags &GRE_KEY )) { +if ((p->i_flags &GRE_KEY ) || (p->o_flags &GRE_KEY )) { +if (!(p->i_flags &VTI_ISVTI ) && (p->iph.protocol !=IPPROTO_GRE )) {fprintf (stderr,"Keys are not allowed with ipip and sit tunnels\n" );return -1 ; }
Accepted. Hope this works for everyone