diff options
author | Ian Moffett <ian@osmora.org> | 2025-06-17 00:27:06 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-17 00:27:06 -0400 |
commit | 767547ed81651a4ff6977c34c3033c82e1ebee16 (patch) | |
tree | 1409a856238d5b8378beac39b99a05a03a97f487 | |
parent | 74851a0f0d6db52659d57000830d078359db4d6d (diff) |
kernel: netinet: Implement ARP reply logic
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/include/netinet/if_ether.h | 1 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 18 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sys/include/netinet/if_ether.h b/sys/include/netinet/if_ether.h index 571622d..d3dc9b7 100644 --- a/sys/include/netinet/if_ether.h +++ b/sys/include/netinet/if_ether.h @@ -51,5 +51,6 @@ struct ether_frame { }; int arp_request(struct netif *nifp, uint8_t *sproto, uint8_t *tproto); +int arp_reply(struct netif *netif, uint8_t *sproto, uint8_t *tproto); #endif /* !_NETINET_IF_ETHER_H_ */ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 23bf026..db1d6d4 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -78,8 +78,8 @@ arp_create(struct netif *nifp, uint32_t *sproto, uint32_t *tproto, uint16_t op) return packet; } -int -arp_request(struct netif *nifp, uint8_t *sproto, uint8_t *tproto) +static int +arp_send(struct netif *nifp, uint8_t *sproto, uint8_t *tproto, uint16_t op) { struct arp_pkt *packet; struct netbuf nb; @@ -95,7 +95,7 @@ arp_request(struct netif *nifp, uint8_t *sproto, uint8_t *tproto) src_tmp = (uint32_t *)sproto; targ_tmp = (uint32_t *)tproto; - packet = arp_create(nifp, src_tmp, targ_tmp, ARP_REQUEST); + packet = arp_create(nifp, src_tmp, targ_tmp, op); if (packet == NULL) { return -ENOMEM; } @@ -108,3 +108,15 @@ arp_request(struct netif *nifp, uint8_t *sproto, uint8_t *tproto) dynfree(packet); return 0; } + +int +arp_request(struct netif *nifp, uint8_t *sproto, uint8_t *tproto) +{ + return arp_send(nifp, sproto, tproto, ARP_REQUEST); +} + +int +arp_reply(struct netif *nifp, uint8_t *sproto, uint8_t *tproto) +{ + return arp_send(nifp, sproto, tproto, ARP_REPLY); +} |