Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
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
linux
Commits
ace8f51f
Commit
ace8f51f
authored
Jun 22, 2003
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV6]: Clean-up advmss calculation.
parent
8514206e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
net/ipv6/route.c
net/ipv6/route.c
+20
-19
No files found.
net/ipv6/route.c
View file @
ace8f51f
...
...
@@ -600,6 +600,22 @@ static int ipv6_get_mtu(struct net_device *dev)
return
mtu
;
}
static
inline
unsigned
int
ipv6_advmss
(
unsigned
int
mtu
)
{
if
(
mtu
<
ip6_rt_min_advmss
)
mtu
=
ip6_rt_min_advmss
;
/*
* Maximal non-jumbo IPv6 payload is 65535 and
* corresponding MSS is 65535 - tcp_header_size.
* 65535 is also valid and means: "any MSS,
* rely only on pmtu discovery"
*/
if
(
mtu
>
65535
-
sizeof
(
struct
tcphdr
))
mtu
=
65535
;
return
mtu
;
}
static
int
ipv6_get_hoplimit
(
struct
net_device
*
dev
)
{
int
hoplimit
=
ipv6_devconf
.
hop_limit
;
...
...
@@ -790,16 +806,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
if
(
!
rt
->
u
.
dst
.
metrics
[
RTAX_MTU
-
1
])
rt
->
u
.
dst
.
metrics
[
RTAX_MTU
-
1
]
=
ipv6_get_mtu
(
dev
);
if
(
!
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
])
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
max_t
(
unsigned
int
,
dst_pmtu
(
&
rt
->
u
.
dst
)
-
60
,
ip6_rt_min_advmss
);
/* Maximal non-jumbo IPv6 payload is 65535 and corresponding
MSS is 65535 - tcp_header_size. 65535 is also valid and
means: "any MSS, rely only on pmtu discovery"
*/
if
(
dst_metric
(
&
rt
->
u
.
dst
,
RTAX_ADVMSS
)
>
65535
-
20
)
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
65535
;
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
ipv6_advmss
(
dst_pmtu
(
&
rt
->
u
.
dst
));
rt
->
u
.
dst
.
dev
=
dev
;
return
rt6_ins
(
rt
,
nlh
,
_rtattr
);
...
...
@@ -952,9 +959,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr,
nrt
->
rt6i_nexthop
=
neigh_clone
(
neigh
);
/* Reset pmtu, it may be better */
nrt
->
u
.
dst
.
metrics
[
RTAX_MTU
-
1
]
=
ipv6_get_mtu
(
neigh
->
dev
);
nrt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
max_t
(
unsigned
int
,
dst_pmtu
(
&
nrt
->
u
.
dst
)
-
60
,
ip6_rt_min_advmss
);
if
(
nrt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
>
65535
-
20
)
nrt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
65535
;
nrt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
ipv6_advmss
(
dst_pmtu
(
&
nrt
->
u
.
dst
));
if
(
rt6_ins
(
nrt
,
NULL
,
NULL
))
goto
out
;
...
...
@@ -1214,9 +1219,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev)
rt
->
u
.
dst
.
output
=
ip6_output
;
rt
->
rt6i_dev
=
&
loopback_dev
;
rt
->
u
.
dst
.
metrics
[
RTAX_MTU
-
1
]
=
ipv6_get_mtu
(
rt
->
rt6i_dev
);
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
max_t
(
unsigned
int
,
dst_pmtu
(
&
rt
->
u
.
dst
)
-
60
,
ip6_rt_min_advmss
);
if
(
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
>
65535
-
20
)
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
65535
;
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
ipv6_advmss
(
dst_pmtu
(
&
rt
->
u
.
dst
));
rt
->
u
.
dst
.
metrics
[
RTAX_HOPLIMIT
-
1
]
=
ipv6_get_hoplimit
(
rt
->
rt6i_dev
);
rt
->
u
.
dst
.
obsolete
=
-
1
;
...
...
@@ -1312,9 +1315,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
(
dst_pmtu
(
&
rt
->
u
.
dst
)
<
arg
->
mtu
&&
dst_pmtu
(
&
rt
->
u
.
dst
)
==
idev
->
cnf
.
mtu6
)))
rt
->
u
.
dst
.
metrics
[
RTAX_MTU
-
1
]
=
arg
->
mtu
;
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
max_t
(
unsigned
int
,
arg
->
mtu
-
60
,
ip6_rt_min_advmss
);
if
(
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
>
65535
-
20
)
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
65535
;
rt
->
u
.
dst
.
metrics
[
RTAX_ADVMSS
-
1
]
=
ipv6_advmss
(
arg
->
mtu
);
return
0
;
}
...
...
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