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.
This commit is contained in:
dyoung 2011-10-27 20:04:57 +00:00
parent cf14ae3072
commit 0275d524f1
2 changed files with 12 additions and 9 deletions

View File

@ -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 mbuf *m, const struct sockaddr *dst,
}
*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, void *data)
ifp->if_flags |= IFF_UP;
break;
case SIOCSIFDSTADDR:
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
switch (ifr->ifr_addr.sa_family) {

View File

@ -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 mbuf *m, const struct sockaddr *dst,
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_long cmd, void *data)
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;