xref: /dflybsd-src/sys/net/ipfw3/ip_fw3_glue.c (revision 4408d5485757eef6e44859025e931d1c1b6746c4)
16a03354eSMatthew Dillon /*
26a03354eSMatthew Dillon  * Copyright (c) 2008 The DragonFly Project.  All rights reserved.
36a03354eSMatthew Dillon  *
46a03354eSMatthew Dillon  * This code is derived from software contributed to The DragonFly Project
56a03354eSMatthew Dillon  * by Sepherosa Ziehau <sepherosa@gmail.com>
66a03354eSMatthew Dillon  *
76a03354eSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
86a03354eSMatthew Dillon  * modification, are permitted provided that the following conditions
96a03354eSMatthew Dillon  * are met:
106a03354eSMatthew Dillon  *
116a03354eSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
126a03354eSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
136a03354eSMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
146a03354eSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
156a03354eSMatthew Dillon  *    the documentation and/or other materials provided with the
166a03354eSMatthew Dillon  *    distribution.
176a03354eSMatthew Dillon  * 3. Neither the name of The DragonFly Project nor the names of its
186a03354eSMatthew Dillon  *    contributors may be used to endorse or promote products derived
196a03354eSMatthew Dillon  *    from this software without specific, prior written permission.
206a03354eSMatthew Dillon  *
216a03354eSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
226a03354eSMatthew Dillon  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
236a03354eSMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
246a03354eSMatthew Dillon  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
256a03354eSMatthew Dillon  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
266a03354eSMatthew Dillon  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
276a03354eSMatthew Dillon  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
286a03354eSMatthew Dillon  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
296a03354eSMatthew Dillon  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
306a03354eSMatthew Dillon  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
316a03354eSMatthew Dillon  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
326a03354eSMatthew Dillon  * SUCH DAMAGE.
336a03354eSMatthew Dillon  *
346a03354eSMatthew Dillon  */
356a03354eSMatthew Dillon 
366a03354eSMatthew Dillon #include <sys/param.h>
376a03354eSMatthew Dillon #include <sys/socketvar.h>
386a03354eSMatthew Dillon 
396a03354eSMatthew Dillon #include <net/if.h>
406a03354eSMatthew Dillon #include <net/netisr.h>
416a03354eSMatthew Dillon 
426a03354eSMatthew Dillon #include <netinet/in.h>
436a03354eSMatthew Dillon 
446a03354eSMatthew Dillon #include <net/ipfw3/ip_fw.h>
456a03354eSMatthew Dillon 
46*c12f07ffSSepherosa Ziehau ip_fw_ctl_t *ip_fw_ctl_x_ptr;
47*c12f07ffSSepherosa Ziehau 
486a03354eSMatthew Dillon int ip_fw3_loaded;
496a03354eSMatthew Dillon 
506a03354eSMatthew Dillon int
ip_fw3_sockopt(struct sockopt * sopt)516a03354eSMatthew Dillon ip_fw3_sockopt(struct sockopt *sopt)
526a03354eSMatthew Dillon {
536a03354eSMatthew Dillon 	int error;
546a03354eSMatthew Dillon 
55*c12f07ffSSepherosa Ziehau 	ASSERT_NETISR0;
566a03354eSMatthew Dillon 
576a03354eSMatthew Dillon 	if (IPFW3_LOADED)
586a03354eSMatthew Dillon 		error = ip_fw_ctl_x_ptr(sopt);
596a03354eSMatthew Dillon 	else
606a03354eSMatthew Dillon 		error = ENOPROTOOPT;
61*c12f07ffSSepherosa Ziehau 	return (error);
626a03354eSMatthew Dillon }
63