diff options
author | dzwdz | 2022-08-22 17:48:29 +0200 |
---|---|---|
committer | dzwdz | 2022-08-22 17:48:29 +0200 |
commit | 55900142023f7a27d467c7ce6a61d2e5ecead4e3 (patch) | |
tree | 98f3bb6af3b174d5ebc599838c237c676e20431c /src/user/app/netstack/arp.c | |
parent | 150303b2b88fff33dba96d6fabaf517bec3fb9ec (diff) |
user/netstack: outgoing UDP connections
Diffstat (limited to 'src/user/app/netstack/arp.c')
-rw-r--r-- | src/user/app/netstack/arp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/user/app/netstack/arp.c b/src/user/app/netstack/arp.c index b43b7e8..9e292b3 100644 --- a/src/user/app/netstack/arp.c +++ b/src/user/app/netstack/arp.c @@ -73,6 +73,16 @@ static void arpcache_put(uint32_t ip, mac_t mac) { arpcache = e; } +int arpcache_get(uint32_t ip, mac_t *mac) { + for (struct arpc *iter = arpcache; iter; iter = iter->next) { + if (iter->ip == ip) { + if (mac) memcpy(mac, iter->mac, 6); + return 0; + } + } + return -1; +} + void arp_fsread(handle_t h, long offset) { const char *fmt = "%08x\t%02x:%02x:%02x:%02x:%02x:%02x\n"; long linelen = snprintf(NULL, 0, fmt, 0, 1, 2, 3, 4, 5, 6) + 1; |