summaryrefslogtreecommitdiffstats
path: root/ffd/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffd/send.c')
-rw-r--r--ffd/send.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ffd/send.c b/ffd/send.c
index 48c44fc..779476b 100644
--- a/ffd/send.c
+++ b/ffd/send.c
@@ -72,6 +72,22 @@ static bool send_eth(const eth_addr_t *addr, unsigned ifindex, void *buf, size_t
return true;
}
+void ffd_send_ack(ffd_iface_t *iface, ffd_neigh_t *neigh, uint16_t nonce) {
+ ffd_packet_t *packet = alloca(sizeof(ffd_packet_t)+FFD_PACKET_MAX);
+
+ packet->version_magic = htons(FFD_VERSION_MAGIC);
+ packet->len = 0;
+
+ ffd_tlv_ack_t *ack = ffd_tlv_add(packet, FFD_PACKET_MAX, TLV_ACK, sizeof(ffd_tlv_ack_t));
+ if (!ack)
+ return;
+
+ ack->nonce = htons(nonce);
+
+ if (!send_eth(&neigh->addr, iface->ifindex, packet, sizeof(ffd_packet_t)+ntohs(packet->len)))
+ fprintf(stderr, "send_eth: %m\n");
+}
+
static void add_ihus(ffd_packet_t *packet, size_t max_len, const ffd_iface_t *iface) {
const ffd_neigh_t *neigh;