kernels/linux-2.4.0/net/core/netfilter.c
/* Functions to register sockopt ranges (exclusive). */
Functions to register sockopt ranges (exclusive).
Functions to register sockopt ranges ( exclusive ) .
int nf_register_sockopt(struct nf_sockopt_ops *reg)
{
	struct list_head *i;
	int ret = 0;
	if (down_interruptible(&nf_sockopt_mutex) != 0)
		return -EINTR;
	for (i = nf_sockopts.next; i != &nf_sockopts; i = i->next) {
		struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i;
		if (ops->pf == reg->pf
		    && (overlap(ops->set_optmin, ops->set_optmax, 
				reg->set_optmin, reg->set_optmax)
			|| overlap(ops->get_optmin, ops->get_optmax, 
				   reg->get_optmin, reg->get_optmax))) {
			NFDEBUG("nf_sock overlap: %u-%u/%u-%u v %u-%u/%u-%u\n",
				ops->set_optmin, ops->set_optmax, 
				ops->get_optmin, ops->get_optmax, 
				reg->set_optmin, reg->set_optmax,
				reg->get_optmin, reg->get_optmax);
			ret = -EBUSY;
			goto out;
		}
	}
	list_add(&reg->list, &nf_sockopts);
out:
	up(&nf_sockopt_mutex);
	return ret;
}
int nf_register_sockopt ( struct nf_sockopt_ops * reg ) { struct list_head * i ; int ret = 0 ; if ( down_interruptible ( & nf_sockopt_mutex ) != 0 ) return - EINTR ; for ( i = nf_sockopts . next ; i != & nf_sockopts ; i = i -> next ) { struct nf_sockopt_ops * ops = ( struct nf_sockopt_ops * ) i ; if ( ops -> pf == reg -> pf && ( overlap ( ops -> set_optmin , ops -> set_optmax , reg -> set_optmin , reg -> set_optmax ) || overlap ( ops -> get_optmin , ops -> get_optmax , reg -> get_optmin , reg -> get_optmax ) ) ) { NFDEBUG ( " \n " , ops -> set_optmin , ops -> set_optmax , ops -> get_optmin , ops -> get_optmax , reg -> set_optmin , reg -> set_optmax , reg -> get_optmin , reg -> get_optmax ) ; ret = - EBUSY ; goto out ; } } list_add ( & reg -> list , & nf_sockopts ) ; out : up ( & nf_sockopt_mutex ) ; return ret ; }
Functions to register sockopt ranges (exclusive).
Functions to register sockopt ranges ( exclusive ) .