Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet correct ip_fragment() wrt ip->ip_off handling.



details:   https://anonhg.NetBSD.org/src/rev/930e2b753002
branches:  trunk
changeset: 552742:930e2b753002
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Oct 01 23:54:40 2003 +0000

description:
correct ip_fragment() wrt ip->ip_off handling.
do not send out incomplete fragment due to ENOBUFS (behavior change from 4.4BSD)

diffstat:

 sys/netinet/ip_output.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r c6662074ac8f -r 930e2b753002 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Wed Oct 01 23:11:29 2003 +0000
+++ b/sys/netinet/ip_output.c   Wed Oct 01 23:54:40 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.121 2003/09/19 00:27:56 jonathan Exp $ */
+/*     $NetBSD: ip_output.c,v 1.122 2003/10/01 23:54:40 itojun Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -98,7 +98,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.121 2003/09/19 00:27:56 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.122 2003/10/01 23:54:40 itojun Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_ipsec.h"
@@ -801,7 +801,7 @@
        }
 
        error = ip_fragment(m, ifp, mtu);
-       if (error == EMSGSIZE)
+       if (error)
                goto bad;
 
        for (; m; m = m0) {
@@ -907,8 +907,9 @@
                        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;



Home | Main Index | Thread Index | Old Index