| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: aarp.c,v 1.43 2018/12/22 14:28:56 maxv Exp $ */ | | 1 | /* $NetBSD: aarp.c,v 1.44 2023/07/31 01:19:49 dholland Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1990,1991 Regents of The University of Michigan. | | 4 | * Copyright (c) 1990,1991 Regents of The University of Michigan. |
5 | * All Rights Reserved. | | 5 | * All Rights Reserved. |
6 | * | | 6 | * |
7 | * Permission to use, copy, modify, and distribute this software and | | 7 | * Permission to use, copy, modify, and distribute this software and |
8 | * its documentation for any purpose and without fee is hereby granted, | | 8 | * its documentation for any purpose and without fee is hereby granted, |
9 | * provided that the above copyright notice appears in all copies and | | 9 | * provided that the above copyright notice appears in all copies and |
10 | * that both that copyright notice and this permission notice appear | | 10 | * that both that copyright notice and this permission notice appear |
11 | * in supporting documentation, and that the name of The University | | 11 | * in supporting documentation, and that the name of The University |
12 | * of Michigan not be used in advertising or publicity pertaining to | | 12 | * of Michigan not be used in advertising or publicity pertaining to |
13 | * distribution of the software without specific, written prior | | 13 | * distribution of the software without specific, written prior |
14 | * permission. This software is supplied as is without expressed or | | 14 | * permission. This software is supplied as is without expressed or |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * This product includes software developed by the University of | | 17 | * This product includes software developed by the University of |
18 | * California, Berkeley and its contributors. | | 18 | * California, Berkeley and its contributors. |
19 | * | | 19 | * |
20 | * Research Systems Unix Group | | 20 | * Research Systems Unix Group |
21 | * The University of Michigan | | 21 | * The University of Michigan |
22 | * c/o Wesley Craig | | 22 | * c/o Wesley Craig |
23 | * 535 W. William Street | | 23 | * 535 W. William Street |
24 | * Ann Arbor, Michigan | | 24 | * Ann Arbor, Michigan |
25 | * +1-313-764-2278 | | 25 | * +1-313-764-2278 |
26 | * netatalk@umich.edu | | 26 | * netatalk@umich.edu |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.43 2018/12/22 14:28:56 maxv Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.44 2023/07/31 01:19:49 dholland Exp $"); |
31 | | | 31 | |
32 | #include "opt_mbuftrace.h" | | 32 | #include "opt_mbuftrace.h" |
33 | #include "opt_atalk.h" | | 33 | #include "opt_atalk.h" |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/socket.h> | | 36 | #include <sys/socket.h> |
37 | #include <sys/syslog.h> | | 37 | #include <sys/syslog.h> |
38 | #include <sys/systm.h> | | 38 | #include <sys/systm.h> |
39 | #include <sys/callout.h> | | 39 | #include <sys/callout.h> |
40 | #include <sys/proc.h> | | 40 | #include <sys/proc.h> |
41 | #include <sys/mbuf.h> | | 41 | #include <sys/mbuf.h> |
42 | #include <sys/time.h> | | 42 | #include <sys/time.h> |
43 | #include <sys/kernel.h> | | 43 | #include <sys/kernel.h> |
| @@ -63,32 +63,34 @@ static void aarptimer(void *); | | | @@ -63,32 +63,34 @@ static void aarptimer(void *); |
63 | static void aarpwhohas(struct ifnet *, const struct sockaddr_at *); | | 63 | static void aarpwhohas(struct ifnet *, const struct sockaddr_at *); |
64 | | | 64 | |
65 | #define AARPTAB_BSIZ 9 | | 65 | #define AARPTAB_BSIZ 9 |
66 | #define AARPTAB_NB 19 | | 66 | #define AARPTAB_NB 19 |
67 | #define AARPTAB_SIZE (AARPTAB_BSIZ * AARPTAB_NB) | | 67 | #define AARPTAB_SIZE (AARPTAB_BSIZ * AARPTAB_NB) |
68 | struct aarptab aarptab[AARPTAB_SIZE]; | | 68 | struct aarptab aarptab[AARPTAB_SIZE]; |
69 | | | 69 | |
70 | #define AARPTAB_HASH(a) \ | | 70 | #define AARPTAB_HASH(a) \ |
71 | ((((a).s_net << 8 ) + (a).s_node ) % AARPTAB_NB ) | | 71 | ((((a).s_net << 8 ) + (a).s_node ) % AARPTAB_NB ) |
72 | | | 72 | |
73 | #define AARPTAB_LOOK(aat,addr) { \ | | 73 | #define AARPTAB_LOOK(aat,addr) { \ |
74 | int n; \ | | 74 | int n; \ |
75 | aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \ | | 75 | aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \ |
76 | for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) \ | | 76 | for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) { \ |
77 | if ( aat->aat_ataddr.s_net == (addr).s_net && \ | | 77 | if ( aat->aat_ataddr.s_net == (addr).s_net && \ |
78 | aat->aat_ataddr.s_node == (addr).s_node ) \ | | 78 | aat->aat_ataddr.s_node == (addr).s_node ) \ |
79 | break; \ | | 79 | break; \ |
80 | if ( n >= AARPTAB_BSIZ ) \ | | 80 | } \ |
81 | aat = 0; \ | | 81 | if ( n >= AARPTAB_BSIZ ) { \ |
| | | 82 | aat = 0; \ |
| | | 83 | } \ |
82 | } | | 84 | } |
83 | | | 85 | |
84 | #define AARPT_AGE (60 * 1) | | 86 | #define AARPT_AGE (60 * 1) |
85 | #define AARPT_KILLC 20 | | 87 | #define AARPT_KILLC 20 |
86 | #define AARPT_KILLI 3 | | 88 | #define AARPT_KILLI 3 |
87 | | | 89 | |
88 | const u_char atmulticastaddr[6] = { | | 90 | const u_char atmulticastaddr[6] = { |
89 | 0x09, 0x00, 0x07, 0xff, 0xff, 0xff | | 91 | 0x09, 0x00, 0x07, 0xff, 0xff, 0xff |
90 | }; | | 92 | }; |
91 | | | 93 | |
92 | const u_char at_org_code[3] = { | | 94 | const u_char at_org_code[3] = { |
93 | 0x08, 0x00, 0x07 | | 95 | 0x08, 0x00, 0x07 |
94 | }; | | 96 | }; |