1 /* $NetBSD: arp.h,v 1.11 2015/07/09 10:15:34 roy Exp $ */
4 * dhcpcd - DHCP client daemon
5 * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 /* ARP timings from RFC5227 */
38 #define ANNOUNCE_WAIT 2
39 #define ANNOUNCE_NUM 2
40 #define ANNOUNCE_INTERVAL 2
41 #define MAX_CONFLICTS 10
42 #define RATE_LIMIT_INTERVAL 60
43 #define DEFEND_INTERVAL 10
49 unsigned char sha
[HWADDR_LEN
];
51 unsigned char tha
[HWADDR_LEN
];
56 TAILQ_ENTRY(arp_state
) next
;
57 struct interface
*iface
;
59 void (*probed_cb
)(struct arp_state
*);
60 void (*announced_cb
)(struct arp_state
*);
61 void (*conflicted_cb
)(struct arp_state
*, const struct arp_msg
*);
62 void (*free_cb
)(struct arp_state
*);
67 struct in_addr failed
;
69 TAILQ_HEAD(arp_statehead
, arp_state
);
73 struct arp_statehead arp_states
;
76 #define ARP_STATE(ifp) \
77 ((struct iarp_state *)(ifp)->if_data[IF_DATA_ARP])
78 #define ARP_CSTATE(ifp) \
79 ((const struct iarp_state *)(ifp)->if_data[IF_DATA_ARP])
82 void arp_report_conflicted(const struct arp_state
*, const struct arp_msg
*);
83 void arp_announce(struct arp_state
*);
84 void arp_probe(struct arp_state
*);
85 struct arp_state
*arp_new(struct interface
*, const struct in_addr
*);
86 void arp_cancel(struct arp_state
*);
87 void arp_free(struct arp_state
*);
88 void arp_free_but(struct arp_state
*);
89 struct arp_state
*arp_find(struct interface
*, const struct in_addr
*);
90 void arp_close(struct interface
*);
92 void arp_handleifa(int, struct interface
*, const struct in_addr
*, int);
94 #define arp_close(a) {}