Page MenuHomeFreeBSD

if_gif: Use the MTU on the gif interface for the outgoing packets
Needs ReviewPublic

Authored by hrs on Mon, Aug 11, 11:14 PM.
Tags
None
Referenced Files
F126689947: D51866.diff
Fri, Aug 22, 4:18 PM
Unknown Object (File)
Wed, Aug 20, 1:00 AM
Unknown Object (File)
Tue, Aug 19, 11:02 PM
Unknown Object (File)
Tue, Aug 19, 11:01 PM
Unknown Object (File)
Tue, Aug 19, 8:06 PM
Unknown Object (File)
Mon, Aug 18, 8:21 PM
Unknown Object (File)
Tue, Aug 12, 12:39 AM

Details

Reviewers
ivy
ae
zlei
meta
Group Reviewers
network
Summary

The gif(4) interface always used MTU of the outgoing interface based on
the routing entries when the outer protocol is IPv4, and IPV6_MINMTU
for IPv6. The latter was required so that packets would not be dropped
in the middle of the IPv6 tunnel endpoints, where path MTU discovery
does not work well.

However, this was confusing and IPV6_MINMTU caused performance penalty
even when the path MTU was obviuosly longer than the minimal value.
The pain point is that there is no way to configure the outer protocol
MTU when it is IPv6, while the MTU looks configurable via the gif interface.

This patch makes gif(4) to use the interface MTU as the outer protocol MTU,
instead of the outgoing interface. The default MTU is 1280, which is
the same as before and the safest value for IPv6. The system administrator
now change the MTU by just using the ifconfig(8) utility.

This reverts change in D51297. I do not think the word 'clamping' is
appropriate for this because the behavior in question just involves
forced fragmentation, not clamping the transfer unit, and is applied to
IPv6 only. A name that looks like a generic knob to adjust the segment
length is not intuitive to sysadmins, IMO.

When I wrote D45854, I received feedback indicating that simply
configuring IPV6_MINMTU as the default MTU on the gif(4) interface
and letting the transmit code path follow it was simpler. I agree
that sysadmins expect that the MTU on the gif(4) interface works
for both the input and output paths.

The reason why this was not implemented in the first place was that
if_bridge(4) does not allow uneven MTUs across the members,
and ip6_output() does not see the MTU value configured on
the gif(4) interface. Fixing this limitation is more consistent
than adding a new knob. I had planned to update the patch,
but I didn't have time to revisit it.

I also plan to add test for whether the fragmentation occurs as expected.
Before that, I would like feedback about this change.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 66178
Build 63061: arc lint + arc unit

Event Timeline

hrs requested review of this revision.Mon, Aug 11, 11:14 PM

Quickly reviewed for typos in manpages. I will test the code changes later.

sbin/ifconfig/ifconfig.8
2956

This was changed to "the", as pointed out by pauamma. It might be a good idea to share the reason if you revert it to "a".

share/man/man4/gif.4
100

s/machanism/mechanism/

162

s/an/a/

165

the reason for?

The interface MTU is a hint to upper layers that, the max transfer unit it can handle directly to the nexthop.

For IPv4, the intermediate routers are capable to fragment when using tunnel interface's MTU. Meanwhile PMTU can also be taken into account so it will not bother too much.

For IPv6, it is a little complicated, as the intermediate routers are forbidden to fragment hence either IPV6_MINMTU is chosen or PMTU is a must to get best performance, which will result in discoverd path MTU between IPV6_MINMTU and interface's MTU.

Given IPv6 is now widely deployed, I think IPv6 PMTU now shall work great. So is it now the time to unconditionally turn IPv6 PMTU on for gif(4) ?

Please correct me if wrong.

So is it now the time to unconditionally turn IPv6 PMTU on for gif(4) ?

Another choice can be, use IPV6_MINMTU initially, and switch to the better path discovered MTU when available, so the tunnel will not be blocked on PMTU process. I have not test if that is possible, just a thought.

So is it now the time to unconditionally turn IPv6 PMTU on for gif(4) ?

Another choice can be, use IPV6_MINMTU initially, and switch to the better path discovered MTU when available, so the tunnel will not be blocked on PMTU process. I have not test if that is possible, just a thought.

The problem is that the inner protocol cannot detect PTB messages for the outer protocol in the current implementation. MTU for the outer protocol can be updated, but no handling is provided for the inner protocol. This is the reason why MTU for the inner protocol is set to the theoretically minimal value. It is possible to implement a PTB message handler for automatic adjustment, as you mentioned. Some routers have this feature.

Tested, it works fine for me both for IPIP and EtherIP. It is a much simpler and good approach. BTW, it conflicts with after D51835.

LGTM except for manpage points.