summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/include/netinet/if_ether.h1
-rw-r--r--sys/netinet/if_ether.c18
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);
+}