Deleted Added
full compact
ip_fw2.c (109566) ip_fw2.c (109623)
1/*
2 * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa
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.

--- 8 unchanged lines hidden (view full) ---

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 *
1/*
2 * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa
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.

--- 8 unchanged lines hidden (view full) ---

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 * $FreeBSD: head/sys/netinet/ip_fw2.c 109566 2003-01-20 11:58:34Z maxim $
25 * $FreeBSD: head/sys/netinet/ip_fw2.c 109623 2003-01-21 08:56:16Z alfred $
26 */
27
28#define DEB(x)
29#define DDB(x) x
30
31/*
32 * Implement IP packet firewall (new version)
33 */

--- 1018 unchanged lines hidden (view full) ---

1052static void
1053send_pkt(struct ipfw_flow_id *id, u_int32_t seq, u_int32_t ack, int flags)
1054{
1055 struct mbuf *m;
1056 struct ip *ip;
1057 struct tcphdr *tcp;
1058 struct route sro; /* fake route */
1059
26 */
27
28#define DEB(x)
29#define DDB(x) x
30
31/*
32 * Implement IP packet firewall (new version)
33 */

--- 1018 unchanged lines hidden (view full) ---

1052static void
1053send_pkt(struct ipfw_flow_id *id, u_int32_t seq, u_int32_t ack, int flags)
1054{
1055 struct mbuf *m;
1056 struct ip *ip;
1057 struct tcphdr *tcp;
1058 struct route sro; /* fake route */
1059
1060 MGETHDR(m, M_DONTWAIT, MT_HEADER);
1060 MGETHDR(m, M_NOWAIT, MT_HEADER);
1061 if (m == 0)
1062 return;
1063 m->m_pkthdr.rcvif = (struct ifnet *)0;
1064 m->m_pkthdr.len = m->m_len = sizeof(struct ip) + sizeof(struct tcphdr);
1065 m->m_data += max_linkhdr;
1066
1067 ip = mtod(m, struct ip *);
1068 bzero(ip, m->m_len);

--- 1424 unchanged lines hidden (view full) ---

2493 if (ipfw_dyn_v) /* add size of dyn.rules */
2494 size += (dyn_count * sizeof(ipfw_dyn_rule));
2495
2496 /*
2497 * XXX todo: if the user passes a short length just to know
2498 * how much room is needed, do not bother filling up the
2499 * buffer, just jump to the sooptcopyout.
2500 */
1061 if (m == 0)
1062 return;
1063 m->m_pkthdr.rcvif = (struct ifnet *)0;
1064 m->m_pkthdr.len = m->m_len = sizeof(struct ip) + sizeof(struct tcphdr);
1065 m->m_data += max_linkhdr;
1066
1067 ip = mtod(m, struct ip *);
1068 bzero(ip, m->m_len);

--- 1424 unchanged lines hidden (view full) ---

2493 if (ipfw_dyn_v) /* add size of dyn.rules */
2494 size += (dyn_count * sizeof(ipfw_dyn_rule));
2495
2496 /*
2497 * XXX todo: if the user passes a short length just to know
2498 * how much room is needed, do not bother filling up the
2499 * buffer, just jump to the sooptcopyout.
2500 */
2501 buf = malloc(size, M_TEMP, M_WAITOK);
2501 buf = malloc(size, M_TEMP, 0);
2502 if (buf == 0) {
2503 splx(s);
2504 error = ENOBUFS;
2505 break;
2506 }
2507
2508 bp = buf;
2509 for (rule = layer3_chain; rule ; rule = rule->next) {

--- 264 unchanged lines hidden ---
2502 if (buf == 0) {
2503 splx(s);
2504 error = ENOBUFS;
2505 break;
2506 }
2507
2508 bp = buf;
2509 for (rule = layer3_chain; rule ; rule = rule->next) {

--- 264 unchanged lines hidden ---