Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix gif(4)/gre(4) operation over interfaces such as ...



details:   https://anonhg.NetBSD.org/src/rev/7d09fcfbeba5
branches:  trunk
changeset: 770648:7d09fcfbeba5
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Oct 27 20:04:57 2011 +0000

description:
Fix gif(4)/gre(4) operation over interfaces such as wm(4) that do IPv4
checksum-offload.  Note well: it really is necessary to clear the
csum_data.

While I'm here, remove the do-nothing case for SIOCSIFDSTADDR and let
ifioctl_common() or the protocol handle it.

diffstat:

 sys/net/if_gif.c |  11 ++++++-----
 sys/net/if_gre.c |  10 ++++++----
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (77 lines):

diff -r cb0b180521a0 -r 7d09fcfbeba5 sys/net/if_gif.c
--- a/sys/net/if_gif.c  Thu Oct 27 19:56:50 2011 +0000
+++ b/sys/net/if_gif.c  Thu Oct 27 20:04:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.c,v 1.78 2010/04/05 07:22:23 joerg Exp $        */
+/*     $NetBSD: if_gif.c,v 1.79 2011/10/27 20:04:57 dyoung Exp $       */
 /*     $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $    */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.78 2010/04/05 07:22:23 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.79 2011/10/27 20:04:57 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "opt_iso.h"
@@ -312,6 +312,10 @@
        }
        *mtod(m, int *) = dst->sa_family;
 
+       /* Clear checksum-offload flags. */
+       m->m_pkthdr.csum_flags = 0;
+       m->m_pkthdr.csum_data = 0;
+
        s = splnet();
        IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
        if (error) {
@@ -493,9 +497,6 @@
                ifp->if_flags |= IFF_UP;
                break;
 
-       case SIOCSIFDSTADDR:
-               break;
-
        case SIOCADDMULTI:
        case SIOCDELMULTI:
                switch (ifr->ifr_addr.sa_family) {
diff -r cb0b180521a0 -r 7d09fcfbeba5 sys/net/if_gre.c
--- a/sys/net/if_gre.c  Thu Oct 27 19:56:50 2011 +0000
+++ b/sys/net/if_gre.c  Thu Oct 27 20:04:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gre.c,v 1.146 2011/10/19 21:59:38 dyoung Exp $ */
+/*     $NetBSD: if_gre.c,v 1.147 2011/10/27 20:04:57 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.146 2011/10/19 21:59:38 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.147 2011/10/27 20:04:57 dyoung Exp $");
 
 #include "opt_atalk.h"
 #include "opt_gre.h"
@@ -993,6 +993,10 @@
        ifp->if_opackets++;
        ifp->if_obytes += m->m_pkthdr.len;
 
+       /* Clear checksum-offload flags. */
+       m->m_pkthdr.csum_flags = 0;
+       m->m_pkthdr.csum_data = 0;
+
        /* send it off */
        if ((error = gre_bufq_enqueue(&sc->sc_snd, m)) != 0) {
                sc->sc_oflow_ev.ev_count++;
@@ -1265,8 +1269,6 @@
                gre_clearconf(sp, false);
                ifp->if_flags |= IFF_UP;
                goto mksocket;
-       case SIOCSIFDSTADDR:
-               break;
        case SIOCSIFFLAGS:
                if ((error = ifioctl_common(ifp, cmd, data)) != 0)
                        break;



Home | Main Index | Thread Index | Old Index