Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
iproute2
Commits
eec47608
Commit
eec47608
authored
Aug 01, 2012
by
Saurabh Mohan
Committed by
Stephen Hemminger
Aug 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VTI support for ip tunnel
Configure VTI using 'ip tunnel'
parent
a564b709
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
ip/iptunnel.c
ip/iptunnel.c
+24
-5
No files found.
ip/iptunnel.c
View file @
eec47608
...
...
@@ -33,7 +33,7 @@ static void usage(void) __attribute__((noreturn));
static
void
usage
(
void
)
{
fprintf
(
stderr
,
"Usage: ip tunnel { add | change | del | show | prl | 6rd } [ NAME ]
\n
"
);
fprintf
(
stderr
,
" [ mode { ipip | gre | sit | isatap } ] [ remote ADDR ] [ local ADDR ]
\n
"
);
fprintf
(
stderr
,
" [ mode { ipip | gre | sit | isatap
| vti
} ] [ remote ADDR ] [ local ADDR ]
\n
"
);
fprintf
(
stderr
,
" [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]
\n
"
);
fprintf
(
stderr
,
" [ prl-default ADDR ] [ prl-nodefault ADDR ] [ prl-delete ADDR ]
\n
"
);
fprintf
(
stderr
,
" [ 6rd-prefix ADDR ] [ 6rd-relay_prefix ADDR ] [ 6rd-reset ]
\n
"
);
...
...
@@ -94,6 +94,13 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
}
p
->
iph
.
protocol
=
IPPROTO_IPV6
;
isatap
++
;
}
else
if
(
strcmp
(
*
argv
,
"vti"
)
==
0
)
{
if
(
p
->
iph
.
protocol
&&
p
->
iph
.
protocol
!=
IPPROTO_IPIP
)
{
fprintf
(
stderr
,
"You managed to ask for more than one tunnel mode.
\n
"
);
exit
(
-
1
);
}
p
->
iph
.
protocol
=
IPPROTO_IPIP
;
p
->
i_flags
|=
VTI_ISVTI
;
}
else
{
fprintf
(
stderr
,
"Cannot guess tunnel mode.
\n
"
);
exit
(
-
1
);
...
...
@@ -220,6 +227,9 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
else
if
(
memcmp
(
p
->
name
,
"isatap"
,
6
)
==
0
)
{
p
->
iph
.
protocol
=
IPPROTO_IPV6
;
isatap
++
;
}
else
if
(
memcmp
(
p
->
name
,
"vti"
,
3
)
==
0
)
{
p
->
iph
.
protocol
=
IPPROTO_IPIP
;
p
->
i_flags
|=
VTI_ISVTI
;
}
}
...
...
@@ -269,13 +279,16 @@ static int do_add(int cmd, int argc, char **argv)
switch
(
p
.
iph
.
protocol
)
{
case
IPPROTO_IPIP
:
return
tnl_add_ioctl
(
cmd
,
"tunl0"
,
p
.
name
,
&
p
);
if
(
p
.
i_flags
!=
VTI_ISVTI
)
return
tnl_add_ioctl
(
cmd
,
"tunl0"
,
p
.
name
,
&
p
);
else
return
tnl_add_ioctl
(
cmd
,
"ip_vti0"
,
p
.
name
,
&
p
);
case
IPPROTO_GRE
:
return
tnl_add_ioctl
(
cmd
,
"gre0"
,
p
.
name
,
&
p
);
case
IPPROTO_IPV6
:
return
tnl_add_ioctl
(
cmd
,
"sit0"
,
p
.
name
,
&
p
);
default:
fprintf
(
stderr
,
"cannot determine tunnel mode (ipip, gre or sit)
\n
"
);
fprintf
(
stderr
,
"cannot determine tunnel mode (ipip, gre
, vti
or sit)
\n
"
);
return
-
1
;
}
return
-
1
;
...
...
@@ -290,7 +303,10 @@ static int do_del(int argc, char **argv)
switch
(
p
.
iph
.
protocol
)
{
case
IPPROTO_IPIP
:
return
tnl_del_ioctl
(
"tunl0"
,
p
.
name
,
&
p
);
if
(
p
.
i_flags
!=
VTI_ISVTI
)
return
tnl_del_ioctl
(
"tunl0"
,
p
.
name
,
&
p
);
else
return
tnl_del_ioctl
(
"ip_vti0"
,
p
.
name
,
&
p
);
case
IPPROTO_GRE
:
return
tnl_del_ioctl
(
"gre0"
,
p
.
name
,
&
p
);
case
IPPROTO_IPV6
:
...
...
@@ -479,7 +495,10 @@ static int do_show(int argc, char **argv)
switch
(
p
.
iph
.
protocol
)
{
case
IPPROTO_IPIP
:
err
=
tnl_get_ioctl
(
p
.
name
[
0
]
?
p
.
name
:
"tunl0"
,
&
p
);
if
(
p
.
i_flags
!=
VTI_ISVTI
)
err
=
tnl_get_ioctl
(
p
.
name
[
0
]
?
p
.
name
:
"tunl0"
,
&
p
);
else
err
=
tnl_get_ioctl
(
p
.
name
[
0
]
?
p
.
name
:
"ip_vti0"
,
&
p
);
break
;
case
IPPROTO_GRE
:
err
=
tnl_get_ioctl
(
p
.
name
[
0
]
?
p
.
name
:
"gre0"
,
&
p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment