Skip to contentSkip to conversation

net: ipv4: Remove MTU check in IP_HDRINCL send flow

PATCH In review Yonatan Goldschmidt 2 participants 2 messages Jan 6, 2018 – Jan 7, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ipv4: Remove MTU check in IP_HDRINCL send flow

IP fragmentation can be performed as expected down the stack, without touching irrelevant fields in the included header besides fragment offset, setting IP_MF and header checksum.
If the included header has IP_DF set, EMSGSIZE is returned.

This allows users of IP_HDRINCL to have the kernel perform fragmentation.

---
 net/ipv4/raw.c | 5 -----
 1 file changed, 5 deletions(-)
net/ipv4/raw.c +0 -0
index 125c1eab3eaa..63167abff05b 100644
@@ -359,11 +359,6 @@ static int raw_send_hdrinc(struct sock *sk, struct

flowi*,

        struct rtable *rt = *rtp;
        int hlen, tlen;

- if (length > rt->dst.dev->mtu) {
- ip_local_error(sk, EMSGSIZE, fl4->daddr,
inet->inet_dport,
- rt->dst.dev->mtu);
- return -EMSGSIZE;
- }
if (length < sizeof(struct iphdr))
return -EINVAL;

maintainer
#1 lore raw

From: Yonatan Goldschmidt <[email protected]>
Date: Sun, 7 Jan 2018 01:26:48 +0200

Quoted 8 lines

IP fragmentation can be performed as expected down the stack, without touching irrelevant fields in the included header besides fragment offset, setting IP_MF and header checksum.
If the included header has IP_DF set, EMSGSIZE is returned.

This allows users of IP_HDRINCL to have the kernel perform fragmentation.

This has been brought up before and we decided that for RAW sockets the user is responsible for fragmentation, and the kernel should not "manage" the packet given to it in any way whatsoever.