+ if (opp->pr_unused != NULL) {
+ printf("%s: domain (%d,%s), proto %d: pr_fasttimo is "
+ "deprecated and won't be called\n", __func__,
+ odp->dom_family, odp->dom_name, opp->pr_protocol);
+ }
+ if (opp->pr_unused2 != NULL) {
+ printf("%s: domain (%d,%s), proto %d: pr_slowtimo is "
+ "deprecated and won't be called\n", __func__,
+ odp->dom_family, odp->dom_name, opp->pr_protocol);
+ }
+
+ /* Copy everything but pr_init, pr_next, pr_domain, pr_protosw */
+ pp->pr_type = opp->pr_type;
+ pp->pr_protocol = opp->pr_protocol;
+ pp->pr_flags = (opp->pr_flags & PRF_USERFLAGS) | PR_OLD;
+ pp->pr_input = opp->pr_input;
+ pp->pr_output = opp->pr_output;
+ pp->pr_ctlinput = opp->pr_ctlinput;
+ pp->pr_ctloutput = opp->pr_ctloutput;
+ pp->pr_usrreqs = pru;
+ pp->pr_init = pr_init_old;
+ pp->pr_drain = opp->pr_drain;
+ pp->pr_sysctl = opp->pr_sysctl;
+ pp->pr_lock = opp->pr_lock;
+ pp->pr_unlock = opp->pr_unlock;
+ pp->pr_getlock = opp->pr_getlock;
+ pp->pr_old = opp;
+
+ /* attach as well as initialize */
+ attach_proto(pp, dp);
+ net_init_proto(pp, dp);
+done:
+ if (error != 0) {
+ printf("%s: domain (%d,%s), proto %d: failed to attach, "
+ "error %d\n", __func__, odp->dom_family,
+ odp->dom_name, opp->pr_protocol, error);
+
+ kheap_free(KHEAP_DEFAULT, pru, sizeof(struct pr_usrreqs));
+ kheap_free(KHEAP_DEFAULT, pp, sizeof(struct protosw));
+ }
+
+ domain_guard_release(guard);
+ return error;
+}
+
+/*
+ * Internal routine, not exported.
+ *
+ * net_del_proto - remove a protosw from a domain's protosw chain.
+ * Search the protosw chain for the element with matching data.
+ * Then unlink and return.
+ *
+ * NOTE: Caller must have acquired domain_proto_mtx
+ */
+int
+net_del_proto(int type, int protocol, struct domain *dp)
+{
+ struct protosw *pp;