source: rtems-libbsd/rtemsbsd/include/machine/rtems-bsd-config.h @ 32a3dd1

55-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 32a3dd1 was 32a3dd1, checked in by Christian Mauderer <Christian.Mauderer@…>, on 08/04/16 at 06:02:24

pf: Add RTEMS_BSD_CONFIG_FIREWALL_xxx options.

  • Property mode set to 100644
File size: 6.4 KB
Line 
1/*
2 * Copyright (c) 2016 Chris Johns <chrisj@rtems.org>.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26/*
27 * Configure the LibBSD software stack.
28 *
29 * Configuration defines:
30 *
31 *  RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE : Memory in bytes for mbufs
32 *  RTEMS_BSD_CONFIG_NET_PF_UNIX            : Packet Filter.
33 *  RTEMS_BSD_CONFIG_NET_IF_LAGG            : Link Aggregetion and Failover.
34 *  RTEMS_BSD_CONFIG_NET_IF_VLAN            : Virtual LAN.
35 *  RTEMS_BSD_CONFIG_SERVICE_TELNETD        : Telnet Protocol (TELNET).
36 *   RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE    : Telnet shell task stack size.
37 *  RTEMS_BSD_CONFIG_SERVICE_FTPD           : File Transfer Protocol (FTP).
38 *  RTEMS_BSD_CONFIG_BSP_CONFIG             : Configure default BSP devices.
39 *  RTEMS_BSD_CONFIG_INIT                   : Configure the LibBSD support.
40 *
41 * Rules for adding to this file:
42 *  1. All user visible defines start with 'RTEMS_BSD_CONFIG_'.
43 *  2. Define an implementation define starting with 'RTEMS_BSD_CFGDECL_'.
44 *  3. Only declare anything in the 'RTEMS_BSD_CONFIG_INIT' section.
45 *  4. Do not use '#ifdef ..' or '#ifndef ..'.
46 *  5. All '#endif' statements need a comment showing the '#if ..' logic.
47 */
48
49#ifndef _RTEMS_BSD_CONFIG_h
50#define _RTEMS_BSD_CONFIG_h
51
52#include <stdbool.h>
53
54/*
55 * Include the Nexus bus.
56 */
57#include <machine/rtems-bsd-nexus-bus.h>
58
59/*
60 * Include the SYSINIT support.
61 */
62#include <machine/rtems-bsd-sysinit.h>
63
64/*
65 * Include the services.
66 */
67#include <machine/rtems-bsd-rc-conf-services.h>
68
69/*
70 * Include the RTEMS BSD support.
71 */
72#include <rtems/bsd/bsd.h>
73
74#ifdef __cplusplus
75extern "C" {
76#endif /* __cplusplus */
77
78/*
79 * BSD Kernel configuration.
80 */
81#if defined(RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE)
82  #define RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUFS_SIZE RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE
83#else
84  #define RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUFS_SIZE RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE_MBUF_DEFAULT
85#endif
86
87/*
88 * BSD Kernel modules.
89 */
90
91/*
92 * Unix packet filter.
93 *  https://www.freebsd.org/doc/handbook/firewalls-pf.html
94 */
95#if defined(RTEMS_BSD_CONFIG_NET_PF_UNIX)
96  #define RTEMS_BSD_CFGDECL_NET_PF_UNIX SYSINIT_NEED_NET_PF_UNIX
97#else
98  #define RTEMS_BSD_CFGDECL_NET_PF_UNIX
99#endif /* RTEMS_BSD_CONFIG_NET_PF_UNIX */
100
101/*
102 * Link Aggregation and Failover.
103 *  https://www.freebsd.org/doc/handbook/network-aggregation.html
104 */
105#if defined(RTEMS_BSD_CONFIG_NET_IF_LAGG)
106  #define RTEMS_BSD_CFGDECL_IF_LAGG SYSINIT_NEED_NET_IF_LAGG
107#else
108  #define RTEMS_BSD_CFGDECL_IF_LAGG
109#endif /* RTEMS_BSD_CONFIG_NET_IF_LAGG */
110
111/*
112 * Virtual LAN
113 *  https://www.freebsd.org/cgi/man.cgi?query=rc.conf then 'network_interfaces'.
114 */
115#if defined(RTEMS_BSD_CONFIG_NET_IF_VLAN)
116  #define RTEMS_BSD_CFGDECL_NET_IF_VLAN SYSINIT_NEED_NET_IF_VLAN
117#else
118  #define RTEMS_BSD_CFGDECL_NET_IF_VLAN
119#endif /* RTEMS_BSD_CONFIG_NET_IF_VLAN */
120
121/*
122 * Firewall PF
123 */
124#if defined(RTEMS_BSD_CONFIG_FIREWALL_PF)
125  #define RTEMS_BSD_CFGDECL_FIREWALL_PF SYSINIT_NEED_FIREWALL_PF
126#else
127  #define RTEMS_BSD_CFGDECL_FIREWALL_PF
128#endif /* RTEMS_BSD_CONFIG_FIREWALL_PF */
129
130#if defined(RTEMS_BSD_CONFIG_FIREWALL_PFLOG)
131  #define RTEMS_BSD_CFGDECL_FIREWALL_PFLOG SYSINIT_NEED_FIREWALL_PFLOG
132#else
133  #define RTEMS_BSD_CFGDECL_FIREWALL_PFLOG
134#endif /* RTEMS_BSD_CONFIG_FIREWALL_PFLOG */
135
136#if defined(RTEMS_BSD_CONFIG_FIREWALL_PFSYNC)
137  #define RTEMS_BSD_CFGDECL_FIREWALL_PFSYNC SYSINIT_NEED_FIREWALL_PFSYNC
138#else
139  #define RTEMS_BSD_CFGDECL_FIREWALL_PFSYNC
140#endif /* RTEMS_BSD_CONFIG_FIREWALL_PFSYNC */
141
142/*
143 * FTPD
144 */
145#if defined(RTEMS_BSD_CONFIG_SERVICE_FTPD)
146  #define RTEMS_BSD_CFGDECL_FTPD RTEMS_BSD_RC_CONF_SYSINT(rc_conf_ftpd)
147#else
148  #define RTEMS_BSD_CFGDECL_FTPD
149#endif /* RTEMS_BSD_CONFIG_SERVICE_FTPD */
150
151/*
152 * Telnetd
153 */
154#if defined(RTEMS_BSD_CONFIG_SERVICE_TELNETD)
155  #if !defined(RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE)
156    #define RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE (8 * 1024)
157  #endif /* RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE */
158  #define RTEMS_BSD_CFGDECL_TELNETD_STACK_SIZE \
159    int rtems_telnetd_stack_size = RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE
160  #define RTEMS_BSD_CFGDECL_TELNETD RTEMS_BSD_RC_CONF_SYSINT(rc_conf_telnetd)
161#else
162  #define RTEMS_BSD_CFGDECL_TELNETD_STACK_SIZE
163  #define RTEMS_BSD_CFGDECL_TELNETD
164#endif /* RTEMS_BSD_CONFIG_SERVICE_TELNETD */
165
166/*
167 * Configure the system.
168 */
169#if defined(RTEMS_BSD_CONFIG_INIT)
170  /*
171   * Configure the domain allocation memory size.
172   */
173  uintptr_t rtems_bsd_allocator_domain_page_mbuf_size = \
174    RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUFS_SIZE;
175
176  /*
177   * If a BSP configuration is requested include the Nexus bus BSP
178   * configuration.
179   */
180  #if defined(RTEMS_BSD_CONFIG_BSP_CONFIG)
181    #include <bsp/nexus-devices.h>
182  #endif /* RTEMS_BSD_CONFIG_BSP_CONFIG */
183
184  /*
185   * Create the networking modules and interfaces.
186   */
187  RTEMS_BSD_CFGDECL_NET_PF_UNIX;
188  RTEMS_BSD_CFGDECL_IF_LAGG;
189  RTEMS_BSD_CFGDECL_NET_IF_VLAN;
190
191  /*
192   * Create the firewall
193   */
194  RTEMS_BSD_CFGDECL_FIREWALL_PF;
195  RTEMS_BSD_CFGDECL_FIREWALL_PFLOG;
196  RTEMS_BSD_CFGDECL_FIREWALL_PFSYNC;
197
198  /*
199   * Create the services.
200   */
201  RTEMS_BSD_CFGDECL_TELNETD;
202  RTEMS_BSD_CFGDECL_TELNETD_STACK_SIZE;
203  RTEMS_BSD_CFGDECL_FTPD;
204#endif /* RTEMS_BSD_CONFIG_INIT */
205
206#ifdef __cplusplus
207}
208#endif /* __cplusplus */
209
210#endif /* _RTEMS_BSD_CONFIG_h */
Note: See TracBrowser for help on using the repository browser.