Module Name: src
Committed By: dyoung
Date: Thu Oct 27 20:04:57 UTC 2011
Modified Files:
src/sys/net: if_gif.c if_gre.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/net/if_gif.c
cvs rdiff -u -r1.146 -r1.147 src/sys/net/if_gre.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.78 src/sys/net/if_gif.c:1.79
--- src/sys/net/if_gif.c:1.78 Mon Apr 5 07:22:23 2010
+++ src/sys/net/if_gif.c Thu Oct 27 20:04:57 2011
@@ -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 @@ gif_output(struct ifnet *ifp, struct mbu
}
*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 @@ gif_ioctl(struct ifnet *ifp, u_long cmd,
ifp->if_flags |= IFF_UP;
break;
- case SIOCSIFDSTADDR:
- break;
-
case SIOCADDMULTI:
case SIOCDELMULTI:
switch (ifr->ifr_addr.sa_family) {
Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.146 src/sys/net/if_gre.c:1.147
--- src/sys/net/if_gre.c:1.146 Wed Oct 19 21:59:38 2011
+++ src/sys/net/if_gre.c Thu Oct 27 20:04:57 2011
@@ -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 @@ gre_output(struct ifnet *ifp, struct mbu
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_ioctl(struct ifnet *ifp, const u_lon
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;