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
f4c05c2e
Commit
f4c05c2e
authored
Jun 15, 2015
by
John W. Linville
Committed by
Stephen Hemminger
Jun 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iplink_geneve: add ttl configuration at link creation
Signed-off-by:
John W. Linville
<
linville@tuxdriver.com
>
parent
c1a1d8bc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
include/linux/if_link.h
include/linux/if_link.h
+1
-0
ip/iplink_geneve.c
ip/iplink_geneve.c
+22
-1
man/man8/ip-link.8.in
man/man8/ip-link.8.in
+7
-0
No files found.
include/linux/if_link.h
View file @
f4c05c2e
...
...
@@ -393,6 +393,7 @@ enum {
IFLA_GENEVE_UNSPEC
,
IFLA_GENEVE_ID
,
IFLA_GENEVE_REMOTE
,
IFLA_GENEVE_TTL
,
__IFLA_GENEVE_MAX
};
#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
...
...
ip/iplink_geneve.c
View file @
f4c05c2e
...
...
@@ -17,9 +17,11 @@
static
void
print_explain
(
FILE
*
f
)
{
fprintf
(
f
,
"Usage: ... geneve id VNI remote ADDR
\n
"
);
fprintf
(
f
,
" [ ttl TTL ]
\n
"
);
fprintf
(
f
,
"
\n
"
);
fprintf
(
f
,
"Where: VNI := 0-16777215
\n
"
);
fprintf
(
f
,
" ADDR := IP_ADDRESS
\n
"
);
fprintf
(
f
,
" TTL := { 1..255 | inherit }
\n
"
);
}
static
void
explain
(
void
)
...
...
@@ -34,7 +36,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
int
vni_set
=
0
;
__u32
daddr
=
0
;
struct
in6_addr
daddr6
=
IN6ADDR_ANY_INIT
;
__u8
ttl
=
0
;
while
(
argc
>
0
)
{
if
(
!
matches
(
*
argv
,
"id"
)
||
...
...
@@ -52,6 +54,18 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
}
if
(
IN_MULTICAST
(
ntohl
(
daddr
)))
invarg
(
"invalid remote address"
,
*
argv
);
}
else
if
(
!
matches
(
*
argv
,
"ttl"
)
||
!
matches
(
*
argv
,
"hoplimit"
))
{
unsigned
uval
;
NEXT_ARG
();
if
(
strcmp
(
*
argv
,
"inherit"
)
!=
0
)
{
if
(
get_unsigned
(
&
uval
,
*
argv
,
0
))
invarg
(
"invalid TTL"
,
*
argv
);
if
(
uval
>
255
)
invarg
(
"TTL must be <= 255"
,
*
argv
);
ttl
=
uval
;
}
}
else
if
(
matches
(
*
argv
,
"help"
)
==
0
)
{
explain
();
return
-
1
;
...
...
@@ -80,6 +94,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32
(
n
,
1024
,
IFLA_GENEVE_ID
,
vni
);
if
(
daddr
)
addattr_l
(
n
,
1024
,
IFLA_GENEVE_REMOTE
,
&
daddr
,
4
);
addattr8
(
n
,
1024
,
IFLA_GENEVE_TTL
,
ttl
);
return
0
;
}
...
...
@@ -105,6 +120,12 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf
(
f
,
"remote %s "
,
format_host
(
AF_INET
,
4
,
&
addr
,
s1
,
sizeof
(
s1
)));
}
if
(
tb
[
IFLA_GENEVE_TTL
])
{
__u8
ttl
=
rta_getattr_u8
(
tb
[
IFLA_GENEVE_TTL
]);
if
(
ttl
)
fprintf
(
f
,
"ttl %d "
,
ttl
);
}
}
static
void
geneve_print_help
(
struct
link_util
*
lu
,
int
argc
,
char
**
argv
,
...
...
man/man8/ip-link.8.in
View file @
f4c05c2e
...
...
@@ -606,6 +606,9 @@ the following additional arguments are supported:
.BI "ip link add " DEVICE
.BI type " geneve " id " ID " remote " IPADDR"
.R " [ "
.BI ttl " TTL "
.R " ]"
.in +8
.sp
...
...
@@ -616,6 +619,10 @@ the following additional arguments are supported:
.BI remote " IPADDR"
- specifies the unicast destination IP address to use in outgoing packets.
.sp
.BI ttl " TTL"
- specifies the TTL value to use in outgoing packets.
.in -8
.SS ip link delete - delete virtual link
...
...
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