Skip to content

Commit 35a089b

Browse files
lxindavem330
authored andcommitted
tipc: check the bearer min mtu properly when setting it by netlink
Checking the bearer min mtu with tipc_udp_mtu_bad() only works for IPv4 UDP bearer, and IPv6 UDP bearer has a different value for the min mtu. This patch checks with encap_hlen + TIPC_MIN_BEARER_MTU for min mtu, which works for both IPv4 and IPv6 UDP bearer. Note that tipc_udp_mtu_bad() is still used to check media min mtu in __tipc_nl_media_set(), as m->mtu currently is only used by the IPv4 UDP bearer as its default mtu value. Fixes: 682cd3c ("tipc: confgiure and apply UDP bearer MTU on running links") Signed-off-by: Xin Long <[email protected]> Acked-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 56077b5 commit 35a089b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/tipc/bearer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,8 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
11511151
return -EINVAL;
11521152
}
11531153
#ifdef CONFIG_TIPC_MEDIA_UDP
1154-
if (tipc_udp_mtu_bad(nla_get_u32
1155-
(props[TIPC_NLA_PROP_MTU]))) {
1154+
if (nla_get_u32(props[TIPC_NLA_PROP_MTU]) <
1155+
b->encap_hlen + TIPC_MIN_BEARER_MTU) {
11561156
NL_SET_ERR_MSG(info->extack,
11571157
"MTU value is out-of-range");
11581158
return -EINVAL;

0 commit comments

Comments
 (0)