Skip to content

Commit 1d5d236

Browse files
committed
Rework the ARP code so that we can have multiple ARP states.
Split the ARP resolution code to dhcp or ipv4ll where it belongs. This allows us to probe IPv4LL while still DISCOVERing a DHCP lease.
1 parent 16c6fdf commit 1d5d236

File tree

10 files changed

+479
-365
lines changed

10 files changed

+479
-365
lines changed

arp.c

Lines changed: 116 additions & 192 deletions
Large diffs are not rendered by default.

arp.h

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,31 @@
4242

4343
#include "dhcpcd.h"
4444

45-
void arp_announce(void *);
46-
void arp_probe(void *);
47-
void arp_start(struct interface *);
45+
struct arp_msg {
46+
uint16_t op;
47+
unsigned char sha[HWADDR_LEN];
48+
struct in_addr sip;
49+
unsigned char tha[HWADDR_LEN];
50+
struct in_addr tip;
51+
};
52+
53+
struct arp_state {
54+
TAILQ_ENTRY(arp_state) next;
55+
struct interface *iface;
56+
57+
void (*probed_cb)(struct arp_state *);
58+
void (*announced_cb)(struct arp_state *);
59+
void (*conflicted_cb)(struct arp_state *, const struct arp_msg *);
60+
61+
struct in_addr addr;
62+
int probes;
63+
int claims;
64+
};
65+
TAILQ_HEAD(arp_statehead, arp_state);
66+
67+
void arp_announce(struct arp_state *);
68+
void arp_probe(struct arp_state *);
69+
struct arp_state *arp_new(struct interface *);
70+
void arp_free(struct arp_state *);
4871
void arp_close(struct interface *);
4972
#endif

0 commit comments

Comments
 (0)