summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-10-02 05:47:31 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-10-02 05:47:31 +0000
commit977c6feb7e30b1642b68e46257941cfd68429c5e (patch)
tree1b7bd1e6c00be9dd2b5f72bb8dee8a443144550a
parent6eb60b9501cbbc8ceacdf0aa797e715831875dda (diff)
correct endian handling of ip->ip_off.
do not try to send incomplete fragments on ENOBUFS case (behavior change from 4.4bsd). dhartmei ok
-rw-r--r--sys/net/pf.c4
-rw-r--r--sys/netinet/ip_output.c9
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 32ac4dabd1f..a78c78b7d02 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.392 2003/09/26 21:44:08 cedric Exp $ */
+/* $OpenBSD: pf.c,v 1.393 2003/10/02 05:47:30 itojun Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -4481,7 +4481,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
m1 = m0;
error = ip_fragment(m0, ifp, ifp->if_mtu);
- if (error == EMSGSIZE)
+ if (error)
goto bad;
for (m0 = m1; m0; m0 = m1) {
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 31c176d3379..10f2c4aae45 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.156 2003/08/15 20:32:20 tedu Exp $ */
+/* $OpenBSD: ip_output.c,v 1.157 2003/10/02 05:47:29 itojun Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -717,7 +717,7 @@ sendit:
}
error = ip_fragment(m, ifp, mtu);
- if (error == EMSGSIZE)
+ if (error)
goto bad;
for (; m; m = m0) {
@@ -798,8 +798,9 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu)
mhip->ip_hl = mhlen >> 2;
}
m->m_len = mhlen;
- mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF);
- if (ip->ip_off & IP_MF)
+ mhip->ip_off = ((off - hlen) >> 3) +
+ (ntohs(ip->ip_off) & ~IP_MF);
+ if (ip->ip_off & htons(IP_MF))
mhip->ip_off |= IP_MF;
if (off + len >= ntohs(ip->ip_len))
len = ntohs(ip->ip_len) - off;