diff options
Diffstat (limited to 'ffd/send.c')
-rw-r--r-- | ffd/send.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; |