svn commit: r200971 - user/luigi/ipfw3-head/sys/netinet/ipfw
Luigi Rizzo
luigi at FreeBSD.org
Thu Dec 24 23:54:58 UTC 2009
Author: luigi
Date: Thu Dec 24 23:54:58 2009
New Revision: 200971
URL: http://svn.freebsd.org/changeset/base/200971
Log:
more corrections on HAVE_NET_IPLEN
Modified:
user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c
user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c
user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c
Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Dec 24 23:26:02 2009 (r200970)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Dec 24 23:54:58 2009 (r200971)
@@ -994,7 +994,7 @@ dummynet_send(struct mbuf *m)
#ifndef HAVE_NET_IPLEN
ip->ip_len = htons(ip->ip_len);
ip->ip_off = htons(ip->ip_off);
-#endif
+#endif /* !HAVE_NET_IPLEN */
netisr_dispatch(NETISR_IP, m);
break;
#ifdef INET6
Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Thu Dec 24 23:26:02 2009 (r200970)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Thu Dec 24 23:54:58 2009 (r200971)
@@ -605,14 +605,13 @@ send_reject(struct ip_fw_args *args, int
m_adj(m, args->L3offset);
#endif
if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */
- /* We need the IP header in host order for icmp_error(). */
#ifndef HAVE_NET_IPLEN
- if (args->eh != NULL)
-#endif /* !HAVE_NET_IPLEN */
- {
+ /* We need the IP header in host order for icmp_error(). */
+ if (args->eh != NULL) {
ip->ip_len = ntohs(ip->ip_len);
ip->ip_off = ntohs(ip->ip_off);
}
+#endif /* !HAVE_NET_IPLEN */
icmp_error(args->m, ICMP_UNREACH, code, 0L, 0);
} else if (args->f_id.proto == IPPROTO_TCP) {
struct tcphdr *const tcp =
@@ -2140,12 +2139,12 @@ do { \
/* if not fragmented, go to next rule */
if ((ip_off & (IP_MF | IP_OFFMASK)) == 0)
break;
+#ifndef HAVE_NET_IPLEN
/*
* ip_reass() expects len & off in host
* byte order: fix them in case we come
* from layer2.
*/
-#ifndef HAVE_NET_IPLEN
if (args->eh != NULL) {
ip->ip_len = ntohs(ip->ip_len);
ip->ip_off = ntohs(ip->ip_off);
@@ -2168,12 +2167,11 @@ do { \
hlen = ip->ip_hl << 2;
#ifndef HAVE_NET_IPLEN
/* revert len. & off to net format if needed */
- if (args->eh != NULL)
-#endif /* !HAVE_NET_IPLEN */
- {
+ if (args->eh != NULL) {
ip->ip_len = htons(ip->ip_len);
ip->ip_off = htons(ip->ip_off);
}
+#endif /* !HAVE_NET_IPLEN */
ip->ip_sum = 0;
if (hlen == sizeof(struct ip))
ip->ip_sum = in_cksum_hdr(ip);
Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c Thu Dec 24 23:26:02 2009 (r200970)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c Thu Dec 24 23:54:58 2009 (r200971)
@@ -409,14 +409,14 @@ ipfw_log(struct ip_fw *f, u_int hlen, st
{
int ip_off, ip_len;
#ifndef HAVE_NET_IPLEN
- if (eh != NULL) { /* layer 2 packets are as on the wire */
- ip_off = ntohs(ip->ip_off);
- ip_len = ntohs(ip->ip_len);
+ if (eh == NULL) {
+ ip_off = ip->ip_off;
+ ip_len = ip->ip_len;
} else
#endif /* !HAVE_NET_IPLEN */
{
- ip_off = ip->ip_off;
- ip_len = ip->ip_len;
+ ip_off = ntohs(ip->ip_off);
+ ip_len = ntohs(ip->ip_len);
}
if (ip_off & (IP_MF | IP_OFFMASK))
snprintf(SNPARGS(fragment, 0),
More information about the svn-src-user
mailing list