diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-05 04:56:08 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-05 04:56:08 +0200 |
commit | 4cf3389fcf094c095d685a3e9f65a5d1fafff717 (patch) | |
tree | 28178dbd858ea08fda978c9aa63e8dd28bd16b6c /ffd/send.c | |
parent | bb7392551ed8578171941b81cf3ed2cfc4ad2b1b (diff) | |
download | ffd-4cf3389fcf094c095d685a3e9f65a5d1fafff717.tar ffd-4cf3389fcf094c095d685a3e9f65a5d1fafff717.zip |
Add ack request handling
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; |