20#include <aquila/errno.h>
26#define ARP_EXPIRE (20 * 60 * 1000ULL)
63 struct arp_hdr *ah = netbuf_put(nb,
sizeof(*ah));
82 for (
int i = 0; i < p->
nheld; ++i) {
170 for (
int j = 0; j < p->
nheld; ++j)
269 nb->
len =
sizeof(*ah);
static void arp_request(struct netif *netif, uint32_t ip)
Broadcasts a request: who has ip?
static void pending_drop(struct arp_pending *p)
Gives up on an address being asked for: its waiting packets are dropped.
static void arp_retry(void *arg)
Asks again for an address that hasn't answered, a second after the last request, or gives up after AR...
static void pending_flush(struct netif *netif, uint32_t ip, const uint8_t mac[6])
Sends the packets that waited for an address, now that it is known.
static const uint8_t ether_broadcast[6]
void callout_stop(struct callout *c)
Cancels a callout, if it is pending.
int ether_output(struct netif *netif, const uint8_t dst[6], uint16_t type, struct netbuf *nb)
Sends a frame: adds its Ethernet header and gives it to the interface.
void arp_update(struct netif *netif, uint32_t ip, const uint8_t mac[6])
Records an address's hardware address, replacing the oldest entry if the table is full,...
int arp_resolve(struct netif *netif, uint32_t ip, struct netbuf *nb)
Holds a packet until the hardware address of its next hop is known, and asks for it.
int arp_lookup(struct netif *netif, uint32_t ip, uint8_t mac[6])
Looks up an address's hardware address.
void arp_input(struct netif *netif, struct netbuf *nb)
Takes in an ARP packet: the sender's address is recorded, and a request for our address is answered.
void * memmove(void *dst, const void *src, size_t n)
Copies n bytes; dst and src may overlap.
void * memset(void *dst, int c, size_t n)
Sets n bytes to c.
void * memcpy(void *dst, const void *src, size_t n)
Copies n bytes; dst and src must not overlap.
void netbuf_free(struct netbuf *nb)
Frees a netbuf.
struct netbuf * netbuf_alloc(void)
Allocates a netbuf, empty, with room for the headers that will be put in front of its data.
void net_callout_set(struct callout *c, uint64_t ns, void(*fn)(void *), void *arg)
Sets a callout that the network's thread runs: fn(arg) is called once ns ns have passed.
static uint64_t * table(paddr_t paddr)
Returns a page table, through the direct map.
unsigned long long int uint64_t
An ARP packet, for IPv4 over Ethernet.
struct netbuf * held[ARP_HOLD]
A function to call later, with its argument.
A network interface (net/netif.c): a device that sends and receives Ethernet frames,...
struct netif::@020302303320120142126121344055047003105154122231 stats
uint64_t arch_rtime_ms(void)
Reads the monotonic clock, in milliseconds.