Skip to content

Commit 61e7f09

Browse files
strssndktndavem330
authored andcommitted
ipv4: consistent reporting of pmtu data in case of corking
We report different pmtu values back on the first write and on further writes on an corked socket. Also don't include the dst.header_len (respectively exthdrlen) as this should already be dealt with by the interface mtu of the outgoing (virtual) interface and policy of that interface should dictate if fragmentation should happen. Instead reduce the pmtu data by IP options as we do for IPv6. Make the same changes for ip_append_data, where we did not care about options or dst.header_len at all. Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db85055 commit 61e7f09

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/ipv4/ip_output.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ static int __ip_append_data(struct sock *sk,
828828

829829
if (cork->length + length > maxnonfragsize - fragheaderlen) {
830830
ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
831-
mtu-exthdrlen);
831+
mtu - (opt ? opt->optlen : 0));
832832
return -EMSGSIZE;
833833
}
834834

@@ -1151,7 +1151,8 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
11511151
mtu : 0xFFFF;
11521152

11531153
if (cork->length + size > maxnonfragsize - fragheaderlen) {
1154-
ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, mtu);
1154+
ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
1155+
mtu - (opt ? opt->optlen : 0));
11551156
return -EMSGSIZE;
11561157
}
11571158

0 commit comments

Comments
 (0)