It is not very simple. However Netgraph/ng_socket.c does something similar.
net_add_domain is called from ngs_mod_event(). However, it is not possible to remove this module because the feature to remove a domain is missing. switch (event) { case MOD_LOAD: /* Register protocol domain */ net_add_domain(&ngdomain); break; case MOD_UNLOAD: /* Insure there are no open netgraph sockets */ if (!LIST_EMPTY(&ngsocklist)) { error = EBUSY; break; } #ifdef NOTYET if ((LIST_EMPTY(&ngsocklist)) && (typestruct.refs == 0)) { /* Unregister protocol domain XXX can't do this yet.. */ if ((error = net_rm_domain(&ngdomain)) != 0) break; } else #endif error = EBUSY; break; I would be interested in this feature too ;-) However there is no reference counter within the protosw structure, neither within the domain structure. It seems to be difficult to remove them. Moreover, how can the domains, that require a "routing layer", be loaded ? rn_init is called only during the boot process in order to find the max_keylen = MAX(dom->dom_maxrtkey). Vincent Le Mardi 14 Janvier 2003 00:53, Radoslav Vasilev a écrit : > I'm interested in whether the following could be acomplished: > there's KLD module, installing some new syscalls in the kernel, as well as > installing new ``struct ipprotosw'' for some protocol or another(let's > assume IPPROTO_UDP). > Could we just add some code in the begging of the new protocol handler > (counting, statistics , etc...) and call the old one after doing that. If > possible, what should be the preparation for that last call ? > Any help appreciated! > > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-net" in the body of the message To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message