Page MenuHomeFreeBSD

Convert ip6_forward() to the new routing KPI.
ClosedPublic

Authored by melifaro on Apr 7 2020, 10:56 PM.

Details

Summary

Convert ip6_forward() to the new routing KPI.

This change depends on D24232.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

melifaro added reviewers: ae, bz, network.

Update review to account for committed changes.

sys/netinet6/ip6_forward.c
206 ↗(On Diff #70478)

stale comment

242 ↗(On Diff #70478)

This looks strange, why we don't send ICMP6_DST_UNREACH_BEYONDSCOPE here? Also ifs6_in_discard is not accounted.

sys/netinet6/ip6_forward.c
242 ↗(On Diff #70478)

I would prefer to address it in a separate review, as IMO these 2 blocks should be rewritten and simplified.

At this moment we know that src & dst are unicast, hence each can be either link-local or global unicast.
This brings matrix of 4 options: ll-ll, ll-gu, gu-ll and gu-gu.
If gu-gu, no scope checks are needed. For the rest 3, as one or both addresses are link-local, both received and transmitted interface has to be the same.

This can lead to the logic similar to:

if (LL(src) or LL(dst)) {
  if (src_ifp != dst_ifp)
   error
}

instead of the 2 checks above.

Does this sound sane to you?

Update to reflect ae@ comments.

ae added inline comments.
sys/netinet6/ip6_forward.c
242 ↗(On Diff #70478)

Yes, this sounds correct for me.

This revision is now accepted and ready to land.Apr 14 2020, 9:55 AM
This revision was automatically updated to reflect the committed changes.