Page MenuHomeFreeBSD

D36383.id109997.diff
No OneTemporary

D36383.id109997.diff

diff --git a/sys/conf/files b/sys/conf/files
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -4333,7 +4333,7 @@
netinet/in_proto.c optional inet | inet6
netinet/in_rmx.c optional inet
netinet/in_rss.c optional inet rss
-netinet/ip_divert.c optional inet ipdivert ipfirewall
+netinet/ip_divert.c optional ipdivert ipfirewall
netinet/ip_ecn.c optional inet | inet6
netinet/ip_encap.c optional inet | inet6
netinet/ip_fastfwd.c optional inet
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -35,9 +35,6 @@
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_sctp.h"
-#ifndef INET
-#error "IPDIVERT requires INET" /* XXX! */
-#endif
#include <sys/param.h>
#include <sys/eventhandler.h>
@@ -171,9 +168,6 @@
static void
divert_packet(struct mbuf *m, bool incoming)
{
-#if defined(SCTP) || defined(SCTP_SUPPORT)
- struct ip *ip;
-#endif
struct divcb *dcb;
u_int16_t nport;
struct sockaddr_in divsrc;
@@ -190,14 +184,17 @@
if (m->m_len < sizeof(struct ip) &&
(m = m_pullup(m, sizeof(struct ip))) == NULL)
return;
-
+#ifdef INET
/* Delayed checksums are currently not compatible with divert. */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
in_delayed_cksum(m);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
+#endif
#if defined(SCTP) || defined(SCTP_SUPPORT)
if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
+ struct ip *ip;
+
ip = mtod(m, struct ip *);
sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
@@ -379,9 +376,11 @@
ip = mtod(m, struct ip *);
switch (ip->ip_v) {
+#ifdef INET
case IPVERSION:
family = AF_INET;
break;
+#endif
#ifdef INET6
case IPV6_VERSION >> 4:
family = AF_INET6;
@@ -414,17 +413,22 @@
static int
div_output_outbound(int family, struct socket *so, struct mbuf *m)
{
- struct ip *const ip = mtod(m, struct ip *);
int error;
switch (family) {
+#ifdef INET
case AF_INET:
+ {
+ struct ip *const ip = mtod(m, struct ip *);
+
/* Don't allow packet length sizes that will crash. */
if (((u_short)ntohs(ip->ip_len) > m->m_pkthdr.len)) {
m_freem(m);
return (EINVAL);
}
break;
+ }
+#endif
#ifdef INET6
case AF_INET6:
{
@@ -446,11 +450,13 @@
error = 0;
switch (family) {
+#ifdef INET
case AF_INET:
error = ip_output(m, NULL, NULL,
((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0)
| IP_ALLOWBROADCAST | IP_RAWOUTPUT, NULL, NULL);
break;
+#endif
#ifdef INET6
case AF_INET6:
error = ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
@@ -472,7 +478,6 @@
div_output_inbound(int family, struct socket *so, struct mbuf *m,
struct sockaddr_in *sin)
{
- const struct ip *ip;
struct ifaddr *ifa;
if (m->m_pkthdr.rcvif == NULL) {
@@ -497,7 +502,11 @@
#endif
/* Send packet to input processing via netisr */
switch (family) {
+#ifdef INET
case AF_INET:
+ {
+ const struct ip *ip;
+
ip = mtod(m, struct ip *);
/*
* Restore M_BCAST flag when destination address is
@@ -510,6 +519,8 @@
netisr_queue_src(NETISR_IP, (uintptr_t)so, m);
DIVSTAT_INC(inbound);
break;
+ }
+#endif
#ifdef INET6
case AF_INET6:
netisr_queue_src(NETISR_IPV6, (uintptr_t)so, m);

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 21, 10:47 AM (13 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27788247
Default Alt Text
D36383.id109997.diff (3 KB)

Event Timeline