Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet If we need to fix up ar_hrd field, we must do it...



details:   https://anonhg.NetBSD.org/src/rev/3fb40f271291
branches:  trunk
changeset: 533236:3fb40f271291
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Jun 25 04:16:31 2002 +0000

description:
If we need to fix up ar_hrd field, we must do it before using ar_tpa/tha.

diffstat:

 sys/netinet/if_arp.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r e0cd8547c8c4 -r 3fb40f271291 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Tue Jun 25 04:04:53 2002 +0000
+++ b/sys/netinet/if_arp.c      Tue Jun 25 04:16:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.88 2002/06/25 04:04:53 itojun Exp $       */
+/*     $NetBSD: if_arp.c,v 1.89 2002/06/25 04:16:31 enami Exp $        */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.88 2002/06/25 04:04:53 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.89 2002/06/25 04:16:31 enami Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -840,10 +840,12 @@
 
        ah = mtod(m, struct arphdr *);
        op = ntohs(ah->ar_op);
-       bcopy((caddr_t)ar_spa(ah), (caddr_t)&isaddr, sizeof (isaddr));
-       bcopy((caddr_t)ar_tpa(ah), (caddr_t)&itaddr, sizeof (itaddr));
 
-       switch (m->m_pkthdr.rcvif->if_type) {
+       /*
+        * Fix up ah->ar_hrd if necessary, before using ar_tha() or
+        * ar_tpa().
+        */
+       switch (ifp->if_type) {
        case IFT_IEEE1394:
                if (ntohs(ah->ar_hrd) == ARPHRD_IEEE1394)
                        ;
@@ -858,6 +860,9 @@
                break;
        }
 
+       bcopy((caddr_t)ar_spa(ah), (caddr_t)&isaddr, sizeof (isaddr));
+       bcopy((caddr_t)ar_tpa(ah), (caddr_t)&itaddr, sizeof (itaddr));
+
        if (m->m_flags & (M_BCAST|M_MCAST))
                arpstat.as_rcvmcast++;
 



Home | Main Index | Thread Index | Old Index