Page MenuHomeFreeBSD

ndp: Fix delayed proxy address
Needs ReviewPublic

Authored by pouria on Fri, Mar 13, 11:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 20, 9:55 PM
Unknown Object (File)
Fri, Mar 20, 10:50 AM
Unknown Object (File)
Fri, Mar 20, 10:50 AM
Unknown Object (File)
Fri, Mar 20, 8:33 AM
Unknown Object (File)
Tue, Mar 17, 11:06 PM

Details

Reviewers
glebius
zlei
bz
Group Reviewers
network
Summary

delayed proxy addresses needs special handling since
it can use linklocal ifa as their source address and different
link-layer data in their response.

Fixes: f37fbe30f559
Fixes: 75f1665f3346

Test Plan
kyua debug -k /usr/tests/Kyuafile sys/netinet6/proxy_ndp

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 71547
Build 68430: arc lint + arc unit

Event Timeline

Hi @glebius,

Please look at the panic below produced by this patch when you have time.
I already reverted the delayed proxy address changes from the main branch, so this won't happen in production.
Honestly, delayed proxy addresses aren't that important.
However, it looks like we need to use a different lock to handle delayed proxy addresses.

panic: /usr/src/sys/netinet6/nd6_nbr.c:1665: nd6_queue_rel: Bad link elm 0xfffff80028a00900 prev->next != elm
cpuid = 2
time = 1773444926
KDB: stack backtrace:
#0 0xffffffff80bed6cd at kdb_backtrace+0x5d
#1 0xffffffff80b9c2fe at vpanic+0x16e
#2 0xffffffff80b9c183 at panic+0x43
#3 0xffffffff80df90cc at nd6_queue_rel+0xdc
#4 0xffffffff80bb9e8b at softclock_call_cc+0x19b
#5 0xffffffff80bbb51d at softclock_thread+0xed
#6 0xffffffff80b4cce2 at fork_exit+0x82
#7 0xffffffff810acd7e at fork_trampoline+0xe
KDB: enter: panic

I already tried many ideas like getting the ifp reference and/or updating the ifp/in6_extra based on sdl->sdl_index value using ifnet_byindex.
This happens because of:

sys/netinet6/nd6_nbr.c
281

This line here.
Since proxy address don't have a local ifa, they get a link-local address to use as its source.
Because of that, I can't use the ifa lock to protect the nd_queue list.
To reproduce, run the proxy_ndp tests with this patch.

At this point, I'm stuck and don't know how to resolve this specific scenario.

I also tried to replace the TAILQ with STAILQ to avoid this line:

panic: /usr/src/sys/netinet6/nd6_nbr.c:1665: nd6_queue_rel: Bad link elm 0xfffff80028a00900 prev->next != elm

But the actual problem is the data is already freed and this is not just a consistency check failure from TAILQ (prev->next != elm).

pouria edited the summary of this revision. (Show Details)

Rebase to D55905.

sys/netinet6/proxy_ndp:pndp_add_gu_success  ->  passed  [2.529s]
sys/netinet6/proxy_ndp:pndp_del_gu_success  ->  passed  [4.840s]
sys/netinet6/proxy_ndp:pndp_ifdestroy_success  ->  passed  [2.899s]
sys/netinet6/proxy_ndp:pndp_neighbor_advert  ->  passed  [5.192s]
pouria retitled this revision from ndp: Fix delayed proxy address (WIP) to ndp: Fix delayed proxy address.Thu, Mar 19, 2:16 PM
pouria edited the test plan for this revision. (Show Details)
pouria added reviewers: zlei, bz.

No need to touch proxy_ndp tests.
Remove it.

Code wise looks good to me. But I'm not protocol expert.

sys/netinet6/nd6_nbr.c
1797

I'd suggest to expand the macro. Right now it has * which negates the inside &. IMHO, this is mind blowing and doesn't improve readability.

This revision is now accepted and ready to land.Thu, Mar 19, 5:58 PM
This revision now requires review to proceed.Thu, Mar 19, 6:14 PM