Iam planning to enhance the existing IPv4 stack(BSD) with v6 features. so there are some open questions in my mind . Please see if anyone can help me out

1) Which is the sub-proc used by the kernel to load the stack ?

2) How will the existing stack comes to know, if a new protocol has
been added,so that it can bring it up along with the existing one?

P.S: please see if you can provide details with an implementation point
of view, which could help me a lot in this context