mirror of
https://github.com/opnsense/src.git
synced 2026-03-07 15:51:20 -05:00
Problem description:
How do we currently perform layer 2 resolution and header imposition:
For IPv4 we have the following chain:
ip_output() -> (ether|atm|whatever)_output() -> arpresolve()
Lookup is done in proper place (link-layer output routine) and it is possible
to provide cached lle data.
For IPv6 situation is more complex:
ip6_output() -> nd6_output() -> nd6_output_ifp() -> (whatever)_output() ->
nd6_storelladdr()
We have ip6_ouput() which calls nd6_output() instead of link output routine.
nd6_output() does the following:
* checks if lle exists, creates it if needed (similar to arpresolve())
* performes lle state transitions (similar to arpresolve())
* calls nd6_output_ifp() which pushes packets to link output routine along
with running SeND/MAC hooks regardless of lle state
(e.g. works as run-hooks placeholder).
After that, iface output routine like ether_output() calls nd6_storelladdr()
which performs lle lookup once again.
As a result, we perform lookup twice for each outgoing packet for most types
of interfaces. We also need to maintain runtime-checked table of 'nd6-free'
interfaces (see nd6_need_cache()).
Fix this behavior by eliminating first ND lookup. To be more specific:
* make all nd6_output() consumers use nd6_output_ifp() instead
* rename nd6_output[_slow]() to nd6_resolve_[slow]()
* convert nd6_resolve() and nd6_resolve_slow() to arpresolve() semantics,
e.g. copy L2 address to buffer instead of pushing packet towards lower
layers
* Make all nd6_storelladdr() users use nd6_resolve()
* eliminate nd6_storelladdr()
The resulting callchain is the following:
ip6_output() -> nd6_output_ifp() -> (whatever)_output() -> nd6_resolve()
Error handling:
Currently sending packet to non-existing la results in ip6_<output|forward>
-> nd6_output() -> nd6_output _lle() which returns 0.
In new scenario packet is propagated to <ether|whatever>_output() ->
nd6_resolve() which will return EWOULDBLOCK, and that result
will be converted to 0.
(And EWOULDBLOCK is actually used by IB/TOE code).
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D1469
|
||
|---|---|---|
| .. | ||
| dest6.c | ||
| frag6.c | ||
| icmp6.c | ||
| icmp6.h | ||
| in6.c | ||
| in6.h | ||
| in6_cksum.c | ||
| in6_gif.c | ||
| in6_ifattach.c | ||
| in6_ifattach.h | ||
| in6_mcast.c | ||
| in6_pcb.c | ||
| in6_pcb.h | ||
| in6_pcbgroup.c | ||
| in6_proto.c | ||
| in6_rmx.c | ||
| in6_rss.c | ||
| in6_rss.h | ||
| in6_src.c | ||
| in6_var.h | ||
| ip6.h | ||
| ip6_ecn.h | ||
| ip6_forward.c | ||
| ip6_gre.c | ||
| ip6_id.c | ||
| ip6_input.c | ||
| ip6_ipsec.c | ||
| ip6_ipsec.h | ||
| ip6_mroute.c | ||
| ip6_mroute.h | ||
| ip6_output.c | ||
| ip6_var.h | ||
| ip6protosw.h | ||
| mld6.c | ||
| mld6.h | ||
| mld6_var.h | ||
| nd6.c | ||
| nd6.h | ||
| nd6_nbr.c | ||
| nd6_rtr.c | ||
| pim6.h | ||
| pim6_var.h | ||
| raw_ip6.c | ||
| raw_ip6.h | ||
| route6.c | ||
| scope6.c | ||
| scope6_var.h | ||
| sctp6_usrreq.c | ||
| sctp6_var.h | ||
| send.c | ||
| send.h | ||
| tcp6_var.h | ||
| udp6_usrreq.c | ||
| udp6_var.h | ||