| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_arp.c,v 1.185 2015/10/13 09:33:35 roy Exp $ */ | | 1 | /* $NetBSD: if_arp.c,v 1.186 2015/10/13 11:13:37 roy Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Public Access Networks Corporation ("Panix"). It was developed under | | 8 | * by Public Access Networks Corporation ("Panix"). It was developed under |
9 | * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. | | 9 | * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -58,27 +58,27 @@ | | | @@ -58,27 +58,27 @@ |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
59 | * SUCH DAMAGE. | | 59 | * SUCH DAMAGE. |
60 | * | | 60 | * |
61 | * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 | | 61 | * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 |
62 | */ | | 62 | */ |
63 | | | 63 | |
64 | /* | | 64 | /* |
65 | * Ethernet address resolution protocol. | | 65 | * Ethernet address resolution protocol. |
66 | * TODO: | | 66 | * TODO: |
67 | * add "inuse/lock" bit (or ref. count) along with valid bit | | 67 | * add "inuse/lock" bit (or ref. count) along with valid bit |
68 | */ | | 68 | */ |
69 | | | 69 | |
70 | #include <sys/cdefs.h> | | 70 | #include <sys/cdefs.h> |
71 | __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.185 2015/10/13 09:33:35 roy Exp $"); | | 71 | __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.186 2015/10/13 11:13:37 roy Exp $"); |
72 | | | 72 | |
73 | #ifdef _KERNEL_OPT | | 73 | #ifdef _KERNEL_OPT |
74 | #include "opt_ddb.h" | | 74 | #include "opt_ddb.h" |
75 | #include "opt_inet.h" | | 75 | #include "opt_inet.h" |
76 | #endif | | 76 | #endif |
77 | | | 77 | |
78 | #ifdef INET | | 78 | #ifdef INET |
79 | | | 79 | |
80 | #include "bridge.h" | | 80 | #include "bridge.h" |
81 | | | 81 | |
82 | #include <sys/param.h> | | 82 | #include <sys/param.h> |
83 | #include <sys/systm.h> | | 83 | #include <sys/systm.h> |
84 | #include <sys/callout.h> | | 84 | #include <sys/callout.h> |
| @@ -819,37 +819,39 @@ arpresolve(struct ifnet *ifp, struct rte | | | @@ -819,37 +819,39 @@ arpresolve(struct ifnet *ifp, struct rte |
819 | /* | | 819 | /* |
820 | * Re-send the ARP request when appropriate. | | 820 | * Re-send the ARP request when appropriate. |
821 | */ | | 821 | */ |
822 | #ifdef DIAGNOSTIC | | 822 | #ifdef DIAGNOSTIC |
823 | if (rt->rt_expire == 0) { | | 823 | if (rt->rt_expire == 0) { |
824 | /* This should never happen. (Should it? -gwr) */ | | 824 | /* This should never happen. (Should it? -gwr) */ |
825 | printf("arpresolve: unresolved and rt_expire == 0\n"); | | 825 | printf("arpresolve: unresolved and rt_expire == 0\n"); |
826 | /* Set expiration time to now (expired). */ | | 826 | /* Set expiration time to now (expired). */ |
827 | rt->rt_expire = time_uptime; | | 827 | rt->rt_expire = time_uptime; |
828 | } | | 828 | } |
829 | #endif | | 829 | #endif |
830 | | | 830 | |
831 | notfound: | | 831 | notfound: |
832 | if (la == NULL) { | | | |
833 | #ifdef IFF_STATICARP /* FreeBSD */ | | 832 | #ifdef IFF_STATICARP /* FreeBSD */ |
834 | #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP) | | 833 | #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP) |
835 | #else | | 834 | #else |
836 | #define _IFF_NOARP IFF_NOARP | | 835 | #define _IFF_NOARP IFF_NOARP |
837 | #endif | | 836 | #endif |
838 | if (ifp->if_flags & _IFF_NOARP) { | | 837 | if (ifp->if_flags & _IFF_NOARP) { |
839 | m_freem(m); | | 838 | if (la != NULL) |
840 | return 0; | | 839 | LLE_RUNLOCK(la); |
841 | } | | 840 | m_freem(m); |
| | | 841 | return 0; |
| | | 842 | } |
842 | #undef _IFF_NOARP | | 843 | #undef _IFF_NOARP |
| | | 844 | if (la == NULL) { |
843 | create_lookup = "create"; | | 845 | create_lookup = "create"; |
844 | IF_AFDATA_WLOCK(ifp); | | 846 | IF_AFDATA_WLOCK(ifp); |
845 | la = lla_create(LLTABLE(ifp), LLE_EXCLUSIVE, dst); | | 847 | la = lla_create(LLTABLE(ifp), LLE_EXCLUSIVE, dst); |
846 | IF_AFDATA_WUNLOCK(ifp); | | 848 | IF_AFDATA_WUNLOCK(ifp); |
847 | if (la == NULL) | | 849 | if (la == NULL) |
848 | ARP_STATINC(ARP_STAT_ALLOCFAIL); | | 850 | ARP_STATINC(ARP_STAT_ALLOCFAIL); |
849 | } else if (LLE_TRY_UPGRADE(la) == 0) { | | 851 | } else if (LLE_TRY_UPGRADE(la) == 0) { |
850 | create_lookup = "lookup"; | | 852 | create_lookup = "lookup"; |
851 | LLE_RUNLOCK(la); | | 853 | LLE_RUNLOCK(la); |
852 | IF_AFDATA_RLOCK(ifp); | | 854 | IF_AFDATA_RLOCK(ifp); |
853 | la = lla_lookup(LLTABLE(ifp), LLE_EXCLUSIVE, dst); | | 855 | la = lla_lookup(LLTABLE(ifp), LLE_EXCLUSIVE, dst); |
854 | IF_AFDATA_RUNLOCK(ifp); | | 856 | IF_AFDATA_RUNLOCK(ifp); |
855 | } | | 857 | } |